Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | SUMMARY = "An open source implementation of the diameter protocol" |
| 2 | DESCRIPTION = "\ |
| 3 | freeDiameter is an open source Diameter protocol implementation \ |
| 4 | (RFC3588). It provides an extensible platform for deploying a \ |
| 5 | Diameter network for your Authentication, Authorization and \ |
| 6 | Accounting needs." |
| 7 | |
| 8 | HOMEPAGE = "http://www.freediameter.net" |
| 9 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 10 | DEPENDS = "flex bison cmake-native libgcrypt gnutls libidn lksctp-tools virtual/kernel bison-native" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 11 | |
| 12 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 13 | |
| 14 | fd_pkgname = "freeDiameter" |
| 15 | |
| 16 | SRC_URI = "\ |
| 17 | http://www.freediameter.net/hg/${fd_pkgname}/archive/${PV}.tar.gz;downloadfilename=${fd_pkgname}-${PV}.tar.gz \ |
| 18 | file://Replace-murmurhash-algorithm-with-Robert-Jenkin-s-ha.patch \ |
| 19 | file://freediameter.service \ |
| 20 | file://freediameter.init \ |
| 21 | ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://install_test.patch file://run-ptest file://pass-ptest-env.patch', '', d)} \ |
| 22 | file://freeDiameter.conf \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 23 | file://0001-libfdcore-sctp.c-update-the-old-sctp-api-check.patch \ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 24 | " |
| 25 | |
Andrew Geissler | c87764f | 2020-06-27 00:16:32 -0500 | [diff] [blame] | 26 | SRC_URI[sha256sum] = "7a537401bd110c606594b7c6be71b993f0ccc73ae151ad68040979286ba4e50e" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 27 | |
| 28 | S = "${WORKDIR}/${fd_pkgname}-${PV}" |
| 29 | |
Brad Bishop | 2d39a06 | 2019-10-28 08:33:36 -0400 | [diff] [blame] | 30 | LICENSE = "BSD-3-Clause" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 31 | LIC_FILES_CHKSUM = "file://LICENSE;md5=69bdc1d97648a2d35914563fcbbb361a" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 32 | |
| 33 | PTEST_PATH = "${libdir}/${fd_pkgname}/ptest" |
| 34 | |
| 35 | inherit cmake pkgconfig update-rc.d ptest systemd |
| 36 | |
| 37 | EXTRA_OECMAKE = " \ |
| 38 | -DDEFAULT_CONF_PATH:PATH=${sysconfdir}/${fd_pkgname} \ |
| 39 | -DBUILD_DBG_MONITOR:BOOL=ON \ |
| 40 | -DBUILD_TEST_APP:BOOL=ON \ |
| 41 | -DBUILD_TESTING:BOOL=ON \ |
| 42 | -DBUILD_APP_RADGW:BOOL=ON \ |
| 43 | -DBUILD_APP_REDIRECT:BOOL=ON \ |
| 44 | -DBUILD_TEST_ACCT:BOOL=ON \ |
| 45 | -DBUILD_TEST_NETEMUL:BOOL=ON \ |
| 46 | -DBUILD_TEST_RT_ANY:BOOL=ON \ |
| 47 | -DINSTALL_LIBRARY_SUFFIX:PATH=${baselib} \ |
| 48 | -DINSTALL_EXTENSIONS_SUFFIX:PATH=${baselib}/${fd_pkgname} \ |
| 49 | -DINSTALL_TEST_SUFFIX:PATH=${PTEST_PATH}-tests \ |
| 50 | -DCMAKE_SKIP_RPATH:BOOL=ON \ |
| 51 | " |
| 52 | # INSTALL_LIBRARY_SUFFIX is relative to CMAKE_INSTALL_PREFIX |
| 53 | # specify it on cmd line will fix the SET bug in CMakeList.txt |
| 54 | |
| 55 | # -DBUILD_APP_ACCT:BOOL=ON This needs POSTGRESQL support |
| 56 | |
| 57 | # -DBUILD_APP_DIAMEAP:BOOL=ON -DBUILD_APP_SIP:BOOL=ON -DBUILD_TEST_SIP:BOOL=ON |
| 58 | # These need MySQL support |
| 59 | |
| 60 | # -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support |
| 61 | |
| 62 | # -DALL_EXTENSIONS=ON will enable all |
| 63 | |
| 64 | FD_KEY ?="${BPN}.key" |
| 65 | FD_PEM ?= "${BPN}.pem" |
| 66 | FD_CA ?= "${BPN}.pem" |
| 67 | FD_DH_PEM ?= "${BPN}-dh.pem" |
| 68 | FD_HOSTNAME ?= "${MACHINE}" |
| 69 | FD_REALM ?= "openembedded.org" |
| 70 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 71 | do_install:append() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 72 | # install the sample configuration files |
| 73 | install -d -m 0755 ${D}${sysconfdir}/${fd_pkgname} |
| 74 | for i in ${S}/doc/*.conf.sample; do |
| 75 | install -m 0644 $i ${D}${sysconfdir}/${fd_pkgname}/ |
| 76 | done |
| 77 | mv ${D}${sysconfdir}/${fd_pkgname}/freediameter.conf.sample \ |
| 78 | ${D}${sysconfdir}/${fd_pkgname}/freeDiameter.conf.sample |
| 79 | install -d ${D}${sysconfdir}/freeDiameter |
| 80 | install ${WORKDIR}/freeDiameter.conf ${D}${sysconfdir}/${fd_pkgname}/freeDiameter.conf |
| 81 | |
| 82 | # install daemon init related files |
| 83 | install -d -m 0755 ${D}${sysconfdir}/default |
| 84 | install -d -m 0755 ${D}${sysconfdir}/init.d |
| 85 | install -m 0644 ${S}/contrib/debian/freediameter-daemon.default \ |
| 86 | ${D}${sysconfdir}/default/${BPN} |
| 87 | install -m 0755 ${WORKDIR}/freediameter.init ${D}${sysconfdir}/init.d/${BPN} |
| 88 | |
| 89 | # install for systemd |
| 90 | install -d ${D}${systemd_system_unitdir} |
| 91 | install -m 0644 ${WORKDIR}/freediameter.service ${D}${systemd_system_unitdir} |
| 92 | sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/*.service |
| 93 | |
| 94 | cat >> ${D}${sysconfdir}/freeDiameter/freeDiameter.conf <<EOF |
| 95 | ## OE specific ## |
| 96 | #Identity="${FD_HOSTNAME}"; |
| 97 | Identity = "${FD_HOSTNAME}.${FD_REALM}"; |
| 98 | Realm = "${FD_REALM}"; |
| 99 | Port = 30868; |
| 100 | SecPort = 30869; |
| 101 | TLS_Cred = "/etc/freeDiameter/${FD_PEM}" , "/etc/freeDiameter/${FD_KEY}"; |
| 102 | TLS_CA = "/etc/freeDiameter/${FD_CA}"; |
| 103 | TLS_DH_File = "/etc/freeDiameter/${FD_DH_PEM}"; |
| 104 | EOF |
| 105 | |
| 106 | # create self cert |
| 107 | openssl req -x509 -config ${STAGING_DIR_NATIVE}/etc/ssl/openssl.cnf -newkey rsa:4096 -sha256 -nodes -out ${D}${sysconfdir}/freeDiameter/${FD_PEM} -keyout ${D}${sysconfdir}/freeDiameter/${FD_KEY} -days 3650 -subj '/CN=${FD_HOSTNAME}.${FD_REALM}' |
| 108 | openssl dhparam -out ${D}${sysconfdir}/freeDiameter/${FD_DH_PEM} 1024 |
| 109 | |
| 110 | } |
| 111 | |
| 112 | do_install_ptest() { |
| 113 | sed -i "s#\(EXTENSIONS_DIR=\).*\$#\1${libdir}/${fd_pkgname}/#" ${D}${PTEST_PATH}/run-ptest |
| 114 | mv ${D}${PTEST_PATH}-tests/* ${D}${PTEST_PATH}/ |
| 115 | rmdir ${D}${PTEST_PATH}-tests |
| 116 | install -m 0644 ${B}/tests/CTestTestfile.cmake ${D}${PTEST_PATH}/ |
| 117 | } |
| 118 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 119 | FILES:${PN}-dbg += "${libdir}/${fd_pkgname}/.debug/*" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 120 | |
| 121 | # include the extensions in main package |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 122 | FILES:${PN} += "${libdir}/${fd_pkgname}/*" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 123 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 124 | RDEPENDS:${PN} = "glib-2.0 gnutls libidn" |
| 125 | RDEPENDS:${PN} += "openssl openssl-conf openssl-engines" |
| 126 | RRECOMMENDS:${PN} += "kernel-module-tipc kernel-module-sctp" |
| 127 | RRECOMMENDS:${PN} += "kernel-module-udp-tunnel kernel-module-ipip" |
| 128 | RDEPENDS:${PN}-ptest = "cmake" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 129 | |
| 130 | INITSCRIPT_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 131 | INITSCRIPT_NAME:${PN} = "${BPN}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 132 | INITSCRIPT_PARAMS$_${PN} = "start 30 . stop 70 0 1 2 3 4 5 6 ." |
| 133 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 134 | SYSTEMD_SERVICE:${PN} = "freediameter.service" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 135 | SYSTEMD_AUTO_ENABLE = "disable" |
| 136 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 137 | CONFFILES:${PN} = "${sysconfdir}/freediameter.conf" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 138 | |