Skip to content

Commit 84ef25d

Browse files
committed
Auto merge of rust-lang#1825 - alexcrichton:msvc-32, r=brson
These commits provide the necessary support to get cargo working in the 32-bit MSVC context. Now that we've got 32-bit MSVC nightlies rolling we can add support!
2 parents 5cf4a89 + 655bcdf commit 84ef25d

11 files changed

+147
-161
lines changed

Cargo.lock

+41-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ threadpool = "0.1"
3434
time = "0.1"
3535
toml = "0.1"
3636
url = "0.2"
37-
winapi = "0.1"
37+
winapi = "0.2"
3838

3939
[dev-dependencies]
4040
tempdir = "0.3"

Makefile.in

-13
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,6 @@ BIN_TARGETS := cargo
5858
BIN_TARGETS := $(BIN_TARGETS:src/bin/%.rs=%)
5959
BIN_TARGETS := $(filter-out cargo,$(BIN_TARGETS))
6060

61-
ifdef CFG_MSVC_INCLUDE_PATH
62-
export INCLUDE := $(CFG_MSVC_INCLUDE_PATH)
63-
endif
64-
ifdef CFG_MSVC_LIB_PATH
65-
export LIB := $(CFG_MSVC_LIB_PATH)
66-
endif
67-
ifdef CFG_MSVC_BIN
68-
export PATH := $(CFG_MSVC_BIN):$(PATH)
69-
endif
70-
ifdef CFG_MSVC_WINDOWS_SDK_DIR
71-
export PATH := $(CFG_MSVC_WINDOWS_SDK_DIR):$(PATH)
72-
endif
73-
7461
define DIST_TARGET
7562
ifdef CFG_ENABLE_OPTIMIZE
7663
TARGET_$(1) = $$(TARGET_ROOT)/$(1)/release

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
environment:
2+
CFG_DISABLE_CROSS_TESTS: 1
23
matrix:
34
- MSVC: 1
45
BITS: 64

configure

-46
Original file line numberDiff line numberDiff line change
@@ -369,52 +369,6 @@ if [ "$CFG_SRC_DIR" != "$CFG_BUILD_DIR" ]; then
369369
err "cargo does not currently support an out-of-tree build dir"
370370
fi
371371

372-
for i in $CFG_TARGET
373-
do
374-
case $i in
375-
x86_64-*-msvc)
376-
# Use the REG program to figure out where VS is installed
377-
# We need to figure out where cl.exe and link.exe are, so we do some
378-
# munging and some probing here. We also look for the default
379-
# INCLUDE and LIB variables for MSVC so we can set those in the
380-
# build system as well.
381-
install=$(reg QUERY \
382-
'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
383-
-v InstallDir)
384-
need_ok "couldn't find visual studio install root"
385-
CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
386-
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
387-
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
388-
CFG_MSVC_BIN="${CFG_MSVC_ROOT}/VC/bin/amd64"
389-
CFG_MSVC_CL="${CFG_MSVC_BIN}/cl.exe"
390-
CFG_MSVC_LIB="${CFG_MSVC_BIN}/lib.exe"
391-
CFG_MSVC_LINK="${CFG_MSVC_BIN}/link.exe"
392-
393-
vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
394-
CFG_MSVC_INCLUDE_PATH=$(cmd /c "\"$vcvarsall\" amd64 && cmd /c echo %INCLUDE%")
395-
need_ok "failed to learn about MSVC's INCLUDE"
396-
CFG_MSVC_LIB_PATH=$(cmd /c "\"$vcvarsall\" amd64 && cmd /c echo %LIB%")
397-
need_ok "failed to learn about MSVC's LIB"
398-
CFG_MSVC_WINDOWS_SDK_DIR=$(cmd /c \
399-
"\"$vcvarsall\" amd64 && cmd /c echo %WindowsSdkDir%")
400-
need_ok "failed to learn about MSVC's WindowsSdkDir"
401-
export CFG_MSVC_WINDOWS_SDK_DIR="${CFG_MSVC_WINDOWS_SDK_DIR}bin/x64"
402-
403-
putvar CFG_MSVC_ROOT
404-
putvar CFG_MSVC_BIN
405-
putvar CFG_MSVC_CL
406-
putvar CFG_MSVC_LIB
407-
putvar CFG_MSVC_LINK
408-
putvar CFG_MSVC_INCLUDE_PATH
409-
putvar CFG_MSVC_LIB_PATH
410-
putvar CFG_MSVC_WINDOWS_SDK_DIR
411-
;;
412-
413-
*)
414-
;;
415-
esac
416-
done
417-
418372
if [ ! -z "$CFG_ENABLE_NIGHTLY" ]; then
419373
if [ ! -f .cargo/config ]; then
420374
mkdir -p .cargo

src/etc/download.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import sys
66
import tarfile
77

8-
def get(url, path):
8+
def get(url, path, quiet=False):
99
# see http://serverfault.com/questions/301128/how-to-download
1010
if sys.platform == 'win32':
1111
run(["PowerShell.exe", "/nologo", "-Command",
1212
"(New-Object System.Net.WebClient).DownloadFile('" + url +
13-
"', '" + path + "')"])
13+
"', '" + path + "')"], quiet=quiet)
1414
else:
15-
run(["curl", "-o", path, url])
15+
run(["curl", "-o", path, url], quiet=quiet)
1616

1717
def unpack(tarball, dst, quiet=False):
1818
if quiet:
@@ -31,8 +31,19 @@ def unpack(tarball, dst, quiet=False):
3131
shutil.move(tp, fp)
3232
shutil.rmtree(os.path.join(dst, fname))
3333

34-
def run(args):
35-
print("running: " + ' '.join(args))
36-
ret = subprocess.call(args)
37-
if ret != 0:
38-
raise Exception("failed to fetch url: " + url)
34+
def run(args, quiet=False):
35+
if not quiet:
36+
print("running: " + ' '.join(args))
37+
sys.stdout.flush()
38+
# Use Popen here instead of call() as it apparently allows powershell on
39+
# Windows to not lock up waiting for input presumably.
40+
ret = subprocess.Popen(args,
41+
stdin = subprocess.PIPE,
42+
stdout = subprocess.PIPE,
43+
stderr = subprocess.PIPE)
44+
out, err = ret.communicate()
45+
code = ret.wait()
46+
if code != 0:
47+
print("stdout: \n\n" + out)
48+
print("stderr: \n\n" + err)
49+
raise Exception("failed to fetch url")

src/etc/install-deps.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
extra_bits = 'i686'
1616

1717
extra = None
18+
libdir = 'lib'
1819

1920
# Figure out our target triple
2021
if sys.platform == 'linux' or sys.platform == 'linux2':
@@ -24,8 +25,10 @@
2425
host = host_bits + '-apple-darwin'
2526
extra = extra_bits + '-apple-darwin'
2627
elif sys.platform == 'win32':
28+
libdir = 'bin'
2729
if os.environ.get('MSVC') == '1':
2830
host = host_bits + '-pc-windows-msvc'
31+
extra = extra_bits + '-pc-windows-msvc'
2932
else:
3033
host = host_bits + '-pc-windows-gnu'
3134
else:
@@ -47,21 +50,18 @@ def install_via_tarballs():
4750
extra_fname = 'rustc-nightly-' + extra + '.tar.gz'
4851
print("adding target libs for " + extra)
4952
download.get(url + '/' + extra_fname, extra_fname)
50-
manifest = open("rustc-install/rustc/manifest.in", "a")
5153
folder = extra_fname.replace(".tar.gz", "")
5254
with contextlib.closing(tarfile.open(extra_fname)) as tar:
5355
for p in tar.getnames():
54-
if not "rustc/lib/rustlib/" + extra in p:
56+
if not "rustc/" + libdir + "/rustlib/" + extra in p:
5557
continue
5658
name = p.replace(folder + "/", "", 1)
5759
dst = "rustc-install/" + name
58-
f = tar.extract(p, "rustc-install")
60+
tar.extract(p, "rustc-install")
5961
tp = os.path.join("rustc-install", p)
6062
if os.path.isdir(tp) and os.path.exists(dst):
6163
continue
6264
shutil.move(tp, dst)
63-
if not os.path.isdir(dst):
64-
manifest.write(p.replace(folder + "/rustc/", "file:") + "\n")
6565
shutil.rmtree("rustc-install/" + folder)
6666
os.remove(extra_fname)
6767

0 commit comments

Comments
 (0)