Просмотр исходного кода

use 'install' to install files on Unix platforms

David Rose 23 лет назад
Родитель
Сommit
775fb9c086
2 измененных файлов с 24 добавлено и 17 удалено
  1. 9 2
      dtool/Config.pp
  2. 15 15
      dtool/pptempl/Template.unix.pp

+ 9 - 2
dtool/Config.pp

@@ -578,8 +578,15 @@
 // How to install a data file or executable file.  $[local] is the
 // 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
 // local name of the file to install, and $[dest] is the name of the
 // directory to put it in.
 // 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.
 // Variable definitions for building with the Irix MIPSPro compiler.
 #if $[eq $[USE_COMPILER], MIPS]
 #if $[eq $[USE_COMPILER], MIPS]

+ 15 - 15
dtool/pptempl/Template.unix.pp

@@ -345,9 +345,9 @@ $[TAB] rm -f $[sort $[installed_files]]
 #endif
 #endif
 
 
 $[install_lib_dir]/lib$[TARGET].so : $[ODIR]/lib$[TARGET].so
 $[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]
 #define dest $[install_lib_dir]
-$[TAB] cp -f $[ODIR]/$[local] $[dest]
+$[TAB] $[INSTALL]
 
 
 #if $[igatescan]
 #if $[igatescan]
 // Now, some additional rules to generate and compile the interrogate
 // 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]
 $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] : $[igatedb]
 #define local $[igatedb]
 #define local $[igatedb]
 #define dest $[install_igatedb_dir]
 #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
 // We have to split this out as a separate rule to properly support
 // parallel make.
 // parallel make.
@@ -457,9 +457,9 @@ $[TAB] rm -f $[sort $[installed_files]]
 #endif
 #endif
 
 
 $[install_lib_dir]/lib$[TARGET]$[dllext].a : $[ODIR]/lib$[TARGET]$[dllext].a
 $[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]
 #define dest $[install_lib_dir]
-$[TAB] cp -f $[ODIR]/$[local] $[dest]
+$[TAB] $[INSTALL]
 
 
 #end static_lib_target
 #end static_lib_target
 
 
@@ -491,10 +491,10 @@ uninstall-$[TARGET] :
 $[TAB] rm -f $[sort $[installed_files]]
 $[TAB] rm -f $[sort $[installed_files]]
 #endif
 #endif
 
 
-#define local $[TARGET]
+#define local $[ODIR]/$[TARGET]
 #define dest $[install_bin_dir]
 #define dest $[install_bin_dir]
 $[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET]
 $[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET]
-$[TAB] cp -f $[ODIR]/$[local] $[dest]
+$[TAB] $[INSTALL_PROG]
 
 
 #end sed_bin_target
 #end sed_bin_target
 
 
@@ -540,9 +540,9 @@ $[TAB] rm -f $[sort $[installed_files]]
 #endif
 #endif
 
 
 $[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET]
 $[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET]
-#define local $[TARGET]
+#define local $[ODIR]/$[TARGET]
 #define dest $[install_bin_dir]
 #define dest $[install_bin_dir]
-$[TAB] cp -f $[ODIR]/$[local] $[dest]
+$[TAB] $[INSTALL_PROG]
 
 
 #end bin_target
 #end bin_target
 
 
@@ -674,35 +674,35 @@ $[TAB] $[COMPILE_C++]
 $[install_bin_dir]/$[file] : $[file]
 $[install_bin_dir]/$[file] : $[file]
 #define local $[file]
 #define local $[file]
 #define dest $[install_bin_dir]
 #define dest $[install_bin_dir]
-$[TAB] cp -f $[local] $[dest]
+$[TAB] $[INSTALL_PROG]
 #end file
 #end file
 
 
 #foreach file $[install_headers]
 #foreach file $[install_headers]
 $[install_headers_dir]/$[file] : $[file]
 $[install_headers_dir]/$[file] : $[file]
 #define local $[file]
 #define local $[file]
 #define dest $[install_headers_dir]
 #define dest $[install_headers_dir]
-$[TAB] cp -f $[local] $[dest]
+$[TAB] $[INSTALL]
 #end file
 #end file
 
 
 #foreach file $[install_parser_inc]
 #foreach file $[install_parser_inc]
 $[install_parser_inc_dir]/$[file] : $[file]
 $[install_parser_inc_dir]/$[file] : $[file]
 #define local $[file]
 #define local $[file]
 #define dest $[install_parser_inc_dir]
 #define dest $[install_parser_inc_dir]
-$[TAB] cp -f $[local] $[dest]
+$[TAB] $[INSTALL]
 #end file
 #end file
 
 
 #foreach file $[install_data]
 #foreach file $[install_data]
 $[install_data_dir]/$[file] : $[file]
 $[install_data_dir]/$[file] : $[file]
 #define local $[file]
 #define local $[file]
 #define dest $[install_data_dir]
 #define dest $[install_data_dir]
-$[TAB] cp -f $[local] $[dest]
+$[TAB] $[INSTALL]
 #end file
 #end file
 
 
 #foreach file $[install_config]
 #foreach file $[install_config]
 $[install_config_dir]/$[file] : $[file]
 $[install_config_dir]/$[file] : $[file]
 #define local $[file]
 #define local $[file]
 #define dest $[install_config_dir]
 #define dest $[install_config_dir]
-$[TAB] cp -f $[local] $[dest]
+$[TAB] $[INSTALL]
 #end file
 #end file
 
 
 // Finally, all the special targets.  These are commands that just need
 // 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]
 $[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER]
 #define local $[CONFIG_HEADER]
 #define local $[CONFIG_HEADER]
 #define dest $[install_headers_dir]
 #define dest $[install_headers_dir]
-$[TAB] cp -f $[local] $[dest]
+$[TAB] $[INSTALL]
 #endif
 #endif
 
 
 #end Makefile
 #end Makefile