File: build

package info (click to toggle)
libproxy 0.5.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 728 kB
  • sloc: ansic: 3,455; sh: 228; python: 128; makefile: 37; cs: 18; perl: 6
file content (41 lines) | stat: -rwxr-xr-x 1,121 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# autopkgtest check: Builds a small application against libproxy, checking
# if it compiles, links and runs successfully.
# Author: Rafał Cieślak <rafalcieslak256@ubuntu.com>

set -eu

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

cd "$WORKDIR"

cat <<EOF > build_test.c
#include <proxy.h>
int main(int argc, char** argv) {
  pxProxyFactory *pf = px_proxy_factory_new();
  if (!pf) return 1;
  return 0;
}
EOF

arch_triplet="$("${CROSS_COMPILE}gcc" --print-multiarch)"
"${CROSS_COMPILE}gcc" -o build_test build_test.c -I/usr/include/glib-2.0 -I/usr/lib/"$arch_triplet"/glib-2.0/include -I/usr/include/libproxy -lproxy
echo "build (legacy): OK"
[ -x build_test ]
./build_test
echo "run: OK"

# Deliberately word-splitting, that's how pkg-config works:
# shellcheck disable=SC2046
"${CROSS_COMPILE}gcc" -o build_test2 build_test.c $("${CROSS_COMPILE}pkg-config" --cflags --libs libproxy-1.0)
echo "build (with pkg-config): OK"
[ -x build_test2 ]
./build_test2
echo "run: OK"