Skip to content

Commit 8b60b8a

Browse files
committed
Fix non-manual build-libldk.sh absolute path detection, and allow explicit LDK directory specification (as opposed to bindings base) environment variable specification for xcarchive builds
1 parent 10350b9 commit 8b60b8a

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

ci/LDKSwift/Package.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@ if let bindingsBase = getenv("LDK_C_BINDINGS_BASE") {
99
cBindingsBase = String(utf8String: bindingsBase)!
1010
}
1111

12+
var bindingsDirectory = "\(cBindingsBase)/lightning-c-bindings/target/debug"
13+
if let ldkBinaryDirectory = getenv("LDK_C_BINDINGS_BINARY_DIRECTORY") {
14+
bindingsDirectory = String(utf8String: ldkBinaryDirectory)!
15+
}
16+
17+
var bindingsLibraryPath = "\(bindingsDirectory)/libldk.a"
18+
1219
var linkerSettings: [PackageDescription.LinkerSetting] = [
13-
.linkedLibrary("\(cBindingsBase)/lightning-c-bindings/target/debug/libldk.a")
20+
.linkedLibrary(bindingsLibraryPath)
1421
]
1522

16-
#if os(macOS)
23+
#if os(Linux)
24+
linkerSettings.append(.linkedLibrary(String(utf8String: getenv("LLVM_CLANG_ASAN_PATH")!)!, .when(platforms: [.linux])))
25+
#else
1726
linkerSettings = [
1827
.unsafeFlags(["-L\(cBindingsBase)/lightning-c-bindings/target/debug"]),
1928
.linkedLibrary("ldk")
2029
]
21-
#elseif os(Linux)
22-
linkerSettings.append(.linkedLibrary(String(utf8String: getenv("LLVM_CLANG_ASAN_PATH")!)!, .when(platforms: [.linux])))
2330
#endif
2431

2532
let package = Package(
@@ -63,6 +70,5 @@ let package = Package(
6370
sources: nil,
6471
cSettings: nil, cxxSettings: nil, swiftSettings: nil,
6572
linkerSettings: nil)
66-
6773
]
6874
)

xcode/LDK/build-libldk.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ set -e # stop execution upon the first error
1414

1515
C_BINDINGS_SOURCE_DIRECTORY="$(cd ${LDK_DIRECTORY}; pwd)/lightning-c-bindings"
1616

17-
BASEDIR=$(dirname "$0")
17+
# https://stackoverflow.com/a/4774063/299711
18+
BASEDIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
1819
BUILD_LOG_PATH="${BASEDIR}/build_libldk.log"
1920

2021
# echo -n "" > $BUILD_LOG_PATH

0 commit comments

Comments
 (0)