blob: ad104e44edc0f440e7cdae9e7b190541b146617a [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001DESCRIPTION = "strongSwan is an OpenSource IPsec implementation for the \
2Linux operating system."
3SUMMARY = "strongSwan is an OpenSource IPsec implementation"
4HOMEPAGE = "http://www.strongswan.org"
5SECTION = "net"
6LICENSE = "GPLv2"
7LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
8DEPENDS = "gmp openssl flex-native flex bison-native"
9
10SRC_URI = "http://download.strongswan.org/strongswan-${PV}.tar.bz2 \
11 file://fix-funtion-parameter.patch \
12 file://0001-memory.h-Include-stdint.h-for-uintptr_t.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050013 "
14
Andrew Geissler69721092021-07-23 12:57:00 -040015SRC_URI[sha256sum] = "9325ab56a0a4e97e379401e1d942ce3e0d8b6372291350ab2caae0755862c6f7"
Andrew Geissler82c905d2020-04-13 13:39:40 -050016
17UPSTREAM_CHECK_REGEX = "strongswan-(?P<pver>\d+(\.\d+)+)\.tar"
18
19EXTRA_OECONF = " \
20 --without-lib-prefix \
21 --with-dev-headers=${includedir}/strongswan \
22"
23
24EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemdsystemunitdir=${systemd_unitdir}/system/', '--without-systemdsystemunitdir', d)}"
25
Andrew Geisslerf103a7f2021-05-07 16:09:40 -050026PACKAGECONFIG ?= "curl gmp openssl sqlite3 swanctl \
Andrew Geissler4b7c1152020-11-30 19:55:29 -060027 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-charon', 'charon', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050028"
29PACKAGECONFIG[aesni] = "--enable-aesni,--disable-aesni,,${PN}-plugin-aesni"
30PACKAGECONFIG[bfd] = "--enable-bfd-backtraces,--disable-bfd-backtraces,binutils"
31PACKAGECONFIG[charon] = "--enable-charon,--disable-charon,"
32PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl,${PN}-plugin-curl"
Andrew Geissler4b7c1152020-11-30 19:55:29 -060033PACKAGECONFIG[eap-identity] = "--enable-eap-identity,--disable-eap-identity,,${PN}-plugin-eap-identity"
34PACKAGECONFIG[eap-mschapv2] = "--enable-eap-mschapv2,--disable-eap-mschapv2,,${PN}-plugin-eap-mschapv2"
Andrew Geissler82c905d2020-04-13 13:39:40 -050035PACKAGECONFIG[gmp] = "--enable-gmp,--disable-gmp,gmp,${PN}-plugin-gmp"
36PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap,openldap,${PN}-plugin-ldap"
37PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,${PN}-plugin-mysql"
38PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl,${PN}-plugin-openssl"
39PACKAGECONFIG[scep] = "--enable-scepclient,--disable-scepclient,"
40PACKAGECONFIG[soup] = "--enable-soup,--disable-soup,libsoup-2.4,${PN}-plugin-soup"
41PACKAGECONFIG[sqlite3] = "--enable-sqlite,--disable-sqlite,sqlite3,${PN}-plugin-sqlite"
42PACKAGECONFIG[stroke] = "--enable-stroke,--disable-stroke,,${PN}-plugin-stroke"
43PACKAGECONFIG[swanctl] = "--enable-swanctl,--disable-swanctl,,libgcc"
44
45# requires swanctl
46PACKAGECONFIG[systemd-charon] = "--enable-systemd,--disable-systemd,systemd,"
47
48inherit autotools systemd pkgconfig
49
Patrick Williams213cb262021-08-07 19:21:33 -050050RRECOMMENDS:${PN} = "kernel-module-ipsec"
Andrew Geissler82c905d2020-04-13 13:39:40 -050051
Patrick Williams213cb262021-08-07 19:21:33 -050052FILES:${PN} += "${libdir}/ipsec/lib*${SOLIBS}"
53FILES:${PN}-dbg += "${bindir}/.debug ${sbindir}/.debug ${libdir}/ipsec/.debug ${libexecdir}/ipsec/.debug"
54FILES:${PN}-dev += "${libdir}/ipsec/lib*${SOLIBSDEV} ${libdir}/ipsec/*.la ${libdir}/ipsec/include/config.h"
55FILES:${PN}-staticdev += "${libdir}/ipsec/*.a"
Andrew Geissler82c905d2020-04-13 13:39:40 -050056
Patrick Williams213cb262021-08-07 19:21:33 -050057CONFFILES:${PN} = "${sysconfdir}/*.conf ${sysconfdir}/ipsec.d/*.conf ${sysconfdir}/strongswan.d/*.conf"
Andrew Geissler82c905d2020-04-13 13:39:40 -050058
59PACKAGES += "${PN}-plugins"
Patrick Williams213cb262021-08-07 19:21:33 -050060ALLOW_EMPTY:${PN}-plugins = "1"
Andrew Geissler82c905d2020-04-13 13:39:40 -050061
62PACKAGES_DYNAMIC += "^${PN}-plugin-.*$"
63NOAUTOPACKAGEDEBUG = "1"
64
65python split_strongswan_plugins () {
66 sysconfdir = d.expand('${sysconfdir}/strongswan.d/charon')
67 libdir = d.expand('${libdir}/ipsec/plugins')
68 dbglibdir = os.path.join(libdir, '.debug')
69
70 def add_plugin_conf(f, pkg, file_regex, output_pattern, modulename):
71 dvar = d.getVar('PKGD')
Patrick Williams213cb262021-08-07 19:21:33 -050072 oldfiles = d.getVar('CONFFILES:' + pkg)
Andrew Geissler82c905d2020-04-13 13:39:40 -050073 newfile = '/' + os.path.relpath(f, dvar)
74
75 if not oldfiles:
Patrick Williams213cb262021-08-07 19:21:33 -050076 d.setVar('CONFFILES:' + pkg, newfile)
Andrew Geissler82c905d2020-04-13 13:39:40 -050077 else:
Patrick Williams213cb262021-08-07 19:21:33 -050078 d.setVar('CONFFILES:' + pkg, oldfiles + " " + newfile)
Andrew Geissler82c905d2020-04-13 13:39:40 -050079
80 split_packages = do_split_packages(d, libdir, 'libstrongswan-(.*)\.so', '${PN}-plugin-%s', 'strongSwan %s plugin', prepend=True)
81 do_split_packages(d, sysconfdir, '(.*)\.conf', '${PN}-plugin-%s', 'strongSwan %s plugin', prepend=True, hook=add_plugin_conf)
82
83 split_dbg_packages = do_split_packages(d, dbglibdir, 'libstrongswan-(.*)\.so', '${PN}-plugin-%s-dbg', 'strongSwan %s plugin - Debugging files', prepend=True, extra_depends='${PN}-dbg')
84 split_dev_packages = do_split_packages(d, libdir, 'libstrongswan-(.*)\.la', '${PN}-plugin-%s-dev', 'strongSwan %s plugin - Development files', prepend=True, extra_depends='${PN}-dev')
85 split_staticdev_packages = do_split_packages(d, libdir, 'libstrongswan-(.*)\.a', '${PN}-plugin-%s-staticdev', 'strongSwan %s plugin - Development files (Static Libraries)', prepend=True, extra_depends='${PN}-staticdev')
86
87 if split_packages:
88 pn = d.getVar('PN')
Patrick Williams213cb262021-08-07 19:21:33 -050089 d.setVar('RRECOMMENDS:' + pn + '-plugins', ' '.join(split_packages))
90 d.appendVar('RRECOMMENDS:' + pn + '-dbg', ' ' + ' '.join(split_dbg_packages))
91 d.appendVar('RRECOMMENDS:' + pn + '-dev', ' ' + ' '.join(split_dev_packages))
92 d.appendVar('RRECOMMENDS:' + pn + '-staticdev', ' ' + ' '.join(split_staticdev_packages))
Andrew Geissler82c905d2020-04-13 13:39:40 -050093}
94
Patrick Williams213cb262021-08-07 19:21:33 -050095PACKAGESPLITFUNCS:prepend = "split_strongswan_plugins "
Andrew Geissler82c905d2020-04-13 13:39:40 -050096
97# Install some default plugins based on default strongSwan ./configure options
98# See https://wiki.strongswan.org/projects/strongswan/wiki/Pluginlist
Patrick Williams213cb262021-08-07 19:21:33 -050099RDEPENDS:${PN} += "\
Andrew Geissler82c905d2020-04-13 13:39:40 -0500100 ${PN}-plugin-aes \
101 ${PN}-plugin-attr \
102 ${PN}-plugin-cmac \
103 ${PN}-plugin-constraints \
104 ${PN}-plugin-des \
105 ${PN}-plugin-dnskey \
106 ${PN}-plugin-hmac \
107 ${PN}-plugin-kernel-netlink \
108 ${PN}-plugin-md5 \
109 ${PN}-plugin-nonce \
110 ${PN}-plugin-pem \
111 ${PN}-plugin-pgp \
112 ${PN}-plugin-pkcs1 \
113 ${PN}-plugin-pkcs7 \
114 ${PN}-plugin-pkcs8 \
115 ${PN}-plugin-pkcs12 \
116 ${PN}-plugin-pubkey \
117 ${PN}-plugin-random \
118 ${PN}-plugin-rc2 \
119 ${PN}-plugin-resolve \
120 ${PN}-plugin-revocation \
121 ${PN}-plugin-sha1 \
122 ${PN}-plugin-sha2 \
123 ${PN}-plugin-socket-default \
124 ${PN}-plugin-sshkey \
125 ${PN}-plugin-updown \
126 ${PN}-plugin-vici \
127 ${PN}-plugin-x509 \
128 ${PN}-plugin-xauth-generic \
129 ${PN}-plugin-xcbc \
130 ${PN}-plugin-curve25519 \
131 "
132
Patrick Williams213cb262021-08-07 19:21:33 -0500133RPROVIDES:${PN} += "${PN}-systemd"
134RREPLACES:${PN} += "${PN}-systemd"
135RCONFLICTS:${PN} += "${PN}-systemd"
Andrew Geissler4b7c1152020-11-30 19:55:29 -0600136
137# The deprecated legacy 'strongswan-starter' service should only be used when charon and
138# stroke are enabled. When swanctl is in use, 'strongswan.service' is needed.
139# See: https://wiki.strongswan.org/projects/strongswan/wiki/Charon-systemd
Patrick Williams213cb262021-08-07 19:21:33 -0500140SYSTEMD_SERVICE:${PN} = " \
Andrew Geissler4b7c1152020-11-30 19:55:29 -0600141 ${@bb.utils.contains('PACKAGECONFIG', 'swanctl', '${BPN}.service', '', d)} \
142 ${@bb.utils.contains('PACKAGECONFIG', 'charon', '${BPN}-starter.service', '', d)} \
143"