1*4882a593SmuzhiyunSUMMARY = "Lightweight UPnP IGD daemon"
2*4882a593SmuzhiyunDESCRIPTION = "The miniUPnP daemon is an UPnP IGD (internet gateway device) \
3*4882a593Smuzhiyunwhich provide NAT traversal services to any UPnP enabled client on \
4*4882a593Smuzhiyunthe network."
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunSECTION = "networking"
7*4882a593SmuzhiyunLICENSE = "BSD-3-Clause"
8*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://LICENSE;md5=a1ed15843ce66639bcf9f109cf247870"
9*4882a593Smuzhiyun
10*4882a593Smuzhiyuninherit autotools gettext pkgconfig systemd
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunDEPENDS += "iptables net-tools util-linux libmnl libnetfilter-conntrack"
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunSRC_URI = "http://miniupnp.tuxfamily.org/files/download.php?file=${BP}.tar.gz;downloadfilename=${BP}.tar.gz \
15*4882a593Smuzhiyun           file://miniupnpd.service \
16*4882a593Smuzhiyun           file://0001-Add-OpenEmbedded-cross-compile-case.patch \
17*4882a593Smuzhiyun           "
18*4882a593SmuzhiyunSRC_URI[md5sum] = "340789edd49c113afe37834cc901a1e8"
19*4882a593SmuzhiyunSRC_URI[sha256sum] = "218fad7af31f3c22fb4c9db28a55a2a8b5067d41f5b38f52008a057a00d2206d"
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunIPV6 = "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '--ipv6', '', d)}"
22*4882a593Smuzhiyun
23*4882a593Smuzhiyundo_configure:prepend() {
24*4882a593Smuzhiyun   echo "${@d.getVar('DISTRO_VERSION')}" > ${S}/os.openembedded
25*4882a593Smuzhiyun}
26*4882a593Smuzhiyun
27*4882a593Smuzhiyundo_compile() {
28*4882a593Smuzhiyun    cd ${S}
29*4882a593Smuzhiyun    CONFIG_OPTIONS="${IPV6} --leasefile --vendorcfg" oe_runmake -f Makefile.linux config.h
30*4882a593Smuzhiyun    CONFIG_OPTIONS="${IPV6} --leasefile --vendorcfg" oe_runmake -f Makefile.linux
31*4882a593Smuzhiyun}
32*4882a593Smuzhiyun
33*4882a593Smuzhiyundo_install() {
34*4882a593Smuzhiyun    install -d ${D}/${sbindir}
35*4882a593Smuzhiyun    install ${S}/miniupnpd ${D}/${sbindir}
36*4882a593Smuzhiyun    install -d ${D}/${sysconfdir}/${BPN}
37*4882a593Smuzhiyun    install ${S}/netfilter/iptables_init.sh ${D}/${sysconfdir}/${BPN}
38*4882a593Smuzhiyun    install ${S}/netfilter/iptables_removeall.sh ${D}/${sysconfdir}/${BPN}
39*4882a593Smuzhiyun    install ${S}/netfilter/ip6tables_init.sh ${D}/${sysconfdir}/${BPN}
40*4882a593Smuzhiyun    install ${S}/netfilter/miniupnpd_functions.sh ${D}/${sysconfdir}/${BPN}
41*4882a593Smuzhiyun    install ${S}/netfilter/ip6tables_removeall.sh ${D}/${sysconfdir}/${BPN}
42*4882a593Smuzhiyun    install -m 0644 -b ${S}/miniupnpd.conf ${D}/${sysconfdir}/${BPN}
43*4882a593Smuzhiyun    install -d ${D}/${sysconfdir}/init.d
44*4882a593Smuzhiyun    install ${S}/linux/miniupnpd.init.d.script ${D}/${sysconfdir}/init.d/miniupnpd
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun    install -d ${D}${systemd_unitdir}/system
47*4882a593Smuzhiyun    install -m 0644 ${WORKDIR}/miniupnpd.service ${D}${systemd_unitdir}/system/
48*4882a593Smuzhiyun}
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "miniupnpd.service"
51