1{ stdenv
2, lib
3, fetchFromGitHub
4, cmake
5, cppunit
6, iconv
7}:
8
9stdenv.mkDerivation rec {
10 pname = "cpp-utilities";
11 version = "5.22.0";
12
13 src = fetchFromGitHub {
14 owner = "Martchus";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "sha256-c36FzKDAaalKVIrqVSCoslrKVopW77cGdGwfiMbaXe4=";
18 };
19
20 nativeBuildInputs = [ cmake ];
21 nativeCheckInputs = [ cppunit ];
22 buildInputs = lib.optionals stdenv.isDarwin [
23 iconv # needed on Darwin, see https://github.com/Martchus/cpp-utilities/issues/4
24 ];
25 # Otherwise, tests fail since the resulting shared object libc++utilities.so is only available in PWD of the make files
26 preCheck = ''
27 checkFlagsArray+=(
28 "LD_LIBRARY_PATH=$PWD"
29 )
30 '';
31 # tests fail on Darwin
32 doCheck = !stdenv.isDarwin;
33
34 meta = with lib; {
35 homepage = "https://github.com/Martchus/cpp-utilities";
36 description = "Common C++ classes and routines used by @Martchus' applications featuring argument parser, IO and conversion utilities";
37 license = licenses.gpl2Plus;
38 maintainers = with maintainers; [ doronbehar ];
39 platforms = platforms.linux ++ platforms.darwin;
40 };
41}