blob: 93a607d3cee0e651e361d0e694d024409db886db [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "An open source implementation of the diameter protocol"
2DESCRIPTION = "\
3freeDiameter is an open source Diameter protocol implementation \
4(RFC3588). It provides an extensible platform for deploying a \
5Diameter network for your Authentication, Authorization and \
6Accounting needs."
7
8HOMEPAGE = "http://www.freediameter.net"
9
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010DEPENDS = "flex bison cmake-native libgcrypt gnutls libidn lksctp-tools virtual/kernel bison-native"
Brad Bishop316dfdd2018-06-25 12:45:53 -040011
12PACKAGE_ARCH = "${MACHINE_ARCH}"
13
14fd_pkgname = "freeDiameter"
15
16SRC_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 \
Patrick Williams92b42cb2022-09-03 06:53:57 -050021 ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://install_test.patch file://run-ptest file://0001-tests-use-EXTENSIONS_DIR.patch', '', d)} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040022 file://freeDiameter.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080023 file://0001-libfdcore-sctp.c-update-the-old-sctp-api-check.patch \
Brad Bishop316dfdd2018-06-25 12:45:53 -040024 "
25
Andrew Geisslerc87764f2020-06-27 00:16:32 -050026SRC_URI[sha256sum] = "7a537401bd110c606594b7c6be71b993f0ccc73ae151ad68040979286ba4e50e"
Brad Bishop316dfdd2018-06-25 12:45:53 -040027
28S = "${WORKDIR}/${fd_pkgname}-${PV}"
29
Brad Bishop2d39a062019-10-28 08:33:36 -040030LICENSE = "BSD-3-Clause"
Brad Bishop26bdd442019-08-16 17:08:17 -040031LIC_FILES_CHKSUM = "file://LICENSE;md5=69bdc1d97648a2d35914563fcbbb361a"
Brad Bishop316dfdd2018-06-25 12:45:53 -040032
33PTEST_PATH = "${libdir}/${fd_pkgname}/ptest"
34
35inherit cmake pkgconfig update-rc.d ptest systemd
36
37EXTRA_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} \
Patrick Williams92b42cb2022-09-03 06:53:57 -050049 -DEXTENSIONS_DIR:PATH=${libdir}/${fd_pkgname} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040050 -DINSTALL_TEST_SUFFIX:PATH=${PTEST_PATH}-tests \
51 -DCMAKE_SKIP_RPATH:BOOL=ON \
52"
53# INSTALL_LIBRARY_SUFFIX is relative to CMAKE_INSTALL_PREFIX
54# specify it on cmd line will fix the SET bug in CMakeList.txt
55
56# -DBUILD_APP_ACCT:BOOL=ON This needs POSTGRESQL support
57
58# -DBUILD_APP_DIAMEAP:BOOL=ON -DBUILD_APP_SIP:BOOL=ON -DBUILD_TEST_SIP:BOOL=ON
59# These need MySQL support
60
61# -DBUILD_DBG_INTERACTIVE:BOOL=ON This needs SWIG support
62
63# -DALL_EXTENSIONS=ON will enable all
64
65FD_KEY ?="${BPN}.key"
66FD_PEM ?= "${BPN}.pem"
67FD_CA ?= "${BPN}.pem"
68FD_DH_PEM ?= "${BPN}-dh.pem"
69FD_HOSTNAME ?= "${MACHINE}"
70FD_REALM ?= "openembedded.org"
71
Patrick Williams213cb262021-08-07 19:21:33 -050072do_install:append() {
Brad Bishop316dfdd2018-06-25 12:45:53 -040073 # install the sample configuration files
74 install -d -m 0755 ${D}${sysconfdir}/${fd_pkgname}
75 for i in ${S}/doc/*.conf.sample; do
76 install -m 0644 $i ${D}${sysconfdir}/${fd_pkgname}/
77 done
78 mv ${D}${sysconfdir}/${fd_pkgname}/freediameter.conf.sample \
79 ${D}${sysconfdir}/${fd_pkgname}/freeDiameter.conf.sample
80 install -d ${D}${sysconfdir}/freeDiameter
81 install ${WORKDIR}/freeDiameter.conf ${D}${sysconfdir}/${fd_pkgname}/freeDiameter.conf
82
83 # install daemon init related files
84 install -d -m 0755 ${D}${sysconfdir}/default
85 install -d -m 0755 ${D}${sysconfdir}/init.d
86 install -m 0644 ${S}/contrib/debian/freediameter-daemon.default \
87 ${D}${sysconfdir}/default/${BPN}
88 install -m 0755 ${WORKDIR}/freediameter.init ${D}${sysconfdir}/init.d/${BPN}
89
90 # install for systemd
91 install -d ${D}${systemd_system_unitdir}
92 install -m 0644 ${WORKDIR}/freediameter.service ${D}${systemd_system_unitdir}
93 sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/*.service
94
95 cat >> ${D}${sysconfdir}/freeDiameter/freeDiameter.conf <<EOF
96## OE specific ##
97#Identity="${FD_HOSTNAME}";
98Identity = "${FD_HOSTNAME}.${FD_REALM}";
99Realm = "${FD_REALM}";
100Port = 30868;
101SecPort = 30869;
102TLS_Cred = "/etc/freeDiameter/${FD_PEM}" , "/etc/freeDiameter/${FD_KEY}";
103TLS_CA = "/etc/freeDiameter/${FD_CA}";
104TLS_DH_File = "/etc/freeDiameter/${FD_DH_PEM}";
105EOF
106
107 # create self cert
108 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}'
109 openssl dhparam -out ${D}${sysconfdir}/freeDiameter/${FD_DH_PEM} 1024
110
Patrick Williams92b42cb2022-09-03 06:53:57 -0500111 find ${B} \( -name "*.c" -o -name "*.h" \) -exec sed -i -e 's#${WORKDIR}##g' {} \;
Brad Bishop316dfdd2018-06-25 12:45:53 -0400112}
113
114do_install_ptest() {
Brad Bishop316dfdd2018-06-25 12:45:53 -0400115 mv ${D}${PTEST_PATH}-tests/* ${D}${PTEST_PATH}/
116 rmdir ${D}${PTEST_PATH}-tests
117 install -m 0644 ${B}/tests/CTestTestfile.cmake ${D}${PTEST_PATH}/
Patrick Williams92b42cb2022-09-03 06:53:57 -0500118 sed -i -e 's#${WORKDIR}##g' ${D}${PTEST_PATH}/CTestTestfile.cmake
119 sed -i "/^set_tests_properties/d" ${D}${PTEST_PATH}/CTestTestfile.cmake
Brad Bishop316dfdd2018-06-25 12:45:53 -0400120}
121
Patrick Williams213cb262021-08-07 19:21:33 -0500122FILES:${PN}-dbg += "${libdir}/${fd_pkgname}/.debug/*"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400123
124# include the extensions in main package
Patrick Williams213cb262021-08-07 19:21:33 -0500125FILES:${PN} += "${libdir}/${fd_pkgname}/*"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400126
Patrick Williams213cb262021-08-07 19:21:33 -0500127RDEPENDS:${PN} = "glib-2.0 gnutls libidn"
128RDEPENDS:${PN} += "openssl openssl-conf openssl-engines"
129RRECOMMENDS:${PN} += "kernel-module-tipc kernel-module-sctp"
130RRECOMMENDS:${PN} += "kernel-module-udp-tunnel kernel-module-ipip"
131RDEPENDS:${PN}-ptest = "cmake"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400132
133INITSCRIPT_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500134INITSCRIPT_NAME:${PN} = "${BPN}"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400135INITSCRIPT_PARAMS$_${PN} = "start 30 . stop 70 0 1 2 3 4 5 6 ."
136
Patrick Williams213cb262021-08-07 19:21:33 -0500137SYSTEMD_SERVICE:${PN} = "freediameter.service"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400138SYSTEMD_AUTO_ENABLE = "disable"
139
Patrick Williams213cb262021-08-07 19:21:33 -0500140CONFFILES:${PN} = "${sysconfdir}/freediameter.conf"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400141