2023-10-06 14:55:35 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitLab
|
2023-12-18 01:37:22 +00:00
|
|
|
, fetchpatch
|
2023-10-06 14:55:35 +00:00
|
|
|
, gitUpdater
|
|
|
|
, testers
|
|
|
|
, boost
|
|
|
|
, cmake
|
|
|
|
, doxygen
|
|
|
|
, gtest
|
|
|
|
, leveldb
|
|
|
|
, lomiri
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
2024-01-28 13:22:52 +00:00
|
|
|
, validatePkgConfig
|
2023-10-06 14:55:35 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "persistent-cache-cpp";
|
2024-01-28 13:22:52 +00:00
|
|
|
version = "1.0.7";
|
2023-10-06 14:55:35 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "ubports";
|
|
|
|
repo = "development/core/lib-cpp/persistent-cache-cpp";
|
|
|
|
rev = finalAttrs.version;
|
2024-01-28 13:22:52 +00:00
|
|
|
hash = "sha256-bOABrRSy5Mzeaqoc5ujcGXyBAaCJLv/488M7fkr0npE=";
|
2023-10-06 14:55:35 +00:00
|
|
|
};
|
|
|
|
|
2023-12-18 01:17:04 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
|
|
|
"doc"
|
|
|
|
];
|
2023-10-06 19:10:48 +00:00
|
|
|
|
2023-12-18 01:17:04 +00:00
|
|
|
patches = [
|
2023-10-06 19:10:48 +00:00
|
|
|
# PersistentStringCacheImpl.exceptions test fails on LLVM's libcxx, it depends on std::system_error producing a very specific exception text
|
|
|
|
# Expects "Unknown error 666", gets "unspecified generic_category error"
|
2023-12-18 01:37:22 +00:00
|
|
|
# Remove when https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/merge_requests/14 merged & in release
|
|
|
|
(fetchpatch {
|
2024-01-28 13:22:52 +00:00
|
|
|
name = "0001-persistent-cache-cpp-persistent_string_cache_impl_test-libcxx-fix.patch";
|
|
|
|
url = "https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/commit/a696dbd3093b8333f9ee1f0cad846b2256c729c5.patch";
|
2023-12-18 01:37:22 +00:00
|
|
|
hash = "sha256-SJxdXeM7W+WKEmiLTwnQYAM7YmPayEk6vPb46y4thv4=";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Enable usage of BUILD_TESTING to opting out of tests
|
|
|
|
# Remove when https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/merge_requests/15 merged & in release
|
|
|
|
(fetchpatch {
|
2024-01-28 13:22:52 +00:00
|
|
|
name = "0002-persistent-cache-cpp-Enable-opting-out-of-tests.patch";
|
|
|
|
url = "https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/commit/1fb06d28c16325e90046e93662c0f5fd16c29b4a.patch";
|
2023-12-18 01:37:22 +00:00
|
|
|
hash = "sha256-2/6EYBh71S4dzqWEde+3dLOGp015fN6IifAj1bI1XAI=";
|
|
|
|
})
|
2023-10-06 14:55:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Wrong concatenation
|
|
|
|
substituteInPlace data/libpersistent-cache-cpp.pc.in \
|
|
|
|
--replace "\''${prefix}/@CMAKE_INSTALL_LIBDIR@" "\''${prefix}/lib"
|
|
|
|
|
|
|
|
# Runs in parallel to other tests, limit to 1 thread
|
|
|
|
substituteInPlace tests/headers/compile_headers.py \
|
|
|
|
--replace 'multiprocessing.cpu_count()' '1'
|
2023-12-18 01:37:22 +00:00
|
|
|
'' + lib.optionalString finalAttrs.finalPackage.doCheck ''
|
2023-10-06 14:55:35 +00:00
|
|
|
patchShebangs tests/{headers,whitespace}/*.py
|
2023-12-18 01:37:22 +00:00
|
|
|
'';
|
2023-10-06 14:55:35 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
doxygen
|
|
|
|
pkg-config
|
2024-01-28 13:22:52 +00:00
|
|
|
validatePkgConfig
|
2023-10-06 14:55:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
lomiri.cmake-extras
|
|
|
|
leveldb
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
gtest
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
# error: 'old_version' may be used uninitialized
|
2023-12-18 01:37:22 +00:00
|
|
|
(lib.cmakeBool "Werror" false)
|
2024-01-28 13:22:52 +00:00
|
|
|
# Defaults to static if not set
|
2023-12-18 01:37:22 +00:00
|
|
|
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
|
2023-10-06 14:55:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
updateScript = gitUpdater { };
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Cache of key-value pairs with persistent storage for C++ 11";
|
|
|
|
longDescription = ''
|
|
|
|
A persistent cache for arbitrary (possibly large amount of data, such as
|
|
|
|
image files) that is fast, scalable, and crash-proof.
|
|
|
|
'';
|
|
|
|
homepage = "https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp";
|
2024-01-28 13:22:52 +00:00
|
|
|
changelog = "https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/blob/${finalAttrs.version}/ChangeLog";
|
2023-10-06 14:55:35 +00:00
|
|
|
license = licenses.lgpl3Only;
|
|
|
|
maintainers = teams.lomiri.members;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
pkgConfigModules = [
|
|
|
|
"libpersistent-cache-cpp"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|