trafgen: fix packet socket initialization with multiple CPUs
[netsniff-ng.git] / curvetun / nacl_build.sh
blobd9ea752e0a8787c2d1fa16fd16df8c246d2b9efe
1 #!/bin/bash
2 # -*- coding: utf-8 -*-
4 # nacl_build.sh -- NaCl library build script
6 # Copyright (C) 2011 Daniel Borkmann <borkmann@redhat.com>
7 # Copyright (C) 2009-2011 Emmanuel Roullit <emmanuel@netsniff-ng.org>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2 as
11 # published by the Free Software Foundation.
13 cc="gcc"
14 nacl_dir="/tmp"
15 nacl_version="nacl-20110221"
16 nacl_suffix="tar.bz2"
17 nacl_base_url="http://hyperelliptic.org/nacl"
18 nacl_path="$nacl_dir/$nacl_version.$nacl_suffix"
19 nacl_build_dir="$1"
21 if test -z "$nacl_build_dir"; then
22 echo "Please input the path where NaCl should be build"
23 exit 1
26 if ! test -d "$nacl_build_dir"; then
27 mkdir "$nacl_build_dir"
30 wget -O "$nacl_path" "$nacl_base_url/$nacl_version.$nacl_suffix"
31 tar xjf "$nacl_path" -C "$nacl_build_dir"
33 $cc -Wall -O2 ./abiname.c -o ./abiname
34 arch="`./abiname`"
35 shorthostname=$(hostname | sed 's/\..*//' | tr -cd '[a-z][A-Z][0-9]')
37 echo "Building NaCl for arch $arch on host $shorthostname (grab a coffee, this takes a while) ..."
39 cd "$nacl_build_dir"/"$nacl_version"
40 ./do
41 cd $OLDPWD > /dev/null
43 nacl_lib_path="$nacl_build_dir/$nacl_version/build/$shorthostname/lib/$arch"
44 nacl_include_path="$nacl_build_dir/$nacl_version/build/$shorthostname/include/$arch"
46 echo "NaCl lib path $nacl_lib_path"
47 echo "NaCl include path $nacl_include_path"
49 ./nacl_path.sh "$nacl_include_path" "$nacl_lib_path"
51 echo "Done!"