blob: 0a2733195bc15aadec57d5418fe536e7e24745cf [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 \
13 "
14
15SRC_URI[md5sum] = "0634e7f40591bd3f6770e583c3f27d29"
16SRC_URI[sha256sum] = "2d9a57e33813b62d58cba07531c4d5a35c6b823dfe9b8ff7c623b6571f02553c"
17
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
27PACKAGECONFIG ??= "charon curl gmp openssl stroke sqlite3 \
28 ${@bb.utils.filter('DISTRO_FEATURES', 'ldap', d)} \
29"
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"
34PACKAGECONFIG[gmp] = "--enable-gmp,--disable-gmp,gmp,${PN}-plugin-gmp"
35PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap,openldap,${PN}-plugin-ldap"
36PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,${PN}-plugin-mysql"
37PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl,${PN}-plugin-openssl"
38PACKAGECONFIG[scep] = "--enable-scepclient,--disable-scepclient,"
39PACKAGECONFIG[soup] = "--enable-soup,--disable-soup,libsoup-2.4,${PN}-plugin-soup"
40PACKAGECONFIG[sqlite3] = "--enable-sqlite,--disable-sqlite,sqlite3,${PN}-plugin-sqlite"
41PACKAGECONFIG[stroke] = "--enable-stroke,--disable-stroke,,${PN}-plugin-stroke"
42PACKAGECONFIG[swanctl] = "--enable-swanctl,--disable-swanctl,,libgcc"
43
44# requires swanctl
45PACKAGECONFIG[systemd-charon] = "--enable-systemd,--disable-systemd,systemd,"
46
47inherit autotools systemd pkgconfig
48
49RRECOMMENDS_${PN} = "kernel-module-ipsec"
50
51FILES_${PN} += "${libdir}/ipsec/lib*${SOLIBS}"
52FILES_${PN}-dbg += "${bindir}/.debug ${sbindir}/.debug ${libdir}/ipsec/.debug ${libexecdir}/ipsec/.debug"
53FILES_${PN}-dev += "${libdir}/ipsec/lib*${SOLIBSDEV} ${libdir}/ipsec/*.la ${libdir}/ipsec/include/config.h"
54FILES_${PN}-staticdev += "${libdir}/ipsec/*.a"
55
56CONFFILES_${PN} = "${sysconfdir}/*.conf ${sysconfdir}/ipsec.d/*.conf ${sysconfdir}/strongswan.d/*.conf"
57
58PACKAGES += "${PN}-plugins"
59ALLOW_EMPTY_${PN}-plugins = "1"
60
61PACKAGES_DYNAMIC += "^${PN}-plugin-.*$"
62NOAUTOPACKAGEDEBUG = "1"
63
64python split_strongswan_plugins () {
65 sysconfdir = d.expand('${sysconfdir}/strongswan.d/charon')
66 libdir = d.expand('${libdir}/ipsec/plugins')
67 dbglibdir = os.path.join(libdir, '.debug')
68
69 def add_plugin_conf(f, pkg, file_regex, output_pattern, modulename):
70 dvar = d.getVar('PKGD')
71 oldfiles = d.getVar('CONFFILES_' + pkg)
72 newfile = '/' + os.path.relpath(f, dvar)
73
74 if not oldfiles:
75 d.setVar('CONFFILES_' + pkg, newfile)
76 else:
77 d.setVar('CONFFILES_' + pkg, oldfiles + " " + newfile)
78
79 split_packages = do_split_packages(d, libdir, 'libstrongswan-(.*)\.so', '${PN}-plugin-%s', 'strongSwan %s plugin', prepend=True)
80 do_split_packages(d, sysconfdir, '(.*)\.conf', '${PN}-plugin-%s', 'strongSwan %s plugin', prepend=True, hook=add_plugin_conf)
81
82 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')
83 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')
84 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')
85
86 if split_packages:
87 pn = d.getVar('PN')
88 d.setVar('RRECOMMENDS_' + pn + '-plugins', ' '.join(split_packages))
89 d.appendVar('RRECOMMENDS_' + pn + '-dbg', ' ' + ' '.join(split_dbg_packages))
90 d.appendVar('RRECOMMENDS_' + pn + '-dev', ' ' + ' '.join(split_dev_packages))
91 d.appendVar('RRECOMMENDS_' + pn + '-staticdev', ' ' + ' '.join(split_staticdev_packages))
92}
93
94PACKAGESPLITFUNCS_prepend = "split_strongswan_plugins "
95
96# Install some default plugins based on default strongSwan ./configure options
97# See https://wiki.strongswan.org/projects/strongswan/wiki/Pluginlist
98RDEPENDS_${PN} += "\
99 ${PN}-plugin-aes \
100 ${PN}-plugin-attr \
101 ${PN}-plugin-cmac \
102 ${PN}-plugin-constraints \
103 ${PN}-plugin-des \
104 ${PN}-plugin-dnskey \
105 ${PN}-plugin-hmac \
106 ${PN}-plugin-kernel-netlink \
107 ${PN}-plugin-md5 \
108 ${PN}-plugin-nonce \
109 ${PN}-plugin-pem \
110 ${PN}-plugin-pgp \
111 ${PN}-plugin-pkcs1 \
112 ${PN}-plugin-pkcs7 \
113 ${PN}-plugin-pkcs8 \
114 ${PN}-plugin-pkcs12 \
115 ${PN}-plugin-pubkey \
116 ${PN}-plugin-random \
117 ${PN}-plugin-rc2 \
118 ${PN}-plugin-resolve \
119 ${PN}-plugin-revocation \
120 ${PN}-plugin-sha1 \
121 ${PN}-plugin-sha2 \
122 ${PN}-plugin-socket-default \
123 ${PN}-plugin-sshkey \
124 ${PN}-plugin-updown \
125 ${PN}-plugin-vici \
126 ${PN}-plugin-x509 \
127 ${PN}-plugin-xauth-generic \
128 ${PN}-plugin-xcbc \
129 ${PN}-plugin-curve25519 \
130 "
131
132RPROVIDES_${PN} += "${PN}-systemd"
133RREPLACES_${PN} += "${PN}-systemd"
134RCONFLICTS_${PN} += "${PN}-systemd"
135SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'swanctl', '${BPN}.service', '', d)} ${BPN}-starter.service"