source: core/c/jbigi/mbuild_jbigi.sh @ 56a6772

Last change on this file since 56a6772 was 56a6772, checked in by kytv <kytv@…>, 8 years ago

Fix compilation with gmp 5.0.1

  • Property mode set to 100755
File size: 2.7 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
5CC="gcc"
6
7case `uname -s` 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*|OpenBSD*|NetBSD*|FreeBSD*|Linux*)
27        UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
28        if [ $UNIXTYPE = "sunos" ]; then
29                UNIXTYPE="solaris"
30        elif [ $UNIXTYPE = "freebsd" ]; then
31                if [ -d /usr/local/openjdk6 ]; then
32                        JAVA_HOME="/usr/local/openjdk6"
33                elif [ -d /usr/local/openjdk7 ]; then
34                        JAVA_HOME="/usr/local/openjdk7"
35                fi
36        elif [ $UNIXTYPE = "openbsd" ]; then
37                if [ -d /usr/local/jdk-1.7.0 ]; then
38                        JAVA_HOME="/usr/local/jdk-1.7.0"
39                fi
40        elif [ $UNIXTYPE = "netbsd" ]; then
41                if [ -d /usr/pkg/java/openjdk7 ]; then
42                        JAVA_HOME="/usr/pkg/java/openjdk7"
43                fi
44        elif [ $UNIXTYPE = "linux" ] && [ -e /etc/debian_version ]; then
45                if [ -d /usr/lib/jvm/default-java ]; then
46                        JAVA_HOME="/usr/lib/jvm/default-java"
47                fi
48        fi
49        COMPILEFLAGS="-fPIC -Wall"
50        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
51        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
52        LIBFILE="libjbigi.so";;
53*)
54        echo "Unsupported system type."
55        exit 1;;
56esac
57
58if [ "$1" = "dynamic" ] ; then
59        echo "Building a jbigi lib that is dynamically linked to GMP"
60        LIBPATH="-L.libs"
61        INCLUDELIBS="-lgmp"
62else
63        echo "Building a jbigi lib that is statically linked to GMP"
64        STATICLIBS=".libs/libgmp.a"
65fi
66
67echo "Compiling C code..."
68rm -f jbigi.o $LIBFILE
69$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
70$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS || exit 1
71
72exit 0
Note: See TracBrowser for help on using the repository browser.