blob: 6fa46904b3d062f28d9c9d849b83fff7816328ac [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001SUMMARY = "An IP address pool manager"
2DESCRIPTION = "IpPool is implemented as a separate server daemon \
3to allow any application to use its address pools. This makes it possible \
4to define address pools that are shared by PPP, L2TP, PPTP etc. It may be \
5useful in some VPN server setups. IpPool comes with a command line \
6management application, ippoolconfig to manage and query address pool \
7status. A pppd plugin is supplied which allows pppd to request IP \
8addresses from ippoold. \
9"
10HOMEPAGE = "http://www.openl2tp.org/"
11SECTION = "console/network"
12LICENSE = "GPLv2+"
13
14SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
15 file://runtest.sh \
16 file://ippool.service \
17 file://ippool_usl_timer.patch \
18 file://ippool_parallel_make_and_pic.patch \
19 file://ippool_init.d.patch \
20 file://always_syslog.patch \
21 file://makefile-add-ldflags.patch \
22 file://0001-usl_timer-Check-for-return-value-of-write-API.patch \
23 file://0001-Respect-flags-from-env.patch \
24 file://0001-read-returns-ssize_t.patch \
25 file://0002-Mark-first-element-of-a-string-as-null.patch \
26 file://0003-cli-Mark-return-of-strtol-as-long-int.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 file://0002-link-with-libtirpc.patch \
28 file://0003-musl-fixes.patch \
29 "
30
31LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"
32SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae"
33SRC_URI[sha256sum] = "d3eab7d6cad5da8ccc9d1e31d5303e27a39622c07bdb8fa3618eea314412075b"
34
35inherit systemd
36
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080037DEPENDS = "readline ppp ncurses gzip-native rpcsvc-proto-native libtirpc"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038RDEPENDS_${PN} = "rpcbind"
39
40EXTRA_OEMAKE = "CC='${CC}' AS='${AS}' LD='${LD}' AR='${AR}' NM='${NM}' STRIP='${STRIP}'"
41EXTRA_OEMAKE += "PPPD_VERSION=${PPPD_VERSION} SYS_LIBDIR=${libdir}"
42# enable self tests
43EXTRA_OEMAKE += "IPPOOL_TEST=y"
44
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045CPPFLAGS += "${SELECTED_OPTIMIZATION} -I${STAGING_INCDIR}/tirpc"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046
47SYSTEMD_SERVICE_${PN} = "ippool.service"
48SYSTEMD_AUTO_ENABLE = "disable"
49
50
51do_compile_prepend() {
52 # fix the CFLAGS= and CPPFLAGS= in main Makefile, to have the extra CFLAGS in env
53 sed -i -e "s/^CFLAGS=/CFLAGS+=/" ${S}/Makefile
54 sed -i -e "s/^CPPFLAGS=/CPPFLAGS+=/" ${S}/Makefile
55
56 sed -i -e "s:-I/usr/include/pppd:-I=/usr/include/pppd:" ${S}/pppd/Makefile
57
58}
59
60
61do_install() {
62 oe_runmake DESTDIR=${D} install
63
64 install -D -m 0755 ${S}/debian/init.d ${D}${sysconfdir}/init.d/ippoold
65 install -D -m 0644 ${WORKDIR}/ippool.service ${D}${systemd_system_unitdir}/ippool.service
66 sed -i -e 's:@SBINDIR@:${sbindir}:g' ${D}${systemd_system_unitdir}/ippool.service
67
68 # install self test
69 install -d ${D}/opt/${BPN}
70 install ${S}/test/all.tcl ${S}/test/ippool.test \
71 ${S}/test/test_procs.tcl ${D}/opt/${BPN}
72 install ${WORKDIR}/runtest.sh ${D}/opt/${BPN}
73 # fix the ../ippoolconfig in test_procs.tcl
74 sed -i -e "s:../ippoolconfig:ippoolconfig:" \
75 ${D}/opt/${BPN}/test_procs.tcl
76}
77
78
79PACKAGES =+ "${PN}-test"
80
81FILES_${PN} += "${libdir}/pppd/${PPPD_VERSION}/ippool.so"
82FILES_${PN}-dbg += "${libdir}/pppd/${PPPD_VERSION}/.debug/ippool.so"
83FILES_${PN}-test = "/opt/${BPN}"
84
85# needs tcl to run tests
86RDEPENDS_${PN}-test += "tcl ${BPN}"
87
88PPPD_VERSION="${@get_ppp_version(d)}"
89
90def get_ppp_version(d):
91 import re
92
93 pppd_plugin = d.expand('${STAGING_LIBDIR}/pppd')
94 if not os.path.isdir(pppd_plugin):
95 return None
96
97 bb.debug(1, "pppd plugin dir %s" % pppd_plugin)
98 r = re.compile("\d*\.\d*\.\d*")
99 for f in os.listdir(pppd_plugin):
100 if os.path.isdir(os.path.join(pppd_plugin, f)):
101 ma = r.match(f)
102 if ma:
103 bb.debug(1, "pppd version dir %s" % f)
104 return f
105 else:
106 bb.debug(1, "under pppd plugin dir %s" % f)
107
108 return None
109