build-scripts/emscripten-buildbot.sh
author Ryan C. Gordon <icculus@icculus.org>
Wed, 24 Dec 2014 13:23:48 -0500
changeset 9288 573ebcb470a3
parent 9285 559ac7dd4ee4
child 10311 848951113551
permissions -rwxr-xr-x
Actually fix Unix scripts this time. :)
     1 #!/bin/bash
     2 
     3 SDKDIR="/emsdk_portable"
     4 ENVSCRIPT="$SDKDIR/emsdk_env.sh"
     5 if [ ! -f "$ENVSCRIPT" ]; then
     6    echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
     7    exit 1
     8 fi
     9 
    10 TARBALL="$1"
    11 if [ -z $1 ]; then
    12     TARBALL=sdl-emscripten.tar.xz
    13 fi
    14 
    15 cd `dirname "$0"`
    16 cd ..
    17 SDLBASE=`pwd`
    18 
    19 if [ -z "$MAKE" ]; then
    20     OSTYPE=`uname -s`
    21     if [ "$OSTYPE" == "Linux" ]; then
    22         NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    23         let NCPU=$NCPU+1
    24     elif [ "$OSTYPE" = "Darwin" ]; then
    25         NCPU=`sysctl -n hw.ncpu`
    26     elif [ "$OSTYPE" = "SunOS" ]; then
    27         NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
    28     else
    29         NCPU=1
    30     fi
    31 
    32     if [ -z "$NCPU" ]; then
    33         NCPU=1
    34     elif [ "$NCPU" = "0" ]; then
    35         NCPU=1
    36     fi
    37 
    38     MAKE="make -j$NCPU"
    39 fi
    40 
    41 echo "\$MAKE is '$MAKE'"
    42 
    43 echo "Setting up Emscripten SDK environment..."
    44 source "$ENVSCRIPT"
    45 
    46 echo "Setting up..."
    47 set -x
    48 cd "$SDLBASE"
    49 rm -rf buildbot
    50 mkdir buildbot
    51 pushd buildbot
    52 
    53 echo "Configuring..."
    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"
    55 
    56 echo "Building..."
    57 emmake $MAKE
    58 
    59 echo "Moving things around..."
    60 emmake $MAKE install
    61 # Fix up a few things to a real install path
    62 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
    63 mkdir -p ./usr
    64 mv ./emscripten-sdl2-installed ./usr/local
    65 popd
    66 tar -cJvvf $TARBALL -C buildbot usr
    67 rm -rf buildbot
    68 
    69 exit 0
    70 
    71 # end of emscripten-buildbot.sh ...
    72