File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ ANDROID="false"
14
14
SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
15
15
BUILD_DIR=" $SCRIPT_DIR /../build"
16
16
17
- # TODO: Any bad consequences by blindly overriding this ??
18
- CARGO_TARGET_DIR=" $BUILD_DIR /tmp/"
19
- export CARGO_TARGET_DIR
20
-
21
17
while [[ " $# " -gt 0 ]]; do
22
18
case $1 in
23
19
--android) ANDROID=" true" ;;
@@ -91,13 +87,15 @@ function build_unix {
91
87
pushd libwg
92
88
if [[ " $DAITA " == " true" ]]; then
93
89
pushd wireguard-go
94
- make libmaybenot.a LIBDEST=" $BUILD_DIR /lib/$TARGET "
90
+ CARGO_TARGET_DIR= " $BUILD_DIR /tmp/ " make libmaybenot.a LIBDEST=" $BUILD_DIR /lib/$TARGET "
95
91
popd
96
92
# TODO: This artifact needs to be available in target/<release | debug>
97
93
CGO_LDFLAGS=" -L$BUILD_DIR /lib/$TARGET " go build -v --tags daita -o " $BUILD_DIR /lib/$TARGET /libwg.so" -buildmode c-shared
98
94
else
99
95
go build -v -o " $BUILD_DIR /lib/$TARGET /libwg.so" -buildmode c-shared
100
96
fi
97
+ # Copy libwg to `OUT_DIR` so that we may refer to it via `OUT_DIR` in `build.rs`, which might be handy.
98
+ cp " $BUILD_DIR /lib/$TARGET /libwg.so" " $OUT_DIR /libwg.so"
101
99
popd
102
100
}
103
101
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ fn main() {
47
47
declare_libs_dir ( "../build/lib" ) ;
48
48
49
49
println ! ( "cargo::rerun-if-changed=libwg" ) ;
50
+
51
+ // Add `OUT_DIR` to the library search path to facilitate linking of libwg for debug artifacts,
52
+ // such as test binaries.
53
+ if cfg ! ( debug_assertions) {
54
+ println ! ( "cargo::rustc-link-search={out_dir}" ) ;
55
+ }
50
56
}
51
57
52
58
/// Tell linker to check `base`/$TARGET for shared libraries.
You can’t perform that action at this time.
0 commit comments