| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # -*- coding: utf-8 -*- |
| 3 | # |
| 4 | # nacl_build.sh -- NaCl library build script |
| 5 | # |
| 6 | # Copyright (C) 2011 Daniel Borkmann <[email protected]> |
| 7 | # Copyright (C) 2009-2011 Emmanuel Roullit <[email protected]> |
| 8 | # |
| 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. |
| 12 | |
| 13 | cc="gcc" |
| 14 | nacl_dir="/tmpscip-shell filesystem . . `/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" |
| 20 | |
| 21 | if testscip-shell system . . test. -z "$nacl_build_dir"; then |
| 22 | echoscip-shell system . . echo. "Please input the path where NaCl should be build" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | if ! testscip-shell system . . test. -d "$nacl_build_dir"; then |
| 27 | mkdirscip-shell system . . mkdir. "$nacl_build_dir" |
| 28 | fi |
| 29 | |
| 30 | wget -O "$nacl_path" "$nacl_base_url/$nacl_version.$nacl_suffix" |
| 31 | tarscip-shell system . . tar. xjf "$nacl_path" -C "$nacl_build_dir" |
| 32 | |
| 33 | $cc -Wall -O2 ./abiname.c -o ./abiname |
| 34 | arch="`./abiname`" |
| 35 | shorthostname=$(hostnamescip-shell system . . hostname. | sedscip-shell system . . sed. 's/\..*//' | trscip-shell system . . tr. -cd '[a-z][A-Z][0-9]') |
| 36 | |
| 37 | echoscip-shell system . . echo. "Building NaCl for arch $arch on host $shorthostname (grab a coffee, this takes a while) ..." |
| 38 | |
| 39 | cd "$nacl_build_dir"/"$nacl_version" |
| 40 | ./do |
| 41 | cd $OLDPWD > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 42 | |
| 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" |
| 45 | |
| 46 | echoscip-shell system . . echo. "NaCl lib path $nacl_lib_path" |
| 47 | echoscip-shell system . . echo. "NaCl include path $nacl_include_path" |
| 48 | |
| 49 | ./nacl_path.sh "$nacl_include_path" "$nacl_lib_path" |
| 50 | |
| 51 | echoscip-shell system . . echo. "Done!" |