annotate build.sh @ 18:c9fba5007577

Merged commit from dereckson: Fixing linuxisms
author Ivo Smits <Ivo@UCIS.nl>
date Sun, 27 Feb 2011 20:55:05 +0100
parents 8f564c559416 d621348448de
children 3400045a57b8
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...
16
8f564c559416 Exclude some local stuff
Ivo Smits <Ivo@UCIS.nl>
parents: 14
diff changeset
20 $tar --transform "s,^\.,quicktun-`cat version`," -czf "out/quicktun-`cat version`.tgz" . --exclude "./out" --exclude "./lib" --exclude "./debian/data" --exclude "./dist.sh"
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
21
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
22 mkdir -p obj tmp lib
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...
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
25 if [ ! -e lib/libnacl.a ]; then
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
26 echo building...
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
27 mkdir tmp/nacl
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
28 cd tmp/nacl
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
29 wget -q -O- http://hyperelliptic.org/nacl/nacl-20090405.tar.bz2 | bunzip2 | $tar -xf - --strip-components 1
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
30 ./do
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
31 cd ../../
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
32 cp tmp/nacl/build/*/lib/*/libnacl.a lib/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
33 cp tmp/nacl/build/*/include/*/crypto_box.h include/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
34 cp tmp/nacl/build/*/include/*/crypto_box_curve25519salsa20hmacsha512.h include/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
35 cp tmp/nacl/build/*/include/*/crypto_box_curve25519xsalsa20poly1305.h include/
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
36 fi
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
37 echo Done.
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
38
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
39 export CPATH=./include/
7
fd7c60905b13 BSD support
ivo <Ivo@UCIS.nl>
parents: 0
diff changeset
40 export LIBRARY_PATH=/usr/local/lib/:./lib/
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
41
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
42 echo Building combined binary...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
43 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
44 gcc $CFLAGS -c -DCOMBINED_BINARY src/crypto_scalarmult_curve25519.c -o obj/crypto_scalarmult_curve25519.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
45 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
46 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
47 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
48 gcc $CFLAGS -c src/common.c -o obj/common.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
49 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 obj/crypto_scalarmult_curve25519.o -lnacl $LDFLAGS
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
50
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
51 echo Building single protocol binaries...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
52 gcc $CFLAGS -o out/quicktun.raw src/proto.raw.c $LDFLAGS
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
53 gcc $CFLAGS -o out/quicktun.nacl0 src/proto.nacl0.c -lnacl $LDFLAGS
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
54 gcc $CFLAGS -o out/quicktun.nacltai src/proto.nacltai.c src/crypto_scalarmult_curve25519.c -lnacl $LDFLAGS
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
55 gcc $CFLAGS -o out/quicktun.keypair src/keypair.c -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 shared libraries...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
58 gcc $CFLAGS -fPIC -shared -Wl,-soname,quicktun.raw -o out/libquicktun.raw src/proto.raw.c
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
59 ##gcc $CFLAGS -fPIC -shared -Wl,-soname,quicktun.nacl0 -o out/libquicktun.nacl0 src/proto.nacl0.c -lnacl $LDFLAGS
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
60
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
61 ##echo Building frontends...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
62 ##gcc $CFLAGS -o out/quicktun.debian src/run.debian.c -ldl
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
63
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
64 if [ -f /etc/network/interfaces ]; then
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
65 echo Building debian binary...
13
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
66 gcc $CFLAGS -c -DCOMBINED_BINARY -DDEBIAN_BINARY src/run.combined.c -o obj/run.debian.o
f7e0145d8e2a solaris support
Gabor Adam Toth <tg@tgbit.net>
parents: 11
diff changeset
67 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 obj/crypto_scalarmult_curve25519.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
68 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
69 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
70 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
71 ./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
72 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
73 fi
0
65c01f57bdce Initial commit
ivo <ivo@UFO-Net.nl>
parents:
diff changeset
74 fi