source: debwrt/trunk/debian/package/hostapd/build.sh @ 207

Last change on this file since 207 was 207, checked in by stappers, 12 years ago

hostapd/build.sh: I want to know when dpkg-cross fails

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/bin/bash
2#
3# 1. Download package and unpack package
4# 2. Copy debian/directory to it
5# 3. Run dpkg-buildpackage --arch=<ARCH> -rfakeroot
6
7if [ -z $ARCH ]; then echo "First set \$ARCH before running the build script"; exit 1; fi
8
9export DEBFULLNAME="Amain (DebWrt.net)"
10export LC_ALL=C
11VERBOSE=1
12
13[ "1" == $VERBOSE ] && set -x
14
15PACKAGE=hostapd
16VERSION=1.0
17RELEASE=1
18DOWNLOAD_URL=svn://svn.openwrt.org/openwrt/trunk/package/${PACKAGE}
19DEP=
20
21BASE_DIR=/usr/src
22BUILD_BASE_DIR=${BASE_DIR}/${PACKAGE}
23BUILD_DIR=${BUILD_BASE_DIR}/${PACKAGE}-${VERSION}
24DOWNLOAD_DIR=${BASE_DIR}/dl
25
26mkdir -p $DOWNLOAD_DIR
27rm -rf ${BUILD_DIR}
28mkdir -p ${BUILD_DIR}
29svn co ${DOWNLOAD_URL} ${BUILD_DIR}
30
31VERSION=`cat ${BUILD_DIR}/Makefile  | grep ^PKG_VERSION | awk -F ":=" '{print $2}'`
32OPENWRT_VERSION=${VERSION:=20100705}
33PACKAGE_SOURCE=hostapd-${OPENWRT_VERSION}.tar.bz2
34DOWNLOAD_URL2=http://mirror2.openwrt.org/sources/hostapd-${OPENWRT_VERSION}.tar.bz2
35
36if [ ! -s ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} ]; then rm -f ${DOWNLOAD_DIR}/${PACKAGE_SOURCE}; wget -O ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} $DOWNLOAD_URL2; fi
37mkdir -p ${BUILD_DIR}/src
38tar xjf ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} -C ${BUILD_DIR}/src --strip 1
39
40# apply openwrt patches
41for patch in `ls ${BUILD_DIR}/patches | sort`; do
42    patch -d ${BUILD_DIR}/src -p1 <${BUILD_DIR}/patches/$patch
43done
44
45# download madwifi from openwrt, to determine which madwifi version to use
46DOWNLOAD_URL3=svn://svn.openwrt.org/openwrt/trunk/package/madwifi
47mkdir -p ${BUILD_DIR}/src/madwifi
48svn co ${DOWNLOAD_URL3} ${BUILD_DIR}/src/madwifi
49
50# download correct version from madwifi
51REV=`cat ${BUILD_DIR}/src/madwifi/Makefile  | grep ^PKG_REV | awk -F ":=" '{print $2}'`
52OPENWRT_VERSION="r${REV:=3314}"
53PACKAGE_SOURCE=madwifi-trunk-${OPENWRT_VERSION}.tar.gz
54DOWNLOAD_URL4=http://mirror2.openwrt.org/sources/${PACKAGE_SOURCE}
55
56if [ ! -s ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} ]; then rm -f ${DOWNLOAD_DIR}/${PACKAGE_SOURCE}; wget -O ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} $DOWNLOAD_URL4; fi
57tar xzf ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} -C ${BUILD_DIR}/src/madwifi --strip 1
58
59# cp config file
60cp ${BUILD_DIR}/files/hostapd-mini.config ${BUILD_DIR}/src/hostapd/.config
61
62# make sure it compiles
63echo "CONFIG_INTERNAL_LIBTOMMATH=internal" >>${BUILD_DIR}/src/hostapd/.config
64
65# temporary remove madwifi
66#sed -i '/CONFIG_DRIVER_MADWIFI/d' ${BUILD_DIR}/src/hostapd/.config
67
68if [ ! -d debian ]; then
69   cd ${BUILD_DIR} 
70   dh_make -c gpl -e "amain@debwrt.net" -s -n
71   echo "Please complete debian package configuration. And copy the files back to the svn working directory."
72   exit 1
73else
74   cp -rav debian ${BUILD_DIR}
75   cd ${BUILD_DIR}
76   dpkg-buildpackage -a${ARCH} -rfakeroot
77   find ${BUILD_BASE_DIR} -maxdepth 1 -name "*.deb"  | xargs -r -t -i sudo dpkg-cross -a ${ARCH} -i {}
78fi
79
Note: See TracBrowser for help on using the repository browser.