File: build

package info (click to toggle)
libretls 3.8.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: ansic: 8,198; makefile: 350; sh: 111
file content (53 lines) | stat: -rw-r--r-- 918 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
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh -e

if [ -z "$AUTOPKGTEST_TMP" ]; then
  AUTOPKGTEST_TMP=$(mktemp -d)  
  trap "rm -rf $AUTOPKGTEST_TMP" 0
fi
cd $AUTOPKGTEST_TMP

CC="${DEB_HOST_GNU_TYPE:+$DEB_HOST_GNU_TYPE-}${CC:-gcc}"
PKG_CONFIG="${DEB_HOST_GNU_TYPE:+$DEB_HOST_GNU_TYPE-}pkg-config"

cat > test.c << 'END'
#include <stdlib.h>
#include <stdio.h>
#include <tls.h>

int main (int argc, char *argv[]) {
	int rc;

	struct tls_config *config = tls_config_new();
	if (!config) {
		perror("tls_config_new()");
		exit(1);
	}

	rc = tls_config_set_protocols(config, TLS_PROTOCOLS_ALL);
	if (rc != 0) {
		perror(tls_config_error(config));
		exit(1);
	}

	struct tls *tls = tls_client();
	if (!tls) {
		perror("tls_client()");
		exit(1);
	}

	rc = tls_configure(tls, config);
	if (rc != 0) {
		perror(tls_error(tls));
		exit(1);
	}

	exit(0);
}
END

$CC -o test test.c $("$PKG_CONFIG" --cflags --libs libtls)
echo "build: OK"

./test
echo "run: OK"