chiark / gitweb /
changelog: start 9.14
[dgit.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # dgit
4 # Integration between git and Debian-style archives
5 #
6 # Copyright (C)2013-2019 Ian Jackson
7 # Copyright (C)2019      Sean Whitton
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 export prefix=/usr
23
24 %:
25         dh $@
26
27 override_dh_gencontrol:
28         dh_gencontrol
29         set -e; \
30          cd debian/dgit; \
31          v=$$(perl -ne 'print if s/^version:\s+//i' DEBIAN/control); \
32          perl -i -pe "s/UNRELEASED/$$v/g if m/###substituted###/" usr/bin/dgit
33
34 override_dh_auto_clean:
35         dh_auto_clean
36         make -C po clean
37
38 globalperl=/usr/share/perl5
39
40 override_dh_auto_install: specpkg_install_gdp \
41  specpkg_install_gdr \
42  specpkg_install_infra
43         make install prefix=/usr DESTDIR=debian/dgit
44         make -C po install prefix=/usr DESTDIR=../debian/tmp \
45                 SUPPRESS_PO_UPDATE=1 S=''
46         mv debian/dgit/usr/bin/git-playtree-setup debian/dgit/usr/share/dgit
47         make -C po4a install DESTDIR=../debian/tmp S=''
48
49 override_dh_missing:
50         dh_missing --fail-missing
51
52 specpkg_install_gdp: p=git-debpush
53
54 specpkg_install_gdr: p=git-debrebase
55 specpkg_install_gdr: pm=GDR
56
57 specpkg_install_infra: p=dgit-infrastructure
58 specpkg_install_infra: pm=Infra
59
60 define specpkg_install_common
61         make install-$(tok) prefix=/usr DESTDIR=debian/$(p) perldir=$(specperl)
62 endef
63
64 specpkg_install_gdp: tok=gdp
65 specpkg_install_gdp: specperl=/usr/share/dgit/gdp/perl5
66 specpkg_install_gdp:
67         $(specpkg_install_common)
68         set -x; perl -i -pe 'next unless m/###substituted###/;' \
69  -e 's{^(git_playtree_setup)=.*}{$$1=/usr/share/$p/git-playtree-setup};' \
70                 debian/$(p)/usr/bin/*
71
72 specpkg_install_%: tok=$*
73 specpkg_install_%: specperl=/usr/share/dgit/$(tok)/perl5
74 specpkg_install_%:
75         $(specpkg_install_common)
76 #       # Most of the Perl modules in this package live in
77 #       # $(specperl).  The exception is Debian::Dgit::Infra, which
78 #       # lives in $(globalperl) and adds $(specperl) to @INC.
79 #       # We also abuse this for git-playtree-setup.  In .debs, this
80 #       # goes in the per-.deb @INC dir.  See Dgit.pm::playtree_setup.
81         set -ex; \
82          base=debian/$(p); \
83          mod=Debian/Dgit/$(pm).pm; \
84          src=$${base}$(specperl)/$${mod}; \
85          dst=$${base}$(globalperl)/$${mod}; \
86          mkdir -p $${dst%/*}; \
87          mv -f $$src $$dst; \
88          install -m 755 git-playtree-setup $${base}$(specperl); \
89          perl -i -p -e 'next unless m/###substituted###/;' \
90                 -e 'next unless s/^# (?=unshift \@INC,)//;' \
91                 -e 'die unless s{q\{\S+\}}{q{$(specperl)}};' \
92                  $$dst
93
94 debian/tests/control: tests/enumerate-tests debian/tests/control.in
95         $< gencontrol >$@.new && mv -f $@.new $@
96
97 debian/tests/control: tests/lib-core tests/lib-restricts
98 debian/tests/control: tests/tests $(wildcard tests/tests/*[^~#])