aboutsummaryrefslogtreecommitdiff
path: root/scm-build.am
blob: afc1fccab0ceadb8b12d8985449f0a9492da6628 (plain)
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
##  scm-build.am -- -*- automake -*- snippet to ease binary packaging
##  Copyright (C) 2019 SEIKO EPSON Corporation
##
##  License: cc-by-sa-3.0
##  Authors: Olaf Meeuwissen
##
##  This file is courtesy of the 'SCM Build' package.
##  The 'SCM Build' package itself is free software, released under
##  the terms of the GNU General Public License as published by the
##  Free Software Foundation, either version 3 of the License, or (at
##  your option) any later version.
##
##  This file, however, has been made available under the terms of the
##  Creative Commons Attribution-Share Alike 3.0 Unported License.
##  See <http://creativecommons.org/licenses/by-sa/3.0/> for details.
##
##  Include this file in your top-level Makefile.am and make sure that
##  you define the following variables in that Makefile.am:
##
##    EXTRA_DIST
##    MAINTAINERCLEANFILES
##    MAINTAINERCLEANLOCAL


##  Source packaging support


##  Debian packaging support

##  Adding files such as debian/rules.in and debian/control.in to the
##  list of AC_CONFIG_FILES does not work as one would expect.  Files
##  listed become candidates for removal by `make distclean`.
##
##  With the regular Debian build machinery doing exactly that at the
##  very start of just about any build, said build machinery will, as
##  a result, have understandable trouble finding usable debian/rules
##  and debian/control files.


EXTRA_DIST += $(scm_deb_builddir)/source/format
MAINTAINERCLEANFILES += $(scm_deb_builddir)/source/format
$(scm_deb_builddir)/source/format:
	test -d $(scm_deb_builddir)/source \
	    || $(mkinstalldirs) $(scm_deb_builddir)/source
	echo 1.0 > $@

EXTRA_DIST += $(scm_deb_builddir)/changelog
MAINTAINERCLEANFILES += $(scm_deb_builddir)/changelog
$(scm_deb_builddir)/changelog:
	test -d $(scm_deb_builddir) || $(mkinstalldirs) $(scm_deb_builddir)
	echo "$(PACKAGE_TARNAME) ($(PACKAGE_VERSION)-$(scm_src_release)) $(scm_deb_dists); urgency=$(scm_deb_urgency)" > $@
	echo "" >> $@
	echo "  * latest \"upstream\"" >> $@
	echo "    See the NEWS and/or ChangeLog files for details." >> $@
	echo "" >> $@
	echo " -- $(scm_deb_maint) <$(scm_deb_maint_email)>  `LC_TIME=C date --rfc-2822`" >> $@

.PHONY: $(scm_deb_srcdir)/changelog

if !scm_deb_have_control_in
EXTRA_DIST += $(scm_deb_srcdir)/control
else
EXTRA_DIST += $(scm_deb_srcdir)/control.in $(scm_deb_builddir)/control
MAINTAINERCLEANFILES += $(scm_deb_builddir)/control
$(scm_deb_builddir)/control: $(scm_deb_srcdir)/control.in $(top_srcdir)/configure
	cd $(top_builddir) && $(SHELL) ./config.status --file $@:$<
	sed -i \
	    -e '/^Description:/,/^$$/{ s/\\$$//; s/^/ / }' \
	    -e '/^ Description:/s/^ //' $@
endif

if !scm_deb_have_copyright_in
EXTRA_DIST += $(scm_deb_srcdir)/copyright
else
EXTRA_DIST += $(scm_deb_srcdir)/copyright.in $(scm_deb_builddir)/copyright
MAINTAINERCLEANFILES += $(scm_deb_builddir)/copyright
$(scm_deb_builddir)/copyright: $(scm_deb_srcdir)/copyright.in $(top_srcdir)/configure
	cd $(top_builddir) && $(SHELL) ./config.status --file $@:$<
endif

if !scm_deb_have_rules_in
EXTRA_DIST += $(scm_deb_srcdir)/rules
else
EXTRA_DIST += $(scm_deb_srcdir)/rules.in $(scm_deb_builddir)/rules
MAINTAINERCLEANFILES += $(scm_deb_builddir)/rules
$(scm_deb_builddir)/rules: $(scm_deb_srcdir)/rules.in $(top_srcdir)/configure
	cd $(top_builddir) && $(SHELL) ./config.status --file $@:$<
	chmod ugo+x $@
endif

##  RPM packaging support

if !scm_rpm_have_spec_in
EXTRA_DIST += $(top_srcdir)/$(scm_rpm_spec)
else
EXTRA_DIST += $(top_srcdir)/$(scm_rpm_spec_in) $(top_builddir)/$(scm_rpm_spec)
MAINTAINERCLEANFILES +=  $(top_builddir)/$(scm_rpm_spec)
MAINTAINERCLEANLOCAL += scm-rpm-spec-file
if scm_rpm_spec_is_srcdir_file
scm-rpm-spec-file:
	echo "To be generated from $(top_srcdir)/$(scm_rpm_spec_in)" \
	    > $(top_builddir)/$(scm_rpm_spec)
	touch -d @0 $(top_builddir)/$(scm_rpm_spec)
endif
$(top_builddir)/$(scm_rpm_spec): $(top_srcdir)/$(scm_rpm_spec_in) $(top_srcdir)/configure
	cd $(top_builddir) && $(SHELL) ./config.status --file $@:$<
	sed -i '/^%description/,/^$$/{ s/\\$$//; s/^ //; s/^\.$$// }' $@
endif

maintainer-clean-local: $(MAINTAINERCLEANLOCAL)