blob: e163a6948a6dc39827fe85bb55ce9b94792f26d8 [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"
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
7 file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba"
8
9PV = "1.60-20181103+git${SRCPV}"
10SRCREV = "0eebece8c964e3cfa8a018f42b2e7e751a7009a0"
11SRC_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 Geissler635e0e42020-08-21 15:58:33 -050019S = "${WORKDIR}/git"
20
21inherit gettext
22
23# The Makefile is lame, no parallel build
24PARALLEL_MAKE = ""
25
26PACKAGECONFIG ??= "hostname arp serial plip"
27PACKAGECONFIG[hostname] = ""
28PACKAGECONFIG[arp] = ""
29PACKAGECONFIG[serial] = ""
30PACKAGECONFIG[plip] = ""
31
32do_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
62do_compile() {
63 # net-tools use COPTS/LOPTS to allow adding custom options
64 oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS"
65}
66
67do_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
83inherit update-alternatives
84
85base_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"
90base_bindir_progs = "ifconfig netstat route \
91 ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'dnsdomainname domainname hostname nisdomainname ypdomainname', '', d)} \
92"
93
94ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
95ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'hostname.1 dnsdomainname.1', '', d)}"
96ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
97ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
98ALTERNATIVE_PRIORITY[hostname.1] = "10"
99
100python __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}
106ALTERNATIVE_PRIORITY = "100"
107
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600108NETTOOLS_PACKAGES = "${PN}-mii-tool"
109NETTOOLS_PACKAGES_class-native = ""
110
111PACKAGE_BEFORE_PN = "${NETTOOLS_PACKAGES}"
112RDEPENDS_${PN} += "${NETTOOLS_PACKAGES}"
113
114FILES_${PN}-mii-tool = "${base_sbindir}/mii-tool"
115
116ALTERNATIVE_${PN}_remove = "mii-tool"
117
118ALTERNATIVE_${PN}-mii-tool = "mii-tool"
119ALTERNATIVE_TARGET[mii-tool] = "${base_sbindir}/mii-tool"
120ALTERNATIVE_LINK_NAME[mii-tool] = "${base_sbindir}/mii-tool"
121
122BBCLASSEXTEND = "native nativesdk"