source: core/c/jbigi/build_jbigi.sh @ a3c6cc1d

Last change on this file since a3c6cc1d was a3c6cc1d, checked in by zzz <zzz@…>, 7 years ago

libjbigi updates:

Added:

nativeJbigiVersion()
nativeGMPMajorVersion()
nativeGMPMinorVersion()
nativeGMPPatchVersion()
nativeModInverse()
nativeModPowCT()

Support negative vaules in conversion functions
Support negative base value in modPow()
Throw ArithmeticException? for bad arguments rather than crashing
Switch to GMP 6.0.0
New build targets

NativeBigInteger? changes:

Test improvements
Version reporting

Crypto changes:

Use constant time modPow() for signing and decryption
Use native modInverse()

  • Property mode set to 100755
File size: 2.3 KB
Line 
1#!/bin/sh
2# When executed in Mingw: Produces a jbigi.dll
3# When executed in Linux/FreeBSD: Produces a libjbigi.so
4# When executed in OSX: Produces a libjbigi.jnilib
5[ -z "$CC" ] && CC="gcc"
6
7# If JAVA_HOME isn't set we'll try to figure it out
8[ -z $JAVA_HOME ] && . `dirname $0`/../find-java-home
9if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
10    echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'"
11    echo "Please set JAVA_HOME to a java home that has the JNI"
12    exit 1
13fi
14
15case `uname -s` in
16MINGW*)
17        JAVA_HOME="c:/software/j2sdk1.4.2_05"
18        COMPILEFLAGS="-Wall"
19        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
20        LINKFLAGS="-shared -Wl,--kill-at"
21        LIBFILE="jbigi.dll";;
22CYGWIN*)
23        JAVA_HOME="c:/software/j2sdk1.4.2_05"
24        COMPILEFLAGS="-Wall -mno-cygwin"
25        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
26        LINKFLAGS="-shared -Wl,--kill-at"
27        LIBFILE="jbigi.dll";;
28Darwin*)
29        JAVA_HOME=$(/usr/libexec/java_home)
30        COMPILEFLAGS="-fPIC -Wall"
31        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
32        LINKFLAGS="-dynamiclib -framework JavaVM"
33        LIBFILE="libjbigi.jnilib";;
34SunOS*|OpenBSD*|NetBSD*|*FreeBSD*|Linux*)
35        UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
36        if [ $UNIXTYPE = "sunos" ]; then
37            UNIXTYPE="solaris"
38        elif [ $UNIXTYPE = "gnu/kfreebsd" ]; then
39            UNIXTYPE="linux"
40        fi
41        COMPILEFLAGS="-fPIC -Wall $CFLAGS"
42        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE} -I/usr/local/include"
43        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
44        LIBFILE="libjbigi.so";;
45*)
46        echo "Unsupported system type."
47        exit 1;;
48esac
49
50if [ "$1" = "dynamic" ] ; then
51        echo "Building a jbigi lib that is dynamically linked to GMP"
52        LIBPATH="-L.libs -L/usr/local/lib"
53        INCLUDELIBS="-lgmp"
54else
55        echo "Building a jbigi lib that is statically linked to GMP"
56        STATICLIBS=".libs/libgmp.a"
57fi
58
59echo "Compiling C code..."
60rm -f jbigi.o $LIBFILE
61$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
62$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH || exit 1
63
64exit 0
Note: See TracBrowser for help on using the repository browser.