build-scripts/emscripten-buildbot.sh
author Ryan C. Gordon <icculus@icculus.org>
Fri, 25 Nov 2016 00:13:13 -0500
changeset 10651 f0065b8e6541
parent 10311 848951113551
child 10774 50a5917c297c
permissions -rwxr-xr-x
macOS: removed deprecated UpdateSystemActivity() call.

The non-deprecated approach (IOPMAssertion) already exists in SDL, and is
available in Mac OS X 10.6 and later (although it was incorrectly listed as
10.7 and later in SDL). Since SDL now requires 10.6 or later, this is no
longer conditionally used.
icculus@9283
     1
#!/bin/bash
icculus@9283
     2
icculus@9283
     3
SDKDIR="/emsdk_portable"
icculus@9283
     4
ENVSCRIPT="$SDKDIR/emsdk_env.sh"
icculus@9283
     5
if [ ! -f "$ENVSCRIPT" ]; then
icculus@9283
     6
   echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
icculus@9283
     7
   exit 1
icculus@9283
     8
fi
icculus@9283
     9
icculus@9284
    10
TARBALL="$1"
icculus@9284
    11
if [ -z $1 ]; then
icculus@9284
    12
    TARBALL=sdl-emscripten.tar.xz
icculus@9284
    13
fi
icculus@9284
    14
icculus@9283
    15
cd `dirname "$0"`
icculus@9283
    16
cd ..
icculus@9283
    17
SDLBASE=`pwd`
icculus@9283
    18
icculus@9283
    19
if [ -z "$MAKE" ]; then
icculus@9283
    20
    OSTYPE=`uname -s`
icculus@9283
    21
    if [ "$OSTYPE" == "Linux" ]; then
icculus@9283
    22
        NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
icculus@9283
    23
        let NCPU=$NCPU+1
icculus@9283
    24
    elif [ "$OSTYPE" = "Darwin" ]; then
icculus@9283
    25
        NCPU=`sysctl -n hw.ncpu`
icculus@9283
    26
    elif [ "$OSTYPE" = "SunOS" ]; then
icculus@9283
    27
        NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
icculus@9283
    28
    else
icculus@9283
    29
        NCPU=1
icculus@9283
    30
    fi
icculus@9283
    31
icculus@9283
    32
    if [ -z "$NCPU" ]; then
icculus@9283
    33
        NCPU=1
icculus@9283
    34
    elif [ "$NCPU" = "0" ]; then
icculus@9283
    35
        NCPU=1
icculus@9283
    36
    fi
icculus@9283
    37
icculus@9283
    38
    MAKE="make -j$NCPU"
icculus@9283
    39
fi
icculus@9283
    40
icculus@9283
    41
echo "\$MAKE is '$MAKE'"
icculus@9283
    42
icculus@9283
    43
echo "Setting up Emscripten SDK environment..."
icculus@9283
    44
source "$ENVSCRIPT"
icculus@9283
    45
icculus@9283
    46
echo "Setting up..."
icculus@9283
    47
set -x
icculus@9283
    48
cd "$SDLBASE"
icculus@9283
    49
rm -rf buildbot
icculus@9283
    50
mkdir buildbot
icculus@9284
    51
pushd buildbot
icculus@9283
    52
icculus@9283
    53
echo "Configuring..."
icculus@10311
    54
emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $?
icculus@9283
    55
icculus@9283
    56
echo "Building..."
icculus@10311
    57
emmake $MAKE || exit $?
icculus@9283
    58
icculus@9284
    59
echo "Moving things around..."
icculus@10311
    60
emmake $MAKE install || exit $?
icculus@10311
    61
icculus@9285
    62
# Fix up a few things to a real install path
icculus@9288
    63
perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config
icculus@9284
    64
mkdir -p ./usr
icculus@9288
    65
mv ./emscripten-sdl2-installed ./usr/local
icculus@9284
    66
popd
icculus@9284
    67
tar -cJvvf $TARBALL -C buildbot usr
icculus@9284
    68
rm -rf buildbot
icculus@9283
    69
icculus@9283
    70
exit 0
icculus@9283
    71
icculus@9283
    72
# end of emscripten-buildbot.sh ...
icculus@9283
    73