blob: 8bd30fc6d9bfebe0e0571230e79619a5a939f7a2 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Basic networking tools"
2DESCRIPTION = "A collection of programs that form the base set of the NET-3 networking distribution for the Linux operating system"
3HOMEPAGE = "http://net-tools.berlios.de/"
4BUGTRACKER = "http://bugs.debian.org/net-tools"
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
7 file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba"
8
9SRC_URI = "http://snapshot.debian.org/archive/debian/20050312T000000Z/pool/main/n/${BPN}/${BPN}_1.60.orig.tar.gz;name=tarball \
10 http://snapshot.debian.org/archive/debian//20150831T093342Z/pool/main/n/${BPN}/${BPN}_${PV}.diff.gz;apply=no;name=patch \
11 file://net-tools-config.h \
12 file://net-tools-config.make \
13 file://ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050014 file://musl-fixes.patch \
15 file://net-tools-1.60-sctp1.patch \
16 file://net-tools-1.60-sctp2-quiet.patch \
17 file://net-tools-1.60-sctp3-addrs.patch \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060018 file://0001-lib-inet6.c-INET6_rresolve-various-fixes.patch \
19 file://net-tools-fix-building-with-linux-4.8.patch \
Andrew Geisslerd25ed322020-06-27 00:28:28 -050020 file://0001-added-ull-prefix-to-unsigned-long-long-constants-to-.patch \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050021 "
22
23# for this package we're mostly interested in tracking debian patches,
24# and not in the upstream version where all development has effectively stopped
25UPSTREAM_CHECK_REGEX = "(?P<pver>((\d+\.*)+)-((\d+\.*)+))\.(diff|debian\.tar)\.(gz|xz)"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
27S = "${WORKDIR}/net-tools-1.60"
28
29SRC_URI[tarball.md5sum] = "ecaf37acb5b5daff4bdda77785fd916d"
30SRC_URI[tarball.sha256sum] = "ec67967cf7b1a3a3828a84762fbc013ac50ee5dc9aa3095d5c591f302c2de0f5"
31
32SRC_URI[patch.md5sum] = "ea3592f49ac8380962bc4d9b66c7e7e9"
33SRC_URI[patch.sha256sum] = "aeeeafaff68866a446f01bb639d4e0146a60af34dcd20e31a3e46585022fc76c"
34
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050035# the package is taken from snapshots.debian.org; that source is static and goes stale
36# so we check the latest upstream from a directory that does get updated
37UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/net-tools/"
38
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039inherit gettext
40
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041do_patch[depends] += "quilt-native:do_populate_sysroot"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050042
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043# The Makefile is lame, no parallel build
44PARALLEL_MAKE = ""
45
46# Unlike other Debian packages, net-tools *.diff.gz contains another series of
47# patches maintained by quilt. So manually apply them before applying other local
48# patches. Also remove all temp files before leaving, because do_patch() will pop
49# up all previously applied patches in the start
50nettools_do_patch() {
51 cd ${S}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080052 # it's important that we only pop the existing patches when they've
53 # been applied, otherwise quilt will climb the directory tree
54 # and reverse out some completely different set of patches
55 if [ -d ${S}/patches ]; then
56 # whilst this is the default directory, doing it like this
57 # defeats the directory climbing that quilt will otherwise
58 # do; note the directory must exist to defeat this, hence
59 # the test inside which we operate
60 QUILT_PATCHES=${S}/patches quilt pop -a
61 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062 if [ -d ${S}/.pc-nettools ]; then
63 rm -rf ${S}/.pc
64 mv ${S}/.pc-nettools ${S}/.pc
65 QUILT_PATCHES=${S}/debian/patches quilt pop -a
66 rm -rf ${S}/.pc ${S}/debian
67 fi
68 patch -p1 < ${WORKDIR}/${BPN}_${PV}.diff
69 QUILT_PATCHES=${S}/debian/patches quilt push -a
70 mv ${S}/.pc ${S}/.pc-nettools
71}
72
73do_unpack[cleandirs] += "${S}"
74
75# We invoke base do_patch at end, to incorporate any local patch
76python do_patch() {
77 bb.build.exec_func('nettools_do_patch', d)
78 bb.build.exec_func('patch_do_patch', d)
79}
80
81do_configure() {
82 # net-tools has its own config mechanism requiring "make config"
83 # we pre-generate desired options and copy to source directory instead
84 cp ${WORKDIR}/net-tools-config.h ${S}/config.h
85 cp ${WORKDIR}/net-tools-config.make ${S}/config.make
Brad Bishop6e60e8b2018-02-01 10:27:11 -050086
87 if [ "${USE_NLS}" = "no" ]; then
88 sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make
89 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090}
91
92do_compile() {
93 # net-tools use COPTS/LOPTS to allow adding custom options
Brad Bishopd7bf8c12018-02-25 22:55:05 -050094 oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050095}
96
97do_install() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050098 # We don't need COPTS or LOPTS, but let's be consistent.
Brad Bishop00e122a2019-10-05 11:10:57 -040099 oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" BASEDIR=${D} INSTALLNLSDIR=${D}${datadir}/locale mandir=${mandir} install
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500100
101 if [ "${base_bindir}" != "/bin" ]; then
102 mkdir -p ${D}/${base_bindir}
103 mv ${D}/bin/* ${D}/${base_bindir}/
104 rmdir ${D}/bin
105 fi
106 if [ "${base_sbindir}" != "/sbin" ]; then
107 mkdir ${D}/${base_sbindir}
108 mv ${D}/sbin/* ${D}/${base_sbindir}/
109 rmdir ${D}/sbin
110 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111}
112
113inherit update-alternatives
114
115base_sbindir_progs = "arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach"
116base_bindir_progs = "dnsdomainname domainname hostname netstat nisdomainname ypdomainname"
117
118ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500119ALTERNATIVE_${PN}-doc += "hostname.1 dnsdomainname.1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600120ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500121ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600122ALTERNATIVE_PRIORITY[hostname.1] = "10"
123
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500124python __anonymous() {
Brad Bishopa5c52ff2018-11-23 10:55:50 +1300125 for prog in d.getVar('base_sbindir_progs').split():
126 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
127 for prog in d.getVar('base_bindir_progs').split():
128 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129}
130ALTERNATIVE_PRIORITY = "100"
131
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500132BBCLASSEXTEND = "native nativesdk"