2021-07-23 11:49:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
TEST_SOURCE=test.c
|
|
|
|
TEST_TARGET="${TEST_SOURCE/\.c/}"
|
|
|
|
|
|
|
|
CXXFLAGS="$(rpm --eval '%{build_cxxflags}')"
|
2021-11-09 15:26:56 +00:00
|
|
|
LDFLAGS="$(rpm --eval '%{build_ldflags}') -Wl,--no-as-needed"
|
2021-07-23 11:49:02 +00:00
|
|
|
PKGFLAGS="$(pkg-config libseccomp --cflags --libs)"
|
|
|
|
|
|
|
|
# build target using distribution-specific flags
|
|
|
|
gcc -Werror $CXXFLAGS $LDFLAGS $PKGFLAGS -o $TEST_TARGET $TEST_SOURCE
|
|
|
|
|
|
|
|
# test that target exists
|
|
|
|
test -f ./$TEST_TARGET
|
|
|
|
|
|
|
|
# test that target is executable
|
|
|
|
test -x ./$TEST_TARGET
|
|
|
|
|
|
|
|
# test that target runs successfully
|
|
|
|
./$TEST_TARGET
|