Skip to content

Commit dce831e

Browse files
committed
Rename lightning C/C++ bindings library to libldk
This should fix #689.
1 parent 53182a8 commit dce831e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

genbindings.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ fi
4848
# Finally, sanity-check the generated C and C++ bindings with demo apps:
4949

5050
# Naively run the C demo app:
51-
gcc -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
51+
gcc -Wall -g -pthread demo.c target/debug/libldk.a -ldl
5252
./a.out
5353

5454
# And run the C++ demo app in valgrind to test memory model correctness and lack of leaks.
55-
g++ -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -llightning -ldl
55+
g++ -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -lldk -ldl
5656
if [ -x "`which valgrind`" ]; then
5757
LD_LIBRARY_PATH=target/debug/ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
5858
echo
@@ -62,7 +62,7 @@ fi
6262

6363
# Test a statically-linked C++ version, tracking the resulting binary size and runtime
6464
# across debug, LTO, and cross-language LTO builds (using the same compiler each time).
65-
clang++ -std=c++11 -Wall -pthread demo.cpp target/debug/liblightning.a -ldl
65+
clang++ -std=c++11 -Wall -pthread demo.cpp target/debug/libldk.a -ldl
6666
./a.out >/dev/null
6767
echo " C++ Bin size and runtime w/o optimization:"
6868
ls -lha a.out
@@ -75,19 +75,19 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then
7575
if [ -x "$(which clang-$LLVM_V)" ]; then
7676
cargo +nightly clean
7777
cargo +nightly rustc -Zbuild-std --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes
78-
mv target/x86_64-unknown-linux-gnu/debug/liblightning.* target/debug/
78+
mv target/x86_64-unknown-linux-gnu/debug/libldk.* target/debug/
7979

8080
# Sadly, std doesn't seem to compile into something that is memsan-safe as of Aug 2020,
8181
# so we'll always fail, not to mention we may be linking against git rustc LLVM which
8282
# may differ from clang-llvm, so just allow everything here to fail.
8383
set +e
8484

8585
# First the C demo app...
86-
clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
86+
clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c target/debug/libldk.a -ldl
8787
./a.out
8888

8989
# ...then the C++ demo app
90-
clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp target/debug/liblightning.a -ldl
90+
clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp target/debug/libldk.a -ldl
9191
./a.out >/dev/null
9292

9393
# restore exit-on-failure
@@ -153,11 +153,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" -o "$HOST_PLATFORM" = "
153153
mv Cargo.toml.bk Cargo.toml
154154

155155
# First the C demo app...
156-
$CLANG -fsanitize=address -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
156+
$CLANG -fsanitize=address -Wall -g -pthread demo.c target/debug/libldk.a -ldl
157157
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out
158158

159159
# ...then the C++ demo app
160-
$CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp target/debug/liblightning.a -ldl
160+
$CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp target/debug/libldk.a -ldl
161161
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out >/dev/null
162162
else
163163
echo "WARNING: Please install clang-$RUSTC_LLVM_V and clang++-$RUSTC_LLVM_V to build with address sanitizer"
@@ -168,7 +168,7 @@ fi
168168

169169
# Now build with LTO on on both C++ and rust, but without cross-language LTO:
170170
cargo rustc -v --release -- -C lto
171-
clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp target/release/liblightning.a -ldl
171+
clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp target/release/libldk.a -ldl
172172
echo "C++ Bin size and runtime with only RL (LTO) optimized:"
173173
ls -lha a.out
174174
time ./a.out > /dev/null
@@ -180,7 +180,7 @@ if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then
180180
# packaging than simply shipping the rustup binaries (eg Debian should Just Work
181181
# here).
182182
cargo rustc -v --release -- -C linker-plugin-lto -C lto -C link-arg=-fuse-ld=lld
183-
$CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp target/release/liblightning.a -ldl
183+
$CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp target/release/libldk.a -ldl
184184
echo "C++ Bin size and runtime with cross-language LTO:"
185185
ls -lha a.out
186186
time ./a.out > /dev/null

lightning-c-bindings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Utilities to fetch the chain from Bitcoin Core REST/RPC Interfaces and feed them
99
"""
1010

1111
[lib]
12-
name = "lightning"
12+
name = "ldk"
1313
crate-type = ["staticlib"
1414
# Note that the following line is matched exactly by genbindings to turn off dylib creation
1515
,"cdylib"]

0 commit comments

Comments
 (0)