File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,33 @@ check: all
99HEADER := ../include/mp4parse.h
1010CXXFLAGS = -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+
1223CRATE_DIR := ../../target/debug/deps
1324
1425libmp4parse.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)
2235test : 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
2339test : test.cc libmp4parse.a $(HEADER )
2440 $(CXX ) $(CXXFLAGS ) -c $(filter % .cc,$^ )
2541 $(CXX ) $(CXXFLAGS ) -o $@ * .o libmp4parse.a $(RUST_LIBS )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ fn build_ffi_test() {
66 let output = Command :: new ( "make" )
77 . arg ( "-C" )
88 . arg ( "examples" )
9+ . arg ( "clean" )
910 . arg ( "check" )
1011 . output ( )
1112 . expect ( "failed to execute process" ) ;
You can’t perform that action at this time.
0 commit comments