build (861B)
1 #!/bin/sh 2 # autopkgtest check: Builds a small application against libmicrohttpd, checking 3 # if it compiles, links and runs successfully. 4 # Author: Martin Pitt <mpitt@debian.org> 5 6 set -e 7 8 if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then 9 CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- 10 else 11 CROSS_COMPILE= 12 fi 13 14 WORKDIR=$(mktemp -d) 15 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM 16 cd $WORKDIR 17 cat <<EOF > build_test.c 18 #include <microhttpd.h> 19 int main(int argc, char** argv) { 20 struct MHD_Daemon *d; 21 d = MHD_start_daemon (MHD_USE_DEBUG, 1234, NULL, NULL, NULL, "<html />", MHD_OPTION_END); 22 if (d != NULL) 23 MHD_stop_daemon (d); 24 return 0; 25 } 26 EOF 27 ${CROSS_COMPILE}gcc `${CROSS_COMPILE}pkg-config --cflags libmicrohttpd` -o build_test build_test.c `${CROSS_COMPILE}pkg-config --libs libmicrohttpd` 28 echo "build: OK" 29 [ -x build_test ] 30 ./build_test 31 echo "run: OK"