Unverified Commit f6770b8b authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

lpac, easylpac: fix Darwin build (#513669)

parents 0ab7b526 560218b4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -20,13 +20,13 @@

buildGoModule rec {
  pname = "easylpac";
  version = "0.8.0.2";
  version = "0.8.0.3";

  src = fetchFromGitHub {
    owner = "creamlike1024";
    repo = "EasyLPAC";
    tag = version;
    hash = "sha256-GxcaMyEaPIGf+/wzmmycmFssTkP5Praj4GCYbxbJU28=";
    hash = "sha256-q76p0BqrG8opuTClYKLfmM5hdziJIrZCwQmg2NkzW/E=";
  };

  vendorHash = "sha256-52I8hlnoHPhygwr0dxDP50X2A7Gsh0v/0SGQFH3FG/8=";
@@ -79,6 +79,6 @@ buildGoModule rec {
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ stargate01 ];
    mainProgram = "EasyLPAC";
    platforms = lib.platforms.linux;
    platforms = lib.platforms.unix;
  };
}
+18 −3
Original line number Diff line number Diff line
{
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  lib,
  cmake,
  pkg-config,
@@ -10,8 +11,8 @@
  libqmi,
  withDrivers ? true,
  withLibeuicc ? true,
  withMbim ? true,
  withQmi ? true,
  withMbim ? stdenv.hostPlatform.isLinux,
  withQmi ? stdenv.hostPlatform.isLinux,
  nix-update-script,
}:

@@ -32,13 +33,25 @@ stdenv.mkDerivation (finalAttrs: {

  env.LPAC_VERSION = finalAttrs.version;

  patches = [ ./lpac-version.patch ];
  patches = [
    ./lpac-version.patch

    # CMAKE_OSX_ARCHITECTURES is set to "arm64;x86_64", and not overridable without this fix.
    # https://github.com/estkme-group/lpac/pull/346
    (fetchpatch {
      url = "https://github.com/estkme-group/lpac/commit/be86645e596ee34f6d85cd0f3e039d5b31f35856.patch";
      hash = "sha256-Y3tL9A1uKjX0x1O2WrQQ9k88Zu+Lpc+MNV9DRYePwgs=";
    })
  ];

  cmakeFlags = [
    (lib.cmakeBool "LPAC_DYNAMIC_DRIVERS" withDrivers)
    (lib.cmakeBool "LPAC_DYNAMIC_LIBEUICC" withLibeuicc)
    (lib.cmakeBool "LPAC_WITH_APDU_MBIM" withMbim)
    (lib.cmakeBool "LPAC_WITH_APDU_QMI" withQmi)
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    (lib.cmakeFeature "CMAKE_OSX_ARCHITECTURES" stdenv.hostPlatform.darwinArch)
  ];

  nativeBuildInputs = [
@@ -48,6 +61,8 @@ stdenv.mkDerivation (finalAttrs: {

  buildInputs = [
    curl
  ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [
    pcsclite
  ]
  ++ optional withMbim libmbim