From 63dc0afd009f6abc3b3f11b1e78586afa8ddc3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Fri, 31 Jul 2015 07:00:50 +0000 Subject: [PATCH] repair rpm build --- ax_check_qt.m4 | 32 ++++-- ax_init_standard_project.m4 | 114 +++++++++++--------- bootstrap.sh | 206 ++++++++++++++++++++++++++++++++++-- libxml-cxx.spec.in | 40 ++++--- mac-create-app-bundle.sh | 103 ++++++++++++++++++ makefile.am | 4 +- 6 files changed, 415 insertions(+), 84 deletions(-) create mode 100755 mac-create-app-bundle.sh diff --git a/ax_check_qt.m4 b/ax_check_qt.m4 index 21c8104..91c0072 100644 --- a/ax_check_qt.m4 +++ b/ax_check_qt.m4 @@ -1,16 +1,16 @@ # SYNOPSIS # # Check if a module exists: -# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) +# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) # # Abort if a module does not exist: -# AX_CXX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) +# AX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) # # DESCRIPTIONS # # qt_prefix # -# Each call to AX_CXX_CHECK_QT should have a different prefix +# Each call to AX_CHECK_QT should have a different prefix # value (with a few exceptions discussed later on). This value, # usually provided in uppercase, is used as prefix to the # variables holding the compiler flags and libraries reported by @@ -42,13 +42,19 @@ 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:-$(${PKG_CONFIG} --variable=$2_location Qt5Core)} + $1=${$1:-$(${PKG_CONFIG} --variable=host_bins Qt5Core)/$2-qt5} + $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:-$(${PKG_CONFIG} --variable=host_bins QtCore)/$2-qt4} if ! which "${$1%% *}" > /dev/null; then - if which "$2" > /dev/null; then + if which "$2-qt5" > /dev/null; then + $1=$2-qt5 + elif which "$2" > /dev/null; then $1=$2 + elif which "$2-qt4" > /dev/null; then + $1=$2-qt4 else HAVE_$1=0 $1="" @@ -100,6 +106,8 @@ AC_DEFUN([AX_CHECK_QT], [ PKG_CHECK_MODULES([$1]5, [${qt_modules//Qt/Qt5}], [ HAVE_$1=1 AC_DEFINE([HAVE_$1]) + QTDIR=$(${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 +128,8 @@ AC_DEFUN([AX_CHECK_QT], [ PKG_CHECK_MODULES([$1], [${qt_modules}], [ HAVE_$1=1 AC_DEFINE([HAVE_$1]) + QTDIR=$(${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 +150,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) @@ -173,13 +185,13 @@ qrc_%.cxx: %.qrc # SYNOPSIS # -# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) +# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules]) # # DESCRIPTIONS # # qt_prefix # -# Each call to AX_CXX_CHECK_QT should have a different prefix +# Each call to AX_CHECK_QT should have a different prefix # value (with a few exceptions discussed later on). This value, # usually provided in uppercase, is used as prefix to the # variables holding the compiler flags and libraries reported by diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 9ea0553..a2dbd87 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -3,45 +3,46 @@ ## 1 2 3 4 5 6 7 8 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 +# m4_esyscmd_s does not exist on centos 5 and 6 +m4_define([mrw_esyscmd_s], [m4_normalize(m4_esyscmd([$1]))]) + # define least version number from subversion's revision number: # it is taken modulo 256 due to a bug on Apple's MacOSX -m4_define(x_least, m4_esyscmd_s( +m4_define(x_least, mrw_esyscmd_s([ SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" for path in . .. ../..; do if svn info $path 2>&1 > /dev/null; then SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p') - (cd $path && svn2cl) break; fi done # Mac does not support LEAST > 255 echo $ECHO_N $(($SVN_REVISION%256)) -)) +])) # define version number from subversion's revision number: # it is taken modulo 256 due to a bug on Apple's MacOSX # add to x_minor if revision number is > 256 -m4_define(x_minor_fixed, m4_esyscmd_s( +m4_define(x_minor_fixed, mrw_esyscmd_s([ SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" for path in . .. ../..; do if svn info $path 2>&1 > /dev/null; then SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p') - (cd $path && svn2cl) break; fi done # Mac does not support LEAST > 255 echo $ECHO_N $((x_minor+$SVN_REVISION/256)) -)) +])) # setup version number -m4_define(x_version, m4_esyscmd_s( +m4_define(x_version, mrw_esyscmd_s([ echo $ECHO_N x_major.x_minor_fixed.x_least -)) +])) ## bugreport mail address is taken from in first line of AUTHORS -m4_define(x_bugreport, m4_esyscmd_s( +m4_define(x_bugreport, mrw_esyscmd_s([ head -1 AUTHORS | \ sed -n 's,.*<\([-_.a-z0-9A-Z]*@[-_.a-z0-9A-Z]*\)>.*,\1,gp' -)) +])) m4_include(ax_check_qt.m4) @@ -84,7 +85,7 @@ AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [ # $1 = variable name AC_DEFUN([AX_SUBST], [ AC_SUBST([$1]) - tmp_var=$(echo "${$1}" | awk 1 ORS='\\n') + tmp_var=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,') tmp_var=${tmp_var//\"/\\\"} tmp_var=${tmp_var//\'/\'\"\'\"\'} tmp_var=${tmp_var//#/\\#} @@ -108,7 +109,15 @@ AC_DEFUN([AX_SUBST], [ # # configures the basic environment AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ - AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_NAME//-/_}'" + MINGW=no + MAC=no + case $host in + *mingw*) MINGW=yes;; + *darwin* | *rhapsody* | *macosx*) MAC=yes;; + esac + AM_CONDITIONAL(MINGW, test "$MINGW" = "yes") + AM_CONDITIONAL(MAC, test "$MAC" = "yes") + AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_TARNAME//[^a-zA-Z0-9]/_}'" AX_SUBST(NUMBERS) AX_SUBST(HOME) README=$(tail -n +3 README) @@ -134,6 +143,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]) @@ -141,7 +165,6 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ test -f makefile.in && cat >> makefile.in <> src/makefile.in <> makefile.in < - cxx-1 -- Initial build. + 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 diff --git a/makefile.am b/makefile.am index 53263cd..f2f674b 100644 --- a/makefile.am +++ b/makefile.am @@ -1,6 +1,6 @@ ## @id $Id$ # -# This file has been added by bootstrap.sh on Mon, 13 July 2015 12:42:59 +0200 +# This file has been added by bootstrap.sh on Fri, 31 July 2015 08:57:51 +0200 # Feel free to change it or even remove and rebuild it, up to your needs # ## 1 2 3 4 5 6 7 8 @@ -8,4 +8,6 @@ SUBDIRS = src test doc examples +doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog + MAINTAINERCLEANFILES = makefile.in