source: trunk/debian/package/broadcom-wl/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: 2.3 KB
RevLine 
[276]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=0
12
13[ "1" == $VERBOSE ] && set -x
14
15PACKAGE=broadcom-wl
16VERSION=1
17RELEASE=1
[517]18DOWNLOAD_URL=svn://svn.openwrt.org/openwrt/trunk/package/kernel/${PACKAGE}
[276]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 checkout ${DOWNLOAD_URL} ${BUILD_DIR}
30
31# PKG_NAME:=broadcom-wl
32# PKG_VERSION:=5.10.56.27.3
33# PKG_RELEASE:=1
34#
35# PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
36# PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
37
38VERSION=`cat ${BUILD_DIR}/Makefile  | grep ^PKG_VERSION | awk -F ":=" '{print $2}'`
39RELEASE=`cat ${BUILD_DIR}/Makefile  | grep ^PKG_RELEASE | awk -F ":=" '{print $2}'`
40
41NEW_BUILD_DIR=${BUILD_BASE_DIR}/${PACKAGE}-${VERSION}
42mv ${BUILD_DIR} ${NEW_BUILD_DIR}
43BUILD_DIR=${NEW_BUILD_DIR}
44
45PACKAGE_SOURCE=${PACKAGE}-${VERSION}_$ARCH.tar.bz2
46DOWNLOAD_URL2=http://mirror2.openwrt.org/sources/${PACKAGE_SOURCE}
47
48if [ ! -s ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} ]; then rm -f ${DOWNLOAD_DIR}/${PACKAGE_SOURCE}; wget -O ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} $DOWNLOAD_URL2; fi
49#mkdir -p ${BUILD_DIR}/src
50tar xjf ${DOWNLOAD_DIR}/${PACKAGE_SOURCE} -C ${BUILD_DIR} --strip 1
51
52# apply openwrt patches
53for patch in `ls ${BUILD_DIR}/patches | sort`; do
54    patch -d ${BUILD_DIR} -p1 <${BUILD_DIR}/patches/$patch
55done
56
57# apply debwrt patches, if any
58for patch in $( ls patches/*.diff )
59do
60    echo "I:patch file = ${patch}"
61    patch -d ${BUILD_DIR} -p0 < ${patch}
62done
63
64if [ ! -d debian ]; then
65   cd ${BUILD_DIR} 
66   dh_make -c gpl -e "amain@debwrt.net" -s -n
67   echo "Please complete debian package configuration. And copy the files back to the svn working directory."
68   exit 1
69else
70   cp -a debian ${BUILD_DIR}
71   cd ${BUILD_DIR}
72   dch -v ${VERSION}-${RELEASE} -m -t "Automated packet generation"
73   dpkg-buildpackage -a${ARCH} -rfakeroot
74   find ${BUILD_BASE_DIR} -maxdepth 1 -name "*.deb"  | xargs -r -t -i sudo dpkg-cross -a ${ARCH} -i {} || true
75fi
Note: See TracBrowser for help on using the repository browser.