source: core/c/jbigi/build_jbigi.sh @ 3677cad

Last change on this file since 3677cad was 455b552, checked in by kytv <kytv@…>, 10 years ago

jbigi: Add support for SunOS/Nexenta/Solaris to the build*.sh scripts

  • Property mode set to 100755
File size: 2.0 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";;
27SunOS*)
28        COMPILEFLAGS="-fPIC -Wall"
29        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/solaris"
30        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
31        LIBFILE="libjbigi.so";;
32*)
33        COMPILEFLAGS="-fPIC -Wall"
34        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
35        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
36        LIBFILE="libjbigi.so";;
37esac
38
39if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
40    echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'"
41    echo "Please set JAVA_HOME to a java home that has the JNI"
42    exit 1
43fi
44
45#To link dynamically to GMP (use libgmp.so or gmp.lib), uncomment the first line below
46#To link statically to GMP, uncomment the second line below
47# Bug!!! Quote *BOTH* or neither! --Sponge
48if test "$1" = "dynamic"
49then
50        echo "Building jbigi lib that is dynamically linked to GMP" 
51        LIBPATH="-L.libs"
52        INCLUDELIBS="-lgmp"
53else
54        echo "Building jbigi lib that is statically linked to GMP"
55        STATICLIBS=".libs/libgmp.a"
56fi
57
58echo "Compiling C code..."
59rm -f jbigi.o $LIBFILE
60$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c
61$CC $LINKFLAGS $INCLUDES $INCLUDELIBS -o $LIBFILE jbigi.o $STATICLIBS
Note: See TracBrowser for help on using the repository browser.