Skip to content

Commit ccde32b

Browse files
committed
Fix failing build_ffi test under current nightly after rust-lang/rust#43067 landed.
1 parent 0f39f07 commit ccde32b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mp4parse_capi/examples/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,33 @@ check: all
99
HEADER := ../include/mp4parse.h
1010
CXXFLAGS = -g -Wall -std=c++11 -I$(dir $(HEADER))
1111

12+
# Printing linker libraries by default was removed in rustc 1.23, so we need to
13+
# request them explicitly.
14+
RUSTC_MINOR_VERSION := $(shell rustc --version | cut -f2 -d.)
15+
RUSTC_MINOR_LT_23 := $(shell [ $(RUSTC_MINOR_VERSION) -lt 23 ] && echo true)
16+
17+
ifeq ($(RUSTC_MINOR_LT_23), true)
18+
PRINT_NATIVE_STATIC_LIBS :=
19+
else
20+
PRINT_NATIVE_STATIC_LIBS := --print native-static-libs
21+
endif
22+
1223
CRATE_DIR := ../../target/debug/deps
1324

1425
libmp4parse.a libmp4parse.a.out : ../src/lib.rs
1526
rustc -g --crate-type staticlib --crate-name mp4parse \
1627
--emit dep-info,link=$@ \
28+
$(PRINT_NATIVE_STATIC_LIBS) \
1729
-L $(CRATE_DIR) $< \
1830
2> libmp4parse.a.out || cat libmp4parse.a.out >&2
1931

2032
-include mp4parse.d
2133

34+
ifeq ($(RUSTC_MINOR_LT_23), true)
2235
test: RUST_LIBS = $(shell awk '/^note: library: / {print "-l"$$3}' libmp4parse.a.out)
36+
else
37+
test: RUST_LIBS = $(shell sed -n 's/^note: native-static-libs: //p' libmp4parse.a.out)
38+
endif
2339
test: test.cc libmp4parse.a $(HEADER)
2440
$(CXX) $(CXXFLAGS) -c $(filter %.cc,$^)
2541
$(CXX) $(CXXFLAGS) -o $@ *.o libmp4parse.a $(RUST_LIBS)

0 commit comments

Comments
 (0)