blob: a4e3285cdb6cb074c503cef4dbbc2410e3da6bda [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 \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050020 "
21
22# for this package we're mostly interested in tracking debian patches,
23# and not in the upstream version where all development has effectively stopped
24UPSTREAM_CHECK_REGEX = "(?P<pver>((\d+\.*)+)-((\d+\.*)+))\.(diff|debian\.tar)\.(gz|xz)"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025
26S = "${WORKDIR}/net-tools-1.60"
27
28SRC_URI[tarball.md5sum] = "ecaf37acb5b5daff4bdda77785fd916d"
29SRC_URI[tarball.sha256sum] = "ec67967cf7b1a3a3828a84762fbc013ac50ee5dc9aa3095d5c591f302c2de0f5"
30
31SRC_URI[patch.md5sum] = "ea3592f49ac8380962bc4d9b66c7e7e9"
32SRC_URI[patch.sha256sum] = "aeeeafaff68866a446f01bb639d4e0146a60af34dcd20e31a3e46585022fc76c"
33
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050034# the package is taken from snapshots.debian.org; that source is static and goes stale
35# so we check the latest upstream from a directory that does get updated
36UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/net-tools/"
37
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038inherit gettext
39
Brad Bishopd7bf8c12018-02-25 22:55:05 -050040do_patch[depends] += "quilt-native:do_populate_sysroot"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050041
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042# The Makefile is lame, no parallel build
43PARALLEL_MAKE = ""
44
45# Unlike other Debian packages, net-tools *.diff.gz contains another series of
46# patches maintained by quilt. So manually apply them before applying other local
47# patches. Also remove all temp files before leaving, because do_patch() will pop
48# up all previously applied patches in the start
49nettools_do_patch() {
50 cd ${S}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051 # it's important that we only pop the existing patches when they've
52 # been applied, otherwise quilt will climb the directory tree
53 # and reverse out some completely different set of patches
54 if [ -d ${S}/patches ]; then
55 # whilst this is the default directory, doing it like this
56 # defeats the directory climbing that quilt will otherwise
57 # do; note the directory must exist to defeat this, hence
58 # the test inside which we operate
59 QUILT_PATCHES=${S}/patches quilt pop -a
60 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 if [ -d ${S}/.pc-nettools ]; then
62 rm -rf ${S}/.pc
63 mv ${S}/.pc-nettools ${S}/.pc
64 QUILT_PATCHES=${S}/debian/patches quilt pop -a
65 rm -rf ${S}/.pc ${S}/debian
66 fi
67 patch -p1 < ${WORKDIR}/${BPN}_${PV}.diff
68 QUILT_PATCHES=${S}/debian/patches quilt push -a
69 mv ${S}/.pc ${S}/.pc-nettools
70}
71
72do_unpack[cleandirs] += "${S}"
73
74# We invoke base do_patch at end, to incorporate any local patch
75python do_patch() {
76 bb.build.exec_func('nettools_do_patch', d)
77 bb.build.exec_func('patch_do_patch', d)
78}
79
80do_configure() {
81 # net-tools has its own config mechanism requiring "make config"
82 # we pre-generate desired options and copy to source directory instead
83 cp ${WORKDIR}/net-tools-config.h ${S}/config.h
84 cp ${WORKDIR}/net-tools-config.make ${S}/config.make
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085
86 if [ "${USE_NLS}" = "no" ]; then
87 sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make
88 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089}
90
91do_compile() {
92 # net-tools use COPTS/LOPTS to allow adding custom options
Brad Bishopd7bf8c12018-02-25 22:55:05 -050093 oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094}
95
96do_install() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050097 # We don't need COPTS or LOPTS, but let's be consistent.
98 oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" 'BASEDIR=${D}' install
Brad Bishop6e60e8b2018-02-01 10:27:11 -050099
100 if [ "${base_bindir}" != "/bin" ]; then
101 mkdir -p ${D}/${base_bindir}
102 mv ${D}/bin/* ${D}/${base_bindir}/
103 rmdir ${D}/bin
104 fi
105 if [ "${base_sbindir}" != "/sbin" ]; then
106 mkdir ${D}/${base_sbindir}
107 mv ${D}/sbin/* ${D}/${base_sbindir}/
108 rmdir ${D}/sbin
109 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110}
111
112inherit update-alternatives
113
114base_sbindir_progs = "arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach"
115base_bindir_progs = "dnsdomainname domainname hostname netstat nisdomainname ypdomainname"
116
117ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500118ALTERNATIVE_${PN}-doc += "hostname.1 dnsdomainname.1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600119ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500120ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600121ALTERNATIVE_PRIORITY[hostname.1] = "10"
122
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500124 for prog in d.getVar('base_sbindir_progs').split():
125 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
126 for prog in d.getVar('base_bindir_progs').split():
127 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500128}
129ALTERNATIVE_PRIORITY = "100"
130
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500131BBCLASSEXTEND = "native nativesdk"