#! /usr/bin/make -f
FUSIONFORGE=FusionForge
-PKGNAME=gforge
+PKGDIR=gforge
+PKGNAME=$(shell head -1 $(PKGDIR)/debian/changelog | sed 's/ .*//')
PKGLETTER=$(shell echo $(PKGNAME) | cut -c1)
ORIGIN=debian.fusionforge.org
BRANCH=$(shell [ "$(shell echo $(basename $(CURDIR)) | sed 's/.*runk.*/trunk/')" = "trunk" ] && echo svn || echo brc)
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)
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
+DEBIANOP=--debootstrapopts --include=apt
+
+gfversion=$(shell head -1 $(PKGDIR)/debian/changelog | sed 's/.*(\(.*\)-[^-]*).*/\1/')
+in_svn_repo:= $(wildcard .svn/)
+ifeq ($(strip $(in_svn_repo)),)
+in_bzr_repo:= $(shell bzr info | grep parent | cut -d: -f2-)
+ifeq ($(strip $(in_bzr_repo)),)
+ svnrev=unknown
+else
+ svnrev=$(shell LANG=C svn info $(in_bzr_repo) | grep Revision | cut -d: -f2| sed 's/ //g')
+endif
+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
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
-squeeze: # Simply build squeeze packages #
+rlenny: # Make a lenny repository #
+ make repodeb DEBIANLIST=1lenny
+
+squeeze: # Simply build squeeze packages #
make cowbuilddeb DEBIANLIST=2squeeze
-sid: # Simply build squeeze packages #
+rsqueeze: # Make a squeeze repository #
+ make repodeb DEBIANLIST=2squeeze
+
+sid: # Simply build sid packages #
make cowbuilddeb DEBIANLIST=3sid
-rlenny: # Make a lenny repository #
- make repodeb DEBIANLIST=1lenny
+rsid: # Make a sid repository #
+ make repodeb DEBIANLIST=3sid
-intrepid: # Simply build intrepid packages #
+#:======== Ubuntu Builds ============#
+intrepid: # Simply build intrepid packages #
make cowbuildubu UBUNTULIST=1intrepid
-jaunty: # Simply build jaunty packages #
+rintrepid: # Make an intrepid repository #
+ make repoubu UBUNTULIST=1intrepid
+
+jaunty: # Simply build jaunty packages #
make cowbuildubu UBUNTULIST=1jaunty
-karmic: # Simply build karmic packages #
+rjaunty: # Make a jaunty repository #
+ make repoubu UBUNTULIST=1jaunty
+
+karmic: # Simply build karmic packages #
make cowbuildubu UBUNTULIST=1karmic
-rkarmic: # Make a karmic repository #
+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 #
-
+phpdoc: phpdocumentor_get phpdocumentor_unpack $(documentor_path)/$(documentor_vers)/patched $(PKGDIR)/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:
[ ! -d $(documentor_path)/$(documentor_vers) ] && cd $(documentor_path) && tar xvzf $(documentor_vers).tar.gz || true
$(documentor_path)/$(documentor_vers)/patched:
- cd $(documentor_path)/ && patch -p2 < $(CURDIR)/$(PKGNAME)/docs/phpdoc/manageclass.patch && touch $(documentor_path)/$(documentor_vers)/patched
-$(PKGNAME)/docs/phpdoc/docs:
- cd $(PKGNAME)/docs/phpdoc/ && ./makedoc.sh
+ cd $(documentor_path)/ && patch -p2 < $(CURDIR)/$(PKGDIR)/docs/phpdoc/manageclass.patch && touch $(documentor_path)/$(documentor_vers)/patched
+$(PKGDIR)/docs/phpdoc/docs:
+ cd $(PKGDIR)/docs/phpdoc/ && ./makedoc.sh
#
# Build with cowbuilder or pbuilder
$(BUILDRESULT)/$(PCHANGEFILE): $(BUILDFILES)/$(PDSCFILE)
$(PBUILDERCMD)
-$(BUILDFILES)/$(DSCFILE): $(BUILDFILES)/$(ORIGFILE)
- cd $(PKGNAME) ; debclean
- 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)/
+$(BUILDFILES)/$(DSCFILE):
+ cd $(PKGDIR) ; debclean
+ find $(PKGDIR) -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
- cd $(BUILDFILES) ; dpkg-source -b $(PKGNAME)
- rm -rf $(BUILDFILES)/$(PKGNAME)
-
-$(BUILDFILES)/$(PDSCFILE): $(BUILDFILES)/$(ORIGFILE)
- cd $(PKGNAME) ; debclean
- 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)/
+ cd $(BUILDFILES)/$(PKGDIR); dch -b -v $(gfversion)$(MINOR) -D UNRELEASED "This is $(DISTRIB) autobuild"
+ perl -pi -e "s/UNRELEASED/$(DISTRIB)/" $(BUILDFILES)/$(PKGDIR)/debian/changelog
+ cd $(BUILDFILES) ; dpkg-source -b $(PKGDIR)
+ rm -rf $(BUILDFILES)/$(PKGDIR)
+
+$(BUILDFILES)/$(PDSCFILE):
+ cd $(PKGDIR) ; debclean
+ find $(PKGDIR) -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
+ cd $(BUILDFILES)/$(PKGDIR); dch -b -v $(gfversion)$(MINOR)+p -D UNRELEASED "This is $(DISTRIB) autobuild"
+ perl -pi -e "s/UNRELEASED/$(DISTRIB)/" $(BUILDFILES)/$(PKGDIR)/debian/changelog
cd $(BUILDFILES) ; dpkg-source -b $(PKGNAME)
- rm -rf $(BUILDFILES)/$(PKGNAME)
+ rm -rf $(BUILDFILES)/$(PKGDIR)
$(BUILDFILES)/$(ORIGFILE): $(TARBALLS)/$(ORIGFILE)
cp $(TARBALLS)/$(ORIGFILE) $(BUILDFILES)
$(TARBALLS)/$(ORIGFILE): $(TARBALLS)
- cd $(PKGNAME) ; debclean
- 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)
-
+ cd $(PKGDIR) ; debclean
+ find $(PKGDIR) -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/ | grep -v \\.jar$$ | grep -v \\.pdf$$ | grep -v plugins/fckeditor/www/_samples | cpio -o -H ustar | gzip > $(TARBALLS)/$(ORIGFILE)
pbuilderenv: $(PBUILDERTGZ) $(PBUILDERTGZ)/base-$(DISTRIB).tgz
@echo "Ready for $(DISTRIB)"
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: