source: core/c/jbigi/build_jbigi.sh @ 60204fe

Last change on this file since 60204fe was 8b372ad, checked in by dream <dream@…>, 11 years ago

Fixed build.sh

jbigi's build.sh had a number of failed assumptions as per where I2P and JAVA_HOME were which needed to be removed and a warning put in their place. A better solution would be to have some way to search for JAVA_HOME and I2P in common locations, but at least this solution works if you do it manually:

I2P=~i2p JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20 sh build.sh dynamic

thank zzz for prodding me to do this

  • Property mode set to 100755
File size: 1.8 KB
Line 
1#!/bin/sh
2# When executed in Mingw: Produces an jbigi.dll
3# When executed in Linux/FreeBSD: Produces an libjbigi.so
4# Darwin produces libjbigi.jnilib, right?
5
6CC="gcc"
7
8case `uname -sr` in
9MINGW*)
10        JAVA_HOME="c:/software/j2sdk1.4.2_05"
11        COMPILEFLAGS="-Wall"
12        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
13        LINKFLAGS="-shared -Wl,--kill-at"
14        LIBFILE="jbigi.dll";;
15CYGWIN*)
16        JAVA_HOME="c:/software/j2sdk1.4.2_05"
17        COMPILEFLAGS="-Wall -mno-cygwin"
18        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
19        LINKFLAGS="-shared -Wl,--kill-at"
20        LIBFILE="jbigi.dll";;
21Darwin*)
22        JAVA_HOME="/Library/Java/Home"
23        COMPILEFLAGS="-Wall"
24        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
25        LINKFLAGS="-dynamiclib -framework JavaVM"
26        LIBFILE="libjbigi.jnilib";;
27*)
28        COMPILEFLAGS="-fPIC -Wall"
29        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
30        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
31        LIBFILE="libjbigi.so";;
32esac
33
34if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
35    echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'"
36    echo "Please set JAVA_HOME to a java home that has the JNI"
37    exit 1
38fi
39
40#To link dynamically to GMP (use libgmp.so or gmp.lib), uncomment the first line below
41#To link statically to GMP, uncomment the second line below
42# Bug!!! Quote *BOTH* or neither! --Sponge
43if test "$1" = "dynamic"
44then
45        echo "Building jbigi lib that is dynamically linked to GMP" 
46        LIBPATH="-L.libs"
47        INCLUDELIBS="-lgmp"
48else
49        echo "Building jbigi lib that is statically linked to GMP"
50        STATICLIBS=".libs/libgmp.a"
51fi
52
53echo "Compiling C code..."
54rm -f jbigi.o $LIBFILE
55$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c
56$CC $LINKFLAGS $INCLUDES $INCLUDELIBS -o $LIBFILE jbigi.o $STATICLIBS
Note: See TracBrowser for help on using the repository browser.