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