Skip to content

Instantly share code, notes, and snippets.

@pingw33n
Forked from tysonmalchow/install_jogl_maven.sh
Created November 23, 2012 16:11
Show Gist options
  • Save pingw33n/4136283 to your computer and use it in GitHub Desktop.
Save pingw33n/4136283 to your computer and use it in GitHub Desktop.
install jogamp's JOGL and GLUEGEN jars to a local maven repository
#!/bin/bash
set -e
if [ $# == 0 -o $# -gt 3 ]; then
echo "usage: $0 version [base_url] [maven_repo]"
echo "defaults:"
echo " base_url=http://jogamp.org/deployment/v<version>"
echo " maven_repo=`echo ~/.m2/repository`"
echo "example:"
echo " $0 2.0-rc11"
exit
fi
VERSION=$1
if [ "$2" != "" ]; then
BASEURL=$2
else
BASEURL=http://jogamp.org/deployment/v$VERSION
fi
if [ "$3" != "" ]; then
MVN_REPO=$3
else
MVN_REPO=~/.m2/repository
fi
NATIVE_PLATFORMS="linux-amd64 linux-i586 macosx-universal solaris-amd64 solaris-i586 windows-amd64 windows-i586"
echo "installing $VERSION from $BASEURL into $MVN_REPO"
TEMPFILE=/tmp/jogl/$VERSION
rm -rf $TEMPFILE > /dev/null 2>&1
mkdir -p "$TEMPFILE"
echo "using temp directory $TEMPFILE"
# base jogl class jar
echo "installing core jogl deps"
wget -nc $BASEURL/jar/jogl-all.jar.gz -O "$TEMPFILE/jogl-all.jar.gz"
gunzip "$TEMPFILE/jogl-all.jar.gz"
mvn install:install-file -Dversion=$VERSION -DlocalRepositoryPath="$MVN_REPO" -DgroupId=com.jogamp.jogl -DartifactId=jogl-all -Dpackaging=jar -Dfile="$TEMPFILE/jogl-all.jar" -DgeneratePom=true
echo "installing gluegen"
wget -nc $BASEURL/jar/gluegen-rt.jar -O "$TEMPFILE/gluegen-rt.jar"
mvn install:install-file -Dversion=$VERSION -DlocalRepositoryPath="$MVN_REPO" -DgroupId=com.jogamp.gluegen -DartifactId=gluegen-rt -Dpackaging=jar -Dfile="$TEMPFILE/gluegen-rt.jar" -DgeneratePom=true
# native jars
echo "installing native libs"
for platform in $NATIVE_PLATFORMS; do
echo " -> installing native lib for $platform"
wget -nc $BASEURL/jar/jogl-all-natives-$platform.jar -O "$TEMPFILE/jogl-all-natives-$platform.jar"
mvn install:install-file -DlocalRepositoryPath="$MVN_REPO" -Dclassifier="$platform" -Dversion=$VERSION -DgroupId=com.jogamp.jogl -DartifactId=jogl-natives -Dpackaging=jar -Dfile="$TEMPFILE/jogl-all-natives-$platform.jar" -DgeneratePom=true
wget -nc $BASEURL/jar/gluegen-rt-natives-$platform.jar -O "$TEMPFILE/gluegen-rt-natives-$platform.jar"
mvn install:install-file -DlocalRepositoryPath="$MVN_REPO" -Dclassifier="$platform" -Dversion=$VERSION -DgroupId=com.jogamp.gluegen -DartifactId=gluegen-natives -Dpackaging=jar -Dfile="$TEMPFILE/gluegen-rt-natives-$platform.jar" -DgeneratePom=true
done
rm -rf $TEMPFILE > /dev/null 2>&1
echo """
Use these in the pom.xml (selecting the appropriate classifier):
<dependency>
<groupId>com.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>$VERSION</version>
</dependency>
<dependency>
<groupId>com.jogamp.jogl</groupId>
<artifactId>jogl-natives</artifactId>
<version>$VERSION</version>
<classifier>$NATIVE_PLATFORMS</classifier>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>$VERSION</version>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-natives</artifactId>
<version>$VERSION</version>
<classifier>$NATIVE_PLATFORMS</classifier>
</dependency>
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment