improvements, mainly for mac
This commit is contained in:
		| @@ -100,6 +100,8 @@ AC_DEFUN([AX_CHECK_QT], [ | |||||||
|   PKG_CHECK_MODULES([$1]5, [${qt_modules//Qt/Qt5}], [ |   PKG_CHECK_MODULES([$1]5, [${qt_modules//Qt/Qt5}], [ | ||||||
|     HAVE_$1=1 |     HAVE_$1=1 | ||||||
|     AC_DEFINE([HAVE_$1]) |     AC_DEFINE([HAVE_$1]) | ||||||
|  |     QTDIR=$(pkg-config --variable=prefix Qt5Core) | ||||||
|  |     QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins | ||||||
|     CPPFLAGS+=" ${[$1]5_CFLAGS}" |     CPPFLAGS+=" ${[$1]5_CFLAGS}" | ||||||
|     MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" |     MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" | ||||||
|     CXXFLAGS+=" ${[$1]5_CFLAGS}" |     CXXFLAGS+=" ${[$1]5_CFLAGS}" | ||||||
| @@ -120,6 +122,8 @@ AC_DEFUN([AX_CHECK_QT], [ | |||||||
|     PKG_CHECK_MODULES([$1], [${qt_modules}], [ |     PKG_CHECK_MODULES([$1], [${qt_modules}], [ | ||||||
|       HAVE_$1=1 |       HAVE_$1=1 | ||||||
|       AC_DEFINE([HAVE_$1]) |       AC_DEFINE([HAVE_$1]) | ||||||
|  |       QTDIR=$(pkg-config --variable=prefix QtCore) | ||||||
|  |       QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins | ||||||
|       CPPFLAGS+=" ${$1_CFLAGS}" |       CPPFLAGS+=" ${$1_CFLAGS}" | ||||||
|       MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" |       MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" | ||||||
|       CXXFLAGS+=" ${$1_CFLAGS}" |       CXXFLAGS+=" ${$1_CFLAGS}" | ||||||
| @@ -140,6 +144,8 @@ AC_DEFUN([AX_CHECK_QT], [ | |||||||
|   ]) |   ]) | ||||||
|   AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) |   AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) | ||||||
|   AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag]) |   AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag]) | ||||||
|  |   AC_SUBST(QTDIR) | ||||||
|  |   AC_SUBST(QT_PLUGIN_PATH) | ||||||
|   AC_SUBST(CPPFLAGS) |   AC_SUBST(CPPFLAGS) | ||||||
|   AC_SUBST(MOC_FLAGS) |   AC_SUBST(MOC_FLAGS) | ||||||
|   AC_SUBST(CXXFLAGS) |   AC_SUBST(CXXFLAGS) | ||||||
|   | |||||||
| @@ -134,6 +134,21 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ | |||||||
|      PROJECT_ICON="${PROJECT_NAME}-icon.png" |      PROJECT_ICON="${PROJECT_NAME}-icon.png" | ||||||
|   fi |   fi | ||||||
|   AX_SUBST(PROJECT_ICON) |   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]) |   AC_CONFIG_FILES([makefile]) | ||||||
|   AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-standard-project-targets], [makefile.in]) |   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]) |   AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-standard-project-targets], [makefile.in]) | ||||||
| @@ -174,20 +189,6 @@ AC_DEFUN([AX_USE_CXX], [ | |||||||
|   AM_DISTCHECK_CONFIGURE_FLAGS="CXXFLAGS='${CXXFLAGS}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'" |   AM_DISTCHECK_CONFIGURE_FLAGS="CXXFLAGS='${CXXFLAGS}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'" | ||||||
|   AC_SUBST(AM_DISTCHECK_CONFIGURE_FLAGS) |   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 |   MINGW32=no | ||||||
|   MAC=no |   MAC=no | ||||||
|   case $host_os in |   case $host_os in | ||||||
| @@ -203,6 +204,15 @@ AC_DEFUN([AX_USE_CXX], [ | |||||||
|   AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-cxx-targets], [src/makefile.in]) |   AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-cxx-targets], [src/makefile.in]) | ||||||
|   test -f src/makefile.in && cat >> src/makefile.in <<EOF |   test -f src/makefile.in && cat >> src/makefile.in <<EOF | ||||||
| #### Begin: Appended by $0 | #### Begin: Appended by $0 | ||||||
|  | %.app: % | ||||||
|  | 	-rm -r [\$][@] | ||||||
|  | 	\$(MAKE) DESTDIR=[\$][\$](pwd)/[\$][@]/tmp install | ||||||
|  | 	QTDIR="\${QTDIR}" \ | ||||||
|  | 	QT_PLUGINS="\${QT_PLUGINS}" \ | ||||||
|  | 	QT_PLUGIN_PATH="\${QT_PLUGIN_PATH}" \ | ||||||
|  | 	  \${top_builddir}/mac-create-app-bundle.sh \ | ||||||
|  | 	    [\$][@] [\$][<] [\$][\$](pwd)/[\$][@]/tmp\${prefix} | ||||||
|  |  | ||||||
| maintainer-clean-cxx-targets: | maintainer-clean-cxx-targets: | ||||||
| 	-rm makefile.in | 	-rm makefile.in | ||||||
| #### End: $0 | #### End: $0 | ||||||
| @@ -406,7 +416,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [ | |||||||
|   AC_SUBST(CPPFLAGS) |   AC_SUBST(CPPFLAGS) | ||||||
|   AC_SUBST(CXXFLAGS) |   AC_SUBST(CXXFLAGS) | ||||||
|   AC_SUBST(PKG_REQUIREMENTS) |   AC_SUBST(PKG_REQUIREMENTS) | ||||||
|   if test -n "$3"; then |   if test -n "$3" -a "${$1_found}" != "no"; then | ||||||
|     tmp_package=${$1_found} |     tmp_package=${$1_found} | ||||||
|     $1_found=no |     $1_found=no | ||||||
|     old_CPPFLAGS=${CPPFLAGS} |     old_CPPFLAGS=${CPPFLAGS} | ||||||
|   | |||||||
							
								
								
									
										84
									
								
								bootstrap.sh
									
									
									
									
									
								
							
							
						
						
									
										84
									
								
								bootstrap.sh
									
									
									
									
									
								
							| @@ -100,6 +100,7 @@ GENERATED FILES | |||||||
|     * ax_init_standard_project.m4 - auxiliary macro definition file |     * ax_init_standard_project.m4 - auxiliary macro definition file | ||||||
|     * ax_cxx_compile_stdcxx_11.m4 - auxiliary macro definition file |     * ax_cxx_compile_stdcxx_11.m4 - auxiliary macro definition file | ||||||
|     * ax_check_qt.m4 - auxiliary macro definition file |     * ax_check_qt.m4 - auxiliary macro definition file | ||||||
|  |     * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle | ||||||
|     * AUTHORS - replace your name in AUTHORS before first run |     * AUTHORS - replace your name in AUTHORS before first run | ||||||
|     * configure.ac - global configuration file template |     * configure.ac - global configuration file template | ||||||
|     * makefile.am - global makefile template |     * makefile.am - global makefile template | ||||||
| @@ -373,6 +374,7 @@ copy ${MY_NAME} | |||||||
| copy ax_init_standard_project.m4 | copy ax_init_standard_project.m4 | ||||||
| copy ax_cxx_compile_stdcxx_11.m4 | copy ax_cxx_compile_stdcxx_11.m4 | ||||||
| copy ax_check_qt.m4 | copy ax_check_qt.m4 | ||||||
|  | copy mac-create-app-bundle.sh | ||||||
| AUTHOR=$(gpg -K  | sed -n 's,uid *,,p' | sort | head -1) | AUTHOR=$(gpg -K  | sed -n 's,uid *,,p' | sort | head -1) | ||||||
| if test -z "${AUTHOR}"; then | if test -z "${AUTHOR}"; then | ||||||
|     AUTHOR="FIRSTNAME LASTNAME (URL) <EMAIL>" |     AUTHOR="FIRSTNAME LASTNAME (URL) <EMAIL>" | ||||||
| @@ -409,7 +411,81 @@ AX_INIT_STANDARD_PROJECT | |||||||
| AC_OUTPUT | AC_OUTPUT | ||||||
| EOF | EOF | ||||||
| PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac) | PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac) | ||||||
| echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition AX_USE_CXX src/makefile.am | if ! testtag "AX_CHECK_QT" configure.ac && \ | ||||||
|  |    ! testtag "AX_REQUIRE_QT" configure.ac; then | ||||||
|  |     echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | \ | ||||||
|  |         to --condition AX_USE_CXX src/makefile.am | ||||||
|  | else | ||||||
|  |     to --condition AX_USE_CXX src/makefile.am <<EOF | ||||||
|  | ${HEADER}bin_PROGRAMS = ${PACKAGE_NAME} | ||||||
|  |  | ||||||
|  | ## required to enable the translation feature | ||||||
|  | LANGUAGE_FILE_BASE = ${PACKAGE_NAME} | ||||||
|  |  | ||||||
|  | ## list here the Qt plugins your project depends on | ||||||
|  | ## required to build Mac OS-X app-bundle | ||||||
|  | QT_PLUGINS = iconengines imageformats platforms | ||||||
|  |  | ||||||
|  | #### enable if you deliver a KDE/Gnome desktop file | ||||||
|  | #applicationsdir = ${datarootdir}/applications | ||||||
|  | #dist_applications_DATA = ${PACKAGE_NAME}.desktop | ||||||
|  |  | ||||||
|  | #### enable (ev. instead of bin_PROGRAMS) if you build a library | ||||||
|  | #lib_LTLIBRARIES = ${PACKAGE_NAME}.la | ||||||
|  | #${PACKAGE_NAME}_la_SOURCES = libmain.cxx version.cxx | ||||||
|  | ## noop to prevent: | ||||||
|  | ## «src/makefile.am: error: object 'version.\$(OBJEXT)' created both with | ||||||
|  | ## libtool and without» | ||||||
|  | #${PACKAGE_NAME}_la_CXXFLAGS = \$(AM_CXXFLAGS) | ||||||
|  |  | ||||||
|  | ## list headers that are required for build, but that are not installed | ||||||
|  | noinst_HEADERS = version.hxx | ||||||
|  |  | ||||||
|  | ## list all %.hxx files with Q_OBJECT as moc_%.cxx | ||||||
|  | ${PACKAGE_NAME//-/_}_MOCFILES = moc_${PACKAGE_NAME}.cxx | ||||||
|  |  | ||||||
|  | ## list all %.ui files as ui_%.hxx | ||||||
|  | ${PACKAGE_NAME//-/_}_UIFILES = ui_${PACKAGE_NAME}.hxx | ||||||
|  |  | ||||||
|  | ## list all %.qrc resource files as qrc_%.cxx | ||||||
|  | ## note: if there exists a directory %, the file %.qrc is generated from that | ||||||
|  | ${PACKAGE_NAME//-/_}_RESOURCES = qrc_languages.cxx qrc_resources.cxx | ||||||
|  |  | ||||||
|  | ## list all final translation files, list all supported languages here | ||||||
|  | ${PACKAGE_NAME//-/_}_TRANSLATIONS = \${LANGUAGE_FILE_BASE}_en.qm	\\ | ||||||
|  |      \${LANGUAGE_FILE_BASE}_de.qm \\ | ||||||
|  |      \${LANGUAGE_FILE_BASE}_fr.qm \\ | ||||||
|  |      \${LANGUAGE_FILE_BASE}_it.qm | ||||||
|  |  | ||||||
|  | ## list all C++ files that need translation | ||||||
|  | ${PACKAGE_NAME//-/_}_TR_FILES = main.cxx version.cxx | ||||||
|  |  | ||||||
|  | ## automatic assembly, no need to change | ||||||
|  | ${PACKAGE_NAME//-/_}_SOURCES = ${swisssign_pin_entry_TR_FILES} ${BUILT_SOURCES} | ||||||
|  |  | ||||||
|  | ## automatic assembly, no need to change | ||||||
|  | BUILT_SOURCES = \${${PACKAGE_NAME//-/_}_MOCFILES} \ | ||||||
|  |                 \${${PACKAGE_NAME//-/_}_UIFILES} \ | ||||||
|  |                 \${${PACKAGE_NAME//-/_}_TRANSLATIONS} \ | ||||||
|  |                 \${${PACKAGE_NAME//-/_}_RESOURCES} | ||||||
|  |  | ||||||
|  | ## automatic assembly, no need to change | ||||||
|  | EXTRA_DIST_TR = \${${PACKAGE_NAME//-/_}_MOCFILES:moc_%.cxx=%.hxx} \ | ||||||
|  |                 \${${PACKAGE_NAME//-/_}_UIFILES:ui_%.hxx=%.ui} | ||||||
|  |  | ||||||
|  | ## automatic assembly, no need to change | ||||||
|  | ## except: adapt the pre-delivered qt_%.qm list (language files you copy from qt | ||||||
|  | EXTRA_DIST = \${EXTRA_DIST_TR} \ | ||||||
|  |              \${${PACKAGE_NAME//-/_}_RESOURCES:qrc_%.cxx:%.qrc} \ | ||||||
|  |              \${${PACKAGE_NAME//-/_}_TRANSLATIONS:%.qm=%.ts} \ | ||||||
|  |              qt_de.qm qt_fr.qm | ||||||
|  |  | ||||||
|  | ## automatic assembly, no need to change | ||||||
|  | LANGUAGE_FILES = \${EXTRA_DIST_TR} \${${PACKAGE_NAME//-/_}_TR_FILES} | ||||||
|  |  | ||||||
|  | MAINTAINERCLEANFILES = makefile.in | ||||||
|  | EOF | ||||||
|  | fi | ||||||
| to --condition AX_USE_CXX src/version.hxx <<EOF | to --condition AX_USE_CXX src/version.hxx <<EOF | ||||||
| /*! @file | /*! @file | ||||||
|  |  | ||||||
| @@ -552,11 +628,13 @@ if testtag AX_USE_DOXYGEN; then | |||||||
|         if testtag AX_USE_SCRIPTS; then |         if testtag AX_USE_SCRIPTS; then | ||||||
|             doxyadd INPUT "@top_srcdir@/scripts" |             doxyadd INPUT "@top_srcdir@/scripts" | ||||||
|         fi |         fi | ||||||
|  |         if testtag AX_BUILD_HTML; then | ||||||
|  |             doxyadd INPUT "@top_srcdir@/html" | ||||||
|  |         fi | ||||||
|         if testtag AX_USE_CPPUNIT; then |         if testtag AX_USE_CPPUNIT; then | ||||||
|             doxyadd INPUT "@top_srcdir@/test" |             doxyadd INPUT "@top_srcdir@/test" | ||||||
|         fi |         fi | ||||||
|         doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js' |         doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt' | ||||||
|         doxyadd FILE_PATTERNS *.wt |  | ||||||
|         doxyreplace RECURSIVE YES |         doxyreplace RECURSIVE YES | ||||||
|         doxyreplace EXCLUDE_PATTERNS "moc_* uic_* qrc_*" |         doxyreplace EXCLUDE_PATTERNS "moc_* uic_* qrc_*" | ||||||
|         if testtag AX_BUILD_EXAMPLES; then |         if testtag AX_BUILD_EXAMPLES; then | ||||||
|   | |||||||
							
								
								
									
										103
									
								
								mac-create-app-bundle.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										103
									
								
								mac-create-app-bundle.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -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 <<EOF | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||||
|  | <plist version="1.0"> | ||||||
|  |   <dict> | ||||||
|  |     <key>CFBundleIdentifier</key> | ||||||
|  |     <string>${2}</string> | ||||||
|  |     <key>CFBundleExecutable</key> | ||||||
|  |     <string>${executablefile##/}</string> | ||||||
|  |   </dict> | ||||||
|  | </plist> | ||||||
|  | EOF | ||||||
|  | fi | ||||||
		Reference in New Issue
	
	Block a user