5 dh_auto_install - automatically runs make install or similar
10 use Debian::Debhelper::Dh_Lib;
15 B<dh_auto_install> [S<I<debhelper options>>] [S<B<--> I<params>>]
19 dh_auto_install is a debhelper program that tries to automatically install
20 built files. If there's a Makefile and it contains a "install" target,
21 then this is done by running make (or MAKE, if the environment variable is
22 set). If there is a setup.py or Build.PL, it is used.
24 The files are installed into debian/<package>/ if there is only one binary
25 package. In the multiple binary package case, the files are instead
26 installed into debian/tmp/, and should be moved from there to the
27 appropriate package build directory using L<dh_install(1)>.
29 DESTDIR is used to tell make where to install the files.
30 If the Makefile was generated by MakeMaker from a Makefile.PL, it will
31 automatically set PREFIX=/usr too, since such Makefiles need that.
33 This is intended to work for about 90% of packages. If it doesn't work, or
34 tries to use the wrong install target, you're encouraged to skip using
35 dh_auto_install at all, and just run make install manually.
43 Pass "params" to the program that is run. These can be used to supplement
44 or override the any standard parameters that dh_auto_install passes.
53 my @allpackages=getpackages();
54 if (@allpackages > 1) {
55 $destdir="debian/tmp";
58 $destdir=tmpdir($dh{MAINPACKAGE});
60 $destdir=cwd()."/".$destdir;
62 if (-e "Makefile" || -e "makefile" || -e "GNUmakefile") {
63 $ENV{MAKE}="make" unless exists $ENV{MAKE};
64 my @params="DESTDIR=$destdir";
66 # Special case for MakeMaker generated Makefiles.
68 system('grep -q "generated automatically by MakeMaker" Makefile') == 0) {
69 push @params, "PREFIX=/usr";
72 foreach my $target (qw{install}) {
73 # Use make -n to check to see if the target would do
74 # anything. There's no good way to test if a target exists.
75 my $ret=`$ENV{MAKE} -s -n $target 2>/dev/null`;
78 doit($ENV{MAKE}, $target,
85 elsif (-e "setup.py") {
86 doit("python", "setup.py", "install",
88 "--no-compile", "-O0",
89 "--install-layout=deb",
92 elsif (-e "Build.PL" && -e "Build") {
93 $ENV{MODULEBUILDRC} = "/dev/null";
94 doit("perl", "Build", "install", "destdir=$destdir",
95 "create_packlist=0", @{$dh{U_PARAMS}});
102 This program is a part of debhelper.
106 Joey Hess <joeyh@debian.org>