blob: c178b4cdacba17aec835a883308a741f4df6fd68 [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 Geissler97771a32021-03-05 15:23:11 -060015SRC_URI[md5sum] = "8918e6675e1be3784817641f07eadeb8"
16SRC_URI[sha256sum] = "61c72f741edb2c1295a7b7ccce0317a104b3f9d39efd04c52cd05b01b55ab063"
Andrew Geissler82c905d2020-04-13 13:39:40 -050017
18UPSTREAM_CHECK_REGEX = "strongswan-(?P<pver>\d+(\.\d+)+)\.tar"
19
20EXTRA_OECONF = " \
21 --without-lib-prefix \
22 --with-dev-headers=${includedir}/strongswan \
23"
24
25EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemdsystemunitdir=${systemd_unitdir}/system/', '--without-systemdsystemunitdir', d)}"
26
Andrew Geisslerf103a7f2021-05-07 16:09:40 -050027PACKAGECONFIG ?= "curl gmp openssl sqlite3 swanctl \
Andrew Geissler4b7c1152020-11-30 19:55:29 -060028 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-charon', 'charon', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050029"
30PACKAGECONFIG[aesni] = "--enable-aesni,--disable-aesni,,${PN}-plugin-aesni"
31PACKAGECONFIG[bfd] = "--enable-bfd-backtraces,--disable-bfd-backtraces,binutils"
32PACKAGECONFIG[charon] = "--enable-charon,--disable-charon,"
33PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl,${PN}-plugin-curl"
Andrew Geissler4b7c1152020-11-30 19:55:29 -060034PACKAGECONFIG[eap-identity] = "--enable-eap-identity,--disable-eap-identity,,${PN}-plugin-eap-identity"
35PACKAGECONFIG[eap-mschapv2] = "--enable-eap-mschapv2,--disable-eap-mschapv2,,${PN}-plugin-eap-mschapv2"
Andrew Geissler82c905d2020-04-13 13:39:40 -050036PACKAGECONFIG[gmp] = "--enable-gmp,--disable-gmp,gmp,${PN}-plugin-gmp"
37PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap,openldap,${PN}-plugin-ldap"
38PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,${PN}-plugin-mysql"
39PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl,${PN}-plugin-openssl"
40PACKAGECONFIG[scep] = "--enable-scepclient,--disable-scepclient,"
41PACKAGECONFIG[soup] = "--enable-soup,--disable-soup,libsoup-2.4,${PN}-plugin-soup"
42PACKAGECONFIG[sqlite3] = "--enable-sqlite,--disable-sqlite,sqlite3,${PN}-plugin-sqlite"
43PACKAGECONFIG[stroke] = "--enable-stroke,--disable-stroke,,${PN}-plugin-stroke"
44PACKAGECONFIG[swanctl] = "--enable-swanctl,--disable-swanctl,,libgcc"
45
46# requires swanctl
47PACKAGECONFIG[systemd-charon] = "--enable-systemd,--disable-systemd,systemd,"
48
49inherit autotools systemd pkgconfig
50
51RRECOMMENDS_${PN} = "kernel-module-ipsec"
52
53FILES_${PN} += "${libdir}/ipsec/lib*${SOLIBS}"
54FILES_${PN}-dbg += "${bindir}/.debug ${sbindir}/.debug ${libdir}/ipsec/.debug ${libexecdir}/ipsec/.debug"
55FILES_${PN}-dev += "${libdir}/ipsec/lib*${SOLIBSDEV} ${libdir}/ipsec/*.la ${libdir}/ipsec/include/config.h"
56FILES_${PN}-staticdev += "${libdir}/ipsec/*.a"
57
58CONFFILES_${PN} = "${sysconfdir}/*.conf ${sysconfdir}/ipsec.d/*.conf ${sysconfdir}/strongswan.d/*.conf"
59
60PACKAGES += "${PN}-plugins"
61ALLOW_EMPTY_${PN}-plugins = "1"
62
63PACKAGES_DYNAMIC += "^${PN}-plugin-.*$"
64NOAUTOPACKAGEDEBUG = "1"
65
66python split_strongswan_plugins () {
67 sysconfdir = d.expand('${sysconfdir}/strongswan.d/charon')
68 libdir = d.expand('${libdir}/ipsec/plugins')
69 dbglibdir = os.path.join(libdir, '.debug')
70
71 def add_plugin_conf(f, pkg, file_regex, output_pattern, modulename):
72 dvar = d.getVar('PKGD')
73 oldfiles = d.getVar('CONFFILES_' + pkg)
74 newfile = '/' + os.path.relpath(f, dvar)
75
76 if not oldfiles:
77 d.setVar('CONFFILES_' + pkg, newfile)
78 else:
79 d.setVar('CONFFILES_' + pkg, oldfiles + " " + newfile)
80
81 split_packages = do_split_packages(d, libdir, 'libstrongswan-(.*)\.so', '${PN}-plugin-%s', 'strongSwan %s plugin', prepend=True)
82 do_split_packages(d, sysconfdir, '(.*)\.conf', '${PN}-plugin-%s', 'strongSwan %s plugin', prepend=True, hook=add_plugin_conf)
83
84 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')
85 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')
86 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')
87
88 if split_packages:
89 pn = d.getVar('PN')
90 d.setVar('RRECOMMENDS_' + pn + '-plugins', ' '.join(split_packages))
91 d.appendVar('RRECOMMENDS_' + pn + '-dbg', ' ' + ' '.join(split_dbg_packages))
92 d.appendVar('RRECOMMENDS_' + pn + '-dev', ' ' + ' '.join(split_dev_packages))
93 d.appendVar('RRECOMMENDS_' + pn + '-staticdev', ' ' + ' '.join(split_staticdev_packages))
94}
95
96PACKAGESPLITFUNCS_prepend = "split_strongswan_plugins "
97
98# Install some default plugins based on default strongSwan ./configure options
99# See https://wiki.strongswan.org/projects/strongswan/wiki/Pluginlist
100RDEPENDS_${PN} += "\
101 ${PN}-plugin-aes \
102 ${PN}-plugin-attr \
103 ${PN}-plugin-cmac \
104 ${PN}-plugin-constraints \
105 ${PN}-plugin-des \
106 ${PN}-plugin-dnskey \
107 ${PN}-plugin-hmac \
108 ${PN}-plugin-kernel-netlink \
109 ${PN}-plugin-md5 \
110 ${PN}-plugin-nonce \
111 ${PN}-plugin-pem \
112 ${PN}-plugin-pgp \
113 ${PN}-plugin-pkcs1 \
114 ${PN}-plugin-pkcs7 \
115 ${PN}-plugin-pkcs8 \
116 ${PN}-plugin-pkcs12 \
117 ${PN}-plugin-pubkey \
118 ${PN}-plugin-random \
119 ${PN}-plugin-rc2 \
120 ${PN}-plugin-resolve \
121 ${PN}-plugin-revocation \
122 ${PN}-plugin-sha1 \
123 ${PN}-plugin-sha2 \
124 ${PN}-plugin-socket-default \
125 ${PN}-plugin-sshkey \
126 ${PN}-plugin-updown \
127 ${PN}-plugin-vici \
128 ${PN}-plugin-x509 \
129 ${PN}-plugin-xauth-generic \
130 ${PN}-plugin-xcbc \
131 ${PN}-plugin-curve25519 \
132 "
133
134RPROVIDES_${PN} += "${PN}-systemd"
135RREPLACES_${PN} += "${PN}-systemd"
136RCONFLICTS_${PN} += "${PN}-systemd"
Andrew Geissler4b7c1152020-11-30 19:55:29 -0600137
138# The deprecated legacy 'strongswan-starter' service should only be used when charon and
139# stroke are enabled. When swanctl is in use, 'strongswan.service' is needed.
140# See: https://wiki.strongswan.org/projects/strongswan/wiki/Charon-systemd
141SYSTEMD_SERVICE_${PN} = " \
142 ${@bb.utils.contains('PACKAGECONFIG', 'swanctl', '${BPN}.service', '', d)} \
143 ${@bb.utils.contains('PACKAGECONFIG', 'charon', '${BPN}-starter.service', '', d)} \
144"