Skip to content

Commit 4e6434d

Browse files
committed
Auto merge of #2513 - alexcrichton:xcompile, r=alexcrichton
Fix nightly dist builds * When downloading rustc, also download a number of cross-std libraries so we can cross compile with that compiler. * Only build OpenSSL on some --enable-nightly builds, not all. For example Windows and OSX don't want to link statically to OpenSSL.
2 parents e43adeb + 8caf4f5 commit 4e6434d

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

Makefile.in

+18-11
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,9 @@ $(DOC_DIR)/%: src/doc/%
166166
@mkdir -p $(@D)
167167
cp $< $@
168168

169-
ifdef CFG_ENABLE_NIGHTLY
170-
171169
OPENSSL_OS_x86_64-unknown-linux-gnu := linux-x86_64
172170
OPENSSL_OS_x86_64-unknown-linux-musl := linux-x86_64
173-
OPENSSL_OS_i686-unknown-linux-gnu := linux-x32
171+
OPENSSL_OS_i686-unknown-linux-gnu := linux-elf
174172
OPENSSL_OS_arm-unknown-linux-gnueabi := linux-armv4
175173
OPENSSL_OS_arm-unknown-linux-gnueabihf := linux-armv4
176174
OPENSSL_OS_armv7-unknown-linux-gnueabihf := linux-armv4
@@ -194,7 +192,12 @@ OPENSSL_AR_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-ar
194192
OPENSSL_AR_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-ar
195193
OPENSSL_AR_x86_64-unknown-netbsd := x86_64-unknown-netbsd-ar
196194

195+
SETARCH_i686-unknown-linux-gnu := setarch i386
196+
OPENSSL_CFLAGS_i686-unknown-linux-gnu := -m32
197+
197198
define BUILD_OPENSSL
199+
ifdef OPENSSL_OS_$(1)
200+
ifdef CFG_ENABLE_NIGHTLY
198201
OPENSSL_INSTALL_$(1) := $$(CFG_BUILD_DIR)/target/openssl/$(1)-install
199202

200203
target/openssl/$(1).stamp: target/openssl/openssl-$$(OPENSSL_VERS).tar.gz \
@@ -204,8 +207,8 @@ target/openssl/$(1).stamp: target/openssl/openssl-$$(OPENSSL_VERS).tar.gz \
204207
(cd target/openssl/$(1) && \
205208
CC=$$(OPENSSL_CC_$(1)) \
206209
AR=$$(OPENSSL_AR_$(1)) \
207-
./Configure --prefix=$$(OPENSSL_INSTALL_$(1)) \
208-
no-dso $$(OPENSSL_OS_$(1)) -fPIC && \
210+
$$(SETARCH_$(1)) ./Configure --prefix=$$(OPENSSL_INSTALL_$(1)) \
211+
no-dso $$(OPENSSL_OS_$(1)) -fPIC $$(OPENSSL_CFLAGS_$(1))&& \
209212
$(MAKE) -j10 && \
210213
$(MAKE) install)
211214
touch $$@
@@ -215,9 +218,19 @@ cargo-$(1): export OPENSSL_STATIC := 1
215218
cargo-$(1): export OPENSSL_ROOT_DIR := $$(OPENSSL_INSTALL_$(1))
216219
cargo-$(1): export OPENSSL_LIB_DIR := $$(OPENSSL_INSTALL_$(1))/lib
217220
cargo-$(1): export OPENSSL_INCLUDE_DIR := $$(OPENSSL_INSTALL_$(1))/include
221+
test-unit-$(1): export OPENSSL_STATIC := 1
222+
test-unit-$(1): export OPENSSL_ROOT_DIR := $$(OPENSSL_INSTALL_$(1))
223+
test-unit-$(1): export OPENSSL_LIB_DIR := $$(OPENSSL_INSTALL_$(1))/lib
224+
test-unit-$(1): export OPENSSL_INCLUDE_DIR := $$(OPENSSL_INSTALL_$(1))/include
218225

219226
# build libz statically into the cargo we're producing
220227
cargo-$(1): export LIBZ_SYS_STATIC := 1
228+
else
229+
target/openssl/$(1).stamp:
230+
endif
231+
else
232+
target/openssl/$(1).stamp:
233+
endif
221234
endef
222235

223236
$(foreach target,$(CFG_TARGET),$(eval $(call BUILD_OPENSSL,$(target))))
@@ -229,12 +242,6 @@ target/openssl/openssl-$(OPENSSL_VERS).tar.gz: | target/openssl/
229242

230243
target/openssl/:
231244
mkdir -p $(@)
232-
else
233-
define BUILD_OPENSSL
234-
target/openssl/$(1).stamp:
235-
endef
236-
$(foreach target,$(CFG_TARGET),$(eval $(call BUILD_OPENSSL,$(target))))
237-
endif
238245

239246
# === Distribution
240247

src/etc/install-deps.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,35 @@
1414
host_bits = 'x86_64'
1515
extra_bits = 'i686'
1616

17-
extra = None
17+
1818

1919
# Figure out our target triple
2020
if sys.platform == 'linux' or sys.platform == 'linux2':
2121
host = host_bits + '-unknown-linux-gnu'
22-
extra = extra_bits + '-unknown-linux-gnu'
22+
targets = [
23+
'i686-unknown-linux-gnu',
24+
'x86_64-unknown-linux-gnu',
25+
'arm-unknown-linux-gnueabi',
26+
'arm-unknown-linux-gnueabihf',
27+
'armv7-unknown-linux-gnueabihf',
28+
'x86_64-unknown-freebsd',
29+
'x86_64-unknown-netbsd',
30+
]
2331
elif sys.platform == 'darwin':
2432
host = host_bits + '-apple-darwin'
25-
extra = extra_bits + '-apple-darwin'
33+
targets = ['i686-apple-darwin', 'x86_64-apple-darwin']
2634
elif sys.platform == 'win32':
2735
if os.environ.get('MSVC') == '1':
2836
host = host_bits + '-pc-windows-msvc'
29-
extra = extra_bits + '-pc-windows-msvc'
37+
targets = [
38+
'i686-pc-windows-msvc',
39+
'x86_64-pc-windows-msvc',
40+
]
3041
else:
3142
host = host_bits + '-pc-windows-gnu'
43+
targets = [host]
3244
else:
33-
exit_msg = "There is no official Cargo snapshot for {} platform, sorry."
45+
exit_msg = "There is no official Cargo snapshot for {} platform, sorry."
3446
sys.exit(exit_msg.format(sys.platform))
3547

3648
rust_date = open('src/rustversion.txt').read().strip()
@@ -48,9 +60,8 @@ def install_via_tarballs():
4860
os.remove(host_fname)
4961

5062
# Download all target libraries needed
51-
fetch_std(host)
52-
if extra is not None:
53-
fetch_std(extra)
63+
for target in targets:
64+
fetch_std(target)
5465

5566
if os.path.isdir("rustc"):
5667
shutil.rmtree("rustc")

0 commit comments

Comments
 (0)