File: build

package info (click to toggle)
libsdl3 3.4.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,312 kB
  • sloc: ansic: 428,899; objc: 13,036; xml: 9,581; cpp: 8,769; perl: 4,667; python: 3,538; sh: 813; makefile: 271; cs: 56
file content (66 lines) | stat: -rwxr-xr-x 1,485 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
# autopkgtest check: Build and run a program against SDL, to verify that the
# headers and pkg-config file are installed correctly
#
# Based on glib2.0's debian/tests/build
# (C) 2012 Canonical Ltd.
# (C) 2018 Simon McVittie
# Authors: Martin Pitt, Simon McVittie

set -eux

WORKDIR=$(mktemp -d)
trap 'rm -rf "$WORKDIR"' 0 INT QUIT ABRT PIPE TERM

if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
else
    CROSS_COMPILE=
fi

export SDL_AUDIO_DRIVER=dummy
export SDL_VIDEO_DRIVER=dummy

cd "$WORKDIR"
cat <<EOF > use-sdl.c
#undef NDEBUG
#include <assert.h>

#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>

int main(void)
{
    int compiled = SDL_VERSION;
    int linked = SDL_GetVersion();

    SDL_Log("Compiled against version %d\n", compiled);
    SDL_Log("Now running with version %d (%s)\n", linked, SDL_GetRevision());

    assert(SDL_VERSIONNUM_MAJOR(compiled) == 3);
    assert(SDL_VERSIONNUM_MAJOR(linked) == 3);

    return 0;
}
EOF

for cc in "${CROSS_COMPILE}gcc" clang; do
    cflags=

    case "$cc" in
    (clang)
        cflags="$cflags ${DEB_HOST_GNU_TYPE:+--target="${DEB_HOST_GNU_TYPE}"}"
        ;;
    esac

    exe="use-${cc}"

    # Deliberately word-splitting cflags, pkg-config output
    # shellcheck disable=SC2046,SC2086
    "$cc" $cflags -o "${exe}" use-sdl.c $("${CROSS_COMPILE}pkgconf" --cflags --libs sdl3)

    echo "build (with $cc): OK"
    [ -x "${exe}" ]
    ./"${exe}"
    echo "run (with $cc): OK"
done