build-scripts/nacl-buildbot.sh
author Sam Lantinga
Tue, 10 Jan 2017 08:54:33 -0800
changeset 10806 36f40b8cc979
parent 10593 9cfaba7f1d66
permissions -rwxr-xr-x
Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11

Mark Callow

The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile:

- Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can
say to use the OpenGL ES driver & EGL rather than the Open GL
driver. (For bug #2570)
- Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum
OpenGL ES version supported by the OpenGL driver (for bug #3145)
- Modifies the test that determines whether to use the OpenGL
driver or the real OpenGL ES driver to take into account the
hint, the requested and supported ES version and whether ES 1.X
is being requested. (For bug #2570 & bug #3145)
- Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds
the test to the VisualC projects.

With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
     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