forked from I2P_Developers/i2p.i2p
improvements to jbigi scripts
support for Solaris (tested with Solaris 11 x86) mbuild-all.sh: - output correctly formatted file names (tested in Solaris x86, FreeBSD (x86 and x64) and Linux (x86 & x64)) - switch from echo -e to the more portable printf - more error checking, comments debian/patches: refreshed based on changes to core/c/* libjcpuid-x86_64-solaris.so: built in solaris 11 x86 with java 1.7.0_07 and gcc 4.5.2, stripped
This commit is contained in:
@@ -5,6 +5,15 @@ if [ $UNIXTYPE = "freebsd" ]; then
|
||||
elif [ -d /usr/local/openjdk7 ]; then
|
||||
JAVA_HOME="/usr/local/openjdk7"
|
||||
fi
|
||||
elif [ $UNIXTYPE = "sunos" ]; then
|
||||
UNIXTYPE="solaris"
|
||||
if [ -d /usr/jdk/latest/ ]; then
|
||||
JAVA_HOME="/usr/jdk/latest"
|
||||
elif [ -d /usr/jdk/instances/jdk1.7.0/ ]; then
|
||||
JAVA_HOME="/usr/jdk/instances/jdk1.7.0"
|
||||
elif [ -d /usr/jdk/instances/jdk1.6.0 ]; then
|
||||
JAVA_HOME="/usr/jdk/instances/jdk1.6.0"
|
||||
fi
|
||||
elif [ $UNIXTYPE = "openbsd" ]; then
|
||||
if [ -d /usr/local/jdk-1.7.0 ]; then
|
||||
JAVA_HOME="/usr/local/jdk-1.7.0"
|
||||
@@ -26,9 +35,10 @@ elif [ $UNIXTYPE = "linux" ] && [ -e /etc/arch-release ]; then
|
||||
elif [ $UNIXTYPE = "darwin" ]; then
|
||||
JAVA_HOME=$(/usr/libexec/java_home)
|
||||
elif [ $UNIXTYPE = "gnu/kfreebsd" ]; then
|
||||
UNIXTYPE="linux"
|
||||
if [ -d /usr/lib/jvm/java-gcj ]; then
|
||||
JAVA_HOME="/usr/lib/jvm/java-gcj"
|
||||
fi
|
||||
fi
|
||||
|
||||
export JAVA_HOME
|
||||
export JAVA_HOME UNIXTYPE
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# When executed in Mingw: Produces a jbigi.dll
|
||||
# When executed in Linux/FreeBSD: Produces a libjbigi.so
|
||||
# When executed in OSX: Produces a libjbigi.jnilib
|
||||
CC="gcc"
|
||||
[ -z "$CC" ] && CC="gcc"
|
||||
|
||||
# If JAVA_HOME isn't set we'll try to figure it out
|
||||
[ -z $JAVA_HOME ] && . ../find-java-home
|
||||
@@ -38,7 +38,7 @@ SunOS*|OpenBSD*|NetBSD*|*FreeBSD*|Linux*)
|
||||
elif [ $UNIXTYPE = "gnu/kfreebsd" ]; then
|
||||
UNIXTYPE="linux"
|
||||
fi
|
||||
COMPILEFLAGS="-fPIC -Wall"
|
||||
COMPILEFLAGS="-fPIC -Wall $CFLAGS"
|
||||
INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
|
||||
LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
|
||||
LIBFILE="libjbigi.so";;
|
||||
|
@@ -1,14 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If JAVA_HOME isn't set we'll try to figure it out
|
||||
[ -z $JAVA_HOME ] && . ../find-java-home
|
||||
if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
|
||||
echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'"
|
||||
echo "Please set JAVA_HOME to a java home that has the JNI"
|
||||
exit 1
|
||||
fi
|
||||
# ON Solaris 11 (at least) this variable must be set.
|
||||
# Linux and *BSD will do the right thing.
|
||||
#
|
||||
#BITS=32
|
||||
|
||||
#FIXME What platforms for MacOS?
|
||||
# FIXME Is this all?
|
||||
DARWIN_PLATFORMS="core2 corei"
|
||||
MISC_DARWIN_PLATFORMS="powerpc powerpc64 powerpc64le powerpcle"
|
||||
|
||||
# Note: You will have to add the CPU ID for the platform in the CPU ID code
|
||||
@@ -45,24 +43,6 @@ X86_64_PLATFORMS="atom athlon64 core2 corei nano pentium4"
|
||||
# Note! these are 32bit _ONLY_
|
||||
X86_PLATFORMS="pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 ${X86_64_PLATFORMS}"
|
||||
|
||||
|
||||
#
|
||||
# You should not need to edit anything below this comment.
|
||||
#
|
||||
|
||||
# The built-in echo in /bin/sh (the real bourne shell) on BSD systems supports -e.
|
||||
# The built-in echo in dash (the default /bin/sh on Debian) does not support -e
|
||||
# but /bin/echo always supports -e in Linux; therefore, let's set echo to /bin/echo
|
||||
# whenever we're on Linux and use the shell's built-in "echo" on everything else.
|
||||
|
||||
if [ $(uname -s |tr "[A-Z]" "[a-z]") = "linux" ]; then
|
||||
ECHO="/bin/echo"
|
||||
elif [ $(uname -s |tr "[A-Z]" "[a-z]") = "gnu/kfreebsd" ]; then
|
||||
ECHO="/bin/echo"
|
||||
else
|
||||
ECHO="echo"
|
||||
fi
|
||||
|
||||
MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}"
|
||||
LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}"
|
||||
FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}"
|
||||
@@ -70,44 +50,96 @@ FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}"
|
||||
NETBSD_PLATFORMS="${FREEBSD_PLATFORMS} ${MISC_LINUX_PLATFORMS} ${MISC_NETBSD_PLATFORMS}"
|
||||
OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}"
|
||||
|
||||
# FIXME Is this all?
|
||||
DARWIN_PLATFORMS="core2 corei"
|
||||
#
|
||||
# You should not need to edit anything below this comment.
|
||||
#
|
||||
|
||||
# If JAVA_HOME isn't set we'll try to figure it out
|
||||
[ -z $JAVA_HOME ] && . ../find-java-home
|
||||
if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
|
||||
echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'" >&2
|
||||
echo "Please set JAVA_HOME to a java home that has the JNI" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! $(which m4) ]; then
|
||||
printf "\aWARNING: \`m4\` not found. If this process fails to complete, install m4 " >&2
|
||||
printf "and re-run this script.\n\n\n\a" >&2
|
||||
sleep 10
|
||||
fi
|
||||
|
||||
|
||||
# Allow TARGET to be overridden (e.g. for use with cross compilers)
|
||||
[ -z $TARGET ] && TARGET=$(uname -s |tr "[A-Z]" "[a-z]")
|
||||
|
||||
|
||||
# Set the version to 5.0.2 for OSX because AFAIK there are only 64bit capable CPUs for the Intel Macs
|
||||
if [ `uname -s |grep Darwin` ]; then
|
||||
# FIXME do this without sed (and tail) (= portably)
|
||||
if [ `echo $TARGET|grep darwin` ]; then
|
||||
VER=5.0.2
|
||||
elif [ `echo $TARGET|grep sunos` ]; then
|
||||
VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | /usr/xpg4/bin/tail -n 1)
|
||||
else
|
||||
VER=$($ECHO gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1)
|
||||
VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1)
|
||||
fi
|
||||
|
||||
if [ "$VER" = "" ] ; then
|
||||
$ECHO "ERROR! Can't find gmp source tarball."
|
||||
echo "ERROR! Can't find gmp source tarball."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the BITS variable isn't set above we'll proceed without setting the *FLAGS
|
||||
# variables ourselves.
|
||||
[ -z $BITS ] && BITS=0
|
||||
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
if [ $BITS -eq 32 ]; then
|
||||
export CC="gcc -m32"
|
||||
export CFLAGS="-m32"
|
||||
export LDFLAGS="-m32"
|
||||
SUFFIX=
|
||||
elif [ $BITS -eq 64 ]; then
|
||||
export CC="gcc -m64"
|
||||
export CFLAGS="-m64"
|
||||
fi
|
||||
|
||||
case "$TARGET" in
|
||||
mingw*)
|
||||
PLATFORM_LIST="${MINGW_PLATFORMS}"
|
||||
NAME="jbigi"
|
||||
TYPE="dll"
|
||||
TARGET="windows"
|
||||
$ECHO "Building windows .dlls for all architectures";;
|
||||
Darwin*)
|
||||
echo "Building windows .dlls for all architectures";;
|
||||
darwin*)
|
||||
PLATFORM_LIST="${DARWIN_PLATFORMS}"
|
||||
NAME="libjbigi"
|
||||
TYPE="jnilib"
|
||||
TARGET="osx"
|
||||
$ECHO "Building ${TARGET} .jnilibs for all architectures";;
|
||||
Linux*|*kFreeBSD)
|
||||
echo "Building ${TARGET} .jnilibs for all architectures";;
|
||||
sunos*)
|
||||
PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
NAME="libjbigi"
|
||||
TYPE="so"
|
||||
UNIXTYPE="solaris"
|
||||
TARGET="${UNIXTYPE}"
|
||||
if $(echo "$CFLAGS" | grep -q "\-m64") ; then
|
||||
[ -z $SUFFIX ] && SUFFIX="_64"
|
||||
PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
else
|
||||
PLATFORM_LIST="${X86_PLATFORMS}"
|
||||
fi
|
||||
echo "Building ${TARGET} .sos for all architectures";;
|
||||
linux*|*kfreebsd)
|
||||
NAME="libjbigi"
|
||||
TYPE="so"
|
||||
PLATFORM_LIST=""
|
||||
if [ $(uname -s | tr "[A-Z]" "[a-z]") = "gnu/kfreebsd" ]; then
|
||||
case "$TARGET" in
|
||||
*kfreebsd)
|
||||
TARGET="kfreebsd"
|
||||
else
|
||||
;;
|
||||
*)
|
||||
TARGET="linux"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
arch=$(uname -m | cut -f1 -d" ")
|
||||
case ${arch} in
|
||||
i[3-6]86)
|
||||
@@ -116,22 +148,23 @@ Linux*|*kFreeBSD)
|
||||
case ${arch} in
|
||||
x86_64 | amd64)
|
||||
PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
TARGET="$TARGET-X86_64";;
|
||||
ia64)
|
||||
PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
TARGET="$TARGET-ia64";;
|
||||
if [ $BITS -ne 32 ]; then
|
||||
[ -z $SUFFIX ] && SUFFIX="_64"
|
||||
fi
|
||||
;;
|
||||
#ia64)
|
||||
# PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
# TARGET="$TARGET-ia64";;
|
||||
x86)
|
||||
PLATFORM_LIST="${X86_PLATFORMS}"
|
||||
TARGET="$TARGET-x86";;
|
||||
PLATFORM_LIST="${X86_PLATFORMS}";;
|
||||
*)
|
||||
PLATFORM_LIST="${LINUX_PLATFORMS}";;
|
||||
esac
|
||||
$ECHO "Building ${TARGET} .sos for ${arch}";;
|
||||
NetBSD*|FreeBSD*|OpenBSD*)
|
||||
echo "Building ${TARGET} .sos for ${arch}";;
|
||||
netbsd*|freebsd*|openbsd*)
|
||||
NAME="libjbigi"
|
||||
TYPE="so"
|
||||
PLATFORM_LIST=""
|
||||
BSDTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
|
||||
PLATFORM_LIST=
|
||||
arch=$(uname -m | cut -f1 -d" ")
|
||||
case ${arch} in
|
||||
i[3-6]86)
|
||||
@@ -140,15 +173,14 @@ NetBSD*|FreeBSD*|OpenBSD*)
|
||||
case ${arch} in
|
||||
x86_64|amd64)
|
||||
PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
TARGET="${BSDTYPE}-X86_64";;
|
||||
ia64)
|
||||
PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
TARGET="${BSDTYPE}-ia64";;
|
||||
[ -z $SUFFIX ] && SUFFIX="_64";;
|
||||
#ia64)
|
||||
# PLATFORM_LIST="${X86_64_PLATFORMS}"
|
||||
# SUFFIX="{SYS}-ia64";;
|
||||
x86)
|
||||
PLATFORM_LIST="${X86_PLATFORMS}"
|
||||
TARGET="${BSDTYPE}-x86";;
|
||||
PLATFORM_LIST="${X86_PLATFORMS}";;
|
||||
*)
|
||||
case ${BSDTYPE} in
|
||||
case ${TARGET} in
|
||||
netbsd)
|
||||
PLATFORM_LIST="${NETBSD_PLATFORMS}";;
|
||||
openbsd)
|
||||
@@ -156,63 +188,78 @@ NetBSD*|FreeBSD*|OpenBSD*)
|
||||
freebsd)
|
||||
PLATFORM_LIST="${FREEBSD_PLATFORMS}";;
|
||||
*)
|
||||
$ECHO "Unsupported build environment"
|
||||
echo "Unsupported build environment"
|
||||
exit 1;;
|
||||
esac
|
||||
esac
|
||||
$ECHO "Building ${BSDTYPE} .sos for ${arch}";;
|
||||
echo "Building ${TARGET} .sos for ${arch}";;
|
||||
*)
|
||||
$ECHO "Unsupported build environment"
|
||||
echo "Unsupported build environment"
|
||||
exit;;
|
||||
esac
|
||||
|
||||
#####################
|
||||
# In the below functions:
|
||||
# $1 = gmp version
|
||||
# $2 = platform: such as athlon64
|
||||
# $3 = basename: "jbigi" on Windows, "libjbigi" everywhere else
|
||||
# $4 = type/extension: windows = "dll". osx = "jnilib". Everything else = "so"
|
||||
# $5 = target: "linux", "freebsd", "kfreebsd", "osx", "windows", etc.
|
||||
# $6 = suffix: null if 32bit, _64 if 64bit
|
||||
|
||||
make_static () {
|
||||
#
|
||||
# TODO
|
||||
# Fix formatting of output filename. Final versions will need to look
|
||||
# like libjbigi-linux-athlon64.so or libjbigi-linux-athlon64_64.so
|
||||
$ECHO "Attempting .${4} creation for ${3}${5}${2}"
|
||||
echo "Attempting .${4} creation for ${3}${5}${2}${6}"
|
||||
../../build_jbigi.sh static || return 1
|
||||
cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}.${4}
|
||||
cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}${6}.${4}
|
||||
return 0
|
||||
}
|
||||
|
||||
make_file () {
|
||||
# Nonfatal bail out on Failed build.
|
||||
$ECHO "Attempting build for ${3}${5}${2}"
|
||||
echo "Attempting build for ${3}${5}${2}"
|
||||
make && return 0
|
||||
cd ..
|
||||
rm -R "$2"
|
||||
$ECHO -e "\n\nFAILED! ${3}${5}${2} not made.\a"
|
||||
printf "\n\nFAILED! ${3}${5}${2} not made.\a"
|
||||
sleep 10
|
||||
return 1
|
||||
}
|
||||
|
||||
configure_file () {
|
||||
$ECHO -e "\n\n\nAttempting configure for ${3}${5}${2}\n\n\n"
|
||||
printf "\n\n\nAttempting configure for ${3}${5}${2}${6}\n\n\n"
|
||||
if [ $BITS -eq 32 ] && [ "$2" = "none" ]; then
|
||||
unset ABI
|
||||
elif [ $BITS -eq 32 ] && [ "$2" != "none" ]; then
|
||||
export ABI=32
|
||||
fi
|
||||
sleep 10
|
||||
# Nonfatal bail out on unsupported platform.
|
||||
if [ `uname -s |grep Darwin` ]; then
|
||||
if [ $(echo $TARGET| grep -q osx) ]; then
|
||||
../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0
|
||||
else
|
||||
../../gmp-${1}/configure --build=${2} --with-pic && return 0
|
||||
fi
|
||||
cd ..
|
||||
rm -R "$2"
|
||||
$ECHO -e "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
|
||||
printf "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
|
||||
sleep 10
|
||||
return 1
|
||||
}
|
||||
|
||||
build_file () {
|
||||
configure_file "$1" "$2" "$3" "$4" "$5" && make_file "$1" "$2" "$3" "$4" "$5" && make_static "$1" "$2" "$3" "$4" "$5" && return 0
|
||||
$ECHO -e "\n\n\nError building static!\n\n\a"
|
||||
configure_file "$1" "$2" "$3" "$4" "$5" "$6" && make_file "$1" "$2" "$3" "$4" "$5" "$6" && make_static "$1" "$2" "$3" "$4" "$5" "$6" && return 0
|
||||
printf "\n\n\nError building static!\n\n\a"
|
||||
sleep 10
|
||||
return 1
|
||||
}
|
||||
|
||||
$ECHO "Extracting GMP Version $VER ..."
|
||||
tar -xjf gmp-$VER.tar.bz2 || ( $ECHO "Error in tarball file!" ; exit 1 )
|
||||
echo "Extracting GMP Version $VER ..."
|
||||
if [ -e gmp-$VER.tar.bz2 ]; then
|
||||
tar -xjf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" >&2 ; exit 1 )
|
||||
else
|
||||
echo "ERROR: gmp tarball not found in current directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d bin ]; then
|
||||
mkdir bin
|
||||
@@ -235,9 +282,11 @@ do
|
||||
rm -Rf *
|
||||
fi
|
||||
|
||||
build_file "$VER" "$x" "$NAME" "$TYPE" "-$TARGET-"
|
||||
build_file "$VER" "$x" "$NAME" "$TYPE" "-$TARGET-" "$SUFFIX"
|
||||
)
|
||||
done
|
||||
|
||||
$ECHO "Success!"
|
||||
echo "Success!"
|
||||
exit 0
|
||||
|
||||
# vim:fenc=utf-8:ai:si:ts=4:sw=4:et:nu
|
||||
|
@@ -19,7 +19,7 @@ esac
|
||||
rm -rf lib
|
||||
mkdir -p lib/freenet/support/CPUInformation
|
||||
|
||||
CC="gcc"
|
||||
[ -z $CC ] && CC="gcc"
|
||||
|
||||
case `uname -s` in
|
||||
MINGW*|CYGWIN*)
|
||||
@@ -62,6 +62,14 @@ case `uname -s` in
|
||||
ARCH="ia64";;
|
||||
i?86*)
|
||||
ARCH="x86";;
|
||||
# Solaris x86
|
||||
i86pc)
|
||||
if $(echo $CC | grep -q '\-m64') ; then
|
||||
ARCH="x86_64"
|
||||
else
|
||||
ARCH="x86"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported build environment. jcpuid is only used on x86 systems."
|
||||
exit 0;;
|
||||
|
8
debian/patches/0002-jbigi-soname.patch
vendored
8
debian/patches/0002-jbigi-soname.patch
vendored
@@ -9,20 +9,18 @@ a soname to shut lintian up.
|
||||
core/c/jbigi/build_jbigi.sh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/c/jbigi/build_jbigi.sh b/core/c/jbigi/build_jbigi.sh
|
||||
index b1a68dd..99b31e4 100755
|
||||
--- a/core/c/jbigi/build_jbigi.sh
|
||||
+++ b/core/c/jbigi/build_jbigi.sh
|
||||
@@ -39,7 +39,7 @@ SunOS*|OpenBSD*|NetBSD*|*FreeBSD*|Linux*)
|
||||
@@ -39,7 +39,7 @@
|
||||
UNIXTYPE="linux"
|
||||
fi
|
||||
COMPILEFLAGS="-fPIC -Wall"
|
||||
COMPILEFLAGS="-fPIC -Wall $CFLAGS"
|
||||
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
|
||||
+ INCLUDES="-I. -I./jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
|
||||
LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
|
||||
LIBFILE="libjbigi.so";;
|
||||
*)
|
||||
@@ -58,7 +58,7 @@ fi
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
echo "Compiling C code..."
|
||||
rm -f jbigi.o $LIBFILE
|
||||
|
4
debian/patches/0003-renaming-jcpuid.patch
vendored
4
debian/patches/0003-renaming-jcpuid.patch
vendored
@@ -6,11 +6,9 @@ Subject: rename jcpuid
|
||||
core/c/jcpuid/build.sh | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/core/c/jcpuid/build.sh b/core/c/jcpuid/build.sh
|
||||
index f3fc9c2..cbd0934 100755
|
||||
--- a/core/c/jcpuid/build.sh
|
||||
+++ b/core/c/jcpuid/build.sh
|
||||
@@ -67,12 +67,8 @@ case `uname -s` in
|
||||
@@ -74,12 +74,8 @@
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
|
BIN
installer/lib/jbigi/libjcpuid-x86_64-solaris.so
Normal file
BIN
installer/lib/jbigi/libjcpuid-x86_64-solaris.so
Normal file
Binary file not shown.
Reference in New Issue
Block a user