@@ -21,9 +21,9 @@ const SHELL: &str = "sh";
2121
2222/// We have to run a few shell scripts, which choke quite a bit on both `\`
2323/// characters and on `C:\` paths, so normalize both of them away.
24- fn sanitize_sh ( path : & Path ) -> String {
24+ fn sanitize_sh ( path : & Path , is_cygwin : bool ) -> String {
2525 let path = path. to_str ( ) . unwrap ( ) . replace ( '\\' , "/" ) ;
26- return change_drive ( unc_to_lfs ( & path) ) . unwrap_or ( path) ;
26+ return if is_cygwin { path } else { change_drive ( unc_to_lfs ( & path) ) . unwrap_or ( path) } ;
2727
2828 fn unc_to_lfs ( s : & str ) -> & str {
2929 s. strip_prefix ( "//?/" ) . unwrap_or ( s)
@@ -71,6 +71,7 @@ fn install_sh(
7171 let prefix = default_path ( & builder. config . prefix , "/usr/local" ) ;
7272 let sysconfdir = prefix. join ( default_path ( & builder. config . sysconfdir , "/etc" ) ) ;
7373 let destdir_env = env:: var_os ( "DESTDIR" ) . map ( PathBuf :: from) ;
74+ let is_cygwin = builder. config . build . is_cygwin ( ) ;
7475
7576 // Sanity checks on the write access of user.
7677 //
@@ -103,14 +104,14 @@ fn install_sh(
103104
104105 let mut cmd = command ( SHELL ) ;
105106 cmd. current_dir ( & empty_dir)
106- . arg ( sanitize_sh ( & tarball. decompressed_output ( ) . join ( "install.sh" ) ) )
107- . arg ( format ! ( "--prefix={}" , prepare_dir( & destdir_env, prefix) ) )
108- . arg ( format ! ( "--sysconfdir={}" , prepare_dir( & destdir_env, sysconfdir) ) )
109- . arg ( format ! ( "--datadir={}" , prepare_dir( & destdir_env, datadir) ) )
110- . arg ( format ! ( "--docdir={}" , prepare_dir( & destdir_env, docdir) ) )
111- . arg ( format ! ( "--bindir={}" , prepare_dir( & destdir_env, bindir) ) )
112- . arg ( format ! ( "--libdir={}" , prepare_dir( & destdir_env, libdir) ) )
113- . arg ( format ! ( "--mandir={}" , prepare_dir( & destdir_env, mandir) ) )
107+ . arg ( sanitize_sh ( & tarball. decompressed_output ( ) . join ( "install.sh" ) , is_cygwin ) )
108+ . arg ( format ! ( "--prefix={}" , prepare_dir( & destdir_env, prefix, is_cygwin ) ) )
109+ . arg ( format ! ( "--sysconfdir={}" , prepare_dir( & destdir_env, sysconfdir, is_cygwin ) ) )
110+ . arg ( format ! ( "--datadir={}" , prepare_dir( & destdir_env, datadir, is_cygwin ) ) )
111+ . arg ( format ! ( "--docdir={}" , prepare_dir( & destdir_env, docdir, is_cygwin ) ) )
112+ . arg ( format ! ( "--bindir={}" , prepare_dir( & destdir_env, bindir, is_cygwin ) ) )
113+ . arg ( format ! ( "--libdir={}" , prepare_dir( & destdir_env, libdir, is_cygwin ) ) )
114+ . arg ( format ! ( "--mandir={}" , prepare_dir( & destdir_env, mandir, is_cygwin ) ) )
114115 . arg ( "--disable-ldconfig" ) ;
115116 cmd. run ( builder) ;
116117 t ! ( fs:: remove_dir_all( & empty_dir) ) ;
@@ -120,7 +121,7 @@ fn default_path(config: &Option<PathBuf>, default: &str) -> PathBuf {
120121 config. as_ref ( ) . cloned ( ) . unwrap_or_else ( || PathBuf :: from ( default) )
121122}
122123
123- fn prepare_dir ( destdir_env : & Option < PathBuf > , mut path : PathBuf ) -> String {
124+ fn prepare_dir ( destdir_env : & Option < PathBuf > , mut path : PathBuf , is_cygwin : bool ) -> String {
124125 // The DESTDIR environment variable is a standard way to install software in a subdirectory
125126 // while keeping the original directory structure, even if the prefix or other directories
126127 // contain absolute paths.
@@ -146,7 +147,7 @@ fn prepare_dir(destdir_env: &Option<PathBuf>, mut path: PathBuf) -> String {
146147 assert ! ( path. is_absolute( ) , "could not make the path relative" ) ;
147148 }
148149
149- sanitize_sh ( & path)
150+ sanitize_sh ( & path, is_cygwin )
150151}
151152
152153macro_rules! install {
0 commit comments