Unverified Commit 7f6b2cf6 authored by Sefa Eyeoglu's avatar Sefa Eyeoglu Committed by GitHub
Browse files

cxxopts: fix broken pkgconfig dependency on icu-cu (#449312)

parents 4afd72e7 313196be
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
@@ -2,9 +2,12 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch2,
  cmake,
  icu74,
  pkg-config,
  testers,
  validatePkgConfig,
  enableUnicodeHelp ? true,
}:

@@ -19,12 +22,18 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-baM6EX9D0yfrKxuPXyUUV9RqdrVLyygeG6x57xN8lc4=";
  };

  buildInputs = lib.optionals enableUnicodeHelp [ icu74.dev ];
  propagatedBuildInputs = lib.optionals enableUnicodeHelp [ icu74.dev ];
  cmakeFlags = [
    "-DCXXOPTS_BUILD_EXAMPLES=OFF"
  ]
  ++ lib.optional enableUnicodeHelp "-DCXXOPTS_USE_UNICODE_HELP=TRUE";
  nativeBuildInputs = [ cmake ] ++ lib.optionals enableUnicodeHelp [ pkg-config ];
  nativeBuildInputs = [
    cmake
  ]
  ++ lib.optionals enableUnicodeHelp [
    pkg-config
    validatePkgConfig
  ];

  doCheck = true;

@@ -34,14 +43,30 @@ stdenv.mkDerivation (finalAttrs: {
  # https://github.com/jarro2783/cxxopts/issues/332
  postPatch = ''
    substituteInPlace packaging/pkgconfig.pc.in \
      --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
      --replace-fail '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
  '';

  patches = [
    (fetchpatch2 {
      url = "https://github.com/jarro2783/cxxopts/commit/e98c73d665915b292a0592bf34fcbe8522035bc1.patch?full_index=1";
      name = "fix-icu-uc-typo-in-pkgconfig.patch";
      hash = "sha256-bqd3H66Op1/EkN2HLd84Obky4Y2ndPPY8MGZ5fqtdk4=";
    })
  ];

  passthru = {
    tests.pkg-config = testers.hasPkgConfigModules {
      package = finalAttrs.finalPackage;
      versionCheck = true;
    };
  };

  meta = with lib; {
    homepage = "https://github.com/jarro2783/cxxopts";
    description = "Lightweight C++ GNU-style option parser library";
    license = licenses.mit;
    maintainers = [ maintainers.spease ];
    pkgConfigModules = [ "cxxopts" ];
    platforms = platforms.all;
  };
})