diff options
Diffstat (limited to '')
-rw-r--r-- | t/templates/source-make-builder/Makefile.in | 86 | ||||
-rw-r--r-- | t/templates/source-make-builder/fill-values.d/source-make-builder.values | 3 | ||||
-rwxr-xr-x | t/templates/source-make-builder/tar-orig | 8 |
3 files changed, 97 insertions, 0 deletions
diff --git a/t/templates/source-make-builder/Makefile.in b/t/templates/source-make-builder/Makefile.in new file mode 100644 index 0000000..f527523 --- /dev/null +++ b/t/templates/source-make-builder/Makefile.in @@ -0,0 +1,86 @@ +ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + +name = [% $source %] +version = [% $upstream_version %] +type = [% $type %] + +packagedir = $(name)-$(version) +underscored = $(name)_$(version) + +origdata = $(ROOT_DIR)/orig +origstem = $(underscored).orig + +debiandata = $(ROOT_DIR)/debian + +formatfile = $(debiandata)/source/format + +watchfile = $(packagedir)/debian/watch + +post_clean = $(ROOT_DIR)/post-clean +pre_orig = $(ROOT_DIR)/pre-orig +tar_orig = $(ROOT_DIR)/tar-orig +pre_build = $(ROOT_DIR)/pre-build +post_build = $(ROOT_DIR)/post-build + +product = [% $build_product %] + +ifneq (,$(wildcard $(ROOT_DIR)/dpkg-overrides)) +dpkgoverrides = $(shell cat $(ROOT_DIR)/dpkg-overrides) +endif + +ifeq ($(type),native) +dpkgoptions = -sn +else +dpkgoptions = -sp +endif + +.DEFAULT_GOAL := $(product) + +$(product): + -mkdir -p $(packagedir) + if [ -x $(post_clean) ] ; then \ + $(post_clean) $(packagedir) ; \ + fi + + mkdir $(origdata) || true + cp -rp $(origdata)/. $(packagedir) + + if [ "[% $type %]" != "native" ] ; then \ + if [ -x $(pre_orig) ] ; then \ + $(pre_orig) $(shell realpath $(packagedir)) ; \ + fi ; \ + if [ -x $(tar_orig) ] ; then \ + $(tar_orig) $(origstem) $(packagedir) ; \ + fi ; \ + if [ -f $(formatfile) ] && grep --quiet "^3\.. (quilt)$$" $(formatfile) ; then \ + rm -rf $(packagedir)/debian ; \ + fi ; \ + fi + + -mkdir -p $(packagedir)/debian + if [ -d $(debiandata) ] ; then \ + cp -rp $(debiandata)/. $(packagedir)/debian ; \ + fi + if [ "[% $type %]" != "native" ] ; then \ + if [ ! -f $(watchfile) ] ; then \ + echo '# Empty watch file' > $(watchfile) ; \ + fi ; \ + fi + + if [ -x $(pre_build) ] ; then \ + $(pre_build) $(shell realpath $(packagedir)) ; \ + fi + if [ -f $(formatfile) ] && grep --quiet "^3\.. (quilt)$$" $(formatfile) ; then \ + dpkg-source $(dpkgoverrides) -b $(packagedir) ; \ + else \ + dpkg-source $(dpkgoverrides) $(dpkgoptions) -b $(packagedir) ; \ + fi + if [ -x $(post_build) ] ; then \ + $(post_build) $(product) ; \ + fi + + +.PHONY: clean +clean: + rm -rf $(packagedir) + rm -f $(underscored)* diff --git a/t/templates/source-make-builder/fill-values.d/source-make-builder.values b/t/templates/source-make-builder/fill-values.d/source-make-builder.values new file mode 100644 index 0000000..41e08da --- /dev/null +++ b/t/templates/source-make-builder/fill-values.d/source-make-builder.values @@ -0,0 +1,3 @@ +Build-Product: [% $source %]_[% $version %].dsc +Build-Command: fakeroot make --trace -f [% $source_path %]/Makefile DEFAULT_DH_COMPAT=[% $dh_compat_level %] +Default-Build-Depends: debhelper-compat (= [% $dh_compat_level %]) diff --git a/t/templates/source-make-builder/tar-orig b/t/templates/source-make-builder/tar-orig new file mode 100755 index 0000000..791bca4 --- /dev/null +++ b/t/templates/source-make-builder/tar-orig @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +tarstem="$1" +directory="$2" + +tar --create --file "$tarstem.tar.gz" --gzip "$directory" |