Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Basic networking tools" |
| 2 | DESCRIPTION = "A collection of programs that form the base set of the NET-3 networking distribution for the Linux operating system" |
| 3 | HOMEPAGE = "http://net-tools.berlios.de/" |
| 4 | BUGTRACKER = "http://bugs.debian.org/net-tools" |
| 5 | LICENSE = "GPLv2+" |
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \ |
| 7 | file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba" |
| 8 | |
| 9 | SRC_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 Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 14 | 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 18 | file://0001-lib-inet6.c-INET6_rresolve-various-fixes.patch \ |
| 19 | file://net-tools-fix-building-with-linux-4.8.patch \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 20 | " |
| 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 |
| 24 | UPSTREAM_CHECK_REGEX = "(?P<pver>((\d+\.*)+)-((\d+\.*)+))\.(diff|debian\.tar)\.(gz|xz)" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | |
| 26 | S = "${WORKDIR}/net-tools-1.60" |
| 27 | |
| 28 | SRC_URI[tarball.md5sum] = "ecaf37acb5b5daff4bdda77785fd916d" |
| 29 | SRC_URI[tarball.sha256sum] = "ec67967cf7b1a3a3828a84762fbc013ac50ee5dc9aa3095d5c591f302c2de0f5" |
| 30 | |
| 31 | SRC_URI[patch.md5sum] = "ea3592f49ac8380962bc4d9b66c7e7e9" |
| 32 | SRC_URI[patch.sha256sum] = "aeeeafaff68866a446f01bb639d4e0146a60af34dcd20e31a3e46585022fc76c" |
| 33 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 34 | # 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 |
| 36 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/net-tools/" |
| 37 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | inherit gettext |
| 39 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 40 | do_patch[depends] += "quilt-native:do_populate_sysroot" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 41 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | # The Makefile is lame, no parallel build |
| 43 | PARALLEL_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 |
| 49 | nettools_do_patch() { |
| 50 | cd ${S} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | # 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 61 | 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 | |
| 72 | do_unpack[cleandirs] += "${S}" |
| 73 | |
| 74 | # We invoke base do_patch at end, to incorporate any local patch |
| 75 | python do_patch() { |
| 76 | bb.build.exec_func('nettools_do_patch', d) |
| 77 | bb.build.exec_func('patch_do_patch', d) |
| 78 | } |
| 79 | |
| 80 | do_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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 85 | |
| 86 | if [ "${USE_NLS}" = "no" ]; then |
| 87 | sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make |
| 88 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | do_compile() { |
| 92 | # net-tools use COPTS/LOPTS to allow adding custom options |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 93 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | do_install() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 97 | # We don't need COPTS or LOPTS, but let's be consistent. |
| 98 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" 'BASEDIR=${D}' install |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 99 | |
| 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | inherit update-alternatives |
| 113 | |
| 114 | base_sbindir_progs = "arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach" |
| 115 | base_bindir_progs = "dnsdomainname domainname hostname netstat nisdomainname ypdomainname" |
| 116 | |
| 117 | ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 118 | ALTERNATIVE_${PN}-doc += "hostname.1 dnsdomainname.1" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 119 | ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 120 | ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 121 | ALTERNATIVE_PRIORITY[hostname.1] = "10" |
| 122 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 123 | python __anonymous() { |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 124 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | } |
| 129 | ALTERNATIVE_PRIORITY = "100" |
| 130 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 131 | BBCLASSEXTEND = "native nativesdk" |