source: core/c/jbigi/mbuild_jbigi.sh @ 796d104b

Last change on this file since 796d104b was 796d104b, checked in by kytv <kytv@…>, 9 years ago

add support for osx

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#!/bin/bash
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
5CC="gcc"
6
7case `uname -sr` in
8MINGW*)
9        JAVA_HOME="c:/software/j2sdk1.4.2_05"
10        COMPILEFLAGS="-Wall"
11        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
12        LINKFLAGS="-shared -Wl,--kill-at"
13        LIBFILE="jbigi.dll";;
14CYGWIN*)
15        JAVA_HOME="c:/software/j2sdk1.4.2_05"
16        COMPILEFLAGS="-Wall -mno-cygwin"
17        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
18        LINKFLAGS="-shared -Wl,--kill-at"
19        LIBFILE="jbigi.dll";;
20Darwin*)
21        JAVA_HOME=$(/usr/libexec/java_home)
22        COMPILEFLAGS="-fPIC -Wall"
23        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
24        LINKFLAGS="-dynamiclib -framework JavaVM"
25        LIBFILE="libjbigi.jnilib";;
26SunOS*)
27        COMPILEFLAGS="-fPIC -Wall"
28        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/solaris"
29        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
30        LIBFILE="libjbigi.so";;
31
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 [ "$1" = "dynamic" ] ; then
40        echo "Building a jbigi lib that is dynamically linked to GMP" 
41        LIBPATH="-L.libs"
42        INCLUDELIBS="-lgmp"
43else
44        echo "Building a jbigi lib that is statically linked to GMP"
45        STATICLIBS=".libs/libgmp.a"
46fi
47
48echo "Compiling C code..."
49rm -f jbigi.o $LIBFILE
50$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
51$CC $LINKFLAGS $INCLUDES $INCLUDELIBS -o $LIBFILE jbigi.o $STATICLIBS || exit 1
52
53exit 0
Note: See TracBrowser for help on using the repository browser.