]> git.donarmstrong.com Git - debhelper.git/blob - dh_builddeb
Add deprecation warnings for -u to the documentation, since putting options after...
[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(1)> 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<--> I<params>
36
37 Pass I<params> to L<dpkg-deb(1)> when it is used to build the
38 package.
39
40 =item B<-u>I<params>
41
42 This is another way to pass I<params> to L<dpkg-deb(1)>.
43 It is deprecated; use B<--> instead.
44
45 =back
46
47 =cut
48
49 init(options => {
50         "filename=s" => \$dh{FILENAME},
51         "destdir=s" => \$dh{DESTDIR},
52 });
53
54 # Set the default destination directory.
55 if (! defined $dh{DESTDIR}) {
56         $dh{DESTDIR}='..';
57 }
58
59 if (! defined $dh{FILENAME}) {
60         $dh{FILENAME}='';
61 }
62 else {
63         $dh{FILENAME}="/$dh{FILENAME}";
64 }
65
66 foreach my $package (@{$dh{DOPACKAGES}}) {
67         my $tmp=tmpdir($package);
68         if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) {
69                 if (! compat(5)) {
70                         complex_doit("find $tmp $dh{EXCLUDE_FIND} | xargs rm -rf");
71                 }
72                 else {
73                         # Old broken code here for compatibility. Does not
74                         # remove everything.
75                         complex_doit("find $tmp -name $_ | xargs rm -rf")
76                                 foreach split(":", $ENV{DH_ALWAYS_EXCLUDE});
77                 }
78         }
79         if (! is_udeb($package)) {
80                 doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$dh{FILENAME});
81         }
82         else {
83                 my $filename=$dh{FILENAME};
84                 if (! $filename) {
85                         $filename="/".udeb_filename($package);
86                 }
87                 doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$filename);
88         }
89 }
90
91 =head1 SEE ALSO
92
93 L<debhelper(7)>
94
95 This program is a part of debhelper.
96
97 =head1 AUTHOR
98
99 Joey Hess <joeyh@debian.org>
100
101 =cut