1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
|
# Build all Debian packaging examples
# Copyright (C) 2021 Osamu Aoki
# Standards-Version: 4.6.2
# Homepage: <insert the upstream URL, if relevant>
# Homepage: https://salsa.debian.org/debian/debmake-doc
# Vcs-Git: https://salsa.debian.org/debian/debmake-doc.git
# Vcs-Browser: https://salsa.debian.org/debian/debmake-doc
# Set the following before "make groom"
HOMEPAGE = https://salsa.debian.org/debian/debmake-doc
STDVER = 4.6.2
DHCOMPAT = 13
MAINTNM = Osamu Aoki <osamu@debian.org>
# vim: set noet ts=8:
# Normalize build environment (Debian default is LANG=C etc.)
LC_ALL := C.UTF-8
export LC_ALL
TERM = dumb
export TERM
ARCH := $(shell dpkg-architecture -q DEB_TARGET_ARCH)
ALL_DEPS := \
autoconf\
automake\
autopoint\
build-essential \
cmake\
debhelper\
debmake\
devscripts\
dh-sequence-single-binary \
gettext\
gir1.2-gtk-3.0\
libltdl-dev\
libtool\
libxml2-utils\
lintian\
locales-all\
pybuild-plugin-pyproject \
python3-all\
python3-debian\
python3-gi\
quilt \
tree \
vim\
w3m\
zip
ALL_DIRS := $(shell find . -maxdepth 1 -type d -regex '\./debhello-.*' | sed -e 's,^\./,,')
BUILD_DIRS := $(shell find . -maxdepth 1 -type d -regex '\./debhello-.*_build.*' | sed -e 's,^\./,,')
UPSTREAM_DIRS := $(filter-out $(BUILD_DIRS),$(ALL_DIRS))
ASCIIDOC_REF := $(addsuffix /ASCIIDOC_REF, $(BUILD_DIRS))
TARGZS := $(addsuffix .tar.gz, $(UPSTREAM_DIRS))
ORIGTARGZS := $(patsubst debhello-%,debhello_%,$(addsuffix .orig.tar.gz, $(UPSTREAM_DIRS)))
BUILDMAKEFILES := $(addsuffix /Makefile, $(BUILD_DIRS))
BUILDSTAMPS := $(addsuffix -stamp, $(BUILD_DIRS))
all:
# === BUILDSTAMPS ===
$(MAKE) clean
$(MAKE) deps
$(MAKE) prep
$(MAKE) asciidoc
$(MAKE) buildall
# === SUCCESS ALL ===
clean:
-rm -f $(TARGZS)
-rm -f $(ORIGTARGZS)
-rm -f $(BUILDMAKEFILES)
-rm -f $(BUILDSTAMPS)
# way to clean build results and Makefile link
-rm -f debhello-*_build*/*.log
-rm -f debhello-*_build*/Makefile
-rm -f debhello-*_build*/next.dir
-rm -f debhello-*_build*/project
-rm -f debhello-*_build*/build
-rm -rf debhello-*_build*/test
# post-debmake snapshot of test
-rm -rf debhello-*_build*/debmake
# post-package snapshot of test
-rm -rf debhello-*_build*/package
-rm -rf debhello-*_build*/dsc
distclean: clean
-rm -f $(ASCIIDOC_REF)
-rm -f debhello-*_build*/*.slog
deps:
# === ALL_DEPS ===
sudo apt-get update
sudo apt-get install $(ALL_DEPS)
prep:
# === ALL_DIRS ===
@ echo "$(ALL_DIRS)"| xargs -n1
# === BUILD_DIRS ===
@ echo "$(BUILD_DIRS)"| xargs -n1
# === UPSTREAM_DIRS ===
@ echo "$(UPSTREAM_DIRS)" | xargs -n1
# === TARGZS ===
@ echo "$(TARGZS)" | xargs -n1
$(MAKE) $(TARGZS)
# === ORIGTARGZS ===
@ echo "$(ORIGTARGZS)" | xargs -n1
$(MAKE) $(ORIGTARGZS)
# === BUILDMAKEFILES ===
$(MAKE) $(BUILDMAKEFILES)
asciidoc:
# === ASCIIDOC_REF ===
$(MAKE) $(ASCIIDOC_REF)
buildall:
# === BUILDSTAMPS ===
$(MAKE) $(BUILDSTAMPS)
debhello-%.tar.gz: debhello-%/README.md
tar --exclude=debhello-$*/debian -cvzf $@ debhello-$*/
debhello_%.orig.tar.gz: debhello-%.tar.gz
ln -sf $^ $@
debhello-%/Makefile: template/Makefile
ln -sf ../$^ $@
debhello-%-stamp: debhello-%/Makefile
$(MAKE) -C debhello-$*
#######################################################################
# Groom debhello-*/debian/* template files
#######################################################################
BUILD_VERS := $(patsubst debhello-%,%,$(BUILD_DIRS))
UPSTREAM_VERS := $(patsubst debhello-%,%,$(UPSTREAM_DIRS))
CHANGELOGS := $(addsuffix /debian/changelog, $(addprefix debhello-,$(UPSTREAM_VERS)))
COPYRIGHTS := $(addsuffix /debian/copyright, $(addprefix debhello-,$(UPSTREAM_VERS)))
COPYRIGHTS := $(addsuffix /debian/control, $(addprefix debhello-,$(UPSTREAM_VERS)))
READMES := $(addsuffix /debian/README.Debian, $(addprefix debhello-,$(UPSTREAM_VERS)))
WATCHS := $(addsuffix /debian/watch, $(addprefix debhello-,$(UPSTREAM_VERS)))
SRCF := $(addsuffix /debian/source/format, $(addprefix debhello-,$(UPSTREAM_VERS)))
WRAPS := $(addsuffix -wrap,$(addprefix debhello-,$(UPSTREAM_VERS)))
builds:
# === BUILD UPSTREAM_VERS ===
@ echo "$(BUILD_VERS)"| xargs -n1
vers:
# === UPSTREAM_VERS ===
@ echo "$(UPSTREAM_VERS)"| xargs -n1
groom:
cd template ; touch * source/*
$(MAKE) $(CHANGELOGS) $(COPYRIGHTS) $(READMES) $(WATCHS) $(SRCF) $(CONTROLS)
# clean whitespaces in line tail (exclude some directories)
-find . -type d \
-regex ".*/\.git" -prune -o \
-regex ".*/post-gettextize" -prune -o \
-regex ".*/png" -prune -o \
-type f -exec sed -i -e 's/[ \t]*$$//' '{}' \;
$(MAKE) $(WRAPS)
debhello-%/debian/changelog: template/changelog
mkdir -p debhello-$*/debian
sed -ne '/debhello ($*-1/,$$p' <$^ >$@
debhello-%/debian/copyright: template/copyright
mkdir -p debhello-$*/debian
cp -f $^ $@
debhello-%/debian/control: template/README.Debian
mkdir -p debhello-$*/debian
sed -i \
-e 's/^Section: unknown$$/Section: devel/' \
-e 's/^Maintainer:.*$$/Maintainer: $(MAINTNM)/' \
-e 's/debhelper-compat *( *= *[1-9][0-9]* *)/debhelper-compat (= $(DHCOMPAT))/' \
-e 's/^Standards-Version:.*$$/Standards-Version: $(STDVER)/' \
-e 's,^Homepage:.*$$,Homepage: $(HOMEPAGE),' \
-e 's,^Description:.*$$,Description: Simple packaging example for debmake,' \
-e 's,was auto-generated.*$$,is an example package.,' \
-e 's,^ debmake(1) command provided by .*$$, (This is an example only),' \
-e 's,^X-Python3-Version.*$$,,' \
$@
debhello-%/debian/README.Debian: template/README.Debian
mkdir -p debhello-$*/debian
cp -f $^ $@
debhello-%/debian/watch: template/watch
mkdir -p debhello-$*/debian
cp -f $^ $@
debhello-%/debian/source/format: template/source/format
mkdir -p debhello-$*/debian/source
cp -f $^ $@
debhello-%-wrap:
cd debhello-$* ; \
wrap-and-sort
debhello-%/ASCIIDOC_REF:
{ cd ../asciidoc ; rg --vimgrep "debhello-$*" *.txt || echo "---" ; } > $@
symlinks:
for d in $(filter-out debhello-0.0_build-1, $(BUILD_DIRS)); do $(MAKE) -C $$d symlink ; cd - ; done
|