diff options
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/libraries/gtest/default.nix | 24 | ||||
-rw-r--r-- | pkgs/tools/filesystems/dwarfs/default.nix | 68 | ||||
-rw-r--r-- | pkgs/tools/filesystems/dwarfs/version_info.patch | 58 |
3 files changed, 59 insertions, 91 deletions
diff --git a/pkgs/development/libraries/gtest/default.nix b/pkgs/development/libraries/gtest/default.nix index 51e0c685a43d2..7e44794620c03 100644 --- a/pkgs/development/libraries/gtest/default.nix +++ b/pkgs/development/libraries/gtest/default.nix @@ -3,6 +3,21 @@ , fetchFromGitHub , cmake , ninja +# Enable C++17 support +# https://github.com/google/googletest/issues/3081 +# Projects that require a higher standard can override this package. +# For an example why that may be necessary, see: +# https://github.com/mhx/dwarfs/issues/188#issuecomment-1907574427 +# Setting this to `null` does not pass any flags to set this. +, cxx_standard ? ( + if ( + (stdenv.cc.isGNU && (lib.versionOlder stdenv.cc.version "11.0")) + || + (stdenv.cc.isClang && (lib.versionOlder stdenv.cc.version "16.0")) + ) + then "17" + else null + ) , static ? stdenv.hostPlatform.isStatic, }: @@ -27,13 +42,8 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" - ] ++ lib.optionals ( - (stdenv.cc.isGNU && (lib.versionOlder stdenv.cc.version "11.0")) - || (stdenv.cc.isClang && (lib.versionOlder stdenv.cc.version "16.0")) - ) [ - # Enable C++17 support - # https://github.com/google/googletest/issues/3081 - "-DCMAKE_CXX_STANDARD=17" + ] ++ lib.optionals (cxx_standard != null) [ + "-DCMAKE_CXX_STANDARD=${cxx_standard}" ]; meta = with lib; { diff --git a/pkgs/tools/filesystems/dwarfs/default.nix b/pkgs/tools/filesystems/dwarfs/default.nix index 0ee916b2d53f8..719ccd1e23d21 100644 --- a/pkgs/tools/filesystems/dwarfs/default.nix +++ b/pkgs/tools/filesystems/dwarfs/default.nix @@ -9,8 +9,10 @@ double-conversion, fmt, fuse3, + flac, glog, gtest, + howard-hinnant-date, jemalloc, libarchive, libevent, @@ -18,60 +20,59 @@ lz4, openssl, pkg-config, + python3, + range-v3, ronn, xxHash, utf8cpp, zstd, }: -let +stdenv.mkDerivation (finalAttrs: { pname = "dwarfs"; - version = "0.9.9"; -in -stdenv.mkDerivation { - inherit pname version; + version = "0.9.10"; src = fetchFromGitHub { owner = "mhx"; repo = "dwarfs"; - rev = "refs/tags/v${version}"; + rev = "refs/tags/v${finalAttrs.version}"; fetchSubmodules = true; - hash = "sha256-Zzm2SaFR31TBBMDfgJulVbqsJBh1He2wBFzHRC/c5vg="; + hash = "sha256-uyYNs+fDV5BfQwfX9Wi3BwiKjSDQHAKRJ1+UvS/fHoE="; }; - patches = [ - ( - with lib.versions; - substituteAll { - src = ./version_info.patch; + cmakeFlags = [ + "-DNIXPKGS_DWARFS_VERSION_OVERRIDE=v${finalAttrs.version}" # see https://github.com/mhx/dwarfs/issues/155 - versionFull = version; # displayed as version number (with v prepended) - versionMajor = major version; - versionMinor = minor version; - versionPatch = patch version; - } - ) - ]; + # Needs to be set so `dwarfs` does not try to download `gtest`; it is not + # a submodule, see: https://github.com/mhx/dwarfs/issues/188#issuecomment-1907657083 + "-DPREFER_SYSTEM_GTEST=ON" - cmakeFlags = [ + # These should no longer be necessary with a version > 0.9.10: + # * https://github.com/mhx/dwarfs/commit/593b22a8a90eb66c0898ae06f097f32f4bf3dfd4 + # * https://github.com/mhx/dwarfs/commit/6e9608b2b01be13e41e6b728aae537c14c00ad82 + # * https://github.com/mhx/dwarfs/commit/ce4bee1ad63c666da57d2cdae9fd65214d8dab7f + "-DPREFER_SYSTEM_LIBFMT=ON" "-DPREFER_SYSTEM_ZSTD=ON" "-DPREFER_SYSTEM_XXHASH=ON" - "-DPREFER_SYSTEM_GTEST=ON" - "-DPREFER_SYSTEM_LIBFMT=ON" # may be added under an option in the future # "-DWITH_LEGACY_FUSE=ON" + "-DWITH_TESTS=ON" ]; nativeBuildInputs = [ bison cmake + howard-hinnant-date # uses only the header-only parts pkg-config + range-v3 # header-only library ronn + (python3.withPackages (ps: [ ps.mistletoe ])) # for man pages ]; buildInputs = [ # dwarfs boost + flac # optional; allows automatic audio compression fmt fuse3 jemalloc @@ -90,17 +91,32 @@ stdenv.mkDerivation { ]; doCheck = true; - nativeCheckInputs = [ gtest ]; + nativeCheckInputs = [ + # https://github.com/mhx/dwarfs/issues/188#issuecomment-1907574427 + # `dwarfs` sets C++20 as the minimum, see + # https://github.com/mhx/dwarfs/blob/2cb5542a5d4274225c5933370adcf00035f6c974/CMakeLists.txt#L129 + # Thus the `gtest` headers, when included, + # refer to symbols that only exist in `.so` files compiled with that version. + (gtest.override { cxx_standard = "20"; }) + ]; # these fail inside of the sandbox due to missing access # to the FUSE device - GTEST_FILTER = "-dwarfs/tools_test.end_to_end/*:dwarfs/tools_test.mutating_ops/*"; + GTEST_FILTER = + let + disabledTests = [ + "dwarfs/tools_test.end_to_end/*" + "dwarfs/tools_test.mutating_and_error_ops/*" + "dwarfs/tools_test.categorize/*" + ]; + in + "-${lib.concatStringsSep ":" disabledTests}"; meta = { description = "Fast high compression read-only file system"; homepage = "https://github.com/mhx/dwarfs"; - changelog = "https://github.com/mhx/dwarfs/blob/v${version}/CHANGES.md"; + changelog = "https://github.com/mhx/dwarfs/blob/v${finalAttrs.version}/CHANGES.md"; license = lib.licenses.gpl3Plus; maintainers = [ lib.maintainers.luftmensch-luftmensch ]; platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/tools/filesystems/dwarfs/version_info.patch b/pkgs/tools/filesystems/dwarfs/version_info.patch deleted file mode 100644 index 8d62bd8d22957..0000000000000 --- a/pkgs/tools/filesystems/dwarfs/version_info.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff --git a/cmake/package_version.cmake b/cmake/package_version.cmake -new file mode 100644 -index 0000000..d4fdb9c ---- /dev/null -+++ b/cmake/package_version.cmake -@@ -0,0 +1,12 @@ -+# autogenerated code, do not modify -+ -+set(PRJ_GIT_REV "v@versionFull@") -+set(PRJ_GIT_DESC "v@versionFull@") -+set(PRJ_GIT_BRANCH "HEAD") -+set(PRJ_GIT_ID "v@versionFull@") -+set(PRJ_GIT_RELEASE_TAG "v@versionFull@") -+set(PRJ_VERSION_FULL "@versionFull@") -+set(PRJ_VERSION_SHORT "@versionFull@") -+set(PRJ_VERSION_MAJOR "@versionMajor@") -+set(PRJ_VERSION_MINOR "@versionMinor@") -+set(PRJ_VERSION_PATCH "@versionPatch@") -diff --git a/include/dwarfs/version.h b/include/dwarfs/version.h -new file mode 100644 -index 0000000..54cf86a ---- /dev/null -+++ b/include/dwarfs/version.h -@@ -0,0 +1,16 @@ -+// autogenerated code, do not modify -+ -+#pragma once -+ -+#define PRJ_VERSION_MAJOR @versionMajor@ -+#define PRJ_VERSION_MINOR @versionMinor@ -+#define PRJ_VERSION_PATCH @versionPatch@ -+ -+namespace dwarfs { -+ -+extern char const* PRJ_GIT_REV; -+extern char const* PRJ_GIT_DESC; -+extern char const* PRJ_GIT_BRANCH; -+extern char const* PRJ_GIT_ID; -+ -+} // namespace dwarfs -diff --git a/src/dwarfs/version.cpp b/src/dwarfs/version.cpp -new file mode 100644 -index 0000000..5759120 ---- /dev/null -+++ b/src/dwarfs/version.cpp -@@ -0,0 +1,12 @@ -+// autogenerated code, do not modify -+ -+#include "dwarfs/version.h" -+ -+namespace dwarfs { -+ -+char const* PRJ_GIT_REV = "@versionFull@"; -+char const* PRJ_GIT_DESC = "v@versionFull@"; -+char const* PRJ_GIT_BRANCH = "HEAD"; -+char const* PRJ_GIT_ID = "v@versionFull@"; -+ -+} // namespace dwarfs |