annotate build.sh @ 19:3400045a57b8 V2.1.6

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
author Ivo Smits <Ivo@UCIS.nl>
date Sun, 27 Feb 2011 22:42:27 +0100
parents c9fba5007577
children bd4259de8459
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
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
22 mkdir -p obj tmp lib include
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
23
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
24 echo Checking for NaCl library...
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
25 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
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
26 echo Found.
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
27 else
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
28 echo Not found, building...
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
29 mkdir tmp/nacl
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
30 cd tmp/nacl
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
31 wget -q -O- http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | bunzip2 | $tar -xf - --strip-components 1
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
32 ./do
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
33 cd ../../
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
34 cp tmp/nacl/build/*/lib/*/libnacl.a lib/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
35 cp tmp/nacl/build/*/include/*/crypto_box.h include/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
36 cp tmp/nacl/build/*/include/*/crypto_box_curve25519xsalsa20poly1305.h include/
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
37 cp tmp/nacl/build/*/include/*/crypto_scalarmult_curve25519.h include/
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
38 echo Done.
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
39 fi
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
40
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
41 export CPATH=./include/
7
fd7c60905b13 BSD support
ivo <Ivo@UCIS.nl>
parents: 0
diff changeset
42 export LIBRARY_PATH=/usr/local/lib/:./lib/
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
43
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
44 echo Building combined binary...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
45 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
46 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
47 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
48 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
49 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
50 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
51
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
52 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
53 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
54 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
55 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
56 gcc $CFLAGS -o out/quicktun.keypair src/keypair.c -lnacl $LDFLAGS
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
57
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
58 if [ -f /etc/network/interfaces ]; then
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
59 echo Building debian binary...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
60 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
61 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
62 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
63 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
64 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
65 ./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
66 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
67 fi
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
68 fi