aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTBK <tbk@jjtc.eu>2019-06-19 22:17:37 +0200
committerLeo <thinkabit.ukim@gmail.com>2019-06-20 10:13:09 -0300
commit15aa878b0dd21efa1aef2518baaf60ba57571daf (patch)
tree55a5f935cd86eb1439da50452ed9838ea1775e8c
parent19b9749b21c861c7f19505796b8f5df2ff191793 (diff)
downloadaports-15aa878b0dd21efa1aef2518baaf60ba57571daf.tar.bz2
aports-15aa878b0dd21efa1aef2518baaf60ba57571daf.tar.xz
testing/jsonnet: new aport
-rw-r--r--testing/jsonnet/APKBUILD45
-rw-r--r--testing/jsonnet/build-cli-shared.patch46
-rw-r--r--testing/jsonnet/fix-soname-ver.patch13
-rw-r--r--testing/jsonnet/use-real-sys-gtest.patch14
4 files changed, 118 insertions, 0 deletions
diff --git a/testing/jsonnet/APKBUILD b/testing/jsonnet/APKBUILD
new file mode 100644
index 0000000000..fd66ae872e
--- /dev/null
+++ b/testing/jsonnet/APKBUILD
@@ -0,0 +1,45 @@
+# Contributor: TBK <alpine@jjtc.eu>
+# Maintainer: TBK <alpine@jjtc.eu>
+pkgname="jsonnet"
+pkgver="0.13.0"
+pkgrel=0
+pkgdesc="The data templating language"
+url="https://jsonnet.org/"
+arch="all"
+license="Apache-2.0"
+makedepends="cmake"
+checkdepends="gtest-dev"
+subpackages="$pkgname-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/google/jsonnet/archive/v$pkgver.tar.gz
+ build-cli-shared.patch
+ use-real-sys-gtest.patch
+ fix-soname-ver.patch
+ "
+
+build() {
+ mkdir build && cd build
+ cmake .. \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DBUILD_CLI_SHARED=ON \
+ -DUSE_SYSTEM_GTEST=ON
+ make
+}
+
+check() {
+ cd "$builddir"/build
+ ctest
+}
+
+package() {
+ cd "$builddir"/build
+ make DESTDIR="$pkgdir" install
+
+ # Remove static lib
+ rm "$pkgdir"/usr/lib/libjsonnet.a
+}
+
+sha512sums="d19e5398763e37b79b0ef02368f6bd6215d2df234b5ff7a6d98e2306a0d47290600061c9f868c0c262570b4f0ee9eee6c309bcc93937b12f6c14f8d12339a7d5 jsonnet-0.13.0.tar.gz
+6fe49c3d9a720096b443a7875ce4b96281871b0070b6243599e5ed4bf64638f8fd118e35d2a3a19c11bb68b3b475c29f1e4ca84f755ec329d5602d783ca39e41 build-cli-shared.patch
+948f89109a4d8d658cfffed8058557b133ef9d62c62854ba13d2dccccd532f0625a4ebe72ed5f748c72da518c0abb44df2add0d49e1dcdf6a105e112ff96b326 use-real-sys-gtest.patch
+4ab891d05bf2ab1bdbc3cfda4bdb6d8ea79c85b6866f847211733dfe6b00b19c8056e01ebd397c6669c3fc3c116e9202df0bb940bcba5a07b09bfbcac10746a3 fix-soname-ver.patch"
diff --git a/testing/jsonnet/build-cli-shared.patch b/testing/jsonnet/build-cli-shared.patch
new file mode 100644
index 0000000000..f10d79edbf
--- /dev/null
+++ b/testing/jsonnet/build-cli-shared.patch
@@ -0,0 +1,46 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,7 @@
+ # User-configurable options.
+ option(BUILD_JSONNET "Build jsonnet command-line tool." ON)
+ option(BUILD_JSONNETFMT "Build jsonnetfmt command-line tool." ON)
++option(BUILD_CLI_SHARED "Build command-line tools against shared lib" OFF)
+ option(BUILD_TESTS "Build and run jsonnet tests." ON)
+ option(USE_SYSTEM_GTEST "Use system-provided gtest library" OFF)
+ set(GLOBAL_OUTPUT_PATH_SUFFIX "" CACHE STRING
+
+--- a/cmd/CMakeLists.txt
++++ b/cmd/CMakeLists.txt
+@@ -2,16 +2,28 @@
+
+ if (BUILD_JSONNET OR BUILD_TESTS)
+ add_executable(jsonnet ${LIBJSONNET_SOURCE} jsonnet.cpp utils.cpp)
+- add_dependencies(jsonnet libjsonnet_static)
+- target_link_libraries(jsonnet libjsonnet_static)
+
++ if (BUILD_CLI_SHARED)
++ add_dependencies(jsonnet libjsonnet)
++ target_link_libraries(jsonnet libjsonnet)
++ else()
++ add_dependencies(jsonnet libjsonnet_static)
++ target_link_libraries(jsonnet libjsonnet_static)
++ endif()
++
+ install(TARGETS jsonnet DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ endif()
+
+ if (BUILD_JSONNETFMT OR BUILD_TESTS)
+ add_executable(jsonnetfmt ${LIBJSONNET_SOURCE} jsonnetfmt.cpp utils.cpp)
+- add_dependencies(jsonnetfmt libjsonnet_static)
+- target_link_libraries(jsonnetfmt libjsonnet_static)
++
++ if (BUILD_CLI_SHARED)
++ add_dependencies(jsonnetfmt libjsonnet)
++ target_link_libraries(jsonnetfmt libjsonnet)
++ else()
++ add_dependencies(jsonnetfmt libjsonnet_static)
++ target_link_libraries(jsonnetfmt libjsonnet_static)
++ endif()
+
+ install(TARGETS jsonnetfmt DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ endif()
diff --git a/testing/jsonnet/fix-soname-ver.patch b/testing/jsonnet/fix-soname-ver.patch
new file mode 100644
index 0000000000..61a733863f
--- /dev/null
+++ b/testing/jsonnet/fix-soname-ver.patch
@@ -0,0 +1,13 @@
+Pulled from master. Can be deleted 0.13.0+
+
+--- a/core/CMakeLists.txt
++++ b/core/CMakeLists.txt
+@@ -35,7 +35,7 @@
+ # CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without
+ # this step the output would be |liblibjsonnet|.
+ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet
+- VERSION "0.12.1"
++ VERSION "0.13.0"
+ SOVERSION "0"
+ PUBLIC_HEADER "${LIB_HEADER}")
+ install(TARGETS libjsonnet
diff --git a/testing/jsonnet/use-real-sys-gtest.patch b/testing/jsonnet/use-real-sys-gtest.patch
new file mode 100644
index 0000000000..d4c00573e0
--- /dev/null
+++ b/testing/jsonnet/use-real-sys-gtest.patch
@@ -0,0 +1,14 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -72,8 +72,9 @@
+ include_directories("${gtest_SOURCE_DIR}/include")
+
+ elseif (BUILD_TESTS AND USE_SYSTEM_GTEST)
+- enable_testing()
+- add_subdirectory(/usr/src/googletest ${GLOBAL_OUTPUT_PATH}/googletest-build)
++ enable_testing()
++ find_package(GTest REQUIRED)
++ include_directories(${GTEST_INCLUDE_DIR})
+ endif()
+
+ # Compiler flags.