blob: 33304297ec4df975e3445d2a07b00bc5b42d8d6d [file] [log] [blame]
Andrew Geissler635e0e42020-08-21 15:58:33 -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"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00005LICENSE = "GPL-2.0-or-later"
Andrew Geissler635e0e42020-08-21 15:58:33 -05006LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
7 file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba"
8
Andrew Geissler90fd73c2021-03-05 15:25:55 -06009SRCREV = "80d7b95067f1f22fece9537dea6dff53081f4886"
Andrew Geissler595f6302022-01-24 19:11:47 +000010SRC_URI = "git://git.code.sf.net/p/net-tools/code;protocol=https;branch=master \
Andrew Geissler635e0e42020-08-21 15:58:33 -050011 file://net-tools-config.h \
12 file://net-tools-config.make \
13 file://Add_missing_headers.patch \
Andrew Geissler635e0e42020-08-21 15:58:33 -050014"
15
Andrew Geissler635e0e42020-08-21 15:58:33 -050016S = "${WORKDIR}/git"
17
18inherit gettext
19
20# The Makefile is lame, no parallel build
21PARALLEL_MAKE = ""
22
23PACKAGECONFIG ??= "hostname arp serial plip"
24PACKAGECONFIG[hostname] = ""
25PACKAGECONFIG[arp] = ""
26PACKAGECONFIG[serial] = ""
27PACKAGECONFIG[plip] = ""
Andrew Geissler90fd73c2021-03-05 15:25:55 -060028PACKAGECONFIG[slattach] = ""
29PACKAGECONFIG[plipconfig] = ""
Andrew Geissler635e0e42020-08-21 15:58:33 -050030
31do_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
61do_compile() {
62 # net-tools use COPTS/LOPTS to allow adding custom options
63 oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS"
64}
65
66do_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
82inherit update-alternatives
83
84base_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"
89base_bindir_progs = "ifconfig netstat route \
90 ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'dnsdomainname domainname hostname nisdomainname ypdomainname', '', d)} \
91"
92
Patrick Williams213cb262021-08-07 19:21:33 -050093ALTERNATIVE:${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
94ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'hostname.1 dnsdomainname.1', '', d)}"
Andrew Geissler635e0e42020-08-21 15:58:33 -050095ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
96ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
97ALTERNATIVE_PRIORITY[hostname.1] = "10"
98
99python __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}
105ALTERNATIVE_PRIORITY = "100"
106
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600107NETTOOLS_PACKAGES = "${PN}-mii-tool"
Patrick Williams213cb262021-08-07 19:21:33 -0500108NETTOOLS_PACKAGES:class-native = ""
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600109
110PACKAGE_BEFORE_PN = "${NETTOOLS_PACKAGES}"
Patrick Williams213cb262021-08-07 19:21:33 -0500111RDEPENDS:${PN} += "${NETTOOLS_PACKAGES}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600112
Patrick Williams213cb262021-08-07 19:21:33 -0500113FILES:${PN}-mii-tool = "${base_sbindir}/mii-tool"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600114
Patrick Williams213cb262021-08-07 19:21:33 -0500115ALTERNATIVE:${PN}:remove = "mii-tool"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600116
Patrick Williams213cb262021-08-07 19:21:33 -0500117ALTERNATIVE:${PN}-mii-tool = "mii-tool"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600118ALTERNATIVE_TARGET[mii-tool] = "${base_sbindir}/mii-tool"
119ALTERNATIVE_LINK_NAME[mii-tool] = "${base_sbindir}/mii-tool"
120
Andrew Geissler90fd73c2021-03-05 15:25:55 -0600121BBCLASSEXTEND = "native nativesdk"