build-scripts/nacl-buildbot.sh
author Ryan C. Gordon <icculus@icculus.org>
Sun, 28 Jun 2020 17:45:07 -0400
changeset 13940 92ea0212b095
parent 10593 9cfaba7f1d66
permissions -rwxr-xr-x
stdinc: Let Clang static analysis see more C runtime functions.

For systems without strlcpy and strlcat, just declare them as if they exist;
the analyzer possibly still knows the details of these functions and can
utilize that in its analysis.

Most of this patch was from meyraud705 at gmail and Martin Gerhardy. Thanks!

Fixes Bugzilla #5163.
     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 # PLEASE NOTE that we have reports that SDL built with pepper_49 (current
     7 #  stable release as of November 10th, 2016) is broken. Please retest
     8 #  when something newer becomes stable and then decide if this was SDL's
     9 #  bug or NaCl's bug.  --ryan.
    10 export NACL_SDK_ROOT="/nacl_sdk/pepper_47"
    11 
    12 TARBALL="$1"
    13 if [ -z $1 ]; then
    14     TARBALL=sdl-nacl.tar.xz
    15 fi
    16 
    17 OSTYPE=`uname -s`
    18 if [ "$OSTYPE" != "Linux" ]; then
    19     # !!! FIXME
    20     echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
    21     exit 1
    22 fi
    23 
    24 if [ "x$MAKE" == "x" ]; then
    25     NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    26     let NCPU=$NCPU+1
    27     MAKE="make -j$NCPU"
    28 fi
    29 
    30 BUILDBOTDIR="nacl-buildbot"
    31 PARENTDIR="$PWD"
    32 
    33 set -e
    34 set -x
    35 rm -f $TARBALL
    36 rm -rf $BUILDBOTDIR
    37 mkdir -p $BUILDBOTDIR
    38 pushd $BUILDBOTDIR
    39 
    40 # !!! FIXME: ccache?
    41 export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
    42 export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
    43 export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
    44 export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
    45 export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
    46 
    47 ../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed
    48 $MAKE
    49 $MAKE install
    50 # Fix up a few things to a real install path
    51 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
    52 mkdir -p ./usr
    53 mv ./nacl-sdl2-installed ./usr/local
    54 
    55 popd
    56 tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
    57 rm -rf $BUILDBOTDIR
    58 
    59 set +x
    60 echo "All done. Final installable is in $TARBALL ...";
    61