Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
#!/bin/bash
2
 
3
if [ -z "$SDKDIR" ]; then
4
    SDKDIR="/emsdk_portable"
5
fi
6
 
7
ENVSCRIPT="$SDKDIR/emsdk_env.sh"
8
if [ ! -f "$ENVSCRIPT" ]; then
9
   echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
10
   echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2
11
   exit 1
12
fi
13
 
14
TARBALL="$1"
15
if [ -z $1 ]; then
16
    TARBALL=physfs-emscripten.tar.xz
17
fi
18
 
19
cd `dirname "$0"`
20
cd ..
21
PHYSFSBASE=`pwd`
22
 
23
if [ -z "$MAKE" ]; then
24
    OSTYPE=`uname -s`
25
    if [ "$OSTYPE" == "Linux" ]; then
26
        NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
27
        let NCPU=$NCPU+1
28
    elif [ "$OSTYPE" = "Darwin" ]; then
29
        NCPU=`sysctl -n hw.ncpu`
30
    elif [ "$OSTYPE" = "SunOS" ]; then
31
        NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
32
    else
33
        NCPU=1
34
    fi
35
 
36
    if [ -z "$NCPU" ]; then
37
        NCPU=1
38
    elif [ "$NCPU" = "0" ]; then
39
        NCPU=1
40
    fi
41
 
42
    MAKE="make -j$NCPU"
43
fi
44
 
45
echo "\$MAKE is '$MAKE'"
46
MAKECMD="$MAKE"
47
unset MAKE  # prevent warnings about jobserver mode.
48
 
49
echo "Setting up Emscripten SDK environment..."
50
source "$ENVSCRIPT"
51
 
52
echo "Setting up..."
53
cd "$PHYSFSBASE"
54
rm -rf buildbot
55
mkdir buildbot
56
cd buildbot
57
 
58
echo "Configuring..."
59
emcmake cmake -G "Unix Makefiles" -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=MinSizeRel .. || exit $?
60
 
61
echo "Building..."
62
emmake $MAKECMD || exit $?
63
 
64
set -e
65
rm -rf "$TARBALL" physfs-emscripten
66
mkdir -p physfs-emscripten
67
echo "Archiving to '$TARBALL' ..."
68
cp ../src/physfs.h libphysfs.a physfs-emscripten
69
chmod -R a+r physfs-emscripten
70
chmod a+x physfs-emscripten
71
chmod -R go-w physfs-emscripten
72
tar -cJvvf "$TARBALL" physfs-emscripten
73
echo "Done."
74
 
75
exit 0
76
 
77
# end of emscripten-buildbot.sh ...
78