cardpeek: fix build on darwin

This commit is contained in:
flurie 2021-11-15 22:40:00 -05:00
parent c8920ed7ce
commit ef1a0dab00
No known key found for this signature in database
GPG key ID: D963E8522F408029
2 changed files with 44 additions and 23 deletions

View file

@ -1,29 +1,50 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook, { lib
glib, gtk3, pcsclite, lua5_2, curl, readline }: , stdenv
, fetchFromGitHub
, pkg-config
, autoreconfHook
, glib
, gtk3
, pcsclite
, lua5_2
, curl
, readline
, PCSC
, xcbuild
}:
let let
version = "0.8.4"; version = "0.8.4";
in in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "cardpeek"; pname = "cardpeek";
inherit version; inherit version;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "L1L1"; owner = "L1L1";
repo = "cardpeek"; repo = "cardpeek";
rev = "cardpeek-${version}"; rev = "cardpeek-${version}";
sha256 = "1ighpl7nvcvwnsd6r5h5n9p95kclwrq99hq7bry7s53yr57l6588"; sha256 = "1ighpl7nvcvwnsd6r5h5n9p95kclwrq99hq7bry7s53yr57l6588";
}; };
nativeBuildInputs = [ pkg-config autoreconfHook ]; postPatch = lib.optionalString stdenv.isDarwin ''
buildInputs = [ glib gtk3 pcsclite lua5_2 curl readline ]; # replace xcode check and hard-coded PCSC framework path
substituteInPlace configure.ac \
--replace 'if test ! -e "/Applications/Xcode.app/"; then' 'if test yes != yes; then' \
--replace 'PCSC_HEADERS=`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/*.sdk/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers/ | sort | head -1`' 'PCSC_HEADERS=${PCSC}/Library/Frameworks/PCSC.framework/Headers'
'';
enableParallelBuilding = true; nativeBuildInputs = [ pkg-config autoreconfHook ];
buildInputs = [ glib gtk3 lua5_2 curl readline ]
++ lib.optional stdenv.isDarwin PCSC
++ lib.optional stdenv.isLinux pcsclite;
meta = with lib; { enableParallelBuilding = true;
homepage = "https://github.com/L1L1/cardpeek";
description = "A tool to read the contents of ISO7816 smart cards"; meta = with lib; {
license = licenses.gpl3Plus; homepage = "https://github.com/L1L1/cardpeek";
platforms = with platforms; linux ++ darwin; description = "A tool to read the contents of ISO7816 smart cards";
maintainers = with maintainers; [ embr ]; license = licenses.gpl3Plus;
}; platforms = with platforms; linux ++ darwin;
} maintainers = with maintainers; [ embr ];
};
}

View file

@ -2377,7 +2377,7 @@ with pkgs;
catclock = callPackage ../applications/misc/catclock { }; catclock = callPackage ../applications/misc/catclock { };
cardpeek = callPackage ../applications/misc/cardpeek { }; cardpeek = callPackage ../applications/misc/cardpeek { inherit (darwin.apple_sdk.frameworks) PCSC; };
cawbird = callPackage ../applications/networking/cawbird { }; cawbird = callPackage ../applications/networking/cawbird { };