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