Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | SUMMARY = "An IP address pool manager" |
| 2 | DESCRIPTION = "IpPool is implemented as a separate server daemon \ |
| 3 | to allow any application to use its address pools. This makes it possible \ |
| 4 | to define address pools that are shared by PPP, L2TP, PPTP etc. It may be \ |
| 5 | useful in some VPN server setups. IpPool comes with a command line \ |
| 6 | management application, ippoolconfig to manage and query address pool \ |
| 7 | status. A pppd plugin is supplied which allows pppd to request IP \ |
| 8 | addresses from ippoold. \ |
| 9 | " |
| 10 | HOMEPAGE = "http://www.openl2tp.org/" |
| 11 | SECTION = "console/network" |
| 12 | LICENSE = "GPLv2+" |
| 13 | |
| 14 | SRC_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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 27 | file://0002-link-with-libtirpc.patch \ |
| 28 | file://0003-musl-fixes.patch \ |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 29 | file://strncpy-truncation.patch \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 30 | " |
| 31 | |
| 32 | LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f" |
| 33 | SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae" |
| 34 | SRC_URI[sha256sum] = "d3eab7d6cad5da8ccc9d1e31d5303e27a39622c07bdb8fa3618eea314412075b" |
| 35 | |
| 36 | inherit systemd |
| 37 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 38 | DEPENDS = "readline ppp ncurses gzip-native rpcsvc-proto-native libtirpc" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 39 | RDEPENDS:${PN} = "rpcbind" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 40 | |
| 41 | EXTRA_OEMAKE = "CC='${CC}' AS='${AS}' LD='${LD}' AR='${AR}' NM='${NM}' STRIP='${STRIP}'" |
| 42 | EXTRA_OEMAKE += "PPPD_VERSION=${PPPD_VERSION} SYS_LIBDIR=${libdir}" |
| 43 | # enable self tests |
| 44 | EXTRA_OEMAKE += "IPPOOL_TEST=y" |
| 45 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 46 | CPPFLAGS += "${SELECTED_OPTIMIZATION} -I${STAGING_INCDIR}/tirpc" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 47 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 48 | SYSTEMD_SERVICE:${PN} = "ippool.service" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 49 | SYSTEMD_AUTO_ENABLE = "disable" |
| 50 | |
| 51 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 52 | do_compile:prepend() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 53 | # fix the CFLAGS= and CPPFLAGS= in main Makefile, to have the extra CFLAGS in env |
| 54 | sed -i -e "s/^CFLAGS=/CFLAGS+=/" ${S}/Makefile |
| 55 | sed -i -e "s/^CPPFLAGS=/CPPFLAGS+=/" ${S}/Makefile |
| 56 | |
| 57 | sed -i -e "s:-I/usr/include/pppd:-I=/usr/include/pppd:" ${S}/pppd/Makefile |
| 58 | |
| 59 | } |
| 60 | |
| 61 | |
| 62 | do_install() { |
| 63 | oe_runmake DESTDIR=${D} install |
| 64 | |
| 65 | install -D -m 0755 ${S}/debian/init.d ${D}${sysconfdir}/init.d/ippoold |
| 66 | install -D -m 0644 ${WORKDIR}/ippool.service ${D}${systemd_system_unitdir}/ippool.service |
| 67 | sed -i -e 's:@SBINDIR@:${sbindir}:g' ${D}${systemd_system_unitdir}/ippool.service |
| 68 | |
| 69 | # install self test |
| 70 | install -d ${D}/opt/${BPN} |
| 71 | install ${S}/test/all.tcl ${S}/test/ippool.test \ |
| 72 | ${S}/test/test_procs.tcl ${D}/opt/${BPN} |
| 73 | install ${WORKDIR}/runtest.sh ${D}/opt/${BPN} |
| 74 | # fix the ../ippoolconfig in test_procs.tcl |
| 75 | sed -i -e "s:../ippoolconfig:ippoolconfig:" \ |
| 76 | ${D}/opt/${BPN}/test_procs.tcl |
| 77 | } |
| 78 | |
| 79 | |
| 80 | PACKAGES =+ "${PN}-test" |
| 81 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 82 | FILES:${PN} += "${libdir}/pppd/${PPPD_VERSION}/ippool.so" |
| 83 | FILES:${PN}-dbg += "${libdir}/pppd/${PPPD_VERSION}/.debug/ippool.so" |
| 84 | FILES:${PN}-test = "/opt/${BPN}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 85 | |
| 86 | # needs tcl to run tests |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 87 | RDEPENDS:${PN}-test += "tcl ${BPN}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 88 | |
| 89 | PPPD_VERSION="${@get_ppp_version(d)}" |
| 90 | |
| 91 | def get_ppp_version(d): |
| 92 | import re |
| 93 | |
| 94 | pppd_plugin = d.expand('${STAGING_LIBDIR}/pppd') |
| 95 | if not os.path.isdir(pppd_plugin): |
| 96 | return None |
| 97 | |
| 98 | bb.debug(1, "pppd plugin dir %s" % pppd_plugin) |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame^] | 99 | r = re.compile(r"\d*\.\d*\.\d*") |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 100 | for f in os.listdir(pppd_plugin): |
| 101 | if os.path.isdir(os.path.join(pppd_plugin, f)): |
| 102 | ma = r.match(f) |
| 103 | if ma: |
| 104 | bb.debug(1, "pppd version dir %s" % f) |
| 105 | return f |
| 106 | else: |
| 107 | bb.debug(1, "under pppd plugin dir %s" % f) |
| 108 | |
| 109 | return None |
| 110 | |