source: core/c/jcpuid/mbuild.sh @ f2fe514

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

Add NetBSD support

  • Property mode set to 100755
File size: 2.9 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*)
11        echo "Building netbsd .sos";;
12FreeBSD*)
13        echo "Building freebsd .sos";;
14Darwin*)
15        echo "Building OSX jnilibs";;
16*)
17        echo "Unsupported build environment"
18        exit;;
19esac
20
21rm -rf lib
22#mkdir lib
23#mkdir lib/freenet
24#mkdir lib/freenet/support
25mkdir -p lib/freenet/support/CPUInformation
26
27CC="gcc"
28
29case `uname -sr` in
30MINGW*)
31        JAVA_HOME="/c/software/j2sdk1.4.2_05"
32        COMPILEFLAGS="-Wall"
33        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/ -I$JAVA_HOME/include/win32/"
34        LINKFLAGS="-shared -static -static-libgcc -Wl,--kill-at"
35        LIBFILE="lib/freenet/support/CPUInformation/jcpuid-x86-windows.dll";;
36Darwin*)
37        JAVA_HOME=$(/usr/libexec/java_home)
38        COMPILEFLAGS="-fPIC -Wall -arch x86_64 -arch i386"
39        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/"
40        LINKFLAGS="-dynamiclib -framework JavaVM"
41        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-darwin.jnilib";;
42NetBSD*)
43        case `uname -m` in
44                amd64)
45                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-netbsd.so"
46                        LIBFILE="lib/netnet/support/CPUInformation/libjcpuid-x86_64-netbsd.so";;
47                i?86*)
48                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-netbsd.so"
49                        LIBFILE="lib/netnet/support/CPUInformation/libjcpuid-x86-netbsd.so";;
50                *)
51                        echo "Unknown build environment"
52                        exit;;
53        esac
54        COMPILEFLAGS="-fPIC -Wall"
55        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/ -I$JAVA_HOME/include/netbsd/";;
56FreeBSD*)
57        case `uname -m` in
58                amd64)
59                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-freebsd.so"
60                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86_64-freebsd.so";;
61                i?86*)
62                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-freebsd.so"
63                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-freebsd.so";;
64                *)
65                        echo "Unknown build environment"
66                        exit;;
67        esac
68        COMPILEFLAGS="-fPIC -Wall"
69        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/ -I$JAVA_HOME/include/freebsd/";;
70Linux*)
71        case `uname -m` in
72                x86_64*)
73                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-linux.so"
74                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86_64-linux.so";;
75                ia64*)
76                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-linux.so"
77                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-ia64-linux.so";;
78                i?86*)
79                        LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-linux.so"
80                        LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-linux.so";;
81                *)
82                        echo "Unsupported build environment"
83                        exit;;
84        esac
85        COMPILEFLAGS="-fPIC -Wall"
86        INCLUDES="-I. -Iinclude -I$JAVA_HOME/include -I$JAVA_HOME/include/linux";;
87
88esac
89
90echo "Compiling C code..."
91rm -f $LIBFILE
92$CC $COMPILEFLAGS $LINKFLAGS $INCLUDES src/*.c -o $LIBFILE
93strip $LIBFILE
94echo Built $LIBFILE
95
96#g++ -shared -static -static-libgcc -Iinclude -I$JAVA_HOME/include \
97#    -I$JAVA_HOME/include/linux src/*.cpp \
98#    -o lib/freenet/support/CPUInformation/libjcpuid-x86-linux.so
Note: See TracBrowser for help on using the repository browser.