File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,33 @@ check: all
9
9
HEADER := ../include/mp4parse.h
10
10
CXXFLAGS = -g -Wall -std=c++11 -I$(dir $(HEADER ) )
11
11
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
+
12
23
CRATE_DIR := ../../target/debug/deps
13
24
14
25
libmp4parse.a libmp4parse.a.out : ../src/lib.rs
15
26
rustc -g --crate-type staticlib --crate-name mp4parse \
16
27
--emit dep-info,link=$@ \
28
+ $(PRINT_NATIVE_STATIC_LIBS ) \
17
29
-L $(CRATE_DIR ) $< \
18
30
2> libmp4parse.a.out || cat libmp4parse.a.out >&2
19
31
20
32
-include mp4parse.d
21
33
34
+ ifeq ($(RUSTC_MINOR_LT_23 ) , true)
22
35
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
23
39
test : test.cc libmp4parse.a $(HEADER )
24
40
$(CXX ) $(CXXFLAGS ) -c $(filter % .cc,$^ )
25
41
$(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() {
6
6
let output = Command :: new ( "make" )
7
7
. arg ( "-C" )
8
8
. arg ( "examples" )
9
+ . arg ( "clean" )
9
10
. arg ( "check" )
10
11
. output ( )
11
12
. expect ( "failed to execute process" ) ;
You can’t perform that action at this time.
0 commit comments