source: trunk/debian/package/hostapd/build.sh @ 517

Last change on this file since 517 was 517, checked in by amain, 6 years ago

Merge contrib branch 340:516. Main features added:

  • updated plugin architecture
  • improved patch system
  • bitten continous integration support
  • sever build fixed over time to remain in sync with OpenWrt
  • Property svn:executable set to *
File size: 3.0 KB
RevLine 
[85]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
[210]11VERBOSE=0
[85]12
13[ "1" == $VERBOSE ] && set -x
14
15PACKAGE=hostapd
16VERSION=1.0
17RELEASE=1
[517]18DOWNLOAD_URL=svn://svn.openwrt.org/openwrt/trunk/package/network/services/${PACKAGE}
[85]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}
[208]29svn checkout ${DOWNLOAD_URL} ${BUILD_DIR} | tail -n 3
[85]30
31VERSION=`cat ${BUILD_DIR}/Makefile  | grep ^PKG_VERSION | awk -F ":=" '{print $2}'`
32OPENWRT_VERSION=${VERSION:=20100705}
[86]33PACKAGE_SOURCE=hostapd-${OPENWRT_VERSION}.tar.bz2
34DOWNLOAD_URL2=http://mirror2.openwrt.org/sources/hostapd-${OPENWRT_VERSION}.tar.bz2
[85]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
[86]45# download madwifi from openwrt, to determine which madwifi version to use
[517]46# apparantly madwifi has been depricated by openwrt. Hostapd does not appear
47# to need madwifi sources anymore
48# DOWNLOAD_URL3=svn://svn.openwrt.org/openwrt/trunk/package/madwifi
49# mkdir -p ${BUILD_DIR}/src/madwifi
50# svn checkout ${DOWNLOAD_URL3} ${BUILD_DIR}/src/madwifi | tail -n 3
51#
52## download correct version from madwifi
53#REV=`cat ${BUILD_DIR}/src/madwifi/Makefile  | grep ^PKG_REV | awk -F ":=" '{print $2}'`
54#OPENWRT_VERSION="r${REV:=3314}"
55#PACKAGE_SOURCE=madwifi-trunk-${OPENWRT_VERSION}.tar.gz
56#DOWNLOAD_URL4=http://mirror2.openwrt.org/sources/${PACKAGE_SOURCE}
57#
58#if [ ! -s ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} ]; then rm -f ${DOWNLOAD_DIR}/${PACKAGE_SOURCE}; wget -O ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} $DOWNLOAD_URL4; fi
59#tar xzf ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} -C ${BUILD_DIR}/src/madwifi --strip 1
[86]60
[85]61# cp config file
62cp ${BUILD_DIR}/files/hostapd-mini.config ${BUILD_DIR}/src/hostapd/.config
63
64# make sure it compiles
65echo "CONFIG_INTERNAL_LIBTOMMATH=internal" >>${BUILD_DIR}/src/hostapd/.config
66
67# temporary remove madwifi
[86]68#sed -i '/CONFIG_DRIVER_MADWIFI/d' ${BUILD_DIR}/src/hostapd/.config
[85]69
[216]70# apply debwrt patches, if any
71for patch in $( ls patches/*.diff )
72do
73    echo "I:patch file = ${patch}"
74    patch -d ${BUILD_DIR} -p0 < ${patch}
75done
76
[85]77if [ ! -d debian ]; then
78   cd ${BUILD_DIR} 
79   dh_make -c gpl -e "amain@debwrt.net" -s -n
80   echo "Please complete debian package configuration. And copy the files back to the svn working directory."
81   exit 1
82else
[209]83   cp -a debian ${BUILD_DIR}
[85]84   cd ${BUILD_DIR}
85   dpkg-buildpackage -a${ARCH} -rfakeroot
[215]86   find ${BUILD_BASE_DIR} -maxdepth 1 -name "*.deb"  | xargs -r -t -i sudo dpkg-cross -a ${ARCH} -i {} || true
[85]87fi
88
Note: See TracBrowser for help on using the repository browser.