aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Moncayo2014-11-08 22:17:00 +0100
committerDani Moncayo2014-11-08 22:17:00 +0100
commite7e61abaa9de9a7e8485d1fc52a5aa6ce112620e (patch)
tree407f048f0ff3cd66af66c52a9b843781b95f3eb8
parent929201eab134620e5ef79211897c93ba90518122 (diff)
downloademacs-e7e61abaa9de9a7e8485d1fc52a5aa6ce112620e.tar.gz
emacs-e7e61abaa9de9a7e8485d1fc52a5aa6ce112620e.zip
build-aux/msys-to-w32: always output absolute paths.
-rwxr-xr-xbuild-aux/msys-to-w3235
1 files changed, 19 insertions, 16 deletions
diff --git a/build-aux/msys-to-w32 b/build-aux/msys-to-w32
index f8c37222889..1f9fda49fff 100755
--- a/build-aux/msys-to-w32
+++ b/build-aux/msys-to-w32
@@ -1,5 +1,5 @@
1#!/bin/bash 1#!/bin/bash
2# Convert a MSYS path list to Windows-native format. 2# Convert a MSYS path list to absolute, Windows-native format.
3# Status is zero if successful, nonzero otherwise. 3# Status is zero if successful, nonzero otherwise.
4 4
5# Copyright (C) 2013-2014 Free Software Foundation, Inc. 5# Copyright (C) 2013-2014 Free Software Foundation, Inc.
@@ -25,20 +25,20 @@ usage="usage: ${me} PATHLIST"
25help="$usage 25help="$usage
26 or: ${me} OPTION 26 or: ${me} OPTION
27 27
28Convert a MSYS path list to Windows-native format. 28Convert a MSYS path list to absolute, Windows-native format.
29 29
30PATHLIST should be a colon-separated list of MSYS paths, which will be 30PATHLIST should be a colon-separated list of MSYS paths, which will be
31written to the standard output after performing these transformations: 31written to the standard output after performing these transformations:
32 32
331. Discard empty paths. 331. Discard empty paths.
342. Replace: '\' with '/', '//' with '/' and ':' with ';'. 342. Replace: '\' with '/', '//' with '/' and ':' with ';'.
353. Translate each path to Windows-native format. 353. Translate each path to absolute, Windows-native format.
36 36
37Relative paths or paths starting with '%emacs_dir%' will be passed 37Paths starting with '%emacs_dir%' will be passed verbatim to the
38verbatim to the standard output. 38standard output.
39 39
40Each non existing absolute path will be translated by looking for its 40Each non existing path will be translated by looking for its deepest
41deepest existing directory, which will be translated and the remainder 41existing directory, which will be translated and the remainder
42appended. 42appended.
43 43
44Options: 44Options:
@@ -81,9 +81,6 @@ do
81 if [ "${p:0:11}" = "%emacs_dir%" ] 81 if [ "${p:0:11}" = "%emacs_dir%" ]
82 then 82 then
83 w32p=$p 83 w32p=$p
84 elif [ "${p:0:1}" != "/" ]
85 then
86 w32p=$p
87 elif [ -d "$p" ] 84 elif [ -d "$p" ]
88 then 85 then
89 w32p=$(cd "$p" && pwd -W) 86 w32p=$(cd "$p" && pwd -W)
@@ -95,17 +92,23 @@ do
95 p=${p//\/\///} 92 p=${p//\/\///}
96 p=${p%/} 93 p=${p%/}
97 94
98 p1=$p 95 p1=$p # last candidate tried
99 while : 96 while :
100 do 97 do
101 p1=${p1%/*} 98 p2=${p1%/*} # next candidate to try
102 [ -z "$p1" ] && p1="/" && break 99 [ "$p2" = "$p1" ] && {
103 [ -d "$p1" ] && break 100 # No more candidates to try
101 echo "Invalid path '$p'." >&2
102 exit 1
103 }
104 [ -z "$p2" ] && p2="/" && break
105 [ -d "$p2" ] && break
106 p1=$p2
104 done 107 done
105 108
106 # translate the existing part and append the rest 109 # translate the existing part and append the rest
107 w32p=$(cd "${p1}" && pwd -W) 110 w32p=$(cd "${p2}" && pwd -W)
108 remainder=${p#$p1} 111 remainder=${p#$p2}
109 w32p+=/${remainder#/} 112 w32p+=/${remainder#/}
110 fi 113 fi
111 114