Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -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=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 7 | file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba" |
| 8 | |
| 9 | PV = "1.60-20181103+git${SRCPV}" |
| 10 | SRCREV = "0eebece8c964e3cfa8a018f42b2e7e751a7009a0" |
| 11 | SRC_URI = "git://git.code.sf.net/p/net-tools/code;protocol=https \ |
| 12 | file://net-tools-config.h \ |
| 13 | file://net-tools-config.make \ |
| 14 | file://Add_missing_headers.patch \ |
| 15 | file://Bug_443075-ifconfig.c-pointtopoint_spelling.patch \ |
| 16 | file://Bug_541172-netstat.c-exit-codes.patch \ |
| 17 | " |
| 18 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 19 | S = "${WORKDIR}/git" |
| 20 | |
| 21 | inherit gettext |
| 22 | |
| 23 | # The Makefile is lame, no parallel build |
| 24 | PARALLEL_MAKE = "" |
| 25 | |
| 26 | PACKAGECONFIG ??= "hostname arp serial plip" |
| 27 | PACKAGECONFIG[hostname] = "" |
| 28 | PACKAGECONFIG[arp] = "" |
| 29 | PACKAGECONFIG[serial] = "" |
| 30 | PACKAGECONFIG[plip] = "" |
| 31 | |
| 32 | do_configure() { |
| 33 | # net-tools has its own config mechanism requiring "make config" |
| 34 | # we pre-generate desired options and copy to source directory instead |
| 35 | cp ${WORKDIR}/net-tools-config.h ${S}/config.h |
| 36 | cp ${WORKDIR}/net-tools-config.make ${S}/config.make |
| 37 | |
| 38 | if [ "${USE_NLS}" = "no" ]; then |
| 39 | sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make |
| 40 | fi |
| 41 | |
| 42 | if ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'true', 'false', d)} ; then |
| 43 | echo "#define HAVE_HOSTNAME_TOOLS 1" >> ${S}/config.h |
| 44 | echo "#define HAVE_HOSTNAME_SYMLINKS 1" >> ${S}/config.h |
| 45 | echo "HAVE_HOSTNAME_TOOLS=1" >> ${S}/config.make |
| 46 | echo "HAVE_HOSTNAME_SYMLINKS=1" >> ${S}/config.make |
| 47 | fi |
| 48 | if ${@bb.utils.contains('PACKAGECONFIG', 'arp', 'true', 'false', d)} ; then |
| 49 | echo "#define HAVE_ARP_TOOLS 1" >> ${S}/config.h |
| 50 | echo "HAVE_ARP_TOOLS=1" >> ${S}/config.make |
| 51 | fi |
| 52 | if ${@bb.utils.contains('PACKAGECONFIG', 'serial', 'true', 'false', d)} ; then |
| 53 | echo "#define HAVE_SERIAL_TOOLS 1" >> ${S}/config.h |
| 54 | echo "HAVE_SERIAL_TOOLS=1" >> ${S}/config.make |
| 55 | fi |
| 56 | if ${@bb.utils.contains('PACKAGECONFIG', 'plip', 'true', 'false', d)} ; then |
| 57 | echo "#define HAVE_PLIP_TOOLS 1" >> ${S}/config.h |
| 58 | echo "HAVE_PLIP_TOOLS=1" >> ${S}/config.make |
| 59 | fi |
| 60 | } |
| 61 | |
| 62 | do_compile() { |
| 63 | # net-tools use COPTS/LOPTS to allow adding custom options |
| 64 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" |
| 65 | } |
| 66 | |
| 67 | do_install() { |
| 68 | # We don't need COPTS or LOPTS, but let's be consistent. |
| 69 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" BASEDIR=${D} INSTALLNLSDIR=${D}${datadir}/locale mandir=${mandir} install |
| 70 | |
| 71 | if [ "${base_bindir}" != "/bin" ]; then |
| 72 | mkdir -p ${D}/${base_bindir} |
| 73 | mv ${D}/bin/* ${D}/${base_bindir}/ |
| 74 | rmdir ${D}/bin |
| 75 | fi |
| 76 | if [ "${base_sbindir}" != "/sbin" ]; then |
| 77 | mkdir ${D}/${base_sbindir} |
| 78 | mv ${D}/sbin/* ${D}/${base_sbindir}/ |
| 79 | rmdir ${D}/sbin |
| 80 | fi |
| 81 | } |
| 82 | |
| 83 | inherit update-alternatives |
| 84 | |
| 85 | base_sbindir_progs = "ipmaddr iptunnel mii-tool nameif \ |
| 86 | ${@bb.utils.contains('PACKAGECONFIG', 'arp', 'arp rarp', '', d)} \ |
| 87 | ${@bb.utils.contains('PACKAGECONFIG', 'plip', 'plipconfig', '', d)} \ |
| 88 | ${@bb.utils.contains('PACKAGECONFIG', 'serial', 'slattach', '', d)} \ |
| 89 | " |
| 90 | base_bindir_progs = "ifconfig netstat route \ |
| 91 | ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'dnsdomainname domainname hostname nisdomainname ypdomainname', '', d)} \ |
| 92 | " |
| 93 | |
| 94 | ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}" |
| 95 | ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'hostname.1 dnsdomainname.1', '', d)}" |
| 96 | ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" |
| 97 | ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1" |
| 98 | ALTERNATIVE_PRIORITY[hostname.1] = "10" |
| 99 | |
| 100 | python __anonymous() { |
| 101 | for prog in d.getVar('base_sbindir_progs').split(): |
| 102 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog)) |
| 103 | for prog in d.getVar('base_bindir_progs').split(): |
| 104 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) |
| 105 | } |
| 106 | ALTERNATIVE_PRIORITY = "100" |
| 107 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 108 | NETTOOLS_PACKAGES = "${PN}-mii-tool" |
| 109 | NETTOOLS_PACKAGES_class-native = "" |
| 110 | |
| 111 | PACKAGE_BEFORE_PN = "${NETTOOLS_PACKAGES}" |
| 112 | RDEPENDS_${PN} += "${NETTOOLS_PACKAGES}" |
| 113 | |
| 114 | FILES_${PN}-mii-tool = "${base_sbindir}/mii-tool" |
| 115 | |
| 116 | ALTERNATIVE_${PN}_remove = "mii-tool" |
| 117 | |
| 118 | ALTERNATIVE_${PN}-mii-tool = "mii-tool" |
| 119 | ALTERNATIVE_TARGET[mii-tool] = "${base_sbindir}/mii-tool" |
| 120 | ALTERNATIVE_LINK_NAME[mii-tool] = "${base_sbindir}/mii-tool" |
| 121 | |
| 122 | BBCLASSEXTEND = "native nativesdk" |