PKGNAME=gforge
PKGLETTER=$(shell echo $(PKGNAME) | cut -c1)
ORIGIN=debian.fusionforge.org
-BRANCH=$(shell [ "$(basename $(pwd))" = "trunk" ] && echo svn || echo brc)
+BRANCH=$(shell [ "$(shell echo $(basename $(CURDIR)) | sed 's/.*runk.*/trunk/')" = "trunk" ] && echo svn || echo brc)
BUILDPLACE=$(CURDIR)/builder/buildplace
BUILDFILES=$(CURDIR)/builder/buildfiles
BUILDRESULT=$(CURDIR)/result
DISTRIB=$(shell echo $(XDISTRIB) | cut -c2-)
LOCALREPODEB=/var/www/debian-fusionforge-$(BRANCH)
LOCALREPOUBU=/var/www/ubuntu-fusionforge-$(BRANCH)
+SIGNKEY=yes
DEBIANLIST=1lenny 2squeeze 3sid
DEBIANLISTP=1etch
DEBLIST=$(DEBIANLIST) $(DEBIANLISTP)
-UBUNTULIST=1hardy 1intrepid 1jaunty
+UBUNTULIST=1hardy 1intrepid 1jaunty 1karmic
UBUNTULISTP=1gutsy
UBULIST=$(UBUNTULIST) $(UBUNTULISTP)
# Try if a local mirror is available
-UBUNTUOP=$(shell wget -q -S http://localhost/ubuntu -O /dev/null && echo "--mirror http://localhost/ubuntu" || echo "--mirror http://archive.ubuntu.com/ubuntu") --debootstrap debootstrap
-
-gfversion=$(shell head -1 $(PKGNAME)/debian/changelog | sed 's/.*(\(.[^+-]*\).*).*/\1/')
-gfminor=$(shell head -1 $(PKGNAME)/debian/changelog | sed 's/.*(.[^+-]*[+-]\(.*\)).*/\1/')
-svnrev=$(shell LANG=C svn info | grep Revision | cut -d: -f2| sed 's/ //g')
+LOCALMIRROR=http://localhost/ubuntu
+UBUNTUOP=$(shell wget -q -S http://localhost/ubuntu -O /dev/null && echo "--mirror $(LOCALMIRROR)" || echo "--mirror http://archive.ubuntu.com/ubuntu") --debootstrap debootstrap
+gfversion=$(shell head -1 $(PKGNAME)/debian/changelog | sed 's/.*(\(.*\)-[^-]*).*/\1/')
+in_svn_repo:= $(wildcard .svn/)
+ifeq ($(strip $(in_svn_repo)),)
+ svnrev=unknown
+else
+ svnrev=$(shell LANG=C svn info | grep Revision | cut -d: -f2| sed 's/ //g')
+endif
MINOR=-1
MINOR=-$(BRANCH)$(svnrev)+$(XDISTRIB)
DEBUG=--debug
DEBUG=
DEBBUILDOPTS=--debbuildopts -sa
+ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
UBUHOOK="--hookdir $(CURDIR)/hook/ubuntu"
# Some doc found there http://wiki.debian.org/cowbuilder
# Hook are not anymore necessary, but I keep as an example
UBUHOOK="--components 'main universe' --debootstrapopts --exclude=udev,pcmciautils,initramfs-tools"
-UBUHOOK=--components "main universe"
+UBUHOOK=--components "main universe" --hookdir $(CURDIR)/hook/ubuntu
ORIGFILE=$(PKGNAME)_$(gfversion).orig.tar.gz
DSCFILE=$(PKGNAME)_$(gfversion)$(MINOR).dsc
PDSCFILE=$(PKGNAME)_$(gfversion)$(MINOR)+p.dsc
-CHANGEFILE=$(PKGNAME)_$(gfversion)$(MINOR)_i386.changes
-PCHANGEFILE=$(PKGNAME)_$(gfversion)$(MINOR)+p_i386.changes
+CHANGEFILE=$(PKGNAME)_$(gfversion)$(MINOR)_$(ARCH).changes
+PCHANGEFILE=$(PKGNAME)_$(gfversion)$(MINOR)+p_$(ARCH).changes
# Quite heavy version, but still requires to be root
COWBUILDERCMD=cd $(BUILDPLACE) && dpkg-source -x $(BUILDFILES)/$(DSCFILE) ; cd $(BUILDPLACE)/$(PKGNAME)-$(gfversion) && pdebuild --pbuilder cowbuilder --buildresult $(BUILDRESULT) -- --basepath $(COWBUILDERBASE)/base-$(DISTRIB).cow --buildplace $(BUILDPLACE) --aptcache $(APTCACHE) ; rm -rf $(BUILDPLACE)/$(PKGNAME)-$(gfversion)
list:
@echo ======================================================================================
- @echo '= Available target are listed below $(BRANCH) ='
+ @echo '= Available targets are listed below ($(BRANCH))($(ARCH)) ='
@echo ======================================================================================
@cat Makefile.debian | grep '^.*:.*#$$' | sed 's/FUSIONFORGE/$(FUSIONFORGE)/' | sed 's/^\(.*:\).*#\(.*\)#$$/\1 \2/'
@echo ======================================================================================
#
# Simple targets
#
+#:======== Debian Builds ============#
lenny: # Simply build lenny packages #
make cowbuilddeb DEBIANLIST=1lenny
-intrepid: # Simply build intrepid packages #
+rlenny: # Make a lenny repository #
+ make repodeb DEBIANLIST=1lenny
+
+squeeze: # Simply build squeeze packages #
+ make cowbuilddeb DEBIANLIST=2squeeze
+
+rsqueeze: # Make a squeeze repository #
+ make repodeb DEBIANLIST=2squeeze
+
+sid: # Simply build sid packages #
+ make cowbuilddeb DEBIANLIST=3sid
+
+rsid: # Make a sid repository #
+ make repodeb DEBIANLIST=3sid
+
+#:======== Ubuntu Builds ============#
+intrepid: # Simply build intrepid packages #
make cowbuildubu UBUNTULIST=1intrepid
+rintrepid: # Make an intrepid repository #
+ make repoubu UBUNTULIST=1intrepid
+
+jaunty: # Simply build jaunty packages #
+ make cowbuildubu UBUNTULIST=1jaunty
+
+rjaunty: # Make a jaunty repository #
+ make repoubu UBUNTULIST=1jaunty
+karmic: # Simply build karmic packages #
+ make cowbuildubu UBUNTULIST=1karmic
+
+rkarmic: # Make a karmic repository #
+ make repoubu UBUNTULIST=1karmic
+
+#:======== Other and Multiple Builds ============#
documentor_path=/tmp
documentor_vers=phpdocumentor-1.3.0rc3
# PHPDOCUMENTOR
#
phpdoc: phpdocumentor_get phpdocumentor_unpack $(documentor_path)/$(documentor_vers)/patched $(PKGNAME)/docs/phpdoc/docs # Get phpdocumentor, install phpdocumentor, build $(PKGNAME) phpdoc #
-
+
phpdocumentor_get:
[ ! -f $(documentor_path)/$(documentor_vers).tar.gz ] && cd $(documentor_path) && wget http://heanet.dl.sourceforge.net/sourceforge/phpdocu/$(documentor_vers).tar.gz || true
phpdocumentor_unpack:
# Build with cowbuilder or pbuilder
#
-all: cowbuilddeb cowbuildubu # ***** Build all package for debian and ubuntu ***** #
+all: cleanorig cowbuilddeb cowbuildubu # ***** Build all package for debian and ubuntu ***** #
deploy: repodeb repoubu # ***** Deploy packages in Debian and Ubuntu repositories ***** #
$(BUILDFILES)/$(DSCFILE): $(BUILDFILES)/$(ORIGFILE)
cd $(PKGNAME) ; debclean
- find $(PKGNAME) -type f -or -type l | grep -v '/CVS/' | grep -v '/.svn/' | grep -v rpm-specific | grep -v docs/phpdoc/docs | grep -v ^./debian/ | cpio -pdumB $(BUILDFILES)/
+ find $(PKGNAME) -type f -or -type l | grep -v '/CVS/' | grep -v '/.svn/' | grep -v '/.testbox/' | grep -v rpm-specific | grep -v docs/phpdoc/docs | grep -v ^./debian/ | cpio -pdumB $(BUILDFILES)/
# Set version for given distrib
cd $(BUILDFILES)/$(PKGNAME); dch -b -v $(gfversion)$(MINOR) -D UNRELEASED "This is $(DISTRIB) autobuild"
perl -pi -e "s/UNRELEASED/$(DISTRIB)/" $(BUILDFILES)/$(PKGNAME)/debian/changelog
$(BUILDFILES)/$(PDSCFILE): $(BUILDFILES)/$(ORIGFILE)
cd $(PKGNAME) ; debclean
- find $(PKGNAME) -type f -or -type l | grep -v '/CVS/' | grep -v '/.svn/' | grep -v rpm-specific | grep -v docs/phpdoc/docs | grep -v ^./debian/ | cpio -pdumB $(BUILDFILES)/
+ find $(PKGNAME) -type f -or -type l | grep -v '/CVS/' | grep -v '/.svn/' | grep -v '/.testbox/' | grep -v rpm-specific | grep -v docs/phpdoc/docs | grep -v ^./debian/ | cpio -pdumB $(BUILDFILES)/
# Set version for given distrib
cd $(BUILDFILES)/$(PKGNAME); dch -b -v $(gfversion)$(MINOR)+p -D UNRELEASED "This is $(DISTRIB) autobuild"
perl -pi -e "s/UNRELEASED/$(DISTRIB)/" $(BUILDFILES)/$(PKGNAME)/debian/changelog
$(TARBALLS)/$(ORIGFILE): $(TARBALLS)
cd $(PKGNAME) ; debclean
- find $(PKGNAME) -type f -or -type l | grep -v '/CVS/' | grep -v '/.svn/' | grep -v rpm-specific | grep -v docs/phpdoc/docs | grep -v ^./debian/ | cpio -o -H ustar | gzip > $(TARBALLS)/$(ORIGFILE)
-
+ find $(PKGNAME) -type f -or -type l | grep -v '/CVS/' | grep -v '/.svn/' | grep -v '/.testbox/' | grep -v rpm-specific | grep -v docs/phpdoc/docs | grep -v ^./debian/ | cpio -o -H ustar | gzip > $(TARBALLS)/$(ORIGFILE)
pbuilderenv: $(PBUILDERTGZ) $(PBUILDERTGZ)/base-$(DISTRIB).tgz
@echo "Ready for $(DISTRIB)"
cowbuilderenv: $(COWBUILDERBASE) $(COWBUILDERBASE)/base-$(DISTRIB).stamp
@echo "Ready for $(DISTRIB)"
+ sudo /usr/sbin/cowbuilder --update $(HOOK) --distribution $(DISTRIB) --basepath $(COWBUILDERBASE)/base-$(DISTRIB).cow --configfile $(COWBUILDERBASE)/config $(DISTROOP)
$(PBUILDERTGZ)/base-$(DISTRIB).tgz: $(PBUILDERTGZ)/config
sudo /usr/sbin/pbuilder --create --distribution $(DISTRIB) --basetgz $(PBUILDERTGZ)/base-$(DISTRIB).tgz --configfile $(PBUILDERTGZ)/config $(DISTROOP)
sudo apt-get install cowdancer
localrepo: $(LOCALREPO) $(LOCALREPO)/conf $(LOCALREPO)/conf/distributions
-
+
reprepro: $(LOCALREPO)/pool/main/$(PKGLETTER)/$(PKGNAME)/$(DSCFILE) # Install in repository
$(LOCALREPO)/pool/main/$(PKGLETTER)/$(PKGNAME)/$(DSCFILE): $(BUILDRESULT)/$(CHANGEFILE)
echo "Origin: $(ORIGIN)" ; \
echo "Version: 4.7" ; \
echo "Description: My $(FUSIONFORGE) $$dist repository" ; \
- echo "SignWith: yes" ; \
+ echo "SignWith: $(SIGNKEY)" ; \
echo "" ; done >> $(LOCALREPO)/conf/distributions
$(LOCALREPO)/conf:
$(LOCALREPO):
sudo mkdir $(LOCALREPO)
sudo chown `id -u`.`id -g` $(LOCALREPO)
+
+clean: # Clean $(BUILDPLACE) $(BUILDFILES) $(TARBALLS) (intermediate files) #
+ rm -rf $(BUILDPLACE) $(BUILDFILES) $(TARBALLS)
+
+cleanenv: # Clean $(COWBUILDERBASE) $(PBUILDERTGZ) (chroots)#
+ rm -rf $(COWBUILDERBASE) $(PBUILDERTGZ)
+
+cleancache: # Clean $(APTCACHE) (apt cache) #
+ rm -rf $(APTCACHE)
+
+cleanorig: # Clean $(TARBALLS)/$(ORIGFILE) #
+ rm -f $(TARBALLS)/$(ORIGFILE)