annotate build.sh @ 23:bd4259de8459

Support shared NaCl library in build script (untested)
author Ivo Smits <Ivo@UCIS.nl>
date Mon, 28 Feb 2011 16:32:48 +0100
parents 3400045a57b8
children dfac56805c77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
1 #!/bin/sh
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
2
17
d621348448de Fixing linuxisms
Dereckson <dereckson@espace-win.org>
parents: 14
diff changeset
3 if [ "$(uname -s)" = "OpenBSD" -o "$(uname -s)" = "FreeBSD" ]; then
14
d9dfeeaff7e8 Added BSD support to build script, updated NaCl URL to new version, added version file
Ivo Smits <Ivo@UCIS.nl>
parents: 13
diff changeset
4 echo "Detected *BSD"
d9dfeeaff7e8 Added BSD support to build script, updated NaCl URL to new version, added version file
Ivo Smits <Ivo@UCIS.nl>
parents: 13
diff changeset
5 tar="gtar"
17
d621348448de Fixing linuxisms
Dereckson <dereckson@espace-win.org>
parents: 14
diff changeset
6 elif [ "$(uname -s)" = "SunOS" ]; then
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
7 echo "Detected SunOS"
14
d9dfeeaff7e8 Added BSD support to build script, updated NaCl URL to new version, added version file
Ivo Smits <Ivo@UCIS.nl>
parents: 13
diff changeset
8 tar="gtar"
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
9 CFLAGS="$CFLAGS -DSOLARIS -m64"
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
10 LDFLAGS="$LDFLAGS -lnsl -lsocket"
14
d9dfeeaff7e8 Added BSD support to build script, updated NaCl URL to new version, added version file
Ivo Smits <Ivo@UCIS.nl>
parents: 13
diff changeset
11 else
d9dfeeaff7e8 Added BSD support to build script, updated NaCl URL to new version, added version file
Ivo Smits <Ivo@UCIS.nl>
parents: 13
diff changeset
12 tar="tar"
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
13 fi
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
14
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
15 echo Cleaning up...
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
16 rm -rf out/ obj/ tmp/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
17
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
18 mkdir -p out
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
19 echo Creating source archive...
19
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
20 $tar --transform "s,^,quicktun-`cat version`/," -czf "out/quicktun-`cat version`.tgz" build.sh clean.sh debian src version --exclude "debian/data"
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
21
23
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
22 mkdir -p obj tmp
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
23
23
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
24 export LIBRARY_PATH="/usr/local/lib/:${LIBRARY_PATH}"
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
25 if [ -z "${NACL_SHARED}" ]; then
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
26 mkdir -p lib include
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
27 echo Checking for NaCl library...
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
28 if [ -e lib/libnacl.a -a -e include/crypto_box.h -a -e include/crypto_box_curve25519xsalsa20poly1305.h -a -e include/crypto_scalarmult_curve25519.h ]; then
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
29 echo Found.
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
30 else
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
31 echo Not found, building...
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
32 mkdir tmp/nacl
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
33 cd tmp/nacl
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
34 wget -q -O- http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | bunzip2 | $tar -xf - --strip-components 1
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
35 ./do
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
36 cd ../../
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
37 cp tmp/nacl/build/*/lib/*/libnacl.a lib/
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
38 cp tmp/nacl/build/*/include/*/crypto_box.h include/
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
39 cp tmp/nacl/build/*/include/*/crypto_box_curve25519xsalsa20poly1305.h include/
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
40 cp tmp/nacl/build/*/include/*/crypto_scalarmult_curve25519.h include/
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
41 echo Done.
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
42 fi
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
43 export CPATH="./include/:${CPATH}"
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
44 export LIBRARY_PATH="/usr/local/lib/:./lib/:${LIBRARY_PATH}"
19
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
45 else
23
bd4259de8459 Support shared NaCl library in build script (untested)
Ivo Smits <Ivo@UCIS.nl>
parents: 19
diff changeset
46 echo Using shared NaCl library.
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
47 fi
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
48
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
49 echo Building combined binary...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
50 gcc $CFLAGS -c -DCOMBINED_BINARY src/proto.raw.c -o obj/proto.raw.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
51 gcc $CFLAGS -c -DCOMBINED_BINARY src/proto.nacl0.c -o obj/proto.nacl0.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
52 gcc $CFLAGS -c -DCOMBINED_BINARY src/proto.nacltai.c -o obj/proto.nacltai.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
53 gcc $CFLAGS -c -DCOMBINED_BINARY src/run.combined.c -o obj/run.combined.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
54 gcc $CFLAGS -c src/common.c -o obj/common.o
19
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
55 gcc $CFLAGS -o out/quicktun.combined obj/common.o obj/run.combined.o obj/proto.raw.o obj/proto.nacl0.o obj/proto.nacltai.o -lnacl $LDFLAGS
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
56
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
57 echo Building single protocol binaries...
19
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
58 gcc $CFLAGS -o out/quicktun.raw src/proto.raw.c $LDFLAGS
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
59 gcc $CFLAGS -o out/quicktun.nacl0 src/proto.nacl0.c -lnacl $LDFLAGS
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
60 gcc $CFLAGS -o out/quicktun.nacltai src/proto.nacltai.c -lnacl $LDFLAGS
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
61 gcc $CFLAGS -o out/quicktun.keypair src/keypair.c -lnacl $LDFLAGS
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
62
11
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
63 if [ -f /etc/network/interfaces ]; then
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
64 echo Building debian binary...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
65 gcc $CFLAGS -c -DCOMBINED_BINARY -DDEBIAN_BINARY src/run.combined.c -o obj/run.debian.o
19
3400045a57b8 Version 2.1.6, changed sourcecode archive generation, use NaCl version 20110221, do not duplicate NaCl sourcecode, support iproute2 for persistent tunnel creation on Debian, support running as root on Debian, removed autogenerated header files
Ivo Smits <Ivo@UCIS.nl>
parents: 18
diff changeset
66 gcc $CFLAGS -o out/quicktun.debian obj/common.o obj/run.debian.o obj/proto.raw.o obj/proto.nacl0.o obj/proto.nacltai.o -lnacl $LDFLAGS
11
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
67 if [ -x /usr/bin/dpkg-deb -a -x /usr/bin/fakeroot ]; then
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
68 echo -n Building debian package...
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
69 cd debian
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
70 ./build.sh
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
71 cd ..
5be1ecb80cc9 Fixed build script for debian systems without packaging tools, removed packet logging from nacltai
root <root@Really.UFO-Net.nl>
parents: 7
diff changeset
72 fi
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
73 fi