Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.PHONY: all clean libnl iw wpa_supplicant
.PHONY: all clean iw wpa_supplicant hostapd

all: libnl iw wpa_supplicant

libnl:
./build_libnl.sh
all: iw wpa_supplicant hostapd

openssl:
./build_openssl.sh

iw: libnl
iw:
./build_iw.sh

wpa_supplicant: libnl
wpa_supplicant:
./build_wpas.sh

hostapd:
./build_hostapd.sh

clean:
rm -rf *.tar.gz *.tar.xz prefix/ binaries/ libnl-3.5.0/ openssl-1.1.1g/ iw-5.8/ wpa_supplicant-2.9/
rm -rf *.tar.gz *.tar.xz prefix/ binaries/ openssl-1.1.1g/ iw-*/ wpa_supplicant-*/ hostapd-*/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository contains scripts for building statically linked **iw** and **wpa
## How to build
### Install requirements (Alpine Linux edge)
```
apk add build-base bison flex gawk linux-headers pkgconf readline-static perl
apk add build-base bison flex gawk linux-headers pkgconf readline-static perl libnl3-dev libnl3-static openssl-dev openssl-libs-static
```
### Build
#### iw
Expand All @@ -22,4 +22,4 @@ LIBS += -lcrypto -lssl
```
#### iw and wpa_supplicant both (excluding openssl)
`make`
### Once built, the executables will be located in the `binaries/` folder
### Once built, the executables will be located in the `binaries/` folder
36 changes: 36 additions & 0 deletions build_hostapd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
set -e

hostapd_url="https://www.w1.fi/releases"
hostapd_tgz="$(wget -O - $hostapd_url | grep -E '>hostapd-[0-9.]+.tar.gz<' | cut -d'>' -f7 | cut -d'<' -f1 | sort | tail -1)"
hostapd_url="$hostapd_url/$hostapd_tgz"
hostapd_dir="${hostapd_tgz%.tar.gz}"

prefix="`pwd`/prefix"
binaries="`pwd`/binaries"

# fetch source code archive
[ -f "$hostapd_tgz" ] || wget $hostapd_url

# unpack source files
[ -d "$hostapd_dir" ] || tar xf "${hostapd_tgz}"

# set hostapd build configuration
cp hostapd_build_config "$hostapd_dir/hostapd/.config"

# build hostapd
if ! [ -f "${hostapd_dir}/hostapd/wpa_supplicant" ] ; then
cd "$hostapd_dir/hostapd/"
(
make -j`nproc --all` LDFLAGS+="-static"
# binaries output directory
[ -d "$binaries" ] || mkdir $binaries

cp hostapd "$binaries/"
cp hostapd_cli "$binaries/"
strip -s "$binaries/hostapd"
strip -s "$binaries/hostapd_cli"
)
fi

echo "hostapd has been compiled. Executables placed in $binaries"
5 changes: 3 additions & 2 deletions build_iw.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/sh
set -e

iw_txz="iw-5.9.tar.xz"
iw_url="https://kernel.org/pub/software/network/iw/$iw_txz"
iw_url="https://kernel.org/pub/software/network/iw"
iw_txz="$(wget -O - $iw_url | grep '.xz' | cut -d'>' -f2 | cut -d'<' -f1 | sort | tail -1)"
iw_url="$iw_url/$iw_txz"
iw_dir="${iw_txz%.tar.xz}"

prefix="`pwd`/prefix"
Expand Down
5 changes: 3 additions & 2 deletions build_wpas.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/sh
set -e

wpas_tgz="wpa_supplicant-2.9.tar.gz"
wpas_url="https://www.w1.fi/releases/$wpas_tgz"
wpas_url="https://www.w1.fi/releases"
wpas_tgz="$(wget -O - $wpas_url | grep -E '>wpa_supplicant-[0-9.]+.tar.gz<' | cut -d'>' -f7 | cut -d'<' -f1 | sort | tail -1)"
wpas_url="$wpas_url/$wpas_tgz"
wpas_dir="${wpas_tgz%.tar.gz}"

prefix="`pwd`/prefix"
Expand Down
Loading