build-scripts/checker-buildbot.sh
author Sam Lantinga
Tue, 10 Jan 2017 08:54:33 -0800
changeset 10806 36f40b8cc979
parent 10652 c3fbfa229d71
child 11170 b5fe34e8401f
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.
icculus@8635
     1
#!/bin/bash
icculus@8635
     2
icculus@8635
     3
# This is a script used by some Buildbot buildslaves to push the project
icculus@8635
     4
#  through Clang's static analyzer and prepare the output to be uploaded
icculus@8635
     5
#  back to the buildmaster. You might find it useful too.
icculus@8635
     6
icculus@8644
     7
# Install Clang (you already have it on Mac OS X, apt-get install clang
icculus@8644
     8
#  on Ubuntu, etc),
icculus@8644
     9
# or download checker at http://clang-analyzer.llvm.org/ and unpack it in
icculus@8635
    10
#  /usr/local ... update CHECKERDIR as appropriate.
icculus@8635
    11
icculus@8635
    12
FINALDIR="$1"
icculus@8635
    13
icculus@10649
    14
CHECKERDIR="/usr/local/checker-279"
icculus@8635
    15
if [ ! -d "$CHECKERDIR" ]; then
icculus@8639
    16
    echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2
icculus@8639
    17
    CHECKERDIR="/usr/share/clang/scan-build"
icculus@8639
    18
fi
icculus@8639
    19
icculus@8639
    20
if [ ! -d "$CHECKERDIR" ]; then
icculus@8639
    21
    echo "$CHECKERDIR not found. Giving up." 1>&2
icculus@8635
    22
    exit 1
icculus@8635
    23
fi
icculus@8635
    24
icculus@8635
    25
if [ -z "$MAKE" ]; then
icculus@8635
    26
    OSTYPE=`uname -s`
icculus@8635
    27
    if [ "$OSTYPE" == "Linux" ]; then
icculus@8635
    28
        NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
icculus@8635
    29
        let NCPU=$NCPU+1
icculus@8635
    30
    elif [ "$OSTYPE" = "Darwin" ]; then
icculus@8635
    31
        NCPU=`sysctl -n hw.ncpu`
icculus@8635
    32
    elif [ "$OSTYPE" = "SunOS" ]; then
icculus@8635
    33
        NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
icculus@8635
    34
    else
icculus@8635
    35
        NCPU=1
icculus@8635
    36
    fi
icculus@8635
    37
icculus@8635
    38
    if [ -z "$NCPU" ]; then
icculus@8635
    39
        NCPU=1
icculus@8635
    40
    elif [ "$NCPU" = "0" ]; then
icculus@8635
    41
        NCPU=1
icculus@8635
    42
    fi
icculus@8635
    43
icculus@8635
    44
    MAKE="make -j$NCPU"
icculus@8635
    45
fi
icculus@8635
    46
icculus@8635
    47
echo "\$MAKE is '$MAKE'"
icculus@8635
    48
icculus@10652
    49
# Unset $MAKE so submakes don't use it.
icculus@10652
    50
MAKECOMMAND="$MAKE"
icculus@10652
    51
unset MAKE
icculus@10652
    52
icculus@8635
    53
set -x
icculus@8635
    54
set -e
icculus@8635
    55
icculus@8635
    56
cd `dirname "$0"`
icculus@8635
    57
cd ..
icculus@8635
    58
icculus@8635
    59
rm -rf checker-buildbot analysis
icculus@8635
    60
if [ ! -z "$FINALDIR" ]; then
icculus@8635
    61
    rm -rf "$FINALDIR"
icculus@8635
    62
fi
icculus@8635
    63
icculus@8635
    64
mkdir checker-buildbot
icculus@8635
    65
cd checker-buildbot
icculus@8644
    66
icculus@10652
    67
# We turn off deprecated declarations, because we don't care about these warnings during static analysis.
icculus@10652
    68
# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
icculus@10652
    69
icculus@8644
    70
# You might want to do this for CMake-backed builds instead...
icculus@10652
    71
PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" ..
icculus@8644
    72
icculus@8644
    73
# ...or run configure without the scan-build wrapper...
icculus@10652
    74
#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled
icculus@8644
    75
icculus@8639
    76
rm -rf analysis
icculus@10652
    77
PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECOMMAND
icculus@10649
    78
icculus@10649
    79
if [ `ls -A analysis |wc -l` == 0 ] ; then
icculus@10649
    80
    mkdir analysis/zarro
icculus@10649
    81
    echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
icculus@10649
    82
fi
icculus@10649
    83
icculus@8635
    84
mv analysis/* ../analysis
icculus@8635
    85
rmdir analysis   # Make sure this is empty.
icculus@8635
    86
cd ..
icculus@8635
    87
chmod -R a+r analysis
icculus@8635
    88
chmod -R go-w analysis
icculus@8635
    89
find analysis -type d -exec chmod a+x {} \;
icculus@8635
    90
if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
icculus@8635
    91
icculus@8635
    92
if [ ! -z "$FINALDIR" ]; then
icculus@8635
    93
    mv analysis "$FINALDIR"
icculus@8635
    94
else
icculus@8635
    95
    FINALDIR=analysis
icculus@8635
    96
fi
icculus@8635
    97
icculus@8635
    98
rm -rf checker-buildbot
icculus@8635
    99
icculus@8635
   100
echo "Done. Final output is in '$FINALDIR' ..."
icculus@8635
   101
icculus@8635
   102
# end of checker-buildbot.sh ...
icculus@8635
   103