Merge pull request #189 from ph4r05/pr/003-osx

Fix build on OSX
This commit is contained in:
Frank Morgner
2021-02-25 18:21:09 +01:00
committed by GitHub
5 changed files with 35 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ else
fi fi
mkdir -p $DROPDIR 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/* for f in /Library/VirtualSmartCard/bin/*
do do

View File

@@ -14,7 +14,7 @@ fi
if [ -L "$DROPDIR" ] if [ -L "$DROPDIR" ]
then then
if [ "$(readlink $DROPDIR)" == "/Library/VirtualSmartCard/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle" ] if [ "$(readlink $DROPDIR)" == "/Library/VirtualSmartCard${DROPDIR}/ifd-vpcd.bundle" ]
then then
rm $DROPDIR rm $DROPDIR
fi fi

View File

@@ -13,20 +13,21 @@ osx: $(OPENPACE_MAKEFILE)
$(MAKE) -C $(OPENPACE) osx $(MAKE) -C $(OPENPACE) osx
rm -rf $(OSX_TARGETDIR) dmg $(top_builddir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)_osx.dmg rm -rf $(OSX_TARGETDIR) dmg $(top_builddir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)_osx.dmg
@echo Configuring virtualsmartcard for IFD bundle @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" \ CFLAGS="-arch x86_64" \
--enable-serialdropdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \ --enable-serialdropdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \
--enable-serialconfdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents --enable-serialconfdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents
@echo Compiling virtualsmartcard @echo Compiling virtualsmartcard
make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR) make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR)
@echo Configuring virtualsmartcard for builtin libpcsclite @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" \ CFLAGS="-arch x86_64" \
--enable-serialdropdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \ --enable-serialdropdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \
--enable-serialconfdir=/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents \ --enable-serialconfdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents \
--enable-libpcsclite --enable-libpcsclite
@echo Compiling virtualsmartcard @echo Compiling virtualsmartcard
make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR) 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 --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 pkgbuild --nopayload --identifier com.vsmartcard.virtualsmartcard.mac.uninstall --scripts MacOSX_uninstall Uninstall_VirtualSmartCard.pkg
mkdir -p dmg mkdir -p dmg

View File

@@ -28,6 +28,12 @@ case "${host}" in
*-cygwin*) *-cygwin*)
WIN32="yes" 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 esac
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
@@ -62,8 +68,12 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
# Checks for libraries. # 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 # --enable-libpcsclite
infoplist=no
AC_ARG_ENABLE(libpcsclite, AC_ARG_ENABLE(libpcsclite,
AC_HELP_STRING([--enable-libpcsclite],[Build a lightweight version of AC_HELP_STRING([--enable-libpcsclite],[Build a lightweight version of
libpcsclite, conflicts with PCSC-Lite @<:@default=no@:>@]), libpcsclite, conflicts with PCSC-Lite @<:@default=no@:>@]),
@@ -75,7 +85,7 @@ if test "${libpcsclite}" = no ; then
case "$host" in case "$host" in
*-*-darwin*) *-*-darwin*)
SDKS_PATH="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs" 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 # 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_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" PCSC_LIBS="--framework PCSC"
@@ -268,6 +278,7 @@ AC_SUBST(DYN_LIB_EXT)
AC_SUBST(LIB_PREFIX) AC_SUBST(LIB_PREFIX)
AC_SUBST(serialdropdir) AC_SUBST(serialdropdir)
AC_SUBST(serialconfdir) AC_SUBST(serialconfdir)
AC_SUBST(OSX_SERIAL_LOCAL_PREFIX)
case "$host" in case "$host" in
*-*-darwin*) *-*-darwin*)
BUNDLE_HOST="MacOS" BUNDLE_HOST="MacOS"

View File

@@ -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 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 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 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
make install make install
@@ -229,7 +229,7 @@ as USB device:
system_profiler SPUSBDataType 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: to match your product and vendor ID:
.. literalinclude:: Info.plist .. 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:: 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 Now, every time you plug in your USB device |vpcd| will be started. It will be
stopped when you unplug the device. 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 Configuring |vpcd| on Windows
================================================================================ ================================================================================