summaryrefslogtreecommitdiff
blob: 75088757bc56c1c7d1eddc2e8d17dea3141dca86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff --git a/BUILD_DIR/hd_install.c b/BUILD_DIR/hd_install.c
--- a/BUILD_DIR/hd_install.c
+++ b/BUILD_DIR/hd_install.c
@@ -1459,6 +1459,7 @@ int HDinstall_file(int argc, char** argv, int status) {
     char** nextArg;
     char** tmpArg;
     char* tmp_cp;
+    char* destdir;
     InstallOptions opts = DEFAULT;
 
     /* Process command line options which apply to this program. */
@@ -1555,6 +1556,15 @@ int HDinstall_file(int argc, char** argv, int status) {
       continue;
     }
 
+    /* Prepend $DESTDIR if defined. */
+    if(NULL != (destdir = getenv("DESTDIR"))) {
+      char* newdest = NULL;
+      if(OK != (status = AppendPath(destdir, dest, &newdest, status)))
+        continue;
+      free(dest);
+      dest = newdest;
+    }
+
     /* Give information. */
     /* Perform installation. */
     status = InstallFiles(src, dest, nextArg, &opts, status);