app-arch/snappy: Bump to 1.1.5

Bump to the new 1.1.5 version and update the ebuild to use CMake as
autotools are deprecated now. Include patches necessary to fix
the horribly broken upstream build system to at least build
and install reasonably correctly. Disable useless microbenchmarks in
unittest executable. Disable static-libs support since it is not
provided upstream.
This commit is contained in:
Michał Górny
2017-06-29 12:02:00 +02:00
parent 3814344636
commit 0db7f46d94
6 changed files with 229 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
DIST snappy-1.1.2.tar.gz 1485435 SHA256 f9d8fe1c85494f62dbfa3efe8e73bc23d8dec7a254ff7fe09ec4b0ebfc586af4 SHA512 da0e80528dfc815d765347c60dc5f14bc7fb882cc6894b87d3a43dec1a127cf8bcfe46e6cb93e130790c0ebd67368a1042500d9080f844441803c1b69c3cc07e WHIRLPOOL a9cf520cc578a0a63ebb7fb127428b50d282cdf2448938ad88349f775e21b3dd27f2c6843f86dd749d66e9df5e29094bc5c67032f0219932fec69f882ec91246
DIST snappy-1.1.3.tar.gz 1509026 SHA256 2f1e82adf0868c9e26a5a7a3115111b6da7e432ddbac268a7ca2fae2a247eef3 SHA512 4c4f47c657a072989179be9df0e5e98d14f4a67c27ec7ae0e5a15d14289a75d4e266bc6c5c89723f3e9860408ffcc7138a815f8ad9299407c4a1946fc00ab5bf WHIRLPOOL 97f82d1439973582f0ba3fde43ba2ee2c23b2512e0ee426b9e372fbfbba87921355c1f6bf0bf80671d7c4da26a23d480508cb7a188e414b9cb5d95996bfabe39
DIST snappy-1.1.5.tar.gz 1128197 SHA256 c67d8d23387b1902ceff134af26e401d5412c510adeeabe6bb6b47c106b08e45 SHA512 99f29f3b4ada0b25692f594a17c0c4b2625fb6c6ffbc875b8dd940fd8080f1e9afdb000c866380f2375246e7b3fbab8521e1bb4d226789798459c628318d571b WHIRLPOOL f0947129ab01bf9545bc5138a5382c555ff1f1b032fe9d53f045ef07ddc79ad0bc2a7fbdd6d058e126b07942c43fa155de2af5070d1df8edbaa677184d63f684

View File

@@ -0,0 +1,90 @@
From a35f15515db7cdfdee2b7fd04624d1b6c9a8a6bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 29 Jun 2017 11:12:44 +0200
Subject: [PATCH 1/3] cmake: Use GNUInstallDirs to provide configurable &
correct install dirs
Use the GNUInstallDirs CMake module to provide a standard set of
variables to control install paths. Otherwise, the package is
incorrectly installed into 'lib' (instead of 'lib64') on 64-bit systems.
While this could be solved via providing custom variables for each
directory, it is simpler to reuse what's already in CMake.
---
CMakeLists.txt | 21 +++++++++------------
cmake/SnappyConfig.cmake.in | 8 ++++----
2 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c79e46..adda7fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,7 @@ INCLUDE(CheckLibraryExists)
INCLUDE(CheckCXXSourceCompiles)
INCLUDE(TestBigEndian)
INCLUDE(CMakePackageConfigHelpers)
+INCLUDE(GNUInstallDirs)
TEST_BIG_ENDIAN(WORDS_BIG_ENDIAN)
IF (WORDS_BIG_ENDIAN)
@@ -98,32 +99,28 @@ INSTALL(FILES snappy.h
snappy-c.h
snappy-sinksource.h
${Snappy_BINARY_DIR}/snappy-stubs-public.h
- DESTINATION include)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
INSTALL(TARGETS snappy
EXPORT SnappyTargets
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-INSTALL(EXPORT SnappyTargets NAMESPACE Snappy:: DESTINATION lib/cmake/Snappy)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+INSTALL(EXPORT SnappyTargets NAMESPACE Snappy:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Snappy)
SET_TARGET_PROPERTIES(snappy PROPERTIES SOVERSION ${PROJECT_VERSION})
-SET(INCLUDE_INSTALL_DIR include)
-SET(LIBRARY_INSTALL_DIR lib)
-SET(BINARY_INSTALL_DIR bin)
-
CONFIGURE_PACKAGE_CONFIG_FILE(cmake/SnappyConfig.cmake.in
${Snappy_BINARY_DIR}/SnappyConfig.cmake
- INSTALL_DESTINATION lib/Snappy/cmake
- PATH_VARS INCLUDE_INSTALL_DIR LIBRARY_INSTALL_DIR BINARY_INSTALL_DIR
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/Snappy/cmake
+ PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_BINDIR
)
WRITE_BASIC_PACKAGE_VERSION_FILE(${Snappy_BINARY_DIR}/SnappyConfigVersion.cmake
COMPATIBILITY SameMajorVersion)
INSTALL(FILES ${Snappy_BINARY_DIR}/SnappyConfig.cmake
${Snappy_BINARY_DIR}/SnappyConfigVersion.cmake
- DESTINATION lib/cmake)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
ENABLE_TESTING()
diff --git a/cmake/SnappyConfig.cmake.in b/cmake/SnappyConfig.cmake.in
index 5e604fe..d47656b 100644
--- a/cmake/SnappyConfig.cmake.in
+++ b/cmake/SnappyConfig.cmake.in
@@ -2,8 +2,8 @@ set(SNAPPY_VERSION @SNAPPY_MAJOR@.@SNAPPY_MINOR@.@SNAPPY_PATCHLEVEL@)
@PACKAGE_INIT@
-set_and_check(SNAPPY_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
-set_and_check(SNAPPY_LIBRARY_DIR "@PACKAGE_LIBRARY_INSTALL_DIR@")
-set_and_check(SNAPPY_BINARY_DIR "@PACKAGE_BINARY_INSTALL_DIR@")
+set_and_check(SNAPPY_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
+set_and_check(SNAPPY_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+set_and_check(SNAPPY_BINARY_DIR "@PACKAGE_CMAKE_INSTALL_BINDIR@")
-check_required_components(SNAPPY)
\ No newline at end of file
+check_required_components(SNAPPY)
--
2.13.2

View File

@@ -0,0 +1,37 @@
From 0f0ff7be9bd4d2ad2cd7e5c6092b1d0261c09335 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 29 Jun 2017 11:14:37 +0200
Subject: [PATCH 2/3] cmake: Correct & unify CMake install path
The CMake file is using 'lib/cmake/Snappy', 'lib/Snappy/cmake'
and 'lib/cmake' inconsistently. Replace all of them with a single
'lib/cmake/Snappy' that matches most of standard CMake packages.
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index adda7fa..b88cb20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,7 +112,7 @@ SET_TARGET_PROPERTIES(snappy PROPERTIES SOVERSION ${PROJECT_VERSION})
CONFIGURE_PACKAGE_CONFIG_FILE(cmake/SnappyConfig.cmake.in
${Snappy_BINARY_DIR}/SnappyConfig.cmake
- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/Snappy/cmake
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Snappy
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_BINDIR
)
@@ -120,7 +120,7 @@ WRITE_BASIC_PACKAGE_VERSION_FILE(${Snappy_BINARY_DIR}/SnappyConfigVersion.cmake
COMPATIBILITY SameMajorVersion)
INSTALL(FILES ${Snappy_BINARY_DIR}/SnappyConfig.cmake
${Snappy_BINARY_DIR}/SnappyConfigVersion.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Snappy)
ENABLE_TESTING()
--
2.13.2

View File

@@ -0,0 +1,28 @@
From 57b13b68466e2ac81d8faa2c92f55e629a3184f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 29 Jun 2017 10:01:37 +0200
Subject: [PATCH 3/3] cmake: Add missing linking to GTEST_LIBRARIES
Since the snappy_unittest target uses gtest routines (when available),
it needs to link to gtest explicitly. Otherwise, the build fails due
to unavailable gtest symbols.
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b88cb20..bbe4d38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,7 +143,7 @@ ENDIF (HAVE_LIBQUICKLZ)
ADD_EXECUTABLE(snappy-unittest snappy_unittest.cc snappy-test.cc)
TARGET_COMPILE_DEFINITIONS(snappy-unittest PRIVATE -DHAVE_CONFIG_H)
TARGET_LINK_LIBRARIES(snappy-unittest snappy ${COMPRESSION_LIBS}
- ${GFLAGS_LIBRARIES})
+ ${GFLAGS_LIBRARIES} ${GTEST_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(snappy-unittest BEFORE PRIVATE ${Snappy_SOURCE_DIR}
${GTEST_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS})
--
2.13.2

View File

@@ -0,0 +1,67 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-multilib
DESCRIPTION="A high-speed compression/decompression library by Google"
HOMEPAGE="https://github.com/google/snappy"
SRC_URI="https://github.com/google/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
# matches SONAME...
SLOT="0/${PV}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux"
IUSE="static-libs test"
# upstream killed static lib support with build system update
# (and we have packages depending on the flag)
REQUIRED_USE="!static-libs"
# all test dependencies are optional:
# - gflags-2.2 is supposedly needed for command-line option parsing
# but it's a huge hack and does not work,
# - gtest probably gives nicer output,
# - compression libraries are used for benchmarks which we do not run.
DEPEND="test? ( dev-cpp/gtest )"
# AUTHORS is useless, ChangeLog is stale
DOCS=( format_description.txt framing_format.txt NEWS README.md )
src_prepare() {
local PATCHES=(
"${FILESDIR}"/snappy-1.1.5-0001-cmake-Use-GNUInstallDirs-to-provide-configurable-cor.patch
"${FILESDIR}"/snappy-1.1.5-0002-cmake-Correct-unify-CMake-install-path.patch
"${FILESDIR}"/snappy-1.1.5-0003-cmake-Add-missing-linking-to-GTEST_LIBRARIES.patch
)
# command-line option parsing does not work at all, so just force
# it off
sed -i -e '/run_microbenchmarks/s:true:false:' snappy-test.cc || die
default
}
multilib_src_configure() {
# TODO: would be nice to make unittest build conditional
# but it is not a priority right now
local mycmakeargs=(
# use gtest for tests only
-DCMAKE_DISABLE_FIND_PACKAGE_GTest=$(usex '!test')
# gflags does not work anyway
-DCMAKE_DISABLE_FIND_PACKAGE_Gflags=ON
# we do not want to run benchmarks, and those are only used
# for benchmarks
-DHAVE_LIBZ=NO
-DHAVE_LIBLZO2=NO
-DHAVE_LIBLZF=NO
-DHAVE_LIBQUICKLZ=NO
)
cmake-utils_src_configure
}
multilib_src_test() {
# run tests directly to get verbose output
cd "${S}" || die
"${BUILD_DIR}"/snappy-unittest || die
}

View File

@@ -7,6 +7,12 @@
# This file is only for generic masks. For arch-specific masks (i.e.
# mask everywhere, unmask on arch/*) use arch/base.
# Michał Górny <mgorny@gentoo.org> (29 Jun 2017)
# Upstream switched to CMake and no longer provides option to build
# static and shared libs. The flag is preserved not to break USE
# depenencies.
>=app-arch/snappy-1.1.5 static-libs
# Ilya Tumaykin <itumaykin+gentoo@gmail.com> (18 Jun 2017)
# Libav is basically unsupported by mpv, see upstream issues 3923, 3925.
# Needs patch to even build, subs are broken and not supported anymore.