2022-01-19 23:45:15 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, icu
|
|
|
|
, pkg-config
|
|
|
|
, enableUnicodeHelp ? true
|
|
|
|
}:
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-04-15 01:41:22 +00:00
|
|
|
pname = "cxxopts";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "3.2.1";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jarro2783";
|
2022-04-15 01:41:22 +00:00
|
|
|
repo = "cxxopts";
|
2022-01-19 23:45:15 +00:00
|
|
|
rev = "v${version}";
|
2024-02-29 20:09:43 +00:00
|
|
|
sha256 = "sha256-aOF3owz7SIV4trJY0PnMtIcwqoUpDbB3tNxZcsl9dzM=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
buildInputs = lib.optionals enableUnicodeHelp [ icu.dev ];
|
2021-05-20 23:08:51 +00:00
|
|
|
cmakeFlags = [ "-DCXXOPTS_BUILD_EXAMPLES=OFF" ]
|
2022-01-19 23:45:15 +00:00
|
|
|
++ lib.optional enableUnicodeHelp "-DCXXOPTS_USE_UNICODE_HELP=TRUE";
|
2022-10-30 15:09:59 +00:00
|
|
|
nativeBuildInputs = [ cmake ] ++ lib.optionals enableUnicodeHelp [ pkg-config ];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# Conflict on case-insensitive filesystems.
|
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# https://github.com/jarro2783/cxxopts/issues/332
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace packaging/pkgconfig.pc.in \
|
|
|
|
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00: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;
|
|
|
|
};
|
|
|
|
}
|