aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTBK <tbk@jjtc.eu>2020-02-24 23:14:38 +0100
committerLeo <thinkabit.ukim@gmail.com>2020-02-25 18:01:42 -0300
commit889eec5a0f66135b84b4b735f4fa976afd729f0d (patch)
tree7d551811db78c51ea315fccaa330ec3803c3db67
parent49fbe56b0a52ef1f3117688f45096b53433ca235 (diff)
downloadaports-889eec5a0f66135b84b4b735f4fa976afd729f0d.tar.gz
aports-889eec5a0f66135b84b4b735f4fa976afd729f0d.tar.bz2
aports-889eec5a0f66135b84b4b735f4fa976afd729f0d.tar.xz
main/snappy: add static subpkg
-rw-r--r--main/snappy/APKBUILD19
-rw-r--r--main/snappy/cmakelists.patch96
2 files changed, 110 insertions, 5 deletions
diff --git a/main/snappy/APKBUILD b/main/snappy/APKBUILD
index 8cc68cdb14..40cd04dba7 100644
--- a/main/snappy/APKBUILD
+++ b/main/snappy/APKBUILD
@@ -2,23 +2,31 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=snappy
pkgver=1.1.8
-pkgrel=1
+pkgrel=2
pkgdesc="Fast compression and decompression library"
url="https://google.github.io/snappy/"
arch="all"
license="BSD-3-Clause"
makedepends="cmake"
-subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc"
+subpackages="$pkgname-dbg $pkgname-static $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/snappy/archive/$pkgver.tar.gz
optimize-mips-s390x.patch
+ cmakelists.patch
"
build() {
- cmake . \
+ if [ "$CBUILD" != "$CHOST" ]; then
+ CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
+ fi
+ cmake \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DBUILD_SHARED_LIBS=ON
+ -DBUILD_SHARED_LIBS=ON \
+ -DBUILD_STATIC_LIBS=ON \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
+ -DCMAKE_C_FLAGS="$CFLAGS" \
+ ${CMAKE_CROSSOPTS} .
cmake --build .
}
@@ -36,4 +44,5 @@ package() {
}
sha512sums="efe18ff1b3edda1b4b6cefcbc6da8119c05d63afdbf7a784f3490353c74dced76baed7b5f1aa34b99899729192b9d657c33c76de4b507a51553fa8001ae75c1c snappy-1.1.8.tar.gz
-a14b0159631beac628cf99cf9ad970631dfdbf607ca2c3911a64124d1133694689dc76a70f25d4f780ce7093584249905aec2926ef7a3d9350952f7648938392 optimize-mips-s390x.patch"
+a14b0159631beac628cf99cf9ad970631dfdbf607ca2c3911a64124d1133694689dc76a70f25d4f780ce7093584249905aec2926ef7a3d9350952f7648938392 optimize-mips-s390x.patch
+6a379a1bd026282d98d5f2ffd316e126d5383b7c32852f81102c7a2aa0754e0c5567f82766dbd72b62552ef8a9569795c5f667387d3f1b2c9ef2bfffc578de18 cmakelists.patch"
diff --git a/main/snappy/cmakelists.patch b/main/snappy/cmakelists.patch
new file mode 100644
index 0000000000..40704452b3
--- /dev/null
+++ b/main/snappy/cmakelists.patch
@@ -0,0 +1,96 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -41,6 +41,8 @@
+ # it prominent in the GUI.
+ option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
+
++option(BUILD_STATIC_LIBS "Build static libraries." ON)
++
+ option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
+
+ option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
+@@ -51,6 +53,10 @@
+
+ option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
+
++if(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
++ set(BUILD_STATIC_LIBS OFF)
++endif ()
++
+ include(TestBigEndian)
+ test_big_endian(SNAPPY_IS_BIG_ENDIAN)
+
+@@ -166,19 +172,28 @@
+ "snappy-stubs-public.h.in"
+ "${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
+
++# When BUILD_SHARED_LIBS is:
++# ON it will generate a SHARED library
++# OFF it will generate a STATIC library
+ add_library(snappy "")
+-target_sources(snappy
+- PRIVATE
++
++# Used to generate both lib types
++if (BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
++ add_library(snappy_static STATIC "")
++ set_target_properties(snappy_static PROPERTIES OUTPUT_NAME snappy)
++ install(TARGETS snappy_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
++endif ()
++
++set(SNAPPY_SOURCE_PRIVATE
+ "snappy-internal.h"
+ "snappy-stubs-internal.h"
+ "snappy-c.cc"
+ "snappy-sinksource.cc"
+ "snappy-stubs-internal.cc"
+ "snappy.cc"
+- "${PROJECT_BINARY_DIR}/config.h"
++ "${PROJECT_BINARY_DIR}/config.h")
+
+- # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
+- $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
++set(SNAPPY_SOURCE_PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
+ $<INSTALL_INTERFACE:include/snappy-c.h>
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
+@@ -186,18 +201,32 @@
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy.h>
+ $<INSTALL_INTERFACE:include/snappy.h>
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/snappy-stubs-public.h>
+- $<INSTALL_INTERFACE:include/snappy-stubs-public.h>
+-)
+-target_include_directories(snappy
+- PUBLIC
++ $<INSTALL_INTERFACE:include/snappy-stubs-public.h>)
++
++set(SNAPPY_INCLUDE_DIRS
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
+- $<INSTALL_INTERFACE:include>
+-)
++ $<INSTALL_INTERFACE:include>)
++
++# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
++target_sources(snappy PRIVATE ${SNAPPY_SOURCE_PRIVATE}
++ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC> ${SNAPPY_SOURCE_PUBLIC})
++
++target_include_directories(snappy PUBLIC ${SNAPPY_INCLUDE_DIRS})
++
++target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
++
++# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
++target_sources(snappy_static PRIVATE ${SNAPPY_SOURCE_PRIVATE}
++ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC> ${SNAPPY_SOURCE_PUBLIC})
++
++target_include_directories(snappy_static PUBLIC ${SNAPPY_INCLUDE_DIRS})
++
++target_compile_definitions(snappy_static PRIVATE -DHAVE_CONFIG_H)
++
+ set_target_properties(snappy
+ PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
+
+-target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
+ if(BUILD_SHARED_LIBS)
+ set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ endif(BUILD_SHARED_LIBS)