]> git.donarmstrong.com Git - debhelper.git/blob - dh_auto_install
cwd is exported
[debhelper.git] / dh_auto_install
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_auto_install - automatically runs make install or similar
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11 use Debian::Debhelper::Dh_Buildsystems;
12 use File::Spec;
13 use Cwd;
14
15 =head1 SYNOPSIS
16
17 B<dh_auto_install> [S<I<build system options>>] [S<I<debhelper options>>] [S<B<--> I<params>>]
18
19 =head1 DESCRIPTION
20
21 dh_auto_install is a debhelper program that tries to automatically install
22 built files. It does so by running the appropriate command for the build
23 system it detects the package uses. For example, if there's a Makefile and
24 it contains a "install" target, then this is done by running make (or MAKE,
25 if the environment variable is set). If there is a setup.py or Build.PL,
26 it is used. Note that the Ant build system does not support installation,
27 so dh_auto_install will not install files built using Ant.
28
29 Unless --destdir option is specified, the files are installed into
30 debian/<package>/ if there is only one binary package. In the multiple binary
31 package case, the files are instead installed into debian/tmp/, and should be
32 moved from there to the appropriate package build directory using
33 L<dh_install(1)>.
34
35 DESTDIR is used to tell make where to install the files. 
36 If the Makefile was generated by MakeMaker from a Makefile.PL, it will
37 automatically set PREFIX=/usr too, since such Makefiles need that.
38
39 This is intended to work for about 90% of packages. If it doesn't work, or
40 tries to use the wrong install target, you're encouraged to skip using
41 dh_auto_install at all, and just run make install manually.
42
43 =head1 OPTIONS
44
45 See L<debhelper(7)/BUILD SYSTEM OPTIONS> for a list of common build
46 system selection and control options.
47
48 =over 4
49
50 =item B<--destdir=>I<directory>
51
52 Install files into the specified I<directory>. If this option is not specified,
53 destination directory is determined automatically as described in the
54 L</DESCRIPTION> section.
55
56 =item B<--> I<params>
57
58 Pass "params" to the program that is run. These can be used to supplement
59 or override the any standard parameters that dh_auto_install passes.
60
61 =back
62
63 =cut
64
65 my $destdir;
66
67 buildsystems_init(options => {
68         "destdir=s" => \$destdir,
69 });
70
71 # If destdir is not specified, determine it automatically
72 if (!$destdir) {
73         my @allpackages=getpackages();
74         if (@allpackages > 1) {
75                 $destdir="debian/tmp";
76         }
77         else {
78                 $destdir=tmpdir($dh{MAINPACKAGE});
79         }
80 }
81 $destdir = File::Spec->rel2abs($destdir, cwd());
82
83 buildsystems_do("install", $destdir);
84
85 =head1 SEE ALSO
86
87 L<debhelper(7)>
88
89 This program is a part of debhelper.
90
91 =head1 AUTHOR
92
93 Joey Hess <joeyh@debian.org>
94
95 =cut