Skip to content

Commit c56344b

Browse files
committed
rollup merge of rust-lang#19604: vadimcn/gcc-less
- Support gcc-less installation on Windows. To do so in unattended mode run:`<intaller>.exe /TYPE=compact /SILENT`. - Do not require admin privileges to install. cc rust-lang#19519
2 parents 2a244ce + de8f48b commit c56344b

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

mk/dist.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,16 @@ PKG_EXE = dist/$(PKG_NAME)-$(CFG_BUILD).exe
123123
$(PKG_EXE): rust.iss modpath.iss upgrade.iss LICENSE.txt rust-logo.ico \
124124
$(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
125125
dist-prepare-win
126-
$(CFG_PYTHON) $(S)src/etc/make-win-dist.py tmp/dist/win $(CFG_BUILD)
126+
$(Q)rm -rf tmp/dist/win/gcc
127+
$(CFG_PYTHON) $(S)src/etc/make-win-dist.py tmp/dist/win/rust tmp/dist/win/gcc $(CFG_BUILD)
127128
@$(call E, ISCC: $@)
128129
$(Q)$(CFG_ISCC) $<
129130

130131
$(eval $(call DEF_PREPARE,win))
131132

132133
dist-prepare-win: PREPARE_HOST=$(CFG_BUILD)
133134
dist-prepare-win: PREPARE_TARGETS=$(CFG_BUILD)
134-
dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win
135+
dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win/rust
135136
dist-prepare-win: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
136137
dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
137138
dist-prepare-win: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)

src/etc/make-win-dist.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11+
# Script parameters:
12+
# argv[1] = rust component root,
13+
# argv[2] = gcc component root,
14+
# argv[3] = target triple
15+
# The first two correspond to the two installable components defined in the setup script.
16+
1117
import sys, os, shutil, subprocess
1218

1319
def find_files(files, path):
@@ -22,7 +28,7 @@ def find_files(files, path):
2228
raise Exception("Could not find '%s' in %s" % (fname, path))
2329
return found
2430

25-
def make_win_dist(dist_root, target_triple):
31+
def make_win_dist(rust_root, gcc_root, target_triple):
2632
# Ask gcc where it keeps its stuff
2733
gcc_out = subprocess.check_output(["gcc.exe", "-print-search-dirs"])
2834
bin_path = os.environ["PATH"].split(os.pathsep)
@@ -90,29 +96,29 @@ def make_win_dist(dist_root, target_triple):
9096
target_libs = find_files(target_libs, lib_path)
9197

9298
# Copy runtime dlls next to rustc.exe
93-
dist_bin_dir = os.path.join(dist_root, "bin")
99+
dist_bin_dir = os.path.join(rust_root, "bin")
94100
for src in rustc_dlls:
95101
shutil.copy(src, dist_bin_dir)
96102

97103
# Copy platform tools to platform-specific bin directory
98-
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "bin")
104+
target_bin_dir = os.path.join(gcc_root, "bin", "rustlib", target_triple, "bin")
99105
if not os.path.exists(target_bin_dir):
100106
os.makedirs(target_bin_dir)
101107
for src in target_tools:
102108
shutil.copy(src, target_bin_dir)
103109

104110
# Copy platform libs to platform-spcific lib directory
105-
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "lib")
111+
target_lib_dir = os.path.join(gcc_root, "bin", "rustlib", target_triple, "lib")
106112
if not os.path.exists(target_lib_dir):
107113
os.makedirs(target_lib_dir)
108114
for src in target_libs:
109115
shutil.copy(src, target_lib_dir)
110116

111117
# Copy license files
112-
lic_dir = os.path.join(dist_root, "bin", "third-party")
118+
lic_dir = os.path.join(rust_root, "bin", "third-party")
113119
if os.path.exists(lic_dir):
114120
shutil.rmtree(lic_dir) # copytree() won't overwrite existing files
115121
shutil.copytree(os.path.join(os.path.dirname(__file__), "third-party"), lic_dir)
116122

117123
if __name__=="__main__":
118-
make_win_dist(sys.argv[1], sys.argv[2])
124+
make_win_dist(sys.argv[1], sys.argv[2], sys.argv[3])

src/etc/pkg/rust.iss

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ AppPublisherURL=http://www.rust-lang.org
1414
VersionInfoVersion={#CFG_VERSION_WIN}
1515
LicenseFile=LICENSE.txt
1616

17+
PrivilegesRequired=lowest
1718
DisableWelcomePage=true
1819
DisableProgramGroupPage=true
1920
DisableReadyPage=true
@@ -37,8 +38,13 @@ Uninstallable=yes
3738
[Tasks]
3839
Name: modifypath; Description: &Add {app}\bin to your PATH (recommended)
3940

41+
[Components]
42+
Name: rust; Description: "Rust compiler and standard crates"; Types: full compact custom; Flags: fixed
43+
Name: gcc; Description: "Linker and platform libraries"; Types: full
44+
4045
[Files]
41-
Source: "tmp/dist/win/*.*" ; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
46+
Source: "tmp/dist/win/rust/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rust
47+
Source: "tmp/dist/win/gcc/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: gcc
4248

4349
[Code]
4450
const

0 commit comments

Comments
 (0)