1#!/bin/sh
2
3set -e
4
5if [ -z "$1" ]; then
6    echo "build_release <version>"
7    exit 1
8fi
9
10TMP=tmp.build_release
11RELDIR=`pwd`/Release
12VER=$1
13NOW=`date +%Y-%m-%d`
14
15echo "Version: $VER - $NOW"
16
17DATEw=`head -n 3 wpa_supplicant/ChangeLog | tail -n 1 | sed "s/ .*//"`
18DATEh=`head -n 3 hostapd/ChangeLog | tail -n 1 | sed "s/ .*//"`
19
20if [ "$DATEw" != "$NOW" -o "$DATEh" != "$NOW" ]; then
21    echo "NOTE! Date mismatch in ChangeLog: wpa_supplicant $DATEw hostapd $DATEh != $NOW"
22fi
23
24if [ -r $TMP ]; then
25    echo "Temporary directory '$TMP' exists. Remove it before running this."
26    exit 1
27fi
28
29mkdir $TMP
30mkdir -p $RELDIR
31
32git archive --format=tar --prefix=wpa-$VER/ HEAD \
33	README COPYING CONTRIBUTIONS src wpa_supplicant hostapd hs20 |
34	gzip > $RELDIR/wpa-$VER.tar.gz
35git archive --format=tar --prefix=hostapd-$VER/ HEAD \
36	README COPYING CONTRIBUTIONS src hostapd |
37	gzip > $RELDIR/hostapd-$VER.tar.gz
38git archive --format=tar --prefix=wpa_supplicant-$VER/ HEAD \
39	README COPYING CONTRIBUTIONS src wpa_supplicant hs20/client |
40	tar --directory=$TMP -xf -
41
42cd $TMP
43make -C wpa_supplicant-$VER/wpa_supplicant/doc/docbook man
44rm -f wpa_supplicant-$VER/wpa_supplicant/doc/docbook/manpage.{links,refs}
45tar czf $RELDIR/wpa_supplicant-$VER.tar.gz wpa_supplicant-$VER
46cd ..
47rm -r $TMP
48