-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-port.sh
executable file
·51 lines (37 loc) · 1.25 KB
/
build-port.sh
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
#!/usr/bin/env bash
# Build script to integrate Qortal plugin into wireshark FreeBSD port
# To be run as root in /usr/ports/net/wireshark
if [ "${UID}" != "0" -o "${PWD}" != "/usr/ports/net/wireshark" ]; then
echo "Must be run as root in /usr/ports/net/wireshark"
exit 1
fi
# SRC is directory containing this script, cmake files and packet-qortal.c
SRC=$(dirname $(realpath "$0"))
port_version=$( perl -n -e 'print $1 if m/^\s*PORTVERSION\W+(\S+)/' < Makefile )
DST=work/wireshark-${port_version}
DST_QORTAL=${DST}/plugins/epan/qortal
set -e
make clean
if fgrep --silent qortal pkg-plist; then
:
else
echo Patching pkg-plist to include plugin
perl -p -i -e 'print "$1qortal.so\n" if m|^(lib/wireshark/plugins/.*?/epan/)gryphon.so|' pkg-plist
fi
if [ -d "/tmp/wireshark-build" ]; then
echo Reusing partial build from /tmp
cp -a /tmp/wireshark-build work
else
echo Creating partial build in /tmp
make extract
cp ${SRC}/CMakeListsCustom.txt ${DST}/
mkdir -p ${DST_QORTAL}
cp ${SRC}/CMakeLists.txt ${DST_QORTAL}/
echo 'FORCE COMPILE ERROR' > ${DST_QORTAL}/packet-qortal.c
make build || true
echo Saving partial build into /tmp
ln -sf ${SRC}/packet-qortal.c ${DST_QORTAL}/packet-qortal.c
cp -a work /tmp/wireshark-build
fi
echo Building...
make build