source: core/c/jcpuid/mbuild.sh @ 462d4fb

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

Add support for OSX to jcpuid's mbuild.sh

  • Property mode set to 100755
File size: 2.4 KB
Line 
1#/bin/sh
2
3case `uname -sr` in
4MINGW*)
5        echo "Building windows .dll's";;
6CYGWIN*)
7        echo "Building windows .dll's";;
8Linux*)
9        echo "Building linux .so's";;
10FreeBSD*)
11        echo "Building freebsd .so's";;
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";;
40FreeBSD*)
41        case `uname -m` in
42                amd64)
43                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-freebsd.so"
44                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86_64-freebsd.so";;
45                i?86*)
46                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-freebsd.so"
47                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-freebsd.so";;
48                *)
49                        echo "Unknown build environment"
50                        exit;;
51        esac
52        COMPILEFLAGS="-fPIC -Wall"
53        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/ -I$JAVA_HOME/include/freebsd/";;
54Linux*)
55        case `uname -m` in
56                x86_64*)
57                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-linux.so"
58                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86_64-linux.so";;
59                ia64*)
60                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-linux.so"
61                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-ia64-linux.so";;
62                i?86*)
63                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-linux.so"
64                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-linux.so";;
65                *)
66                        echo "Unsupported build environment"
67                        exit;;
68        esac
69        COMPILEFLAGS="-fPIC -Wall"
70        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include -I$JAVA_HOME/include/linux";;
71
72esac
73
74echo "Compiling C code..."
75rm -f $LIBFILE
76$CC $COMPILEFLAGS $LINKFLAGS $INCLUDES src/*.c -o $LIBFILE
77strip $LIBFILE
78echo Built $LIBFILE
79
80#g++ -shared -static -static-libgcc -Iinclude -I$JAVA_HOME/include \
81#    -I$JAVA_HOME/include/linux src/*.cpp \
82#    -o lib/freenet/support/CPUInformation/libjcpuid-x86-linux.so
Note: See TracBrowser for help on using the repository browser.