source: core/c/jcpuid/mbuild.sh @ 8ee6503e

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

allow x86_64 or amd64 for the X86_64 systems

  • Property mode set to 100755
File size: 2.8 KB
Line 
1#/bin/sh
2
3case `uname -sr` in
4MINGW*)
5        echo "Building windows .dlls";;
6CYGWIN*)
7        echo "Building windows .dlls";;
8Linux*)
9        echo "Building linux .sos";;
10NetBSD*|OpenBSD*|FreeBSD*)
11        echo "Building `uname -s |tr [A-Z] [a-z]` .sos";;
12Darwin*)
13        echo "Building OSX jnilibs";;
14*)
15        echo "Unsupported build environment"
16        exit;;
17esac
18
19rm -rf lib
20#mkdir lib
21#mkdir lib/freenet
22#mkdir lib/freenet/support
23mkdir -p lib/freenet/support/CPUInformation
24
25CC="gcc"
26
27case `uname -sr` in
28MINGW*)
29        JAVA_HOME="/c/software/j2sdk1.4.2_05"
30        COMPILEFLAGS="-Wall"
31        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/ -I$JAVA_HOME/include/win32/"
32        LINKFLAGS="-shared -static -static-libgcc -Wl,--kill-at"
33        LIBFILE="lib/freenet/support/CPUInformation/jcpuid-x86-windows.dll";;
34Darwin*)
35        JAVA_HOME=$(/usr/libexec/java_home)
36        COMPILEFLAGS="-fPIC -Wall -arch x86_64 -arch i386"
37        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/"
38        LINKFLAGS="-dynamiclib -framework JavaVM"
39        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-darwin.jnilib";;
40Linux*|OpenBSD*|NetBSD*|FreeBSD*|SunOS*)
41        UNIXTYPE="`uname -s | tr [A-Z] [a-z]`"
42        if [ $UNIXTYPE = "sunos" ]; then
43                UNIXTYPE="solaris"
44        elif [ $UNIXTYPE = "freebsd" ]; then
45                if [ -d /usr/local/openjdk6 ]; then
46                        JAVA_HOME="/usr/local/openjdk6"
47                elif [ -d /usr/local/openjdk7 ]; then
48                        JAVA_HOME="/usr/local/openjdk7"
49                fi
50        elif [ $UNIXTYPE = "openbsd" ]; then
51                if [ -d /usr/local/jdk-1.7.0 ]; then
52                        JAVA_HOME="/usr/local/jdk-1.7.0"
53                fi
54        elif [ $UNIXTYPE = "netbsd" ]; then
55                if [ -d /usr/pkg/java/openjdk7 ]; then
56                        JAVA_HOME="/usr/pkg/java/openjdk7"
57                fi
58        elif [ $UNIXTYPE = "linux" -a -e /etc/debian_version ]; then
59                if [ -d /usr/lib/jvm/default-java ]; then
60                        JAVA_HOME="/usr/lib/jvm/default-java"
61                fi
62        fi
63        case `uname -m` in
64                x86_64*|amd64)
65                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-${UNIXTYPE}.so"
66                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86_64-${UNIXTYPE}.so";;
67                ia64*)
68                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-${UNIXTYPE}.so"
69                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-ia64-${UNIXTYPE}.so";;
70                i?86*)
71                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-${UNIXTYPE}.so"
72                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-${UNIXTYPE}.so";;
73                *)
74                        echo "Unsupported build environment"
75                        exit;;
76        esac
77        COMPILEFLAGS="-fPIC -Wall"
78        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}";;
79
80esac
81
82echo "Compiling C code..."
83rm -f $LIBFILE
84$CC $COMPILEFLAGS $LINKFLAGS $INCLUDES src/*.c -o $LIBFILE
85strip $LIBFILE
86echo Built $LIBFILE
87
88#g++ -shared -static -static-libgcc -Iinclude -I$JAVA_HOME/include \
89#    -I$JAVA_HOME/include/linux src/*.cpp \
90#    -o lib/freenet/support/CPUInformation/libjcpuid-x86-linux.so
Note: See TracBrowser for help on using the repository browser.