]> git.donarmstrong.com Git - debhelper.git/blob - dh_builddeb
Move many command-specific options to only be accepted by the command that uses them.
[debhelper.git] / dh_builddeb
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_builddeb - build debian binary packages
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_builddeb> [S<I<debhelper options>>] [B<--destdir=>I<directory>] [B<--filename=>I<name>] [S<B<--> I<params>>]
15
16 =head1 DESCRIPTION
17
18 dh_builddeb simply calls L<dpkg-deb(8)> to build a debian package or
19 packages.
20
21 =head1 OPTIONS
22
23 =over 4
24
25 =item B<--destdir=>I<directory>
26
27 Use this if you want the generated .deb files to be put in a directory
28 other than the default of ".."
29
30 =item B<--filename=>I<name>
31
32 Use this if you want to force the generated .deb file to have a particular
33 file name. Does not work well if more than one .deb is generated!
34
35 =item B<-u>I<params>
36
37 =item B<--> I<params>
38
39 Pass I<params> to L<dpkg-deb(1)> when it is used to build the
40 package.
41
42 =back
43
44 =cut
45
46 init(options => {
47         "filename=s" => \$dh{FILENAME},
48 });
49
50 # Set the default destination directory.
51 if (! defined $dh{DESTDIR}) {
52         $dh{DESTDIR}='..';
53 }
54
55 if (! defined $dh{FILENAME}) {
56         $dh{FILENAME}='';
57 }
58 else {
59         $dh{FILENAME}="/$dh{FILENAME}";
60 }
61
62 foreach my $package (@{$dh{DOPACKAGES}}) {
63         my $tmp=tmpdir($package);
64         if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) {
65                 if (! compat(5)) {
66                         complex_doit("find $tmp $dh{EXCLUDE_FIND} | xargs rm -rf");
67                 }
68                 else {
69                         # Old broken code here for compatibility. Does not
70                         # remove everything.
71                         complex_doit("find $tmp -name $_ | xargs rm -rf")
72                                 foreach split(":", $ENV{DH_ALWAYS_EXCLUDE});
73                 }
74         }
75         if (! is_udeb($package)) {
76                 doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$dh{FILENAME});
77         }
78         else {
79                 my $filename=$dh{FILENAME};
80                 if (! $filename) {
81                         $filename="/".udeb_filename($package);
82                 }
83                 doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$filename);
84         }
85 }
86
87 =head1 SEE ALSO
88
89 L<debhelper(7)>
90
91 This program is a part of debhelper.
92
93 =head1 AUTHOR
94
95 Joey Hess <joeyh@debian.org>
96
97 =cut