diff --git a/dtool/Config.pp b/dtool/Config.pp index 80671a1b5e..f346b04faa 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -578,8 +578,15 @@ // How to install a data file or executable file. $[local] is the // local name of the file to install, and $[dest] is the name of the // directory to put it in. -#defer INSTALL install -m 666 $[local] $[dest] -#defer INSTALL_PROG install -m 777 $[local] $[dest] + +// On Unix systems, we strongly prefer using the install program to +// install files. This has nice features like automatically setting +// the permissions bits, and also is usually clever enough to install +// a running program without crashing the running instance. However, +// it doesn't understanding installing a program from a subdirectory, +// so we have to cd into the source directory first. +#defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m 666 $[notdir $[local]] $[dest] +#defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m 777 $[notdir $[local]] $[dest] // Variable definitions for building with the Irix MIPSPro compiler. #if $[eq $[USE_COMPILER], MIPS] diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 37ff7df367..2e5cfcc9a4 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -345,9 +345,9 @@ $[TAB] rm -f $[sort $[installed_files]] #endif $[install_lib_dir]/lib$[TARGET].so : $[ODIR]/lib$[TARGET].so -#define local lib$[TARGET].so +#define local $[ODIR]/lib$[TARGET].so #define dest $[install_lib_dir] -$[TAB] cp -f $[ODIR]/$[local] $[dest] +$[TAB] $[INSTALL] #if $[igatescan] // Now, some additional rules to generate and compile the interrogate @@ -365,7 +365,7 @@ $[TAB] cp -f $[ODIR]/$[local] $[dest] $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] : $[igatedb] #define local $[igatedb] #define dest $[install_igatedb_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL] // We have to split this out as a separate rule to properly support // parallel make. @@ -457,9 +457,9 @@ $[TAB] rm -f $[sort $[installed_files]] #endif $[install_lib_dir]/lib$[TARGET]$[dllext].a : $[ODIR]/lib$[TARGET]$[dllext].a -#define local lib$[TARGET]$[dllext].a +#define local $[ODIR]/lib$[TARGET]$[dllext].a #define dest $[install_lib_dir] -$[TAB] cp -f $[ODIR]/$[local] $[dest] +$[TAB] $[INSTALL] #end static_lib_target @@ -491,10 +491,10 @@ uninstall-$[TARGET] : $[TAB] rm -f $[sort $[installed_files]] #endif -#define local $[TARGET] +#define local $[ODIR]/$[TARGET] #define dest $[install_bin_dir] $[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET] -$[TAB] cp -f $[ODIR]/$[local] $[dest] +$[TAB] $[INSTALL_PROG] #end sed_bin_target @@ -540,9 +540,9 @@ $[TAB] rm -f $[sort $[installed_files]] #endif $[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET] -#define local $[TARGET] +#define local $[ODIR]/$[TARGET] #define dest $[install_bin_dir] -$[TAB] cp -f $[ODIR]/$[local] $[dest] +$[TAB] $[INSTALL_PROG] #end bin_target @@ -674,35 +674,35 @@ $[TAB] $[COMPILE_C++] $[install_bin_dir]/$[file] : $[file] #define local $[file] #define dest $[install_bin_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL_PROG] #end file #foreach file $[install_headers] $[install_headers_dir]/$[file] : $[file] #define local $[file] #define dest $[install_headers_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL] #end file #foreach file $[install_parser_inc] $[install_parser_inc_dir]/$[file] : $[file] #define local $[file] #define dest $[install_parser_inc_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL] #end file #foreach file $[install_data] $[install_data_dir]/$[file] : $[file] #define local $[file] #define dest $[install_data_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL] #end file #foreach file $[install_config] $[install_config_dir]/$[file] : $[file] #define local $[file] #define dest $[install_config_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL] #end file // Finally, all the special targets. These are commands that just need @@ -849,7 +849,7 @@ $[TAB] @test -d $[install_headers_dir] || mkdir -p $[install_headers_dir] $[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER] #define local $[CONFIG_HEADER] #define dest $[install_headers_dir] -$[TAB] cp -f $[local] $[dest] +$[TAB] $[INSTALL] #endif #end Makefile