File: link-libraries

package info (click to toggle)
ndctl 82-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,460 kB
  • sloc: ansic: 42,027; sh: 3,974; makefile: 28
file content (40 lines) | stat: -rwxr-xr-x 910 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
#!/bin/sh

set -ex

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 > linkia.c
#include <daxctl/libdaxctl.h>
#include <ndctl/libndctl.h>
#include <cxl/libcxl.h>

int main()
{
    return daxctl_dev_get_id(0)
         + ndctl_dax_get_id(0)
         + cxl_memdev_get_pmem_size(0);
}
EOF

# Installed headers have been moved in the past, and the build system places
# binary libs in a weird place.
"${CROSS_COMPILE}gcc" -o linkia linkia.c \
	$("${CROSS_COMPILE}pkg-config" libcxl --cflags --libs) \
	$("${CROSS_COMPILE}pkg-config" libndctl --cflags --libs) \
	$("${CROSS_COMPILE}pkg-config" libdaxctl --cflags --libs)

# we can't run because dereferencing 0 will make the program segfault with a null pointer exception.
#./linkia
#echo "run: OK"

exit 0