summaryrefslogtreecommitdiff
path: root/opt/nmap/MAKEPKG
blob: f08067e4efb82058311702b354b8c06bb7f00271 (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
67
68
#!/bin/mkpkg
# description: Network exploration tool and security scanner
# url: https://nmap.org

name=nmap
version=7.991
release=1
depends=(libpcap pcre2 libressl libssh2 lua zlib)
capabilities=(
    /usr/bin/nmap:cap_net_raw,cap_net_admin,cap_net_bind_service+eip
)
source=(https://nmap.org/dist/$name-$version.tar.bz2)

sha256sums=(
    "a5d507f29437bef3bedd4771ff9aaa8fc1c2a109ddba1f5b1cf12027456929be"
)
patch() {
    cd $name-$version

    # --- LibreSSL compatibility (from Gentoo libressl overlay) ---

    # Enable opaque struct codepaths for LibreSSL >= 3.5.0
    # Upstream guards these with '&& !defined LIBRESSL_VERSION_NUMBER'
    # but LibreSSL has had opaque structs since 2.x
    for f in nse_ssl_cert.cc nse_openssl.cc ncat/ncat_ssl.c nping/Crypto.cc; do
        sed -i 's/&& !defined LIBRESSL_VERSION_NUMBER//' "$f"
    done

    # EC_GROUP_method_of() removed in LibreSSL >= 4.0
    # Explicit curves are rare in X.509 (RFC 5480); default to prime field
    sed -i 's/EC_METHOD_get_field_type(EC_GROUP_method_of(group))/NID_X9_62_prime_field/' \
        nse_ssl_cert.cc
    sed -i 's/ac_cv_dnet_linux_pf_packet=no/ac_cv_dnet_linux_pf_packet=yes/' \
        libdnet-stripped/configure

}

build() {
    cd $name-$version

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

    make
    make DESTDIR=$PKG install

    rm -f $PKG/usr/share/man/man1/ncat.1
}

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

# vim: filetype=sh