nixpkgs/pkgs/development/libraries/cpp-utilities/default.nix
2024-03-05 15:29:28 +00:00

44 lines
1.2 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, cmake
, cppunit
, iconv
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cpp-utilities";
version = "5.24.7";
src = fetchFromGitHub {
owner = "Martchus";
repo = "cpp-utilities";
rev = "v${finalAttrs.version}";
sha256 = "sha256-gfyvWnvUXgjocid0nvp3lWhdPb7MYm+1GJRP5RYInEY=";
};
nativeBuildInputs = [ cmake ];
nativeCheckInputs = [ cppunit ];
buildInputs = lib.optionals stdenv.isDarwin [
iconv # needed on Darwin, see https://github.com/Martchus/cpp-utilities/issues/4
];
cmakeFlags = ["-DBUILD_SHARED_LIBS=ON"];
# Otherwise, tests fail since the resulting shared object libc++utilities.so is only available in PWD of the make files
preCheck = ''
checkFlagsArray+=(
"LD_LIBRARY_PATH=$PWD"
)
'';
# tests fail on Darwin
doCheck = !stdenv.isDarwin;
meta = with lib; {
homepage = "https://github.com/Martchus/cpp-utilities";
description = "Common C++ classes and routines used by @Martchus' applications featuring argument parser, IO and conversion utilities";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ doronbehar ];
platforms = platforms.linux ++ platforms.darwin;
};
})