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