From 7c36e12d22e0ed7a03ee8a8f5e635492becf6959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 21 Jul 2015 08:42:14 +0000 Subject: [PATCH] pcsclite does not exist on windows --- ax_check_qt.m4 | 14 +++-- ax_init_standard_project.m4 | 54 +++++++++++-------- bootstrap.sh | 84 +++++++++++++++++++++++++++-- configure.ac | 4 +- debian/control.in | 2 +- mac-create-app-bundle.sh | 103 ++++++++++++++++++++++++++++++++++++ 6 files changed, 230 insertions(+), 31 deletions(-) create mode 100755 mac-create-app-bundle.sh diff --git a/ax_check_qt.m4 b/ax_check_qt.m4 index 21c8104..88dc733 100644 --- a/ax_check_qt.m4 +++ b/ax_check_qt.m4 @@ -42,10 +42,10 @@ AC_DEFUN([AX_CXX_QT_TOOL], [ HAVE_$1=1 AC_MSG_CHECKING([for $2]) AC_ARG_VAR([$1], [path to Qt tool $2]) - $1=${$1:-$(pkg-config --variable=$2_location Qt5Core)} - $1=${$1:-$(pkg-config --variable=host_bins Qt5Core)/$2} - $1=${$1:-$(pkg-config --variable=$2_location QtCore)} - $1=${$1:-$(pkg-config --variable=host_bins QtCore)/$2} + $1=${$1:-$(${ac_tool_prefix}pkg-config --variable=$2_location Qt5Core)} + $1=${$1:-$(${ac_tool_prefix}pkg-config --variable=host_bins Qt5Core)/$2} + $1=${$1:-$(${ac_tool_prefix}pkg-config --variable=$2_location QtCore)} + $1=${$1:-$(${ac_tool_prefix}pkg-config --variable=host_bins QtCore)/$2} if ! which "${$1%% *}" > /dev/null; then if which "$2" > /dev/null; then $1=$2 @@ -100,6 +100,8 @@ AC_DEFUN([AX_CHECK_QT], [ PKG_CHECK_MODULES([$1]5, [${qt_modules//Qt/Qt5}], [ HAVE_$1=1 AC_DEFINE([HAVE_$1]) + QTDIR=$(${ac_tool_prefix}pkg-config --variable=prefix Qt5Core) + QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins CPPFLAGS+=" ${[$1]5_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" CXXFLAGS+=" ${[$1]5_CFLAGS}" @@ -120,6 +122,8 @@ AC_DEFUN([AX_CHECK_QT], [ PKG_CHECK_MODULES([$1], [${qt_modules}], [ HAVE_$1=1 AC_DEFINE([HAVE_$1]) + QTDIR=$(${ac_tool_prefix}pkg-config --variable=prefix QtCore) + QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins CPPFLAGS+=" ${$1_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" CXXFLAGS+=" ${$1_CFLAGS}" @@ -140,6 +144,8 @@ AC_DEFUN([AX_CHECK_QT], [ ]) AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag]) + AC_SUBST(QTDIR) + AC_SUBST(QT_PLUGIN_PATH) AC_SUBST(CPPFLAGS) AC_SUBST(MOC_FLAGS) AC_SUBST(CXXFLAGS) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 9bfa33e..d2fd59d 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -134,6 +134,21 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ PROJECT_ICON="${PROJECT_NAME}-icon.png" fi AX_SUBST(PROJECT_ICON) + + AC_ARG_ENABLE(pedantic, + [AS_HELP_STRING([--enable-pedantic], + [enable all warnings and checks, abort on warnings])], + [have_pedantic="$enableval"; test "$enableval" = "yes" && \ + AM_CXXFLAGS="${AM_CXXFLAGS:-} -pedantic-errors -Wall -W -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wpacked -Wredundant-decls -Werror -Wshadow -Wcast-qual -Wno-ctor-dtor-privacy"]) + dnl problem in libs: -Wshadow -Wcast-qual + dnl auto.hpp: -Wno-ctor-dtor-privacy (removed) + AM_CONDITIONAL(PEDANTIC, test "$enableval" = "yes") + if test "$have_pedantic" == "yes"; then + AC_MSG_NOTICE([Pedantic compile mode enabled! + - all warnings for GNU g++ are enabled + - all warnings result in an error + - doxygen warnings are treated as error too]); fi + AC_CONFIG_FILES([makefile]) AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-standard-project-targets], [makefile.in]) AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-standard-project-targets], [makefile.in]) @@ -174,27 +189,13 @@ AC_DEFUN([AX_USE_CXX], [ AM_DISTCHECK_CONFIGURE_FLAGS="CXXFLAGS='${CXXFLAGS}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'" AC_SUBST(AM_DISTCHECK_CONFIGURE_FLAGS) - AC_ARG_ENABLE(pedantic, - [AS_HELP_STRING([--enable-pedantic], - [enable all warnings and checks, abort on warnings])], - [have_pedantic="$enableval"; test "$enableval" = "yes" && \ - AM_CXXFLAGS="${AM_CXXFLAGS:-} -pedantic-errors -Wall -W -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wpacked -Wredundant-decls -Werror -Wshadow -Wcast-qual -Wno-ctor-dtor-privacy"]) - dnl problem in libs: -Wshadow -Wcast-qual - dnl auto.hpp: -Wno-ctor-dtor-privacy (removed) - AM_CONDITIONAL(PEDANTIC, test "$enableval" = "yes") - if test "$have_pedantic" == "yes"; then - AC_MSG_NOTICE([Pedantic compile mode enabled! - - all warnings for GNU g++ are enabled - - all warnings result in an error - - doxygen warnings are treated as error too]); fi - - MINGW32=no + MINGW=no MAC=no case $host_os in - *mingw32*) MINGW32=yes;; + *mingw*) MINGW=yes;; *darwin* | *rhapsody* | *macosx*) MAC=yes;; esac - AM_CONDITIONAL(MINGW32, test "$MINGW32" = "yes") + AM_CONDITIONAL(MINGW, test "$MINGW" = "yes") AM_CONDITIONAL(MAC, test "$MAC" = "yes") AC_SUBST(AM_CXXFLAGS) @@ -203,6 +204,15 @@ AC_DEFUN([AX_USE_CXX], [ AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-cxx-targets], [src/makefile.in]) test -f src/makefile.in && cat >> src/makefile.in <= 5.2]) CPPFLAGS="${CPPFLAGS} -DQT_NO_KEYWORDS" # libraries used -AX_PKG_REQUIRE([pcsc], [libpcsclite], [pcsclite.h]) +if test "$MINGW" = "no"; then + AX_PKG_REQUIRE([pcsc], [libpcsclite], [pcsclite.h]) +fi AX_PKG_REQUIRE([ssl], [libssl], [openssl/crypto.h], [openssl]) AX_PKG_REQUIRE([mrwcxx], [mrw-c++], [mrw/checkcxx11.hxx]) AX_PKG_REQUIRE([pkcs11], [p11-kit-1], [pkcs11.h], [libpkcs11-helper-1]) diff --git a/debian/control.in b/debian/control.in index a186d94..36d9e5a 100644 --- a/debian/control.in +++ b/debian/control.in @@ -1,7 +1,7 @@ Source: @PACKAGE_NAME@ Priority: extra Maintainer: @AUTHOR@ -Build-Depends: debhelper (>= 7), pkg-config, autotools-dev, doxygen, graphviz, lsb-release, libssl-dev, libpkcs11-helper1-dev | libp11-kit-dev | libgnutls-dev, libpcsclite-dev, mrw-c++-dev, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools +Build-Depends: debhelper (>= 7), pkg-config, autotools-dev, doxygen, graphviz, lsb-release, libssl-dev, libpkcs11-helper1-dev | libp11-kit-dev | libgnutls-dev, libpcsclite-dev, mrw-c++-dev, libproxy-dev, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools Standards-Version: 3.8.1 Section: libs Homepage: https://dev.marc.waeckerlin.org/projects/libpcscxx diff --git a/mac-create-app-bundle.sh b/mac-create-app-bundle.sh new file mode 100755 index 0000000..6ced200 --- /dev/null +++ b/mac-create-app-bundle.sh @@ -0,0 +1,103 @@ +#!/bin/bash -ex + +## @id $Id$ +## +## Create Mac OS-X App Bundle from built file +## +## Parameters: +## $1: name of the app-target +## $2: name of the project +## $3: installation source +## +## 1 2 3 4 5 6 7 8 +## 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +if test "$(uname -s)" != "Darwin"; then + echo "**** ERROR: run on Mac OS-X: $0" + exit 1 +fi +test -n "$1" +test -n "$2" +test -d "$3" +target="$(pwd)/${1}/Contents/MacOS" + +# Step 1: create and fill app directory structure +mkdir -p ${1}/Contents/{Resources,MacOS} +! test -d ${3}/bin || \ + find ${3}/bin -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; +executablefile=$(ls -1 ${1}/Contents/MacOS/ | head -1) +! test -d ${3}/lib || \ + find ${3}/lib -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; +! test -d ${3}/share/${2} || \ + find ${3}/share/${2} -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; +! test -d ${3}/share/${2} || rmdir ${3}/share/${2} +! test -d ${3}/share || \ + find ${3}/share -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; +! test -d ${3}/bin || rmdir ${3}/bin +! test -d ${3}/lib || rmdir ${3}/lib +! test -d ${3}/share || rmdir ${3}/share +! test -d ${3} || \ + find ${3} -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; +! test -d ${3} || rmdir ${3} +! test -d ${1}/tmp || rm -r ${1}/tmp + +# Step 2: copy qt plugins, if necessary +for f in ${QT_PLUGINS}; do + test -d ${target}/${f} \ + || cp -r ${QT_PLUGIN_PATH}/${f} ${target}/${f} \ + || exit 1 +done + +# Step 3: resolve all library dependencies +found=1 +oldpath="$(pwd)" +while [ $found -ne 0 ]; do + found=0 + cd "${target}" + for file in $(find . -type f); do + for lib in $(otool -L ${file} | tail -n +2 \ + | egrep '/opt/local/|'"${HOME}" \ + | grep -v $file | awk '{print $1}'); do + found=1 + test -f ${lib##*/} \ + || ( \ + cp ${lib} . \ + && chmod u+w ${lib##*/} \ + ) \ + || exit 1 + install_name_tool -change ${lib} \ + @executable_path/${lib##*/} ${file} \ + || exit 1 + done + done +done +cd ${oldpath} + +# Step 4: if necessary, install qt_menu.nib +if test -n "${QTDIR}"; then + MENU_NIB=$(find ${QTDIR} -name .svn -prune -o -name qt_menu.nib -print \ + | head -1) + if test -e "${MENU_NIB}"; then + rsync -r "${MENU_NIB}" ${1}/Contents/Resources/ + test -d ${1}/Contents/Resources/qt_menu.nib + fi +fi + +# Step 5: copy or create info.plist +infoplist=$(find ${1}/Contents/Resources -name Info.plist) +if test -f "${infoplist}"; then + mv "${infoplist}" ${1}/Contents/Info.plist +else + cat > ${1}/Contents/Info.plist < + + + + CFBundleIdentifier + ${2} + CFBundleExecutable + ${executablefile##/} + + +EOF +fi \ No newline at end of file