Unverified Commit af56b152 authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #232786 from yl3dy/cxxopts

cxxopts: 3.0.0 -> 3.1.1
parents 775c78df 9cea0bc2
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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";
+0 −18
Original line number Diff line number Diff line
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")
+5 −0
Original line number Diff line number Diff line
@@ -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;