@@ -21,9 +21,9 @@ const SHELL: &str = "sh";
21
21
22
22
/// We have to run a few shell scripts, which choke quite a bit on both `\`
23
23
/// 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 {
25
25
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) } ;
27
27
28
28
fn unc_to_lfs(s: &str) -> &str {
29
29
s.strip_prefix("//?/").unwrap_or(s)
@@ -71,6 +71,7 @@ fn install_sh(
71
71
let prefix = default_path(&builder.config.prefix, "/usr/local");
72
72
let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, "/etc"));
73
73
let destdir_env = env::var_os("DESTDIR").map(PathBuf::from);
74
+ let is_cygwin = builder.config.build.is_cygwin();
74
75
75
76
// Sanity checks on the write access of user.
76
77
//
@@ -103,14 +104,14 @@ fn install_sh(
103
104
104
105
let mut cmd = command(SHELL);
105
106
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 )))
114
115
.arg("--disable-ldconfig");
115
116
cmd.run(builder);
116
117
t!(fs::remove_dir_all(&empty_dir));
@@ -120,7 +121,7 @@ fn default_path(config: &Option<PathBuf>, default: &str) -> PathBuf {
120
121
config.as_ref().cloned().unwrap_or_else(|| PathBuf::from(default))
121
122
}
122
123
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 {
124
125
// The DESTDIR environment variable is a standard way to install software in a subdirectory
125
126
// while keeping the original directory structure, even if the prefix or other directories
126
127
// contain absolute paths.
@@ -146,7 +147,7 @@ fn prepare_dir(destdir_env: &Option<PathBuf>, mut path: PathBuf) -> String {
146
147
assert!(path.is_absolute(), "could not make the path relative");
147
148
}
148
149
149
- sanitize_sh(&path)
150
+ sanitize_sh(&path, is_cygwin )
150
151
}
151
152
152
153
macro_rules! install {
0 commit comments