From f17c83ab50766b7912b8188fb79aa852acd7e097 Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Tue, 9 Feb 2021 15:57:16 +0100 Subject: [PATCH 1/3] fix configure step on OSX --- virtualsmartcard/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtualsmartcard/configure.ac b/virtualsmartcard/configure.ac index 9f1c0e3..c00ba9f 100644 --- a/virtualsmartcard/configure.ac +++ b/virtualsmartcard/configure.ac @@ -75,7 +75,7 @@ if test "${libpcsclite}" = no ; then case "$host" in *-*-darwin*) SDKS_PATH="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs" - SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -t. -k2 -r | head -1)}" + SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | grep -i MacOSX.sdk | sort -n -t. -k2 -r | head -1)}" # and set the PC/SC include path PCSC_CFLAGS="-I$SDK_PATH/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers -DRESPONSECODE_DEFINED_IN_WINTYPES_H -I`pwd`/${top_srcdir}/MacOSX" PCSC_LIBS="--framework PCSC" From 91b9c6384729ebfea30a845a9a380756ec36033e Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Tue, 9 Feb 2021 16:04:47 +0100 Subject: [PATCH 2/3] fix build instructions for OSX --- virtualsmartcard/doc/README.txt.in | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/virtualsmartcard/doc/README.txt.in b/virtualsmartcard/doc/README.txt.in index 44063d7..42aec90 100644 --- a/virtualsmartcard/doc/README.txt.in +++ b/virtualsmartcard/doc/README.txt.in @@ -129,9 +129,9 @@ Mac OS X 10.10 (and later) ships with a proprietary implementation of the PC/SC layer instead of with PCSC-Lite. As far as we know, this means that smart card readers must be USB devices instead of directly allowing a more generic type of reader. To make |vpcd| work we simply configure it to pretend being a USB smart -card reader with an :file:`Ìnfo.plist`:: +card reader with an :file:`Info.plist`:: - ./configure --prefix=/ --enable-infoplist + ./configure --enable-infoplist make make install @@ -229,7 +229,7 @@ as USB device: system_profiler SPUSBDataType -3. Change :file:`/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Info.plist` +3. Change :file:`/usr/local/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Info.plist` to match your product and vendor ID: .. literalinclude:: Info.plist @@ -240,11 +240,20 @@ Note that ``ifdFriendlyName`` can be used in the same way as ``DEVICENAME`` 4. Restart the PC/SC service:: - sudo killall -SIGKILL -m .*com.apple.ifdreader + sudo killall -SIGKILL -m '.*com.apple.ifdreader' Now, every time you plug in your USB device |vpcd| will be started. It will be stopped when you unplug the device. +To verify the installation, execute:: + + system_profiler SPSmartCardsDataType + +In case of a problem, inspect the logs:: + + log show --predicate '(subsystem == "com.apple.CryptoTokenKit")' --info --debug + + ================================================================================ Configuring |vpcd| on Windows ================================================================================ From bf9bc6a5476fbd1e2755a533d830a170f0c0db47 Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Tue, 9 Feb 2021 18:45:38 +0100 Subject: [PATCH 3/3] fix osx package build --- virtualsmartcard/MacOSX/MacOSX_install/postinstall | 2 +- .../MacOSX/MacOSX_uninstall/postinstall | 2 +- virtualsmartcard/MacOSX/Makefile.am | 13 +++++++------ virtualsmartcard/configure.ac | 13 ++++++++++++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/virtualsmartcard/MacOSX/MacOSX_install/postinstall b/virtualsmartcard/MacOSX/MacOSX_install/postinstall index c751511..fc5ef00 100755 --- a/virtualsmartcard/MacOSX/MacOSX_install/postinstall +++ b/virtualsmartcard/MacOSX/MacOSX_install/postinstall @@ -13,7 +13,7 @@ else fi mkdir -p $DROPDIR -ln -sf /Library/VirtualSmartCard/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle $DROPDIR +ln -sf "/Library/VirtualSmartCard/${DROPDIR}/ifd-vpcd.bundle" "${DROPDIR}" for f in /Library/VirtualSmartCard/bin/* do diff --git a/virtualsmartcard/MacOSX/MacOSX_uninstall/postinstall b/virtualsmartcard/MacOSX/MacOSX_uninstall/postinstall index a504167..f204996 100755 --- a/virtualsmartcard/MacOSX/MacOSX_uninstall/postinstall +++ b/virtualsmartcard/MacOSX/MacOSX_uninstall/postinstall @@ -14,7 +14,7 @@ fi if [ -L "$DROPDIR" ] then - if [ "$(readlink $DROPDIR)" == "/Library/VirtualSmartCard/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle" ] + if [ "$(readlink $DROPDIR)" == "/Library/VirtualSmartCard${DROPDIR}/ifd-vpcd.bundle" ] then rm $DROPDIR fi diff --git a/virtualsmartcard/MacOSX/Makefile.am b/virtualsmartcard/MacOSX/Makefile.am index 8021519..846375e 100644 --- a/virtualsmartcard/MacOSX/Makefile.am +++ b/virtualsmartcard/MacOSX/Makefile.am @@ -13,20 +13,21 @@ osx: $(OPENPACE_MAKEFILE) $(MAKE) -C $(OPENPACE) osx rm -rf $(OSX_TARGETDIR) dmg $(top_builddir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)_osx.dmg @echo Configuring virtualsmartcard for IFD bundle - cd $(top_builddir) && ./configure --prefix=/Library/VirtualSmartCard \ + cd $(top_builddir) && ./configure --enable-infoplist --prefix=/Library/VirtualSmartCard \ CFLAGS="-arch x86_64" \ - --enable-serialdropdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \ - --enable-serialconfdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents + --enable-serialdropdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \ + --enable-serialconfdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents @echo Compiling virtualsmartcard make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR) @echo Configuring virtualsmartcard for builtin libpcsclite - cd $(top_builddir) && ./configure --prefix=/Library/VirtualSmartCard \ + cd $(top_builddir) && ./configure --enable-infoplist --prefix=/Library/VirtualSmartCard \ CFLAGS="-arch x86_64" \ - --enable-serialdropdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \ - --enable-serialconfdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents \ + --enable-serialdropdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \ + --enable-serialconfdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents \ --enable-libpcsclite @echo Compiling virtualsmartcard make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR) + mv $(OSX_TARGETDIR)/usr $(OSX_TARGETDIR)/Library/VirtualSmartCard/usr pkgbuild --root $(OSX_TARGETDIR) --scripts MacOSX_install --identifier com.vsmartcard.virtualsmartcard.mac --version $(PACKAGE_VERSION) --install-location / VirtualSmartCard-$(PACKAGE_VERSION)_install.pkg pkgbuild --nopayload --identifier com.vsmartcard.virtualsmartcard.mac.uninstall --scripts MacOSX_uninstall Uninstall_VirtualSmartCard.pkg mkdir -p dmg diff --git a/virtualsmartcard/configure.ac b/virtualsmartcard/configure.ac index c00ba9f..c5f530f 100644 --- a/virtualsmartcard/configure.ac +++ b/virtualsmartcard/configure.ac @@ -28,6 +28,12 @@ case "${host}" in *-cygwin*) WIN32="yes" ;; + *-*-darwin*) + OSX="yes" + OSX_VERSION="$(sw_vers -productVersion | awk -F '.' '{print $1 * 1000 + $2}')" + OSX_GE_CAPITAN=$(test "${OSX_VERSION}" -gt 10011 && echo "yes") + OSX_SERIAL_LOCAL_PREFIX=$(test "${OSX_GE_CAPITAN}" = "yes" && echo "/local") + ;; esac AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) @@ -62,8 +68,12 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) # Checks for libraries. +# --enable-infoplist +AC_ARG_ENABLE(infoplist, + AC_HELP_STRING([--enable-infoplist],[Builds Info.plist for OSX @<:@default=no@:>@]), + [infoplist="yes"], [infoplist=no]) + # --enable-libpcsclite -infoplist=no AC_ARG_ENABLE(libpcsclite, AC_HELP_STRING([--enable-libpcsclite],[Build a lightweight version of libpcsclite, conflicts with PCSC-Lite @<:@default=no@:>@]), @@ -268,6 +278,7 @@ AC_SUBST(DYN_LIB_EXT) AC_SUBST(LIB_PREFIX) AC_SUBST(serialdropdir) AC_SUBST(serialconfdir) +AC_SUBST(OSX_SERIAL_LOCAL_PREFIX) case "$host" in *-*-darwin*) BUNDLE_HOST="MacOS"