build-scripts/nacl-buildbot.sh
changeset 8881 eb48568ecabb
child 8882 4fc9e98413c3
equal deleted inserted replaced
8880:ee5117b56b93 8881:eb48568ecabb
       
     1 #!/bin/bash
       
     2 
       
     3 # This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
       
     4 #  amd64 Linux to NaCl.
       
     5 
       
     6 # The final tarball can be unpacked in the root directory of a RPi,
       
     7 #  so the SDL2 install lands in /usr/local. Run ldconfig, and then
       
     8 #  you should be able to build and run SDL2-based software on your
       
     9 #  Pi. Standard configure scripts should be able to find SDL and
       
    10 #  build against it, and sdl2-config should work correctly on the
       
    11 #  actual device.
       
    12 
       
    13 export NACL_SDK_ROOT="/nacl_sdk/pepper_35"
       
    14 
       
    15 TARBALL="$1"
       
    16 if [ -z $1 ]; then
       
    17     TARBALL=sdl-nacl.tar.xz
       
    18 fi
       
    19 
       
    20 OSTYPE=`uname -s`
       
    21 if [ "$OSTYPE" != "Linux" ]; then
       
    22     # !!! FIXME
       
    23     echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
       
    24     exit 1
       
    25 fi
       
    26 
       
    27 if [ "x$MAKE" == "x" ]; then
       
    28     NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
       
    29     let NCPU=$NCPU+1
       
    30     MAKE="make -j$NCPU"
       
    31 fi
       
    32 
       
    33 BUILDBOTDIR="nacl-buildbot"
       
    34 PARENTDIR="$PWD"
       
    35 
       
    36 set -e
       
    37 set -x
       
    38 rm -f $TARBALL
       
    39 rm -rf $BUILDBOTDIR
       
    40 mkdir -p $BUILDBOTDIR
       
    41 pushd $BUILDBOTDIR
       
    42 
       
    43 # !!! FIXME: ccache?
       
    44 export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
       
    45 export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
       
    46 export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
       
    47 export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
       
    48 export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
       
    49 
       
    50 ../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed
       
    51 $MAKE
       
    52 $MAKE install
       
    53 # Fix up a few things to a real install path on a real Raspberry Pi...
       
    54 perl -w -pi -e "s#$PWD/nacl-sdl2-installed#/usr/local#g;" ./nacl-sdl2-installed/lib/libSDL2.la ./nacl-sdl2-installed/lib/pkgconfig/sdl2.pc ./nacl-sdl2-installed/bin/sdl2-config
       
    55 mkdir -p ./usr
       
    56 mv ./nacl-sdl2-installed ./usr/local
       
    57 
       
    58 popd
       
    59 tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
       
    60 rm -rf $BUILDBOTDIR
       
    61 
       
    62 set +x
       
    63 echo "All done. Final installable is in $TARBALL ...";
       
    64