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