summaryrefslogtreecommitdiff
path: root/opt/ncat/MAKEPKG
blob: 69546293572e8ee2fb365be368669fff1926c0bf (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
65
66
#!/bin/mkpkg
# description: Feature-rich netcat from the Nmap project
# url: https://nmap.org/ncat

name=ncat
version=7.991
release=1
_srcname=nmap
depends=(libressl libpcap)
source=(https://nmap.org/dist/$_srcname-$version.tar.bz2)

sha256sums=(
    "a5d507f29437bef3bedd4771ff9aaa8fc1c2a109ddba1f5b1cf12027456929be"
)

patch() {
    cd $_srcname-$version
    
    # libdnet runtime detection fails in sandbox; force the right answer
    sed -i 's/ac_cv_dnet_linux_pf_packet=no/ac_cv_dnet_linux_pf_packet=yes/' \
        libdnet-stripped/configure
    
    # LibreSSL >= 3.5 has opaque structs; remove the guard that excludes it
    # (only ncat_ssl.c is relevant for ncat — the other files are nmap/nping)
    sed -i 's/&& !defined LIBRESSL_VERSION_NUMBER//' ncat/ncat_ssl.c
}

build() {
    cd $_srcname-$version

    ./configure \
        CC=${CC:-cc} CXX=${CXX:-c++} \
        --prefix=/usr \
        --without-nmap \
        --without-nping \
        --without-zenmap \
        --without-ndiff \
        --without-nmap-update \
        --with-openssl \
        --with-libpcap \
        --with-libpcre=included \
        --without-liblua \
        --without-libssh2

    # only build ncat and its dependencies
    make -C libnetutil
    make -C nbase
    make -C nsock/src
    make -C ncat

    install -d $PKG/usr/bin
    install -d $PKG/usr/share/man/man1
    install -m 755 ncat/ncat $PKG/usr/bin/ncat
    install -m 644 ncat/docs/ncat.1 $PKG/usr/share/man/man1/ncat.1
    ln -sf ncat $PKG/usr/bin/nc

    install -d $PKG/usr/share/ncat
    install -m 644 ncat/certs/ca-bundle.crt $PKG/usr/share/ncat/ca-bundle.crt
}

signify() {
    untrusted comment: public key
    RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}

# vim: filetype=sh