build-scripts/emscripten-buildbot.sh
author Ozkan Sezer <sezeroz@gmail.com>
Mon, 24 Jun 2019 23:51:10 +0300
changeset 12904 a08fb896b104
parent 10958 92d837180433
permissions -rwxr-xr-x
update version in os/2 makefile
icculus@9283
     1
#!/bin/bash
icculus@9283
     2
icculus@10774
     3
if [ -z "$SDKDIR" ]; then
icculus@10774
     4
    SDKDIR="/emsdk_portable"
icculus@10774
     5
fi
icculus@10774
     6
icculus@9283
     7
ENVSCRIPT="$SDKDIR/emsdk_env.sh"
icculus@9283
     8
if [ ! -f "$ENVSCRIPT" ]; then
icculus@9283
     9
   echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
icculus@10774
    10
   echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2
icculus@9283
    11
   exit 1
icculus@9283
    12
fi
icculus@9283
    13
icculus@9284
    14
TARBALL="$1"
icculus@9284
    15
if [ -z $1 ]; then
icculus@9284
    16
    TARBALL=sdl-emscripten.tar.xz
icculus@9284
    17
fi
icculus@9284
    18
icculus@9283
    19
cd `dirname "$0"`
icculus@9283
    20
cd ..
icculus@9283
    21
SDLBASE=`pwd`
icculus@9283
    22
icculus@9283
    23
if [ -z "$MAKE" ]; then
icculus@9283
    24
    OSTYPE=`uname -s`
icculus@9283
    25
    if [ "$OSTYPE" == "Linux" ]; then
icculus@9283
    26
        NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
icculus@9283
    27
        let NCPU=$NCPU+1
icculus@9283
    28
    elif [ "$OSTYPE" = "Darwin" ]; then
icculus@9283
    29
        NCPU=`sysctl -n hw.ncpu`
icculus@9283
    30
    elif [ "$OSTYPE" = "SunOS" ]; then
icculus@9283
    31
        NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
icculus@9283
    32
    else
icculus@9283
    33
        NCPU=1
icculus@9283
    34
    fi
icculus@9283
    35
icculus@9283
    36
    if [ -z "$NCPU" ]; then
icculus@9283
    37
        NCPU=1
icculus@9283
    38
    elif [ "$NCPU" = "0" ]; then
icculus@9283
    39
        NCPU=1
icculus@9283
    40
    fi
icculus@9283
    41
icculus@9283
    42
    MAKE="make -j$NCPU"
icculus@9283
    43
fi
icculus@9283
    44
icculus@9283
    45
echo "\$MAKE is '$MAKE'"
icculus@9283
    46
icculus@9283
    47
echo "Setting up Emscripten SDK environment..."
icculus@9283
    48
source "$ENVSCRIPT"
icculus@9283
    49
icculus@9283
    50
echo "Setting up..."
icculus@9283
    51
set -x
icculus@9283
    52
cd "$SDLBASE"
icculus@9283
    53
rm -rf buildbot
icculus@9283
    54
mkdir buildbot
icculus@9284
    55
pushd buildbot
icculus@9283
    56
icculus@9283
    57
echo "Configuring..."
philipp@10958
    58
emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $?
icculus@9283
    59
icculus@9283
    60
echo "Building..."
icculus@10311
    61
emmake $MAKE || exit $?
icculus@9283
    62
icculus@9284
    63
echo "Moving things around..."
icculus@10311
    64
emmake $MAKE install || exit $?
icculus@10311
    65
icculus@9285
    66
# Fix up a few things to a real install path
icculus@9288
    67
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
    68
mkdir -p ./usr
icculus@9288
    69
mv ./emscripten-sdl2-installed ./usr/local
icculus@9284
    70
popd
icculus@9284
    71
tar -cJvvf $TARBALL -C buildbot usr
icculus@9284
    72
rm -rf buildbot
icculus@9283
    73
icculus@9283
    74
exit 0
icculus@9283
    75
icculus@9283
    76
# end of emscripten-buildbot.sh ...
icculus@9283
    77