X-Git-Url: https://scm.fusionforge.org/anonscm/gitweb?p=fusionforge%2Ffusionforge.git;a=blobdiff_plain;f=Makefile.debian;h=6fcbad0d4adf9a549a7871ed1110d38e2384e0e1;hp=555a08eb84acad5f11ff581e9192719afa1a7317;hb=81c6f8079772050d0c1053662f191275db542b81;hpb=16624c5917bc3ba475a436b608101cf872f3e567;ds=sidebyside diff --git a/Makefile.debian b/Makefile.debian index 555a08eb84..6fcbad0d4a 100644 --- a/Makefile.debian +++ b/Makefile.debian @@ -9,7 +9,14 @@ # Built packages will be put into ./result/ # +# You can customize var in several way +# 1 - Setup env vars (available for BUILDERDIR, BUILDRESULT, UBUMIRROR, DEBMIRROR, TARBALLS +# 2 - Create a config/local.$(hostname) file +# # ATTENTION : it requires you to run cowbuilder with sudo +# This also requires the following packages : +# dpkg-dev +# dpkg-parsechangelog # FUSIONFORGE=FusionForge @@ -17,8 +24,6 @@ PKGDIR=src PKGNAME:=$(shell [ ! -f $(PKGDIR)/debian/changelog ] || head -1 $(PKGDIR)/debian/changelog | sed 's/ .*//') PKGLETTER:=$(shell echo $(PKGNAME) | cut -c1) ORIGIN=debian.fusionforge.org -# BRANCH set to 'svn' if checkout from trunk or 'brc' otherwise -BRANCH:=$(shell [ "$(shell echo $(basename $(CURDIR)) | sed 's/.*runk.*/trunk/')" = "trunk" ] && echo svn || echo brc) # ifeq (,$(shell echo "$$BUILDERDIR")) BUILDERDIR=$(CURDIR)/builder @@ -47,9 +52,38 @@ else DEBEMAIL:=$(shell echo $$DEBEMAIL) endif # +ifeq (,$(shell echo "$$TARBALLS")) +TARBALLS:=$(shell echo $$TARBALLS) +else TARBALLS=$(CURDIR)/tarballs +endif +# +# SCM detect +# +# BRANCH set to 'trunk' if checkout from trunk or 'brc' otherwise +BRANCH:=$(shell [ "$(shell echo $(basename $(CURDIR)) | sed 's/.*runk.*/trunk/')" = "trunk" ] && echo svn || echo brc) +# +in_svn_repo:= $(wildcard .svn/) +ifeq ($(strip $(in_svn_repo)),) +in_bzr_repo:= $(wildcard .bzr/) +ifeq ($(strip $(in_bzr_repo)),) +in_git_repo:= $(wildcard .git/) +ifeq ($(strip $(in_git_repo)),) + svnrev=unknown +else + svnrev=git-$(shell git describe --always) + BRANCH:=$(shell git branch|cut -c3-) +endif # git +else + svnrev=bzr$(shell bzr revno) +endif # bzr +else + svnrev:=$(shell LANG=C svn info 2>&1 | grep Revision | cut -d: -f2| sed 's/ //g') +endif # svn + # # Local customization +# ifeq (../../3rd-party,$(shell ls -d ../../3rd-party 2>/dev/null)) -include ../../config/local.$(shell hostname) else @@ -83,34 +117,17 @@ DEBIANOP=--mirror $(DEBMIRROR) --debootstrapopts --include=apt --debootstrap deb ASKPASS=--ask-passphrase ASKPASS= -MAJOR:=$(shell [ ! -f $(PKGDIR)/debian/changelog ] || dpkg-parsechangelog -l$(PKGDIR)/debian/changelog | sed -rne 's,^Version: ([^-]+).*,\1,p') +MAJOR:=$(shell [ ! -f $(PKGDIR)/debian/changelog ] || dpkg-parsechangelog -l$(PKGDIR)/debian/changelog 2>&1 | sed -rne 's,^Version: ([^-]+).*,\1,p') # SMAJOR is MAJOR without epoch if any SMAJOR:=$(shell echo $(MAJOR) | sed 's/^.://') -in_svn_repo:= $(wildcard .svn/) -ifeq ($(strip $(in_svn_repo)),) -in_bzr_repo:= $(wildcard .bzr/) -ifeq ($(strip $(in_bzr_repo)),) -in_git_repo:= $(wildcard .git/) -ifeq ($(strip $(in_git_repo)),) - svnrev=unknown -else - svnrev=git$(shell git describe --always) -endif # git -else - svnrev=bzr$(shell bzr revno) -endif # bzr -else - svnrev:=$(shell LANG=C svn info 2>&1 | grep Revision | cut -d: -f2| sed 's/ //g') -endif # svn - MINOR=-1 -MINOR=-$(BRANCH)$(svnrev)+$(XDISTRIB) +MINOR=-$(BRANCH)-$(svnrev)+$(XDISTRIB) DEBUG=--debug DEBUG= -DEBBUILDOPTS=--debbuildopts -sa -ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) +DEBBUILDOPTS=--debbuildopts -sa +ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH 2>/dev/null) # Some doc found there http://wiki.debian.org/cowbuilder # Hook are not anymore necessary, but I keep as an example @@ -126,14 +143,14 @@ CHANGEFILE=$(PKGNAME)_$(SMAJOR)$(MINOR)_$(ARCH).changes PCHANGEFILE=$(PKGNAME)_$(SMAJOR)$(MINOR)+p_$(ARCH).changes # Quite heavy version, but still requires to be root -COWBUILDERCMD=cd $(BUILDPLACE) && dpkg-source -x $(BUILDFILES)/$(DSCFILE) ; cd $(BUILDPLACE)/$(PKGNAME)-$(SMAJOR) && pdebuild --pbuilder cowbuilder --buildresult $(BUILDRESULT) -- --basepath $(COWBUILDERBASE)/base-$(DISTRIB)-$(ARCH).cow --buildplace $(BUILDPLACE) --aptcache $(APTCACHE) ; rm -rf $(BUILDPLACE)/$(PKGNAME)-$(SMAJOR) +COWBUILDERCMD=cd $(BUILDPLACE) && dpkg-source -x $(BUILDFILES)/$(DSCFILE) ; cd $(BUILDPLACE)/$(PKGNAME)-$(SMAJOR) && pdebuild --pbuilder cowbuilder --buildresult $(BUILDRESULT) -- --basepath $(COWBUILDERBASE)/base-$(DISTRIB)-$(ARCH).cow --buildplace $(BUILDPLACE) --aptcache $(APTCACHE) ; rm -rf $(BUILDPLACE)/$(PKGNAME)-$(SMAJOR) # This one is with sudo and probably faster COWBUILDERCMD=sudo /usr/sbin/cowbuilder --build --basepath $(COWBUILDERBASE)/base-$(DISTRIB)-$(ARCH).cow --configfile $(COWBUILDERBASE)/configfile-$(ARCH) $(BUILDFILES)/$(DSCFILE) $(DEBBUILDOPTS) # This one is with pbuilder PBUILDERCMD=cd $(BUILDFILES) && sudo /usr/sbin/pbuilder --build --basetgz $(PBUILDERTGZ)/base-$(DISTRIB)-$(ARCH).tgz --configfile $(PBUILDERTGZ)/configfile-$(ARCH) $(BUILDFILES)/$(PDSCFILE) -default: list +default: depends list list: @echo ====================================================================================== @@ -219,13 +236,13 @@ documentor_subdir=PhpDocumentor-1.4.3 # orig: # Make Debian package .orig tarball # - $(MAKE) $(TARBALLS)/$(ORIGFILE) + $(MAKE) $(TARBALLS)/$(ORIGFILE) # # PHPDOCUMENTOR # # Get phpdocumentor, install phpdocumentor, build $(PKGNAME) phpdoc -phpdoc: $(PKGDIR)/docs/phpdoc/docs +phpdoc: $(PKGDIR)/docs/phpdoc/docs doc: (cd src/docs/docbook ; make debian TARGET=$(CURDIR)/build/docs/docbook/) @@ -244,7 +261,7 @@ phpdocumentor_unpack: phpdocumentor_get $(documentor_path)/$(documentor_subdir)/patched: phpdocumentor_unpack cd $(documentor_path)/$(documentor_subdir) && \ patch < $(CURDIR)/$(PKGDIR)/docs/phpdoc/phpDocumentor.ini.patch \ - && touch $(documentor_path)/$(documentor_subdir)/patched + && touch $(documentor_path)/$(documentor_subdir)/patched $(PKGDIR)/docs/phpdoc/docs: $(documentor_path)/$(documentor_subdir)/patched cd $(PKGDIR)/docs/phpdoc/ && ./makedoc.sh @@ -440,7 +457,8 @@ $(LOCALREPO): if [ -w `dirname $@` ] ; then mkdir $@ ; else sudo mkdir $@ ; sudo chown `id -u`.`id -g` $@; fi clean: # Clean $(BUILDPLACE) $(BUILDFILES) $(TARBALLS) (intermediate files) # - rm -rf $(BUILDPLACE) $(BUILDFILES) $(TARBALLS) + rm -rf $(BUILDPLACE)/$(PKGNAME)-$(SMAJOR) $(BUILDFILES) $(TARBALLS) + rmdir $(BUILDPLACE) && mkdir $(BUILDPLACE) || true cleanenv: # Clean $(COWBUILDERBASE) $(PBUILDERTGZ) (chroots)# sudo rm -rf $(COWBUILDERBASE) $(PBUILDERTGZ) @@ -474,3 +492,13 @@ gnupgkey: exportgnupgkey: gpg --export --armor $(DEBEMAIL) + +depends: dpkg-dev dpkg-parsechangelog + +testdepends: phpunit php-htmlpurifier pcregrep + +dpkg-dev: + @[ -f /usr/bin/dpkg-architecture ] || (echo "You need to install $@ package" ; exit 1) + +dpkg-parsechangelog: + @[ -f /usr/bin/dpkg-parsechangelog ] || (echo "You need to install $@ package" ; exit 1)