2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
2021-02-05 17:12:51 +00:00
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, cppunit
|
2023-04-29 16:46:19 +00:00
|
|
|
, iconv
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cpp-utilities";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "5.24.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Martchus";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-krskfuoCRxYcAIDqrae4+yEABXXZ9Nv0BjBVwSMjC7g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ cppunit ];
|
2023-04-29 16:46:19 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
iconv # needed on Darwin, see https://github.com/Martchus/cpp-utilities/issues/4
|
|
|
|
];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
cmakeFlags = ["-DBUILD_SHARED_LIBS=ON"];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Otherwise, tests fail since the resulting shared object libc++utilities.so is only available in PWD of the make files
|
2021-05-20 23:08:51 +00:00
|
|
|
preCheck = ''
|
|
|
|
checkFlagsArray+=(
|
|
|
|
"LD_LIBRARY_PATH=$PWD"
|
|
|
|
)
|
|
|
|
'';
|
2023-04-29 16:46:19 +00:00
|
|
|
# tests fail on Darwin
|
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/Martchus/cpp-utilities";
|
|
|
|
description = "Common C++ classes and routines used by @Martchus' applications featuring argument parser, IO and conversion utilities";
|
2021-05-20 23:08:51 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ doronbehar ];
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|