summaryrefslogtreecommitdiff
path: root/doc/note/qemu/build-libpcap.txt
blob: b86dd1c7d9cca195b8d297bd6f5909086a9e402c (plain)
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
54
55
56
57
58
59
60
61
62
63
64

### Debian native
true \
  && PKGS_TO_ADD="curl ca-certificates gcc make libc6-dev flex bison" \
  && SUDO=sudo \
  && PKGINIT="$SUDO apt update" \
  && PKGADD="$SUDO apt install -y --no-install-recommends" \
  && HOST= \
  && true


### Alpine mingw cross
true \
  && PKGS_TO_ADD="binutils curl mingw-w64-gcc make tar flex bison" \
  && SUDO="/home/$USER/.local/bin/mysudo" \
  && PKGINIT=true \
  && PKGADD="$SUDO apk add" \
  && HOST=x86_64-w64-mingw32 \
  && true


## Generic
true \
  && PCAP_VERSION="1.10.4" \
  && CACHE_DIR="/var/tmp" \
  && WORKDIR="/tmp" \
  && INSTALL_ROOT="/usr/local" \
  && MAKE_JOBS=$(nproc) \
  && true


## Make
true \
  && PCAP_URL="https://github.com/the-tcpdump-group/libpcap/archive/refs/tags/libpcap-${PCAP_VERSION:?}.tar.gz" \
  && PCAP_SRCTGZ="${CACHE_DIR:?}/pcap-${PCAP_VERSION:?}.tgz" \
  && PCAP_BINTGZ="${PCAP_SRCTGZ%.*}-bin.tgz" \
  && if test -f "${PCAP_SRCTGZ:?}" ]; then true \
     && echo "[DEBUG] Already have \"${PCAP_SRCTGZ:?}\"" \
     ;else true \
     && echo curl -sSL "${PCAP_URL:?}" -o "${PCAP_SRCTGZ:?}" \
     && curl -sSL "${PCAP_URL:?}" -o "${PCAP_SRCTGZ:?}" \
     ;fi \
  && ( mkdir "${WORKDIR:?}/pcap-${PCAP_VERSION}" \
     &&   cd "${WORKDIR:?}/pcap-${PCAP_VERSION}" \
     && tar xf "${PCAP_SRCTGZ:?}" \
     && cd * \
     && ./configure --prefix=${WORKDIR:?}/pcap-"${PCAP_VERSION:?}"/out \
     && make clean \
     && make -j$(nproc) \
     && make install \
     && cd ../out \
     && rm bin/pcap-config lib/pkgconfig -rf \
     && tar cf "${PCAP_BINTGZ:?}" * \
     && printf '\n  Build pcap  Done\n\n' \
     ) \
     && true


### Install
true \
  && $SUDO mkdir -p "${INSTALL_ROOT:?}" \
  && $SUDO tar -C "${INSTALL_ROOT:?}" -xf "${PCAP_BINTGZ:?}" \
  && true