-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·60 lines (50 loc) · 1.29 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env sh
unset CDPATH
NACLVERSION=20110221
NACLSRCDIR=`pwd`/src/cbits/nacl-$NACLVERSION
printf "shortname is... "
SHORTHOST=`hostname | sed 's/\..*//' | tr -cd '[a-z][A-Z][0-9]'`
echo $SHORTHOST
printf "ghc architecture is... "
ARCHGREP=`ghc --info | grep x86_64`
if [ "$ARCHGREP" != "" ]; then
ARCH=amd64
else
ARCH=x86
fi
echo $ARCH
OUTDIR=$HOME/.haskell.salt/$ARCH-$NACLVERSION
printf "checking if NaCl has been built... "
if [ ! -d "$OUTDIR" ]; then
if [ ! -d "$NACLSRCDIR/build" ]; then
echo "no"
printf "now building... "
D=`pwd`
cd $NACLSRCDIR
export SALT_ABI=$ARCH
./do
unset SALT_ABI
if [ $? != 0 ]; then
echo "error (return code was $?)"
exit 1
fi
cd $D
echo "ok, done"
else
echo "yes"
fi
echo "copying includes/libraries to $OUTDIR"
mkdir -p $OUTDIR/include
mkdir -p $OUTDIR/lib
cp -r $NACLSRCDIR/build/$SHORTHOST/include/$ARCH/* $OUTDIR/include
cp -r $NACLSRCDIR/build/$SHORTHOST/lib/$ARCH/* $OUTDIR/lib
else
echo "yes"
fi
echo "configure: generating salt.buildinfo"
INCDIR=$OUTDIR/include
LIBDIR=$OUTDIR/lib
rm -f salt.buildinfo
echo "include-dirs: $INCDIR" > salt.buildinfo
echo "extra-lib-dirs: $LIBDIR" >> salt.buildinfo
exit 0