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