1*4882a593SmuzhiyunSECTION = "console/network"
2*4882a593SmuzhiyunSUMMARY = "Internet Software Consortium DHCP Relay Agent"
3*4882a593SmuzhiyunDESCRIPTION = "A DHCP relay agent passes DHCP requests from one \
4*4882a593SmuzhiyunLAN to another, so that a DHCP server is not needed on every LAN."
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunHOMEPAGE = "http://www.isc.org/"
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunLICENSE = "MPL-2.0"
9*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://LICENSE;md5=c463f4afde26d9eb60f14f50aeb85f8f"
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunDEPENDS = "openssl libcap zlib"
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunSRC_URI = "https://downloads.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
14*4882a593Smuzhiyun           file://default-relay \
15*4882a593Smuzhiyun           file://init-relay \
16*4882a593Smuzhiyun           file://dhcrelay.service \
17*4882a593Smuzhiyun           file://0001-Makefile.am-only-build-dhcrelay.patch \
18*4882a593Smuzhiyun           file://0002-bind-Makefile.in-disable-backtrace.patch \
19*4882a593Smuzhiyun           file://0003-bind-Makefile.in-regenerate-configure.patch \
20*4882a593Smuzhiyun           file://CVE-2022-2928.patch \
21*4882a593Smuzhiyun           file://CVE-2022-2929.patch \
22*4882a593Smuzhiyun           "
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunSRC_URI[sha256sum] = "0e3ec6b4c2a05ec0148874bcd999a66d05518378d77421f607fb0bc9d0135818"
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunUPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/"
27*4882a593SmuzhiyunUPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunS = "${WORKDIR}/dhcp-${PV}"
30*4882a593Smuzhiyun
31*4882a593Smuzhiyuninherit autotools-brokensep systemd pkgconfig
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "dhcrelay.service"
34*4882a593SmuzhiyunSYSTEMD_AUTO_ENABLE:${PN} = "disable"
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunCFLAGS += "-D_GNU_SOURCE -fcommon"
37*4882a593SmuzhiyunLDFLAGS:append = " -pthread"
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunEXTRA_OECONF = "--enable-paranoia \
40*4882a593Smuzhiyun                --disable-static \
41*4882a593Smuzhiyun                --enable-libtool \
42*4882a593Smuzhiyun                --with-randomdev=/dev/random \
43*4882a593Smuzhiyun               "
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun# Enable shared libs per dhcp README
46*4882a593Smuzhiyundo_configure:prepend () {
47*4882a593Smuzhiyun    cp configure.ac+lt configure.ac
48*4882a593Smuzhiyun}
49*4882a593Smuzhiyun
50*4882a593Smuzhiyundo_install:append () {
51*4882a593Smuzhiyun    install -Dm 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
54*4882a593Smuzhiyun        install -d ${D}${systemd_unitdir}/system
55*4882a593Smuzhiyun        install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
56*4882a593Smuzhiyun        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
57*4882a593Smuzhiyun        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
58*4882a593Smuzhiyun    else
59*4882a593Smuzhiyun        install -d ${D}${sysconfdir}/init.d
60*4882a593Smuzhiyun        install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
61*4882a593Smuzhiyun    fi
62*4882a593Smuzhiyun}
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunPARALLEL_MAKE = ""
65