Mercurial > hg > quicktun
changeset 30:6f0e6b7dc088
Fixed build script to support multiple abis on one machine, bugfix in code, minor improvements
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Thu, 04 Aug 2011 18:17:06 +0200 |
parents | 7c5e5be876bb |
children | a51d07ac3f1b |
files | build.sh src/common.c src/proto.nacltai.c src/run.combined.c |
diffstat | 4 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/build.sh Sat Apr 09 23:34:06 2011 +0200 +++ b/build.sh Thu Aug 04 18:17:06 2011 +0200 @@ -8,6 +8,10 @@ tar="gtar" CFLAGS="$CFLAGS -DSOLARIS -m64" LDFLAGS="$LDFLAGS -lnsl -lsocket" +elif [ "$(uname -s)" = "Darwin" ]; then + echo "Detected Mac OS X (Darwin)" + CFLAGS="$CFLAGS -arch i686" + LDFLAGS="$LDFLAGS -arch i686" else tar="tar" fi @@ -31,12 +35,14 @@ echo Not found, building... mkdir tmp/nacl cd tmp/nacl - wget -q -O- http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | bunzip2 | $tar -xf - --strip-components 1 + NACLURL="http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2" + (wget -q -O- "${NACLURL}" || curl -q "${NACLURL}") | bunzip2 | $tar -xf - --strip-components 1 ./do cd ../../ - cp tmp/nacl/build/*/lib/*/libnacl.a lib/ - cp tmp/nacl/build/*/include/*/crypto_box_curve25519xsalsa20poly1305.h include/ - cp tmp/nacl/build/*/include/*/crypto_scalarmult_curve25519.h include/ + ABI=`nacl/build/*/bin/okabi | head -n 1` + cp "tmp/nacl/build/*/lib/${ABI}/libnacl.a" lib/ + cp "tmp/nacl/build/*/include/${ABI}/crypto_box_curve25519xsalsa20poly1305.h" include/ + cp "tmp/nacl/build/*/include/${ABI}/crypto_scalarmult_curve25519.h" include/ echo Done. fi export CPATH="./include/:${CPATH}"
--- a/src/common.c Sat Apr 09 23:34:06 2011 +0200 +++ b/src/common.c Thu Aug 04 18:17:06 2011 +0200 @@ -273,3 +273,4 @@ return 0; } #endif +
--- a/src/proto.nacltai.c Sat Apr 09 23:34:06 2011 +0200 +++ b/src/proto.nacltai.c Thu Aug 04 18:17:06 2011 +0200 @@ -118,7 +118,7 @@ } static int encode(struct qtsession* sess, char* raw, char* enc, int len) { - if (debug) fprintf(stderr, "Encoding packet of %d bytes from %d to %d\n", len, (int)raw, (int)enc); + if (debug) fprintf(stderr, "Encoding packet of %d bytes from %p to %p\n", len, raw, enc); struct qt_proto_data_nacltai* d = (struct qt_proto_data_nacltai*)sess->protocol_data; memset(raw, 0, crypto_box_curve25519xsalsa20poly1305_ZEROBYTES); taia_now(&d->cdtaie); @@ -126,12 +126,12 @@ if (crypto_box_curve25519xsalsa20poly1305_afternm(enc, raw, len + crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, d->cenonce, d->cbefore)) return errorexit("Encryption failed"); memcpy((void*)(enc + crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES - noncelength), d->cenonce + nonceoffset, noncelength); len += overhead; - if (debug) fprintf(stderr, "Encoded packet of %d bytes from %d to %d\n", len, (int)raw, (int)enc); + if (debug) fprintf(stderr, "Encoded packet of %d bytes from %p to %p\n", len, raw, enc); return len; } static int decode(struct qtsession* sess, char* enc, char* raw, int len) { - if (debug) fprintf(stderr, "Decoding packet of %d bytes from %d to %d\n", len, (int)enc, (int)raw); + if (debug) fprintf(stderr, "Decoding packet of %d bytes from %p to %p\n", len, enc, raw); struct qt_proto_data_nacltai* d = (struct qt_proto_data_nacltai*)sess->protocol_data; struct taia cdtaic; int i; @@ -152,7 +152,7 @@ return 0; } d->cdtaip = cdtaic; - if (debug) fprintf(stderr, "Decoded packet of %d bytes from %d to %d\n", len, (int)enc, (int)raw); + if (debug) fprintf(stderr, "Decoded packet of %d bytes from %p to %p\n", len, enc, raw); return len; }
--- a/src/run.combined.c Sat Apr 09 23:34:06 2011 +0200 +++ b/src/run.combined.c Thu Aug 04 18:17:06 2011 +0200 @@ -25,9 +25,9 @@ #include "common.c" -struct qtproto qtproto_raw; -struct qtproto qtproto_nacl0; -struct qtproto qtproto_nacltai; +extern struct qtproto qtproto_raw; +extern struct qtproto qtproto_nacl0; +extern struct qtproto qtproto_nacltai; #ifdef DEBIAN_BINARY char* getenvdeb(const char* name) { @@ -67,3 +67,4 @@ return qtrun(&qtproto_raw); } } +