Skip to content

Commit c6a9f6d

Browse files
committed
---
yaml --- r: 113635 b: refs/heads/snap-stage3 c: 8cbda5d h: refs/heads/master i: 113633: 5fedef4 113631: 6d5dc7c v: v3
1 parent 07a6717 commit c6a9f6d

File tree

23 files changed

+159
-56
lines changed

23 files changed

+159
-56
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: abdacecdf86b4b5a4f432560445a24e1c5f4751b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a8646be1a8e2025e0bfd18dfcebf968cfcb4645e
4+
refs/heads/snap-stage3: 8cbda5da939e97d5dafde4a2a20927fb539bf80c
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/main.mk

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,45 @@ CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
349349
endef
350350

351351
# Same macro/variables as above, but defined in a separate loop so it can use
352-
# all the varibles above for all archs. The RPATH_VAR setup sometimes needs to
352+
# all the variables above for all archs. The RPATH_VAR setup sometimes needs to
353353
# reach across triples to get things in order.
354+
#
355+
# Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
356+
# * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
357+
# environment to access or extend the lookup path for dynamic
358+
# libraries. Note on Windows, that key is `$PATH`, and thus not
359+
# only conflates programs with dynamic libraries, but also often
360+
# contains spaces which confuse make.
361+
# * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
362+
# * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
363+
#
364+
# Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
365+
# above settings.
366+
#
354367
define SREQ_CMDS
355368

356369
ifeq ($$(OSTYPE_$(3)),apple-darwin)
357-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
358-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
370+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
371+
else
372+
ifeq ($$(CFG_WINDOWSY_$(2)),1)
373+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
359374
else
360-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
361-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
375+
LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
376+
endif
362377
endif
363378

379+
LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
380+
$$(CURDIR)/$$(HLIB$(1)_H_$(3))
381+
LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
382+
$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
383+
384+
HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
385+
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)):$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))
386+
TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
387+
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)):$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))
388+
389+
RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
390+
364391
# Pass --cfg stage0 only for the build->host part of stage0;
365392
# if you're building a cross config, the host->* parts are
366393
# effectively stage1, since it uses the just-built stage0.
@@ -376,13 +403,7 @@ ifeq ($(1),0)
376403
ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
377404
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
378405

379-
ifeq ($$(OSTYPE_$(3)),apple-darwin)
380-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
381-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))"
382-
else
383-
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
384-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))"
385-
endif
406+
RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))
386407
endif
387408
endif
388409

branches/snap-stage3/mk/tests.mk

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,27 @@ else
793793
CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
794794
endif
795795

796+
# (Issues #13732, #13983, #14000) The doc for the regex crate includes
797+
# uses of the `regex!` macro from the regex_macros crate. There is
798+
# normally a dependence injected that makes the target's regex depend
799+
# upon the host's regex_macros (see #13845), but that dependency
800+
# injection is currently skipped for stage1 as a special case.
801+
#
802+
# Therefore, as a further special case, this conditional skips
803+
# attempting to run the doc tests for the regex crate atop stage1,
804+
# (since there is no regex_macros crate for the stage1 rustc to load).
805+
#
806+
# (Another approach for solving this would be to inject the desired
807+
# dependence for stage1 as well, by setting things up to generate a
808+
# regex_macros crate that was compatible with the stage1 rustc and
809+
# thus re-enable our ability to run this test.)
810+
ifeq (stage$(1)-crate-$(4),stage1-crate-regex)
811+
check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec:
812+
@$$(call E, skipping doc-crate-$(4) as it uses macros and cannot run at stage$(1))
813+
else
796814
check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
797815
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
816+
endif
798817

799818
ifeq ($(2),$$(CFG_BUILD))
800819
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
@@ -951,7 +970,10 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
951970
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
952971
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
953972
"$$(TESTNAME)" \
954-
"$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
973+
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
974+
"$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
975+
"$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
976+
$(1)
955977
@touch $$@
956978
else
957979
# FIXME #11094 - The above rule doesn't work right for multiple targets

branches/snap-stage3/src/etc/maketest.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,21 @@ def putenv(name, value):
3030
value = normalize_path(value)
3131
os.putenv(name, value)
3232

33+
def convert_path_spec(name, value):
34+
if os.name == 'nt' and name != 'PATH':
35+
value = ":".join(normalize_path(v) for v in value.split(";"))
36+
return value
3337

3438
make = sys.argv[2]
3539
putenv('RUSTC', os.path.abspath(sys.argv[3]))
3640
putenv('TMPDIR', os.path.abspath(sys.argv[4]))
3741
putenv('CC', sys.argv[5])
3842
putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
3943
filt = sys.argv[7]
40-
ldpath = sys.argv[8]
41-
if ldpath != '':
42-
name = ldpath.split('=')[0]
43-
value = ldpath.split('=')[1]
44-
if os.name == 'nt' and name != 'PATH':
45-
value = ":".join(normalize_path(v) for v in value.split(";"))
46-
os.putenv(name, value)
44+
putenv('LD_LIB_PATH_ENVVAR', sys.argv[8]);
45+
putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]));
46+
putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]));
47+
putenv('RUST_BUILD_STAGE', sys.argv[11])
4748

4849
if not filt in sys.argv[1]:
4950
sys.exit(0)
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
-include ../tools.mk
22

3+
HOST_LIB_DIR=$(TMPDIR)/../../../stage$(RUST_BUILD_STAGE)/lib
4+
# This overrides the LD_LIBRARY_PATH for RUN
5+
TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
6+
37
all:
48
$(RUSTC) lib.rs
59
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6-
$(CC) main.c -o $(call RUN,main) -lboot
10+
$(CC) main.c -o $(call RUN_BINFILE,main) $(call RPATH_LINK_SEARCH,$(HOST_LIB_DIR)) -lboot
711
$(call RUN,main)
8-
rm $(call DYLIB,boot)
12+
$(call REMOVE_DYLIBS,boot)
913
$(call FAIL,main)
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
-include ../tools.mk
22

3+
HOST_LIB_DIR=$(TMPDIR)/../../../stage$(RUST_BUILD_STAGE)/lib
4+
# This overrides the LD_LIBRARY_PATH for RUN
5+
TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
6+
37
all:
48
$(RUSTC) lib.rs
59
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6-
$(CC) main.c -o $(call RUN,main) -lboot
10+
$(CC) main.c -o $(call RUN_BINFILE,main) $(call RPATH_LINK_SEARCH,$(HOST_LIB_DIR)) -lboot
711
$(call RUN,main)
8-
rm $(call DYLIB,boot)
12+
$(call REMOVE_DYLIBS,boot)
913
$(call FAIL,main)

branches/snap-stage3/src/test/run-make/c-dynamic-dylib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ all: $(call DYLIB,cfoo)
99
$(RUSTC) foo.rs
1010
$(RUSTC) bar.rs
1111
$(call RUN,bar)
12-
rm $(TMPDIR)/$(call DYLIB_GLOB,cfoo)
12+
$(call REMOVE_DYLIBS,cfoo)
1313
$(call FAIL,bar)
1414
endif
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
-include ../tools.mk
22

3+
# This overrides the LD_LIBRARY_PATH for RUN
4+
TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
5+
36
# This hits an assertion in the linker on older versions of osx apparently
47
ifeq ($(shell uname),Darwin)
58
all:
@@ -8,7 +11,7 @@ else
811
all: $(call DYLIB,cfoo)
912
$(RUSTC) foo.rs
1013
$(RUSTC) bar.rs
11-
LD_LIBRARY_PATH=$(TMPDIR) $(call RUN,bar)
12-
rm $(TMPDIR)/$(call DYLIB_GLOB,cfoo)
14+
$(call RUN,bar)
15+
$(call REMOVE_DYLIBS,cfoo)
1316
$(call FAIL,bar)
1417
endif
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
-include ../tools.mk
22

3+
HOST_LIB_DIR=$(TMPDIR)/../../../stage$(RUST_BUILD_STAGE)/lib
4+
35
all:
46
$(RUSTC) foo.rs
57
ln -s $(call DYLIB,foo-*) $(call DYLIB,foo)
6-
$(CC) bar.c -lfoo -o $(call RUN,bar) -Wl,-rpath,$(TMPDIR)
8+
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(call RPATH_LINK_SEARCH,$(HOST_LIB_DIR)) -Wl,-rpath,$(TMPDIR)
79
$(call RUN,bar)
8-
rm $(call DYLIB,foo)
10+
$(call REMOVE_DYLIBS,foo)
911
$(call FAIL,bar)

branches/snap-stage3/src/test/run-make/c-link-to-rust-staticlib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ifneq ($(shell uname),FreeBSD)
1111
all:
1212
$(RUSTC) foo.rs
1313
ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo)
14-
$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++
14+
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(EXTRAFLAGS) -lstdc++
1515
$(call RUN,bar)
1616
rm $(call STATICLIB,foo*)
1717
$(call RUN,bar)

branches/snap-stage3/src/test/run-make/c-static-dylib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ all: $(call STATICLIB,cfoo)
55
$(RUSTC) bar.rs
66
rm $(TMPDIR)/$(call STATICLIB_GLOB,cfoo)
77
$(call RUN,bar)
8-
rm $(TMPDIR)/$(call DYLIB_GLOB,foo)
8+
$(call REMOVE_DYLIBS,foo)
99
$(call FAIL,bar)

branches/snap-stage3/src/test/run-make/c-static-rlib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
all: $(call STATICLIB,cfoo)
44
$(RUSTC) foo.rs
55
$(RUSTC) bar.rs
6-
rm $(TMPDIR)/$(call RLIB_GLOB,foo)
6+
$(call REMOVE_RLIBS,foo)
77
rm $(TMPDIR)/$(call STATICLIB_GLOB,cfoo)
88
$(call RUN,bar)

branches/snap-stage3/src/test/run-make/dylib-chain/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ all:
66
$(RUSTC) m3.rs
77
$(RUSTC) m4.rs
88
$(call RUN,m4)
9-
rm $(TMPDIR)/$(call DYLIB_GLOB,m1)
10-
rm $(TMPDIR)/$(call DYLIB_GLOB,m2)
11-
rm $(TMPDIR)/$(call DYLIB_GLOB,m3)
9+
$(call REMOVE_DYLIBS,m1)
10+
$(call REMOVE_DYLIBS,m2)
11+
$(call REMOVE_DYLIBS,m3)
1212
$(call FAIL,m4)

branches/snap-stage3/src/test/run-make/extern-fn-reachable/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
-include ../tools.mk
22

3+
# This overrides the LD_LIBRARY_PATH for RUN
4+
TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
5+
36
all:
47
$(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so
58
$(RUSTC) main.rs

branches/snap-stage3/src/test/run-make/lto-smoke-c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ CC := $(CC:-g=)
1919
all:
2020
$(RUSTC) foo.rs -Z lto
2121
ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo)
22-
$(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++
22+
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(EXTRAFLAGS) -lstdc++
2323
$(call RUN,bar)
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
-include ../tools.mk
22

3-
all:
3+
# This test attempts to use syntax extensions, which are known to be
4+
# incompatible with stage1 at the moment.
5+
6+
ifeq ($(RUST_BUILD_STAGE),1)
7+
DOTEST=
8+
else
9+
DOTEST=dotest
10+
endif
11+
12+
all: $(DOTEST)
13+
14+
dotest:
15+
env
416
$(RUSTC) lib.rs
517
$(RUSTC) main.rs -Z lto
618
$(call RUN,main)

branches/snap-stage3/src/test/run-make/missing-crate-dependency/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
all:
44
$(RUSTC) --crate-type=rlib crateA.rs
55
$(RUSTC) --crate-type=rlib crateB.rs
6-
rm $(TMPDIR)/$(call RLIB_GLOB,crateA)
6+
$(call REMOVE_RLIBS,crateA)
77
# Ensure crateC fails to compile since dependency crateA is missing
88
$(RUSTC) crateC.rs 2>&1 | \
99
grep "error: can't find crate for \`crateA\` which \`crateB\` depends on"

branches/snap-stage3/src/test/run-make/mixing-libs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ all:
55
$(RUSTC) dylib.rs
66
$(RUSTC) rlib.rs --crate-type=dylib
77
$(RUSTC) dylib.rs
8-
rm $(call DYLIB,rlib-*)
8+
$(call REMOVE_DYLIBS,rlib)
99
$(RUSTC) prog.rs && exit 1 || exit 0

branches/snap-stage3/src/test/run-make/obey-crate-type-flag/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# fail if an rlib was built
88
all:
99
$(RUSTC) test.rs
10-
rm $(TMPDIR)/$(call RLIB_GLOB,test)
11-
rm $(TMPDIR)/$(call DYLIB_GLOB,test)
10+
$(call REMOVE_RLIBS,test)
11+
$(call REMOVE_DYLIBS,test)
1212
$(RUSTC) --crate-type dylib test.rs
13-
rm $(TMPDIR)/$(call RLIB_GLOB,test) && exit 1 || exit 0
13+
$(call REMOVE_RLIBS,test) && exit 1 || exit 0

branches/snap-stage3/src/test/run-make/output-type-permutations/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
all:
44
$(RUSTC) foo.rs --crate-type=rlib,dylib,staticlib
5-
rm $(TMPDIR)/$(call RLIB_GLOB,bar)
6-
rm $(TMPDIR)/$(call DYLIB_GLOB,bar)
5+
$(call REMOVE_RLIBS,bar)
6+
$(call REMOVE_DYLIBS,bar)
77
rm $(TMPDIR)/$(call STATICLIB_GLOB,bar)
88
$(RUSTC) foo.rs --crate-type=bin
99
rm $(TMPDIR)/$(call BIN,bar)
@@ -41,4 +41,4 @@ all:
4141
cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc
4242
rm $(TMPDIR)/bar.bc
4343
rm $(TMPDIR)/foo.bc
44-
rm $(TMPDIR)/$(call RLIB_GLOB,bar)
44+
$(call REMOVE_RLIBS,bar)

branches/snap-stage3/src/test/run-make/prefer-dylib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ all:
55
$(RUSTC) foo.rs -C prefer-dynamic
66
$(call RUN,foo)
77
rm $(TMPDIR)/*bar*
8-
$(call FAILS,foo)
8+
$(call FAIL,foo)

branches/snap-stage3/src/test/run-make/tools.mk

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@ export DYLD_LIBRARY_PATH:=$(TMPDIR):$(DYLD_LIBRARY_PATH)
44
RUSTC := $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
55
CC := $(CC) -L $(TMPDIR)
66

7-
RUN = $(TMPDIR)/$(1)
8-
FAILS = $(TMPDIR)/$(1) && exit 1 || exit 0
7+
# These deliberately use `=` and not `:=` so that client makefiles can
8+
# augment HOST_RPATH_DIR / TARGET_RPATH_DIR.
9+
HOST_RPATH_ENV = \
10+
$(LD_LIB_PATH_ENVVAR)=$$$(LD_LIB_PATH_ENVVAR):$(HOST_RPATH_DIR)
11+
TARGET_RPATH_ENV = \
12+
$(LD_LIB_PATH_ENVVAR)=$$$(LD_LIB_PATH_ENVVAR):$(TARGET_RPATH_DIR)
13+
14+
# This is the name of the binary we will generate and run; use this
15+
# e.g. for `$(CC) -o $(RUN_BINFILE)`.
16+
RUN_BINFILE = $(TMPDIR)/$(1)
17+
18+
# RUN and FAIL are basic way we will invoke the generated binary. On
19+
# non-windows platforms, they set the LD_LIBRARY_PATH environment
20+
# variable before running the binary.
921

1022
RLIB_GLOB = lib$(1)*.rlib
1123
STATICLIB = $(TMPDIR)/lib$(1).a
@@ -18,20 +30,32 @@ IS_WINDOWS=1
1830
endif
1931

2032
ifeq ($(UNAME),Darwin)
33+
RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)
34+
FAIL = $(TARGET_RPATH_ENV) $(RUN_BINFILE) && exit 1 || exit 0
2135
DYLIB_GLOB = lib$(1)*.dylib
2236
DYLIB = $(TMPDIR)/lib$(1).dylib
37+
RPATH_LINK_SEARCH =
2338
else
2439
ifdef IS_WINDOWS
40+
RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(RUN_BINFILE)
41+
FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(RUN_BINFILE) && exit 1 || exit 0
2542
DYLIB_GLOB = $(1)*.dll
2643
DYLIB = $(TMPDIR)/$(1).dll
2744
BIN = $(1).exe
28-
export PATH := $(PATH):$(LD_LIBRARY_PATH)
45+
RPATH_LINK_SEARCH =
46+
RUSTC := PATH="$(PATH):$(LD_LIBRARY_PATH)" $(RUSTC)
2947
else
48+
RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)
49+
FAIL = $(TARGET_RPATH_ENV) $(RUN_BINFILE) && exit 1 || exit 0
3050
DYLIB_GLOB = lib$(1)*.so
3151
DYLIB = $(TMPDIR)/lib$(1).so
52+
RPATH_LINK_SEARCH = -Wl,-rpath-link=$(1)
3253
endif
3354
endif
3455

56+
REMOVE_DYLIBS = rm $(TMPDIR)/$(call DYLIB_GLOB,$(1))
57+
REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1))
58+
3559
%.a: %.o
3660
ar crus $@ $<
3761
%.dylib: %.o

0 commit comments

Comments
 (0)