Unverified Commit 0867cb01 authored by Ben Siraphob's avatar Ben Siraphob Committed by GitHub
Browse files

Merge pull request #320037 from LeSuisse/iniparser-4.2.3

iniparser: 4.1 -> 4.2.3
parents f0f420e6 3d44176e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -41,9 +41,9 @@ buildGoModule rec {
  ];

  postPatch = ''
    sed -i 's|iniparser/||' */*.c
    sed -i '1i#include <stdlib.h>\n#include <string.h>' tool/pwd_conf_update.c
    substituteInPlace misc/{pkgconfig/libdeepin_pw_check.pc,system-services/org.deepin.dde.PasswdConf1.service} \
      --replace "/usr" "$out"
      --replace-fail "/usr" "$out"
  '';

  buildPhase = ''
+61 −33
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub }:
{ lib
, stdenv
, fetchFromGitLab
, fetchpatch
, fetchFromGitHub
, substituteAll
, symlinkJoin
, cmake
, doxygen
, ruby
, validatePkgConfig
, testers
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "iniparser";
  version = "4.1";
  version = "4.2.3";

  src = fetchFromGitHub {
    owner = "ndevilla";
  src = fetchFromGitLab {
    owner = "iniparser";
    repo = "iniparser";
    rev = "v${version}";
    sha256 = "0dhab6pad6wh816lr7r3jb6z273njlgw2vpw8kcfnmi7ijaqhnr5";
    rev = "v${finalAttrs.version}";
    hash = "sha256-rCp9whYPYmVd7saVFILmpdn041u6fYGqe1/Oqc7RaeA=";
  };

  patches = ./no-usr.patch;

  postPatch = lib.optionalString stdenv.isDarwin ''
    substituteInPlace Makefile \
        --replace -Wl,-soname= -Wl,-install_name,
  patches = [
    (fetchpatch {
      name = "fix-paths-pkgconfig-file.patch";
      url = "https://gitlab.com/iniparser/iniparser/-/commit/6a76cd5e97b32014b22d87039bf6f4ee425c79a2.patch";
      hash = "sha256-KlTxeOzwBZiLNmuwbbem5c/xspxsflyYfeUaQnGyarI=";
    })
  ] ++ lib.optionals finalAttrs.doCheck [
    (substituteAll {
      # Do not let cmake's fetchContent download unity
      src = ./remove-fetchcontent-usage.patch;
      unitySrc = symlinkJoin {
        name = "unity-with-iniparser-config";
        paths = [
          (fetchFromGitHub {
            owner = "throwtheswitch";
            repo = "unity";
            rev = "v2.6.0";
            hash = "sha256-SCcUGNN/UJlu3ALJiZ9bQKxYRZey3cm9QG+NOehp6Ow=";
          })
        ];
        postBuild = ''
          ln -s ${finalAttrs.src}/test/unity_config.h $out/src/unity_config.h
        '';
      };
    })
  ];

  doCheck = true;
  preCheck = "patchShebangs test/make-tests.sh";

  installPhase = ''
    mkdir -p $out/lib

    mkdir -p $out/include
    cp src/*.h $out/include
  nativeBuildInputs = [ cmake doxygen validatePkgConfig ] ++ lib.optionals finalAttrs.doCheck [ ruby ];

    mkdir -p $out/share/doc/${pname}-${version}
    for i in AUTHORS INSTALL LICENSE README.md; do
      bzip2 -c -9 $i > $out/share/doc/${pname}-${version}/$i.bz2;
    done;
    cp -r html $out/share/doc/${pname}-${version}
  cmakeFlags = [
    "-DBUILD_TESTING=${if finalAttrs.doCheck then "ON" else "OFF"}"
  ];

    cp libiniparser.a $out/lib
    cp libiniparser.so.1 $out/lib
    ln -s libiniparser.so.1 $out/lib/libiniparser.so
  doCheck = false;

    mkdir -p $out/lib/pkgconfig
    substituteAll ${./iniparser.pc.in} $out/lib/pkgconfig/iniparser.pc
  postFixup = ''
    ln -sv $out/include/iniparser/*.h $out/include/
  '';

  passthru.tests = {
    pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
    iniparser-with-tests = finalAttrs.overrideAttrs (_: { doCheck = true; });
  };

  meta = with lib; {
    inherit (src.meta) homepage;
    homepage = "https://gitlab.com/iniparser/iniparser";
    description = "Free standalone ini file parsing library";
    changelog = "https://gitlab.com/iniparser/iniparser/-/releases/v${finalAttrs.version}";
    license = licenses.mit;
    platforms = platforms.unix;
    pkgConfigModules = [ "iniparser" ];
    maintainers = [ maintainers.primeos ];
  };
}
})
+0 −12
Original line number Diff line number Diff line
prefix=@out@
exec_prefix=@out@
libdir=${exec_prefix}/lib
includedir=${prefix}/include
datarootdir=${prefix}/share
datadir=${datarootdir}

Name: libiniparser
Description: Iniparser library
Version: @version@
Libs: -L${libdir} -liniparser
Cflags: -I${includedir}
+0 −13
Original line number Diff line number Diff line
--- a/Makefile	2017-10-20 20:30:41.494608284 +0200
+++ b/Makefile	2017-10-20 20:33:22.279212026 +0200
@@ -20,8 +20,8 @@
 ARFLAGS = rcv
 
 SHLD = ${CC} ${CFLAGS}
-LDSHFLAGS = -shared -Wl,-Bsymbolic
-LDFLAGS += -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
+LDSHFLAGS = -shared
+LDFLAGS =
 
 # .so.0 is for version 3.x, .so.1 is 4.x
 SO_TARGET ?= libiniparser.so.1
+17 −0
Original line number Diff line number Diff line
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b28d151..33a6bcf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -28,10 +28,8 @@ set(FETCHCONTENT_QUIET OFF)
 
 FetchContent_Declare(
   unity
-  GIT_REPOSITORY "https://github.com/throwtheswitch/unity.git"
-  GIT_PROGRESS TRUE
-  PATCH_COMMAND ${CMAKE_COMMAND} -E copy
-                ${CMAKE_CURRENT_LIST_DIR}/unity_config.h ./src/)
+  SOURCE_DIR @unitySrc@
+)
 
 FetchContent_MakeAvailable(unity)
 target_compile_definitions(unity PUBLIC UNITY_INCLUDE_CONFIG_H)