Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | DESCRIPTION = "strongSwan is an OpenSource IPsec implementation for the \ |
| 2 | Linux operating system." |
| 3 | SUMMARY = "strongSwan is an OpenSource IPsec implementation" |
| 4 | HOMEPAGE = "http://www.strongswan.org" |
| 5 | SECTION = "net" |
| 6 | LICENSE = "GPLv2" |
| 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
| 8 | DEPENDS = "gmp openssl flex-native flex bison-native" |
| 9 | |
| 10 | SRC_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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 13 | " |
| 14 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 15 | SRC_URI[sha256sum] = "9325ab56a0a4e97e379401e1d942ce3e0d8b6372291350ab2caae0755862c6f7" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 16 | |
| 17 | UPSTREAM_CHECK_REGEX = "strongswan-(?P<pver>\d+(\.\d+)+)\.tar" |
| 18 | |
| 19 | EXTRA_OECONF = " \ |
| 20 | --without-lib-prefix \ |
| 21 | --with-dev-headers=${includedir}/strongswan \ |
| 22 | " |
| 23 | |
| 24 | EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemdsystemunitdir=${systemd_unitdir}/system/', '--without-systemdsystemunitdir', d)}" |
| 25 | |
Andrew Geissler | f103a7f | 2021-05-07 16:09:40 -0500 | [diff] [blame] | 26 | PACKAGECONFIG ?= "curl gmp openssl sqlite3 swanctl \ |
Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 27 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-charon', 'charon', d)} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 28 | " |
| 29 | PACKAGECONFIG[aesni] = "--enable-aesni,--disable-aesni,,${PN}-plugin-aesni" |
| 30 | PACKAGECONFIG[bfd] = "--enable-bfd-backtraces,--disable-bfd-backtraces,binutils" |
| 31 | PACKAGECONFIG[charon] = "--enable-charon,--disable-charon," |
| 32 | PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl,${PN}-plugin-curl" |
Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 33 | PACKAGECONFIG[eap-identity] = "--enable-eap-identity,--disable-eap-identity,,${PN}-plugin-eap-identity" |
| 34 | PACKAGECONFIG[eap-mschapv2] = "--enable-eap-mschapv2,--disable-eap-mschapv2,,${PN}-plugin-eap-mschapv2" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 35 | PACKAGECONFIG[gmp] = "--enable-gmp,--disable-gmp,gmp,${PN}-plugin-gmp" |
| 36 | PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap,openldap,${PN}-plugin-ldap" |
| 37 | PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,${PN}-plugin-mysql" |
| 38 | PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl,${PN}-plugin-openssl" |
| 39 | PACKAGECONFIG[scep] = "--enable-scepclient,--disable-scepclient," |
| 40 | PACKAGECONFIG[soup] = "--enable-soup,--disable-soup,libsoup-2.4,${PN}-plugin-soup" |
| 41 | PACKAGECONFIG[sqlite3] = "--enable-sqlite,--disable-sqlite,sqlite3,${PN}-plugin-sqlite" |
| 42 | PACKAGECONFIG[stroke] = "--enable-stroke,--disable-stroke,,${PN}-plugin-stroke" |
| 43 | PACKAGECONFIG[swanctl] = "--enable-swanctl,--disable-swanctl,,libgcc" |
| 44 | |
| 45 | # requires swanctl |
| 46 | PACKAGECONFIG[systemd-charon] = "--enable-systemd,--disable-systemd,systemd," |
| 47 | |
| 48 | inherit autotools systemd pkgconfig |
| 49 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 50 | RRECOMMENDS:${PN} = "kernel-module-ipsec" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 51 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 52 | FILES:${PN} += "${libdir}/ipsec/lib*${SOLIBS}" |
| 53 | FILES:${PN}-dbg += "${bindir}/.debug ${sbindir}/.debug ${libdir}/ipsec/.debug ${libexecdir}/ipsec/.debug" |
| 54 | FILES:${PN}-dev += "${libdir}/ipsec/lib*${SOLIBSDEV} ${libdir}/ipsec/*.la ${libdir}/ipsec/include/config.h" |
| 55 | FILES:${PN}-staticdev += "${libdir}/ipsec/*.a" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 56 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 57 | CONFFILES:${PN} = "${sysconfdir}/*.conf ${sysconfdir}/ipsec.d/*.conf ${sysconfdir}/strongswan.d/*.conf" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 58 | |
| 59 | PACKAGES += "${PN}-plugins" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 60 | ALLOW_EMPTY:${PN}-plugins = "1" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 61 | |
| 62 | PACKAGES_DYNAMIC += "^${PN}-plugin-.*$" |
| 63 | NOAUTOPACKAGEDEBUG = "1" |
| 64 | |
| 65 | python 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 Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 72 | oldfiles = d.getVar('CONFFILES:' + pkg) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 73 | newfile = '/' + os.path.relpath(f, dvar) |
| 74 | |
| 75 | if not oldfiles: |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 76 | d.setVar('CONFFILES:' + pkg, newfile) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 77 | else: |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 78 | d.setVar('CONFFILES:' + pkg, oldfiles + " " + newfile) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 79 | |
| 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 Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 89 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 93 | } |
| 94 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 95 | PACKAGESPLITFUNCS:prepend = "split_strongswan_plugins " |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 96 | |
| 97 | # Install some default plugins based on default strongSwan ./configure options |
| 98 | # See https://wiki.strongswan.org/projects/strongswan/wiki/Pluginlist |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 99 | RDEPENDS:${PN} += "\ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 100 | ${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 Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 133 | RPROVIDES:${PN} += "${PN}-systemd" |
| 134 | RREPLACES:${PN} += "${PN}-systemd" |
| 135 | RCONFLICTS:${PN} += "${PN}-systemd" |
Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 136 | |
| 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 Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 140 | SYSTEMD_SERVICE:${PN} = " \ |
Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 141 | ${@bb.utils.contains('PACKAGECONFIG', 'swanctl', '${BPN}.service', '', d)} \ |
| 142 | ${@bb.utils.contains('PACKAGECONFIG', 'charon', '${BPN}-starter.service', '', d)} \ |
| 143 | " |