2022-01-05 18:44:38 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, icu
|
|
|
|
, pkg-config
|
|
|
|
, enableUnicodeHelp ? true
|
|
|
|
}:
|
2021-01-22 07:22:23 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-02-23 21:00:06 +01:00
|
|
|
pname = "cxxopts";
|
2022-01-05 18:44:38 +01:00
|
|
|
version = "3.0.0";
|
2021-01-22 07:22:23 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jarro2783";
|
2022-02-23 21:00:06 +01:00
|
|
|
repo = "cxxopts";
|
2022-01-05 18:44:38 +01:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "08x7j168l1xwj0r3rv89cgghmfhsx98lpq35r3vkh504m1pd55a6";
|
2021-01-22 07:22:23 +01:00
|
|
|
};
|
|
|
|
|
2022-01-05 18:44:38 +01:00
|
|
|
# CMake does not set CMAKE_LIBRARY_ARCHITECTURE variable in Nix, which breaks architecture-independent library path generation
|
|
|
|
patches = [ ./fix-install-path.patch ];
|
|
|
|
|
2022-10-06 18:38:53 +02:00
|
|
|
buildInputs = lib.optionals enableUnicodeHelp [ icu.dev ];
|
2021-05-15 20:39:46 +02:00
|
|
|
cmakeFlags = [ "-DCXXOPTS_BUILD_EXAMPLES=OFF" ]
|
2022-01-05 18:44:38 +01:00
|
|
|
++ lib.optional enableUnicodeHelp "-DCXXOPTS_USE_UNICODE_HELP=TRUE";
|
2022-10-06 18:38:53 +02:00
|
|
|
nativeBuildInputs = [ cmake ] ++ lib.optionals enableUnicodeHelp [ pkg-config ];
|
2021-01-22 07:22:23 +01:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-05-15 20:39:46 +02:00
|
|
|
# Conflict on case-insensitive filesystems.
|
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
2022-05-16 14:41:07 +02:00
|
|
|
# https://github.com/jarro2783/cxxopts/issues/332
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace packaging/pkgconfig.pc.in \
|
|
|
|
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
|
|
'';
|
|
|
|
|
2021-01-22 07:22:23 +01:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/jarro2783/cxxopts";
|
|
|
|
description = "Lightweight C++ GNU-style option parser library";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.spease ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|