improve QT_PLUGIN_PATH detection; improve PROJECT_URL default; fix example dir; improve mac app build; tested build for deb and rpm
This commit is contained in:
		@@ -10,8 +10,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
SUBDIRS = scripts doc
 | 
					SUBDIRS = scripts doc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
desktopdir = ${datadir}/applications
 | 
					 | 
				
			||||||
desktop_DATA = @PACKAGE_DESKTOP@
 | 
					 | 
				
			||||||
dist_pkgdata_DATA = @PACKAGE_ICON@
 | 
					dist_pkgdata_DATA = @PACKAGE_ICON@
 | 
				
			||||||
dist_noinst_DATA = ax_check_qt.m4 bootstrap.sh				\
 | 
					dist_noinst_DATA = ax_check_qt.m4 bootstrap.sh				\
 | 
				
			||||||
                   resolve-rpmbuilddeps.sh autogen.sh			\
 | 
					                   resolve-rpmbuilddeps.sh autogen.sh			\
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,14 +130,6 @@ AC_DEFUN([AX_CHECK_QT], [
 | 
				
			|||||||
      QT_PLUGIN_PATH="${QTDIR}/plugins"
 | 
					      QT_PLUGIN_PATH="${QTDIR}/plugins"
 | 
				
			||||||
    elif test -d "${QTDIR}/share/qt5/plugins; then
 | 
					    elif test -d "${QTDIR}/share/qt5/plugins; then
 | 
				
			||||||
      QT_PLUGIN_PATH="${QTDIR}/share/qt5/plugins"
 | 
					      QT_PLUGIN_PATH="${QTDIR}/share/qt5/plugins"
 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      AC_MSG_ERROR([QT_PLUGIN_PATH not found
 | 
					 | 
				
			||||||
 - not in: ${qt_libdir}/plugins
 | 
					 | 
				
			||||||
 - not in: ${qt_libdir}/qt5/plugins
 | 
					 | 
				
			||||||
 - not in: ${qt_host_bins}/../plugins
 | 
					 | 
				
			||||||
 - not in: ${QTDIR}/plugins
 | 
					 | 
				
			||||||
 - not in: ${QTDIR}/share/qt5/plugins
 | 
					 | 
				
			||||||
])
 | 
					 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
 | 
					    MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
 | 
				
			||||||
    [$1]_CPPFLAGS="${[$1]5_CFLAGS}"
 | 
					    [$1]_CPPFLAGS="${[$1]5_CFLAGS}"
 | 
				
			||||||
@@ -181,10 +173,17 @@ AC_DEFUN([AX_CHECK_QT], [
 | 
				
			|||||||
      AC_DEFINE([HAVE_$1])
 | 
					      AC_DEFINE([HAVE_$1])
 | 
				
			||||||
      QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore)
 | 
					      QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore)
 | 
				
			||||||
      qt_host_bins=$(${PKG_CONFIG} --variable=host_bins QtCore)
 | 
					      qt_host_bins=$(${PKG_CONFIG} --variable=host_bins QtCore)
 | 
				
			||||||
      if test -d "${qt_host_bins}"; then
 | 
					      qt_libdir=$(${PKG_CONFIG} --variable=libdir QtCore)
 | 
				
			||||||
        QT_PLUGIN_PATH=${qt_host_bins}/../plugins
 | 
					      if test -d "${qt_libdir}" -a -d "${qt_libdir}/plugins"; then
 | 
				
			||||||
      else
 | 
					        QT_PLUGIN_PATH="${qt_libdir}/plugins"
 | 
				
			||||||
        QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins
 | 
					      elif test -d "${qt_libdir}/qt5" -a -d "${qt_libdir}/qt5/plugins"; then
 | 
				
			||||||
 | 
					        QT_PLUGIN_PATH="${qt_libdir}/qt5/plugins"
 | 
				
			||||||
 | 
					      elif test -d "${qt_host_bins}" -a -d "${qt_host_bins}/../plugins"; then
 | 
				
			||||||
 | 
					        QT_PLUGIN_PATH="${qt_host_bins}/../plugins"
 | 
				
			||||||
 | 
					      elif test -d "${QTDIR}/plugins; then
 | 
				
			||||||
 | 
					        QT_PLUGIN_PATH="${QTDIR}/plugins"
 | 
				
			||||||
 | 
					      elif test -d "${QTDIR}/share/qt5/plugins; then
 | 
				
			||||||
 | 
					        QT_PLUGIN_PATH="${QTDIR}/share/qt5/plugins"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
      MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
 | 
					      MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
 | 
				
			||||||
      [$1]_CPPFLAGS="${[$1]_CFLAGS}"
 | 
					      [$1]_CPPFLAGS="${[$1]_CFLAGS}"
 | 
				
			||||||
@@ -229,9 +228,6 @@ AC_DEFUN([AX_CHECK_QT], [
 | 
				
			|||||||
    AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag])
 | 
					    AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag])
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  test "x$prefix" = xNONE && prefix=$ac_default_prefix
 | 
					  test "x$prefix" = xNONE && prefix=$ac_default_prefix
 | 
				
			||||||
  if test "${QT_PLUGIN_PATH}" = "${QT_PLUGIN_PATH#${prefix}}"; then
 | 
					 | 
				
			||||||
    QT_PLUGIN_PATH=${prefix}${QT_PLUGIN_PATH#/usr}
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  AC_ARG_WITH([qt-plugin-path],
 | 
					  AC_ARG_WITH([qt-plugin-path],
 | 
				
			||||||
              [AS_HELP_STRING([--with-qt-plugin-path=PATH],
 | 
					              [AS_HELP_STRING([--with-qt-plugin-path=PATH],
 | 
				
			||||||
                              [define a different qt plugin path, current @<:@default=check@:>@])],
 | 
					                              [define a different qt plugin path, current @<:@default=check@:>@])],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -218,8 +218,17 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
 | 
				
			|||||||
  AX_SUBST(AUTHOR_URL)
 | 
					  AX_SUBST(AUTHOR_URL)
 | 
				
			||||||
  AX_SUBST(AUTHOR_MAIL)
 | 
					  AX_SUBST(AUTHOR_MAIL)
 | 
				
			||||||
  AX_SUBST(PACKAGER)
 | 
					  AX_SUBST(PACKAGER)
 | 
				
			||||||
  PROJECT_URL="${PROJECT_URL:-${AUTHOR_URL}/projects/${PACKAGE_NAME}}"
 | 
					  PROJECT_URL="${PROJECT_URL:-${AUTHOR_URL}}"
 | 
				
			||||||
  SOURCE_DOWNLOAD="${SOURCE_DOWNLOAD:-${AUTHOR_URL}/downloads/${PACKAGE_NAME}}"
 | 
					  for path in . .. ../.. ../../..; do
 | 
				
			||||||
 | 
					    if test -d ${path}/.svn; then
 | 
				
			||||||
 | 
					      PROJECT_URL="$(LANG= svn info | sed -n 's,^Repository Root: ,,p')"
 | 
				
			||||||
 | 
					      break
 | 
				
			||||||
 | 
					    elif test -d ${path}/.git; then
 | 
				
			||||||
 | 
					      PROJECT_URL="$(git remote get-url origin)"
 | 
				
			||||||
 | 
					      break
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  done
 | 
				
			||||||
 | 
					  SOURCE_DOWNLOAD="${SOURCE_DOWNLOAD:-${PROJECT_URL}}"
 | 
				
			||||||
  AX_SUBST(PROJECT_URL)
 | 
					  AX_SUBST(PROJECT_URL)
 | 
				
			||||||
  AX_SUBST(SOURCE_DOWNLOAD)
 | 
					  AX_SUBST(SOURCE_DOWNLOAD)
 | 
				
			||||||
  VENDOR=$((lsb_release -is 2>/dev/null || echo unknown) | tr ' ' '_')
 | 
					  VENDOR=$((lsb_release -is 2>/dev/null || echo unknown) | tr ' ' '_')
 | 
				
			||||||
@@ -365,12 +374,13 @@ AC_DEFUN([AX_USE_CXX], [
 | 
				
			|||||||
#### Begin: Appended by $0
 | 
					#### Begin: Appended by $0
 | 
				
			||||||
%.app: %
 | 
					%.app: %
 | 
				
			||||||
	-rm -r [\$][@]
 | 
						-rm -r [\$][@]
 | 
				
			||||||
	\$(MAKE) DESTDIR=[\$][\$](pwd)/[\$][@]/tmp install
 | 
						\$(MAKE) DESTDIR=[\$][\$](pwd)/tmp install
 | 
				
			||||||
	QTDIR="\${QTDIR}" \
 | 
						QTDIR="\${QTDIR}" \
 | 
				
			||||||
	QT_PLUGINS="\${QT_PLUGINS}" \
 | 
						QT_PLUGINS="\${QT_PLUGINS}" \
 | 
				
			||||||
	QT_PLUGIN_PATH="\${QT_PLUGIN_PATH}" \
 | 
						QT_PLUGIN_PATH="\${QT_PLUGIN_PATH}" \
 | 
				
			||||||
	  \${top_builddir}/mac-create-app-bundle.sh \
 | 
						  \${top_builddir}/mac-create-app-bundle.sh \
 | 
				
			||||||
	    [\$][@] [\$][<] [\$][\$](pwd)/[\$][@]/tmp\${prefix}
 | 
						    [\$][@] [\$][<] [\$][\$](pwd)/tmp[\$]{prefix}
 | 
				
			||||||
 | 
						-rm -rf tmp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
maintainer-clean-cxx-targets:
 | 
					maintainer-clean-cxx-targets:
 | 
				
			||||||
	-rm makefile.in
 | 
						-rm makefile.in
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1352,7 +1352,7 @@ ${HEADER}AM_CPPFLAGS = -I\${top_srcdir}/src -I\${top_builddir}/src
 | 
				
			|||||||
AM_LDFLAGS = -L\${abs_top_builddir}/src/.libs
 | 
					AM_LDFLAGS = -L\${abs_top_builddir}/src/.libs
 | 
				
			||||||
LDADD = -l${PACKAGE_NAME#lib}
 | 
					LDADD = -l${PACKAGE_NAME#lib}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exampledir = ${docdir}/examples
 | 
					exampledir = \${docdir}/examples
 | 
				
			||||||
example_DATA = 
 | 
					example_DATA = 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAINTAINERCLEANFILES = makefile.in
 | 
					MAINTAINERCLEANFILES = makefile.in
 | 
				
			||||||
@@ -1605,8 +1605,8 @@ if testtag AX_USE_DEBIAN_PACKAGING; then
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 -- @PACKAGER@  @BUILD_DATE@
 | 
					 -- @PACKAGER@  @BUILD_DATE@
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
    RUN_DEPENDS="$(if testtag AX_USE_NODEJS; then echo -n ", nodejs, npm"; fi)"
 | 
					    RUN_DEPENDS="$(if testtag AX_USE_NODEJS; then echo -n ", nodejs, npm,"; fi)"
 | 
				
			||||||
    BUILD_DEPENDS="debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release$(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)"
 | 
					    BUILD_DEPENDS="debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release$(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev | qt4-dev,"; fi)"
 | 
				
			||||||
    to debian/control.in <<EOF
 | 
					    to debian/control.in <<EOF
 | 
				
			||||||
Source: @PACKAGE_NAME@
 | 
					Source: @PACKAGE_NAME@
 | 
				
			||||||
Priority: extra
 | 
					Priority: extra
 | 
				
			||||||
@@ -1646,6 +1646,9 @@ usr/lib/lib*.so
 | 
				
			|||||||
usr/lib/pkgconfig/*
 | 
					usr/lib/pkgconfig/*
 | 
				
			||||||
usr/lib/*.la
 | 
					usr/lib/*.la
 | 
				
			||||||
usr/share/doc/${PACKAGE_NAME}/html
 | 
					usr/share/doc/${PACKAGE_NAME}/html
 | 
				
			||||||
 | 
					$(if testtag AX_BUILD_EXAMPLES; then
 | 
				
			||||||
 | 
					  echo usr/share/doc/${PACKAGE_NAME}/examples
 | 
				
			||||||
 | 
					fi)
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
    to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF
 | 
					    to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF
 | 
				
			||||||
${HEADER}%:
 | 
					${HEADER}%:
 | 
				
			||||||
@@ -1773,7 +1776,7 @@ $(if testtag AX_USE_ETC; then
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cat <<EOF2
 | 
					cat <<EOF2
 | 
				
			||||||
%config
 | 
					%config
 | 
				
			||||||
/etc/*
 | 
					/etc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EOF2
 | 
					EOF2
 | 
				
			||||||
fi)
 | 
					fi)
 | 
				
			||||||
@@ -1882,6 +1885,7 @@ $(if test -e README.md -a ! -e README; then
 | 
				
			|||||||
cat <<EOF2
 | 
					cat <<EOF2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
README: README.md
 | 
					README: README.md
 | 
				
			||||||
 | 
						cp README.md README
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CLEANFILES = README
 | 
					CLEANFILES = README
 | 
				
			||||||
EOF2
 | 
					EOF2
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,14 +17,12 @@ if test "$(uname -s)" != "Darwin"; then
 | 
				
			|||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ${0%/*}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
project=${2:-$(sed -n 's/ *m4_define *( *x_package_name, *\(.*\) *).*/\1/p' $(pwd)/configure.ac)}
 | 
					project=${2:-$(sed -n 's/ *m4_define *( *x_package_name, *\(.*\) *).*/\1/p' $(pwd)/configure.ac)}
 | 
				
			||||||
apptarget=${1:-${project}.app}
 | 
					apptarget=${1:-${project}.app}
 | 
				
			||||||
sources=${3:-$(pwd)/usr}
 | 
					sources=${3:-$(pwd)/tmp}
 | 
				
			||||||
 | 
					! test -e "$apptarget" || rm -rf "$apptarget"
 | 
				
			||||||
test -n "$project"
 | 
					test -n "$project"
 | 
				
			||||||
test -d "$sources"
 | 
					test -d "$sources"
 | 
				
			||||||
! test -e "$apptarget" || rm -rf "$apptarget"
 | 
					 | 
				
			||||||
target="$(pwd)/${apptarget}/Contents/MacOS"
 | 
					target="$(pwd)/${apptarget}/Contents/MacOS"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Creating $apptarget for $project from $sources"
 | 
					echo "Creating $apptarget for $project from $sources"
 | 
				
			||||||
@@ -33,6 +31,8 @@ echo "Creating $apptarget for $project from $sources"
 | 
				
			|||||||
mkdir -p ${apptarget}/Contents/{Resources,MacOS}
 | 
					mkdir -p ${apptarget}/Contents/{Resources,MacOS}
 | 
				
			||||||
! test -d ${sources}/bin || \
 | 
					! test -d ${sources}/bin || \
 | 
				
			||||||
    find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
 | 
					    find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
 | 
				
			||||||
 | 
					! test -d ${sources}/scripts || \
 | 
				
			||||||
 | 
					    find ${sources}/scripts -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
 | 
				
			||||||
executablefile=${apptarget}/Contents/MacOS/${project}
 | 
					executablefile=${apptarget}/Contents/MacOS/${project}
 | 
				
			||||||
test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | head -1)
 | 
					test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | head -1)
 | 
				
			||||||
! test -d ${sources}/lib || \
 | 
					! test -d ${sources}/lib || \
 | 
				
			||||||
@@ -40,9 +40,9 @@ test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ |
 | 
				
			|||||||
! test -d ${sources}/share/${project} || \
 | 
					! test -d ${sources}/share/${project} || \
 | 
				
			||||||
    find ${sources}/share/${project} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
 | 
					    find ${sources}/share/${project} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
 | 
				
			||||||
! test -d ${sources}/share || \
 | 
					! test -d ${sources}/share || \
 | 
				
			||||||
    find ${sources}/share -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
 | 
					    find ${sources}/share -mindepth 1 -maxdepth 1 -name ${project} -prune -o -exec cp -a {} ${apptarget}/Contents/Resources/ \;
 | 
				
			||||||
! test -d ${sources} || \
 | 
					! test -d ${sources} || \
 | 
				
			||||||
    find ${sources} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
 | 
					    find ${sources} -mindepth 1 -maxdepth 1 -name share -o -name bin -o -name lib -o -name scripts -prune -o -exec cp -a {} ${apptarget}/Contents/Resources/ \;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Step 2: copy qt plugins, if necessary
 | 
					# Step 2: copy qt plugins, if necessary
 | 
				
			||||||
for f in ${QT_PLUGINS}; do
 | 
					for f in ${QT_PLUGINS}; do
 | 
				
			||||||
@@ -59,7 +59,7 @@ while [ $found -ne 0 ]; do
 | 
				
			|||||||
    cd "${target}"
 | 
					    cd "${target}"
 | 
				
			||||||
    for file in $(find . -type f); do
 | 
					    for file in $(find . -type f); do
 | 
				
			||||||
        for lib in $(otool -L ${file} | tail -n +2 \
 | 
					        for lib in $(otool -L ${file} | tail -n +2 \
 | 
				
			||||||
            | egrep '/opt/local/|'"${HOME}" \
 | 
					            | egrep '/usr/local/|/opt/local/|'"${HOME}" \
 | 
				
			||||||
            | grep -v $file | awk '{print $1}'); do
 | 
					            | grep -v $file | awk '{print $1}'); do
 | 
				
			||||||
            found=1
 | 
					            found=1
 | 
				
			||||||
            test -f ${lib##*/} \
 | 
					            test -f ${lib##*/} \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user