blob: fe5fa2b82ee22f7a3cfe6926987ca5f00ef3cb1b [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "Client for Wi-Fi Protected Access (WPA)"
2HOMEPAGE = "http://w1.fi/wpa_supplicant/"
3BUGTRACKER = "http://w1.fi/security/"
4SECTION = "network"
5LICENSE = "BSD"
6LIC_FILES_CHKSUM = "file://COPYING;md5=a3791c270ad6bb026707d17bf750e5ef \
7 file://README;beginline=1;endline=56;md5=495cbce6008253de4b4d8f4cdfae9f4f \
8 file://wpa_supplicant/wpa_supplicant.c;beginline=1;endline=12;md5=a5687903a31b8679e6a06b3afa5c819e"
9DEPENDS = "dbus libnl"
10RRECOMMENDS_${PN} = "wpa-supplicant-passphrase wpa-supplicant-cli"
11
12PACKAGECONFIG ??= "gnutls"
13PACKAGECONFIG[gnutls] = ",,gnutls libgcrypt"
14PACKAGECONFIG[openssl] = ",,openssl"
15
16inherit pkgconfig systemd
17
18SYSTEMD_SERVICE_${PN} = "wpa_supplicant.service wpa_supplicant-nl80211@.service wpa_supplicant-wired@.service"
19SYSTEMD_AUTO_ENABLE = "disable"
20
21SRC_URI = "http://w1.fi/releases/wpa_supplicant-${PV}.tar.gz \
22 file://defconfig \
23 file://wpa-supplicant.sh \
24 file://wpa_supplicant.conf \
25 file://wpa_supplicant.conf-sane \
26 file://99_wpa_supplicant \
27 file://0001-replace-systemd-install-Alias-with-WantedBy.patch \
28 "
29SRC_URI[md5sum] = "a68538fb62766f40f890125026c42c10"
30SRC_URI[sha256sum] = "76ea6b06b7a2ea8e6d9eb1a9166166f1656e6d48c7508914f592100c95c73074"
31
32CVE_PRODUCT = "wpa_supplicant"
33
34S = "${WORKDIR}/wpa_supplicant-${PV}"
35
36PACKAGES_prepend = "wpa-supplicant-passphrase wpa-supplicant-cli "
37FILES_wpa-supplicant-passphrase = "${bindir}/wpa_passphrase"
38FILES_wpa-supplicant-cli = "${sbindir}/wpa_cli"
39FILES_${PN} += "${datadir}/dbus-1/system-services/*"
40CONFFILES_${PN} += "${sysconfdir}/wpa_supplicant.conf"
41
42do_configure () {
43 ${MAKE} -C wpa_supplicant clean
44 install -m 0755 ${WORKDIR}/defconfig wpa_supplicant/.config
45
46 if echo "${PACKAGECONFIG}" | grep -qw "openssl"; then
47 ssl=openssl
48 elif echo "${PACKAGECONFIG}" | grep -qw "gnutls"; then
49 ssl=gnutls
50 fi
51 if [ -n "$ssl" ]; then
52 sed -i "s/%ssl%/$ssl/" wpa_supplicant/.config
53 fi
54
55 # For rebuild
56 rm -f wpa_supplicant/*.d wpa_supplicant/dbus/*.d
57}
58
59export EXTRA_CFLAGS = "${CFLAGS}"
60export BINDIR = "${sbindir}"
61
62do_compile () {
63 unset CFLAGS CPPFLAGS CXXFLAGS
64 sed -e "s:CFLAGS\ =.*:& \$(EXTRA_CFLAGS):g" -i ${S}/src/lib.rules
65 oe_runmake -C wpa_supplicant
66}
67
68do_install () {
69 install -d ${D}${sbindir}
70 install -m 755 wpa_supplicant/wpa_supplicant ${D}${sbindir}
71 install -m 755 wpa_supplicant/wpa_cli ${D}${sbindir}
72
73 install -d ${D}${bindir}
74 install -m 755 wpa_supplicant/wpa_passphrase ${D}${bindir}
75
76 install -d ${D}${docdir}/wpa_supplicant
77 install -m 644 wpa_supplicant/README ${WORKDIR}/wpa_supplicant.conf ${D}${docdir}/wpa_supplicant
78
79 install -d ${D}${sysconfdir}
80 install -m 600 ${WORKDIR}/wpa_supplicant.conf-sane ${D}${sysconfdir}/wpa_supplicant.conf
81
82 install -d ${D}${sysconfdir}/network/if-pre-up.d/
83 install -d ${D}${sysconfdir}/network/if-post-down.d/
84 install -d ${D}${sysconfdir}/network/if-down.d/
85 install -m 755 ${WORKDIR}/wpa-supplicant.sh ${D}${sysconfdir}/network/if-pre-up.d/wpa-supplicant
86 cd ${D}${sysconfdir}/network/ && \
87 ln -sf ../if-pre-up.d/wpa-supplicant if-post-down.d/wpa-supplicant
88
89 install -d ${D}/${sysconfdir}/dbus-1/system.d
90 install -m 644 ${S}/wpa_supplicant/dbus/dbus-wpa_supplicant.conf ${D}/${sysconfdir}/dbus-1/system.d
91 install -d ${D}/${datadir}/dbus-1/system-services
92 install -m 644 ${S}/wpa_supplicant/dbus/*.service ${D}/${datadir}/dbus-1/system-services
93
94 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
95 install -d ${D}/${systemd_unitdir}/system
96 install -m 644 ${S}/wpa_supplicant/systemd/*.service ${D}/${systemd_unitdir}/system
97 fi
98
99 install -d ${D}/etc/default/volatiles
100 install -m 0644 ${WORKDIR}/99_wpa_supplicant ${D}/etc/default/volatiles
101}
102
103pkg_postinst_wpa-supplicant () {
104 # If we're offline, we don't need to do this.
105 if [ "x$D" = "x" ]; then
106 killall -q -HUP dbus-daemon || true
107 fi
108
109}