cxxopts: 3.0.0 -> 3.1.1

This commit is contained in:
Alexander Kiselyov 2023-05-19 11:17:02 +03:00
parent de376ace26
commit 9cea0bc2fd
3 changed files with 7 additions and 23 deletions

View file

@ -9,18 +9,15 @@
stdenv.mkDerivation rec {
pname = "cxxopts";
version = "3.0.0";
version = "3.1.1";
src = fetchFromGitHub {
owner = "jarro2783";
repo = "cxxopts";
rev = "v${version}";
sha256 = "08x7j168l1xwj0r3rv89cgghmfhsx98lpq35r3vkh504m1pd55a6";
sha256 = "sha256-lJPMaXBfrCeUhhXha5f7zmOGtyEDzU3oPTMirPTFZzQ=";
};
# CMake does not set CMAKE_LIBRARY_ARCHITECTURE variable in Nix, which breaks architecture-independent library path generation
patches = [ ./fix-install-path.patch ];
buildInputs = lib.optionals enableUnicodeHelp [ icu.dev ];
cmakeFlags = [ "-DCXXOPTS_BUILD_EXAMPLES=OFF" ]
++ lib.optional enableUnicodeHelp "-DCXXOPTS_USE_UNICODE_HELP=TRUE";

View file

@ -1,18 +0,0 @@
diff --git a/cmake/cxxopts.cmake b/cmake/cxxopts.cmake
index 46e87ba..0ead543 100644
--- a/cmake/cxxopts.cmake
+++ b/cmake/cxxopts.cmake
@@ -87,7 +87,12 @@ endfunction()
# Helper function to ecapsulate install logic
function(cxxopts_install_logic)
- string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
+ if(CMAKE_LIBRARY_ARCHITECTURE)
+ string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
+ else()
+ # On some systems (e.g. NixOS), `CMAKE_LIBRARY_ARCHITECTURE` can be empty
+ set(CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
+ endif()
set(CXXOPTS_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/cxxopts" CACHE STRING "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.")
set(version_config "${PROJECT_BINARY_DIR}/cxxopts-config-version.cmake")
set(project_config "${PROJECT_BINARY_DIR}/cxxopts-config.cmake")

View file

@ -43,6 +43,11 @@ buildPythonPackage rec {
pytestCheckHook
];
# A fix for cxxopts >=3.1
postPatch = ''
substituteInPlace src/cli.cpp \
--replace "cxxopts::OptionException" "cxxopts::exceptions::exception"
'';
# CMake needs to be run by setuptools rather than by its hook
dontConfigure = true;