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

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

Improved support for GNU/kFreeBSD

  • add kFreeBSD to NBI and CPUID
  • add kFreeBSD to jcpuid/jbigi build scripts
  • refresh debian patches to compensate for kFreeBSD changes
  • i2prouter: Detect kFreeBSD and normalize its name
  • clean up osid (switching to "elif") and adding support for detecting kFreeBSD
  • update postinstall.sh; I2P cannot be installed using gij so postinstall.sh will not be run. If/when openjdk finally comes to kFreeBSD, we'll be ready for it.
  • Property mode set to 100755
File size: 2.2 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
7# If JAVA_HOME isn't set we'll try to figure it out
8[ -z $JAVA_HOME ] && . ../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"
42        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
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"
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 || exit 1
63
64exit 0
Note: See TracBrowser for help on using the repository browser.