blob: de4a71597146ce48b0efa7a8ef81cc94085fc1a9 [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
Andrew Geissler90fd73c2021-03-05 15:25:55 -06009SRCREV = "80d7b95067f1f22fece9537dea6dff53081f4886"
Andrew Geissler635e0e42020-08-21 15:58:33 -050010SRC_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 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
93ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
94ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'hostname.1 dnsdomainname.1', '', d)}"
95ALTERNATIVE_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"
108NETTOOLS_PACKAGES_class-native = ""
109
110PACKAGE_BEFORE_PN = "${NETTOOLS_PACKAGES}"
111RDEPENDS_${PN} += "${NETTOOLS_PACKAGES}"
112
113FILES_${PN}-mii-tool = "${base_sbindir}/mii-tool"
114
115ALTERNATIVE_${PN}_remove = "mii-tool"
116
117ALTERNATIVE_${PN}-mii-tool = "mii-tool"
118ALTERNATIVE_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"