jsonnet: fix linking issue with libjsonnet++

This commit is contained in:
Jeremy Parker 2023-07-10 19:39:08 +10:00
parent 12d4e183c1
commit e0698cf898
2 changed files with 23 additions and 2 deletions

View file

@ -3,7 +3,7 @@
stdenv.mkDerivation rec {
pname = "jsonnet";
version = "0.20.0";
outputs = ["out" "doc"];
outputs = [ "out" "doc" ];
src = fetchFromGitHub {
rev = "v${version}";
@ -15,7 +15,16 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ jekyll cmake ];
buildInputs = [ gtest ];
cmakeFlags = ["-DBUILD_STATIC_LIBS=ON" "-DUSE_SYSTEM_GTEST=ON" ];
cmakeFlags = [
"-DUSE_SYSTEM_GTEST=ON"
"-DBUILD_STATIC_LIBS=${if stdenv.hostPlatform.isStatic then "ON" else "OFF"}"
"-DBUILD_SHARED_BINARIES=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
];
# https://github.com/google/jsonnet/issues/778
patches = [
./fix-cpp-unresolved-symbols.patch
];
enableParallelBuilding = true;

View file

@ -0,0 +1,12 @@
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 3a52458..872e6c6 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -10,6 +10,7 @@ set(LIBJSONNETPP_SOURCE
add_library(libjsonnet++ SHARED ${LIBJSONNETPP_HEADERS} ${LIBJSONNETPP_SOURCE})
add_dependencies(libjsonnet++ jsonnet)
+target_link_libraries(libjsonnet++ libjsonnet)
# target_link_libraries(libjsonnet libjsonnet)
# CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without