diff --git a/configure.ac b/configure.ac index 7929d3bb..ee405246 100644 --- a/configure.ac +++ b/configure.ac @@ -1,395 +1,396 @@ # configure.ac for GPG4Win # Copyright (C) 2005, 2006, 2007, 2008, 2010 g10 Code GmbH # # This file is part of GPG4Win # # GPG4Win is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # GPG4Win is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # (Process this file with autoconf to produce a configure script.) AC_PREREQ(2.59) min_automake_version="1.9.3" # To build a release you need to create a tag with the version number # (git tag -s gpg4win-2.x.y) and run "./autogen.sh --force". Please # bump the version number immediately after the release and do another # commit and push so that the git magic is able to work. m4_define([my_version], [4.0.0]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a # flag indicating a development version (my_isgit). The latter works # by requiring the final tag in the repository. m4_define([git_revision], m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r'])) m4_define([git_revision_dec], m4_esyscmd_s([echo $((0x$(echo ]git_revision[|head -c 4)))])) m4_define([git_betastring], m4_esyscmd_s([git describe --tags --match 'gpg4win-[0-9].*.*[0-9]' \ --long | awk -F- '$3!=0{print"-beta"$3}'])) m4_define([my_isgit],m4_if(git_betastring,[],[no],[yes])) m4_define([my_full_version],[my_version[]git_betastring]) AC_INIT([gpg4win],[my_full_version],[gpg4win-devel@wald.intevation.org]) # Remember to update these version numbers also in the NEWS file. MANUALVERSION_EINSTEIGER="2.0.2" MANUALDATE_EINSTEIGER="30. Mai 2006" MANUALVERSION_DURCHBLICKER="2.0.2" MANUALDATE_DURCHBLICKER="30. Mai 2006" MANUALVERSION_NOVICES="1.0.0" MANUALDATE_NOVICES="Nov. 30, 2006" MANUALVERSION_ADVANCED="0.0.0" MANUALDATE_ADVANCED="Nov. 30, 2006" COMPENDIUM_VERSION_DE="4.0.1" COMPENDIUM_DATE_DE="3. April 2018" COMPENDIUMINPROGRESS_DE="zuletzt geringfügig korrigiert am 3. April 2018" COMPENDIUM_VERSION_EN="3.0.0" COMPENDIUM_DATE_EN="30th November 2016" COMPENDIUMINPROGRESS_EN="last minor changes from 30th November 2016" MANUALINPROGRESS_DE=m4_if(my_isgit,[yes],["~und evtl. seitdem weiter bearbeitet"]) MANUALINPROGRESS_EN=m4_if(my_isgit,[yes],["~and may have been further edited"]) PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION GIT_REVISION=git_revision GIT_REVISION_DEC=git_revision_dec AC_CONFIG_SRCDIR(src/config.nsi.in) AC_CONFIG_MACRO_DIR(m4) AM_INIT_AUTOMAKE([tar-ustar]) AM_MAINTAINER_MODE AC_CANONICAL_HOST AM_CONFIG_HEADER(config.h) # Language support AM_PO_SUBDIRS AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_SUBST(MANUALVERSION_EINSTEIGER) AC_SUBST(MANUALDATE_EINSTEIGER) AC_SUBST(MANUALVERSION_DURCHBLICKER) AC_SUBST(MANUALDATE_DURCHBLICKER) AC_SUBST(MANUALINPROGRESS_DE) AC_SUBST(MANUALVERSION_NOVICES) AC_SUBST(MANUALDATE_NOVICES) AC_SUBST(MANUALVERSION_ADVANCED) AC_SUBST(MANUALDATE_ADVANCED) AC_SUBST(MANUALINPROGRESS_EN) AC_SUBST(COMPENDIUM_VERSION_DE) AC_SUBST(COMPENDIUM_DATE_DE) AC_SUBST(COMPENDIUMINPROGRESS_DE) AC_SUBST(COMPENDIUM_VERSION_EN) AC_SUBST(COMPENDIUM_DATE_EN) AC_SUBST(COMPENDIUMINPROGRESS_EN) if echo "${PACKAGE_VERSION}" | egrep 'svn|rc|beta|git' >/dev/null ; then IS_BETA_BUILD=yes else IS_BETA_BUILD=no fi AC_SUBST(IS_BETA_BUILD) # Generate extended version information. Note, that for NSIS use we # must not translate the dots to commas in the BUILD_FILEVERSION. BUILD_TIMESTAMP=`date --iso-8601=minutes` BUILD_ISODATE=`date --iso-8601` changequote(,)dnl BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./'` changequote([,])dnl BUILD_FILEVERSION="${BUILD_FILEVERSION}${GIT_REVISION_DEC}" AC_SUBST(BUILD_TIMESTAMP) AC_SUBST(BUILD_ISODATE) AC_SUBST(BUILD_FILEVERSION) # The final release is copied to an archive server. The default # location may be changed by setting the RELEASEHOST envvar. if test -z "$RELEASEHOST" ; then RELEASEHOST="vigenere:tarballs/gpg4win" if test "${IS_BETA_BUILD}" = yes ; then RELEASEHOST="${RELEASEHOST}/Beta" fi fi AC_SUBST(RELEASEHOST) # Substitutions to set generated files in a Emacs buffer to read-only. AC_SUBST(emacs_local_vars_begin, ['Local Variables:']) AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t']) AC_SUBST(emacs_local_vars_end, ['End:']) # For development it is often faster to build without manuals. AC_ARG_ENABLE(manuals, AC_HELP_STRING([--disable-manuals], [Do not build the manuals (for debugging)]), build_manuals=$enableval, build_manuals=yes) AM_CONDITIONAL(BUILD_MANUALS, test "$build_manuals" = yes) # Additionaly enable building gpgex for another host AC_ARG_WITH([additional-gpgex-host], AC_HELP_STRING([--with-additional-gpgex-host=HOST], [Additionaly build gpgex for this host]), [if test "$withval" = yes; then AC_MSG_FAILURE( [--with-additional-gpgex-host was given, but no host specified]) else gpgex_host=$withval fi ], gpgex_host=no) if test "$gpgex_host" != no; then GPGEX_ADD_HOST="$gpgex_host" fi AC_SUBST(GPGEX_ADD_HOST) AC_ARG_ENABLE(fast-makensis, AC_HELP_STRING([--enable-fast-makensis], [Use a less efficient compressor to speed up building]), use_fast_makensis=$enableval, use_fast_makensis=no) if test "$use_fast_makensis" = yes; then EXTRA_MAKENSIS_FLAGS="${EXTRA_MAKENSIS_FLAGS} -DDISABLE_LZMA=1" fi AC_SUBST(EXTRA_MAKENSIS_FLAGS) # Required tools. AC_PROG_CC AC_PROG_CPP AC_PROG_RANLIB AC_CHECK_TOOL(AR, ar, :) AC_CHECK_TOOLS(STRIP, strip) AC_CHECK_TOOLS(DLLTOOL, dlltool) AC_CHECK_PROGS(MAKE, make) AC_CHECK_PROGS(UNZIP, unzip) AC_CHECK_PROGS(TAR, tar) AC_CHECK_PROGS(MKDIR, mkdir) AC_CHECK_PROGS(CP, cp) AC_CHECK_PROGS(RM, rm) AC_CHECK_PROGS(STOW, stow) AC_CHECK_PROGS(MAKENSIS, makensis) AC_CHECK_PROGS(ZCAT, zcat) AC_CHECK_PROGS(TEXI2DVI, texi2dvi) AC_CHECK_PROGS(DVIPDF, dvipdf) AC_CHECK_PROGS(CONVERT, convert) AC_CHECK_PROGS(SHA1SUM, sha1sum) AC_CHECK_PROGS(MSGFMT, msgfmt) AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [build-aux/gitlog-to-changelog]) AC_CHECK_PROGS(BUILD_CC, gcc cc) AC_PROG_INSTALL if test -n "$GPGEX_ADD_HOST"; then AC_CHECK_TOOLS(STRIP_EX, ${GPGEX_ADD_HOST}-strip) fi if test -z "$GPG4WIN_PARALLEL"; then JOBS=$(nproc 2>/dev/null || echo 1) GPG4WIN_PARALLEL=-j$JOBS AC_MSG_NOTICE([Using autodetected $JOBS make jobs. You can override this by setting GPG4WIN_PARALLEL.]) fi AC_SUBST(GPG4WIN_PARALLEL) missing_tools= for i in DLLTOOL MAKE UNZIP TAR MKDIR CP RM STOW MAKENSIS ZCAT TEXI2DVI \ DVIPDF CONVERT SHA1SUM MSGFMT BUILD_CC; do eval tmp='$'$i if test -z "$tmp"; then missing_tools="$missing_tools `echo $i | tr 'A-Z' 'a-z'`" fi done # Additional runtime libraries from mingw. GPG4WIN_RUNTIME_LIBRARY(libgcc_s_sjlj-1) GPG4WIN_RUNTIME_LIBRARY(libstdc++-6) GPG4WIN_RUNTIME_LIBRARY(libwinpthread-1) AC_CHECK_PROGS(GLIB_GENMARSHAL, glib-genmarshal) AC_CHECK_PROGS(GLIB_COMPILE_SCHEMAS, glib-compile-schemas) AC_CHECK_PROGS(GLIB_COMPILE_RESOURCES, glib-compile-resources) AC_CHECK_PROGS(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource) missing_opt_tools= for i in GLIB_GENMARSHAL GLIB_COMPILE_SCHEMAS GLIB_COMPILE_RESOURCES \ GDK_PIXBUF_CSOURCE; do eval tmp='$'$i if test -z "$tmp"; then missing_opt_tools="$missing_opt_tools `echo $i | tr 'A-Z' 'a-z'`" fi done # Optional tools. AC_CHECK_PROGS(WGET, wget) # Packages. gpg4win_dup_sources="" GPG4WIN_SPKG([zlib]) GPG4WIN_BPKG_GTK([pkgconfig]) GPG4WIN_SPKG([libffi], [pkgconfig]) GPG4WIN_SPKG([glib], [libiconv gettext pkgconfig libffi zlib]) GPG4WIN_BPKG_GTK_DEV([atk], [glib pkgconfig]) GPG4WIN_BPKG_GTK_DEV([pango], [glib pkgconfig]) GPG4WIN_BPKG_GTK_DEV([cairo], [glib pkgconfig]) GPG4WIN_BPKG_GTK_DEV([expat]) GPG4WIN_BPKG_GTK_DEV([freetype], [pkgconfig zlib]) GPG4WIN_BPKG_GTK_DEV([fontconfig], [pkgconfig zlib expat]) GPG4WIN_SPKG([gdk-pixbuf], [glib]) GPG4WIN_SPKG([gtk+], [libiconv gettext pkgconfig atk pango dnl glib gdk-pixbuf cairo]) GPG4WIN_SPKG([libpng], [pkgconfig]) GPG4WIN_SPKG([bzip2]) GPG4WIN_SPKG([libgpg-error], [libiconv gettext]) GPG4WIN_SPKG([libassuan], [libgpg-error w32pth]) GPG4WIN_SPKG([scute], [libgpg-error libassuan]) GPG4WIN_SPKG([pinentry], [qtbase libiconv gtk+]) GPG4WIN_SPKG([gpgme], [libgpg-error libassuan glib qtbase]) GPG4WIN_SPKG([gpgol], [gpgme libassuan]) GPG4WIN_SPKG([gpgex], [libassuan]) GPG4WIN_SPKG([paperkey]) GPG4WIN_SPKG([gpa], [libiconv gettext zlib gtk+ libpng glib gpgme]) GPG4WIN_SPKG([w32pth]) GPG4WIN_SPKG([libiconv]) GPG4WIN_SPKG([gettext], [libiconv]) # Packages needed for gpgex GPG4WIN_SPKGEX([libgpg-error]) GPG4WIN_SPKGEX([libassuan], [libgpg-error]) GPG4WIN_SPKGEX([gpgex], [libassuan]) GPG4WIN_SPKGEX([gpgme], [libgpg-error libassuan]) GPG4WIN_SPKGEX([gpgol], [gpgme]) GPG4WIN_IPKG([compendium]) # The GnuPG Package. GPG4WIN_BPKG_BINSRC([gnupg-w32]) +GPG4WIN_BPKG_MSISRC([gnupg-msi]) # See the script kde-l10n.sh how this package is created. GPG4WIN_BPKG_BINSRC([kde-l10n]) # Qt related stuff. GPG4WIN_SPKG([qtbase], [libpng]) GPG4WIN_SPKG([qttools], [qtbase]) GPG4WIN_SPKG([qttranslations], [qtsvg qttools qtwinextras]) GPG4WIN_SPKG([qtwinextras], [qtbase]) GPG4WIN_SPKG([qtsvg], [qtbase]) GPG4WIN_SPKG([boost], [expat zlib bzip2]) GPG4WIN_KDEPKG([breeze-icons], [extra-cmake-modules qtbase]) GPG4WIN_KDEPKG([kleopatra], [gnupg-w32 breeze-icons kxmlgui libkleo kde-l10n kitemmodels qttranslations]) GPG4WIN_KDEPKG([extra-cmake-modules]) GPG4WIN_KDEPKG([kconfig], [qtbase qttools extra-cmake-modules]) GPG4WIN_KDEPKG([ki18n], [qtbase gettext qttools extra-cmake-modules]) GPG4WIN_KDEPKG([kwidgetsaddons], [kconfig qttools qtbase]) GPG4WIN_KDEPKG([kcompletion], [kwidgetsaddons]) GPG4WIN_KDEPKG([kwindowsystem], [qtbase qtwinextras]) GPG4WIN_KDEPKG([kcoreaddons], [qtbase qttools]) GPG4WIN_KDEPKG([kcodecs], [qtbase qttools]) GPG4WIN_KDEPKG([kguiaddons], [qtbase qttools]) GPG4WIN_KDEPKG([kmime], [kcodecs]) GPG4WIN_KDEPKG([kconfigwidgets], [kwidgetsaddons kguiaddons ki18n kcodecs kconfig]) GPG4WIN_KDEPKG([kitemviews], [qtbase qttools]) GPG4WIN_KDEPKG([kitemmodels], [qtbase qttools]) GPG4WIN_KDEPKG([karchive], [qtbase qttools extra-cmake-modules]) GPG4WIN_KDEPKG([kcrash], [kwindowsystem kcoreaddons]) GPG4WIN_KDEPKG([kiconthemes], [qtsvg kconfigwidgets karchive]) GPG4WIN_KDEPKG([kxmlgui], [kiconthemes kconfigwidgets kitemviews]) GPG4WIN_KDEPKG([libkleo], [kmime kwidgetsaddons kwindowsystem kcompletion kconfig gpgme]) GPG4WIN_KDEPKG([gpg4win-tools], [libkleo gpgme]) GPG4WIN_FINALIZE # Throw an error if required tools are missing if test -n "$missing_tools"; then for i in $missing_tools; do AC_MSG_NOTICE([$i is missing]) done AC_MSG_ERROR([[ *** *** Required tools not found. Please consult the above messages *** and install them before running configure again. ***]]) fi # Throw an error if any duplicate source packages have been found if test -n "$gpg4win_dup_sources"; then tmp= for i in $gpg4win_dup_sources; do tmp="$tmp $i" done tmp2=" You might remove them with:" for i in $gpg4win_rm_candidates; do if ! grep -q $(basename $i) packages/packages.current; then tmp2="$tmp2 rm $i" fi done AC_MSG_ERROR([Packages with more that one source version:$tmp$tmp2]) fi # Finalize. AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(packages/Makefile src/Makefile po/Makefile.in) AC_CONFIG_FILES(po/build-cc) AC_CONFIG_FILES(src/config.nsi src/gpg4win.mk) AC_CONFIG_FILES(doc/Makefile) AC_CONFIG_FILES(doc/logo/Makefile) AC_CONFIG_FILES(doc/manual/Makefile doc/manual/version.tex) AC_CONFIG_FILES(src/toolchain.cmake) AC_OUTPUT # Throw a warning if optional tools are missing if test -n "$missing_opt_tools"; then AC_MSG_WARN([[ *** *** Some tools not found. They may or may not be needed depending on *** the packages you want to include. For example GLIB and GTK+ *** require certain tools; you may need to install a recent version of *** GLIB and GTK+ on the build machine to allow for cross-compiling. ***]]) for i in $missing_opt_tools; do AC_MSG_NOTICE([$i is missing]) done fi echo -n " $PACKAGE_NAME-$PACKAGE_VERSION prepared for make Revision: ${GIT_REVISION} (${GIT_REVISION_DEC}) 32bit platform: $host 64bit platform: ${GPGEX_ADD_HOST} " if test -n "$JOBS"; then echo " make jobs: ${JOBS}" else echo "" fi diff --git a/m4/gpg4win.m4 b/m4/gpg4win.m4 index ede88f45..768ca998 100644 --- a/m4/gpg4win.m4 +++ b/m4/gpg4win.m4 @@ -1,832 +1,889 @@ dnl gpg4win.m4 - macros to configure gpg4win. dnl Copyright (C) 2005, 2009 g10 Code GmbH dnl dnl This file is part of GPG4Win. dnl dnl GPG4Win is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl GPG4Win is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, dnl MA 02110-1301, USA # GPG4WIN_DEFINE SYMBOL # A poor man's version of AC_DEFINE_UNQUOTED for NSIS. AC_DEFUN([GPG4WIN_DEFINE], [ eval $1=\"\!define $1 1\" AC_SUBST($1) ]) # GPG4WIN_BASH # Gpg4Win needs bash. This macro checks for it. AC_DEFUN([GPG4WIN_BASH], [ AC_MSG_CHECKING([for Bash]) _bash=$BASH_VERSION if test -z "$_bash"; then _bash=no fi AC_MSG_RESULT($_bash) if test $_bash = no; then AC_MSG_ERROR("this configure script requires Bash") fi ]) # GPG4WIN_PACKAGES # Determines the path to the source and binary packages. # Default is the "packages" directory in the source directory. # The path is stored in the shell variable gpg4win_packages. AC_DEFUN([GPG4WIN_PACKAGES], [ AC_MSG_CHECKING(for packages directory) _gpg4win_packages_default=packages AC_ARG_WITH([packages], AS_HELP_STRING([--with-packages=DIR], [source and binary packages [[packages]]]), gpg4win_packages=$withval) AS_IF([test -z $gpg4win_packages], [gpg4win_packages=$_gpg4win_packages_default]) AS_IF([test `echo $gpg4win_packages | head -c 1` != /], [gpg4win_packages=`pwd`/$gpg4win_packages]) AC_SUBST(gpg4win_packages) AC_MSG_RESULT($gpg4win_packages) # Set auto-detection. FIXME: This should accept a comma-separated # list of packages that will be autodetected. _gpg4win_auto_detection=yes AC_ARG_ENABLE([packages], AS_HELP_STRING([--enable-packages], [enable auto-detection [[yes]]]), _gpg4win_auto_detection=$enableval) ]) # Should be called early. AC_DEFUN([GPG4WIN_INIT], [ # We call this here so its options appear before the per-package options. AC_REQUIRE([GPG4WIN_PACKAGES]) ]) # GPG4WIN_FIND([FILE],[PATTERN],[ZIP|TAR],[DIR],[IF-FOUND],[IF-NOT-FOUND]) # Search for package file FILE in DIR. If DIR is empty, yes or maybe, # look in default directory. If DIR is not maybe, abort if not found. # The package file name is provided in gpg4win_val and the version in # gpg4win_version. AC_DEFUN([GPG4WIN_FIND], [ AC_REQUIRE([GPG4WIN_BASH]) AC_REQUIRE([GPG4WIN_PACKAGES]) gpg4win_val= gpg4win_version= AC_MSG_CHECKING(for package $1) _gpg4win_critical=no _gpg4win_file= _gpg4win_dir=$4 # If --enable-pkg-foo was specified, make success critical. AS_IF([test x$_gpg4win_dir != xmaybe], [_gpg4win_critical=yes]) # Only check if critical or auto detection is requested. AS_IF([test $_gpg4win_auto_detection = yes -o $_gpg4win_critical = yes], [AS_IF([test -z "$_gpg4win_dir" -o "$_gpg4win_dir" = yes -o "$_gpg4win_dir" = maybe], [_gpg4win_dir=$gpg4win_packages]) # Install pattern. AS_IF([test -z "$2"], [_gpg4win_pat='$1-\([[0-9]].*\)'], [_gpg4win_pat="$2"]) # Frob pattern. Regex party! [_gpg4win_glob=`echo "$_gpg4win_pat" | sed -e 's/\\\\(\(.*\)\\\\)/\1/'`] [_gpg4win_glob=`echo "$_gpg4win_glob" | sed -e 's/\\.\\*/*/'`] # Make non-matching globs expand to nothing. shopt -s nullglob _gpg4win_format=both AS_IF([test ! -z "$3"], _gpg4win_format="$3") AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tar.xz` _gpg4win_suffix=.tar.xz]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tar.bz2` _gpg4win_suffix=.tar.bz2]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tbz2` _gpg4win_suffix=.tbz2]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tbz` _gpg4win_suffix=.tbz]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tar.gz` _gpg4win_suffix=.tar.gz]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tgz` _gpg4win_suffix=.tgz]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != tar], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.zip` _gpg4win_suffix=.zip]) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != tar -a $_gpg4win_format != zip], [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.exe` _gpg4win_suffix=.exe]) + AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != tar -a $_gpg4win_format != zip], + [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.wixlib` + _gpg4win_suffix=.wixlib]) shopt -u nullglob]) AS_IF([test -z "$_gpg4win_file"], AC_MSG_RESULT(no), AS_IF([test `echo $_gpg4win_file | head -c 1` != /], [_gpg4win_file=`pwd`/$_gpg4win_file]) AC_MSG_RESULT($_gpg4win_file)) AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_critical = yes], AC_MSG_ERROR(could not find sources for $1 in $_gpg4win_dir)) # Test for duplicate. _gpg4win_found= for _gpg4win_f in $_gpg4win_file; do AS_IF([test "$_gpg4win_found" = yes], [AC_MSG_WARN(found more than one sources for $1 in $_gpg4win_dir) gpg4win_dup_sources="$gpg4win_dup_sources $1"; gpg4win_rm_candidates="$gpg4win_rm_candidates $_gpg4win_file"]) _gpg4win_found=yes done AS_IF([test ! -z "$_gpg4win_file"], [gpg4win_val="$_gpg4win_file" [gpg4win_version=`echo "$gpg4win_val" | sed -e "s,^.*/${_gpg4win_pat}${_gpg4win_suffix}$,\1,"`] [$5]], [$6]) ]) AC_DEFUN([GPG4WIN_CHECK_EXDEPS], [ AC_REQUIRE([GPG4WIN_CHECK_DEPS]) AC_MSG_CHECKING([additional host build list]) gpg4win_build_ex_list=`echo $_gpg4win_ex_deps | tsort` # Remove newlines. gpg4win_build_ex_list=`echo $gpg4win_build_ex_list` AC_MSG_RESULT($gpg4win_build_ex_list) AC_SUBST(gpg4win_build_ex_list) # Check each dependency. _gpg4win_not_found= _gpg4win_d= _gpg4win_p= for _gpg4win_p in $_gpg4win_ex_deps; do AS_IF([test -z $_gpg4win_d], [_gpg4win_d=$_gpg4win_p], [ _gpg4win_found= for _gpg4win_i in $_gpg4win_pkgs; do AS_IF([test $_gpg4win_d = $_gpg4win_i], _gpg4win_found=yes break) done AS_IF([test -z $_gpg4win_found], AC_MSG_WARN(could not find ex variant of package $_gpg4win_d required by package $_gpg4win_p) _gpg4win_not_found=yes) _gpg4win_d= ]) done AS_IF([test ! -z "$_gpg4win_not_found"], AC_MSG_ERROR([could not find some required packages])) ]) AC_DEFUN([GPG4WIN_CHECK_DEPS], [ AC_MSG_CHECKING(build list) gpg4win_build_list=`echo $_gpg4win_deps | tsort` # Remove newlines. gpg4win_build_list=`echo $gpg4win_build_list` AC_MSG_RESULT($gpg4win_build_list) AC_SUBST(gpg4win_build_list) # Check each dependency. _gpg4win_not_found= _gpg4win_d= _gpg4win_p= for _gpg4win_p in $_gpg4win_deps; do AS_IF([test -z $_gpg4win_d], [_gpg4win_d=$_gpg4win_p], [ _gpg4win_found= for _gpg4win_i in $_gpg4win_pkgs; do AS_IF([test $_gpg4win_d = $_gpg4win_i], _gpg4win_found=yes break) done AS_IF([test -z $_gpg4win_found], AC_MSG_WARN(could not find package $_gpg4win_d required by package $_gpg4win_p) _gpg4win_not_found=yes) _gpg4win_d= ]) done AS_IF([test ! -z "$_gpg4win_not_found"], AC_MSG_ERROR([could not find some required packages])) ]) AC_DEFUN([GPG4WIN_FINALIZE], [ AC_REQUIRE([GPG4WIN_CHECK_EXDEPS]) _gpg4win_debug=no AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [enable debugging [[no]]]), _gpg4win_debug=$enableval) AS_IF([test "${_gpg4win_debug}" != no], GPG4WIN_DEFINE(GPG4WIN_DEBUG)) ]) # GPG4WIN_IPKG([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the internal package PKG. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_IPKG], [ AC_REQUIRE([GPG4WIN_INIT]) AC_MSG_CHECKING([for internal package $1]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include internal package $1]), _gpg4win_pkg=$enableval, _gpg4win_pkg=yes) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AC_MSG_RESULT($_gpg4win_pkg) AS_IF([test "$_gpg4win_pkg" != no], _gpg4win_pkgs="$_gpg4win_pkgs $1" GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_SPKG([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the source package PKG. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_SPKG], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_spkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1,,, $_gpg4win_pkg, _gpg4win_spkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_spkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_spkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_spkg" != no], _gpg4win_pkgs="$_gpg4win_pkgs $1" GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_SPKGEX([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the source package PKG to be additionally built # for the host provided as additional-gpgex-host AC_DEFUN([GPG4WIN_SPKGEX], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_spkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1,,, $_gpg4win_pkg, _gpg4win_spkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_spkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_spkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) AS_IF([test ! -z "$GPGEX_ADD_HOST"], # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_ex_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_ex_deps) gpg4win_ex_pkgs="$gpg4win_ex_pkgs $1" GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])_EX) # Record dependencies. Also enter every package as node. _gpg4win_ex_deps="$_gpg4win_ex_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_ex_deps="$_gpg4win_ex_deps $_gpg4win_i $1" done) ) ]) # GPG4WIN_KDEPKG([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the source package PKG to be additionally built # for the host provided as additional-gpgex-host AC_DEFUN([GPG4WIN_KDEPKG], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_kdepkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1,,, $_gpg4win_pkg, _gpg4win_kdepkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # gpg4win_pkg_PKGNAME=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_kdepkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_kdepkg" != no], _gpg4win_pkgs="$_gpg4win_pkgs $1" GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_BPKG_GNUWIN32([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the gnuwin32 package PKG. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_BPKG_GNUWIN32], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_bpkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1-bin, [$1-\(.*\)-bin],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_bpkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_bpkg" != "no" ], GPG4WIN_FIND($1-lib, [$1-\(.*\)-lib],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find development package for package $1)) # gpg4win_pkg_PKGNAME_dev=FILENAME_OF_BINARY_DEVEL gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_dev=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_dev) GPG4WIN_FIND($1-src, [$1-\(.*\)-src],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find sources for package $1)) # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src) # FIXME: Add a version consistency check here. All three packages # must match! GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) _gpg4win_pkgs="$_gpg4win_pkgs $1" # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_BPKG_GNUWIN32_LIB([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the gnuwin32 package PKG. This is a static only library version. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_BPKG_GNUWIN32_LIB], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_bpkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1-lib, [$1-\(.*\)-lib],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_bpkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) AS_IF([test "$_gpg4win_bpkg" != no], GPG4WIN_FIND($1-src, [$1-\(.*\)-src],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find sources for package $1)) # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src) # FIXME: Add a version consistency check here. All two packages # must match! GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) _gpg4win_pkgs="$_gpg4win_pkgs $1" # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_BPKG_GTK([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the Gtk binary package PKG. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_BPKG_GTK], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_bpkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1,,zip, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_bpkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_bpkg" != no], [GPG4WIN_FIND($1,,tar, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find sources for package $1))] # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src) # FIXME: Add a version consistency check here. All three packages # must match! GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) _gpg4win_pkgs="$_gpg4win_pkgs $1" # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_BPKG_GTK_DEV([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the Gtk library package PKG. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_BPKG_GTK_DEV], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_bpkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1,,zip, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_bpkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_bpkg" != no], [GPG4WIN_FIND($1-dev,,, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find development package for package $1))] # gpg4win_pkg_PKGNAME_dev=FILENAME_OF_BINARY_DEVEL gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_dev=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_dev) [GPG4WIN_FIND($1,,tar, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find sources for package $1))] # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src) # FIXME: Add a version consistency check here. All three packages # must match! GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) _gpg4win_pkgs="$_gpg4win_pkgs $1" # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) # GPG4WIN_BPKG_GNU([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up the source package PKG. # It is provided in gpg4win_val. AC_DEFUN([GPG4WIN_BPKG_GNU], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_bpkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [ # For some shameful reason, the gettext package is actually called # gettext-runtime! AS_IF([test $1 = gettext], [GPG4WIN_FIND($1-runtime,,zip, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)], [GPG4WIN_FIND($1,,zip, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) ]) # At this point, _gpg4win_bpkg is no, or the actual package source file. # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_bpkg" != no], [GPG4WIN_FIND($1,,tar, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find sources for package $1))] # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[-+],[__])[]_src) # FIXME: Add a version consistency check here. All two packages # must match! GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) _gpg4win_pkgs="$_gpg4win_pkgs $1" # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps $1 $1" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1" done) [$3], [$4]) ]) +# GPG4WIN_BPKG_MSISRC([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) +# Set up package PKG which is expected to be delivered as two ZIP files +# with a "-(src|source)" and a "-(bin|noinstaller)" suffix. +AC_DEFUN([GPG4WIN_BPKG_MSISRC], +[ + AC_REQUIRE([GPG4WIN_INIT]) + _gpg4win_pkg=maybe + AC_ARG_ENABLE([pkg-$1], + AS_HELP_STRING([--enable-pkg-$1[=DIR]], + [include package $1]), + _gpg4win_pkg=$enableval) + _gpg4win_bpkg=no + _gpg4win_version= + AS_IF([test "$_gpg4win_pkg" != no], + [GPG4WIN_FIND($1-bin, [$1-\(.*\)-bin],, + $_gpg4win_pkg, + _gpg4win_bpkg=$gpg4win_val + _gpg4win_version=$gpg4win_version)]) + AS_IF([test "$_gpg4win_pkg" != no -a "$_gpg4win_bpkg" = no], + [GPG4WIN_FIND($1-noinstaller, [$1-\(.*\)-noinstaller],, + $_gpg4win_pkg, + _gpg4win_bpkg=$gpg4win_val + _gpg4win_version=$gpg4win_version)]) + + # At this point, _gpg4win_bpkg is no, or the actual package binary file. + + # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY + gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]=$_gpg4win_bpkg + AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])) + + # gpg4win_pkg_PKGNAME_version=VERSION + gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_version=$_gpg4win_version + AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_version) + + # gpg4win_pkg_PKGNAME_deps=DEPS + gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" + AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) + + AS_IF([test "$_gpg4win_bpkg" != no], + tmp_binsrc=yes + GPG4WIN_FIND($1-src, [$1-\(.*\)-src],, + $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, tmp_binsrc=no) + if test $tmp_binsrc = no ; then + GPG4WIN_FIND($1-source, [$1-\(.*\)-source],, + $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, + AC_MSG_ERROR(can not find sources for package $1)) + fi + # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE + gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_src=$_gpg4win_bpkg + AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_src) + GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) + ) +]) + # GPG4WIN_BPKG_BINSRC([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND]) # Set up package PKG which is expected to be delivered as two ZIP files # with a "-(src|source)" and a "-(bin|noinstaller)" suffix. AC_DEFUN([GPG4WIN_BPKG_BINSRC], [ AC_REQUIRE([GPG4WIN_INIT]) _gpg4win_pkg=maybe AC_ARG_ENABLE([pkg-$1], AS_HELP_STRING([--enable-pkg-$1[=DIR]], [include package $1]), _gpg4win_pkg=$enableval) _gpg4win_bpkg=no _gpg4win_version= AS_IF([test "$_gpg4win_pkg" != no], [GPG4WIN_FIND($1-bin, [$1-\(.*\)-bin],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) AS_IF([test "$_gpg4win_pkg" != no -a "$_gpg4win_bpkg" = no], [GPG4WIN_FIND($1-noinstaller, [$1-\(.*\)-noinstaller],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val _gpg4win_version=$gpg4win_version)]) # At this point, _gpg4win_bpkg is no, or the actual package binary file. # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])) # gpg4win_pkg_PKGNAME_version=VERSION gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_version=$_gpg4win_version AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_version) # gpg4win_pkg_PKGNAME_deps=DEPS gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps="$2" AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_deps) AS_IF([test "$_gpg4win_bpkg" != no], tmp_binsrc=yes GPG4WIN_FIND($1-src, [$1-\(.*\)-src],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, tmp_binsrc=no) if test $tmp_binsrc = no ; then GPG4WIN_FIND($1-source, [$1-\(.*\)-source],, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val, AC_MSG_ERROR(can not find sources for package $1)) fi # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_src=$_gpg4win_bpkg AC_SUBST(gpg4win_pkg_[]m4_translit([$1],[A-Z+-],[a-z__])[]_src) # FIXME: Add a version consistency check here. Both packages # must match! GPG4WIN_DEFINE(HAVE_PKG_[]m4_translit([$1],[a-z+-],[A-Z__])) _gpg4win_pkgs="$_gpg4win_pkgs []m4_translit([$1],[A-Z],[a-z])" # Record dependencies. Also enter every package as node. _gpg4win_deps="$_gpg4win_deps []m4_translit([$1],[A-Z],[a-z]) []m4_translit([$1],[A-Z],[a-z])" AS_IF([test ! -z "$2"], for _gpg4win_i in $2; do _gpg4win_deps="$_gpg4win_deps $_gpg4win_i []m4_translit([$1],[A-Z],[a-z])" done) [$3], [$4]) ]) # Add a runtime library argument 1 should be the dll # name without the .dll suffix AC_DEFUN([GPG4WIN_RUNTIME_LIBRARY], [ dll_path="no" AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1-dll[=FILE]], [include FILE as runtime dependency for the installer.]), [dll_path=$withval]) if test "$dll_path" = "no"; then changequote(,) gcc_major_minor=$($CC --version \ | awk 'NR==1 {split($NF,a,"."); print a[1] "." a[2]}') gcc_major_minor_alt=$($CC --version | cut -d " " -f 3 \ | awk 'NR==1 {split($NF,a,"."); print a[1] "." a[2]}') changequote([,]) guesses="/usr/lib/gcc/$host/$gcc_major_minor/$1.dll /usr/$host/lib/$1.dll /usr/lib/gcc/$host/${gcc_major_minor}-win32/$1.dll /usr/lib/gcc/$host/${gcc_major_minor_alt}-win32/$1.dll /usr/lib/gcc/$host/${gcc_major_minor_alt}/$1.dll" for file in $guesses; do if test -r "$file"; then dll_path="$file" break fi done fi if test "$dll_path" = "no"; then AC_MSG_ERROR(can not find the runtime library $1.dll in the default locations. Use the --with-$1 option to set the path directly. ) fi AC_MSG_NOTICE(Using $dll_path to provide $1) $CP "$dll_path" src/$1.dll-x $STRIP src/$1.dll-x ]) diff --git a/po/gpg4win-de.wxl b/po/gpg4win-de.wxl index bf7560f5..b0b6b85b 100644 --- a/po/gpg4win-de.wxl +++ b/po/gpg4win-de.wxl @@ -1,5 +1,6 @@ 1031 - Eine neuere Version von GnuPG Desktop ist hier bereits installiert. + Eine neuere Version von GnuPG VS-Desktop ist hier bereits installiert. Möchten Sie diese überschreiben? +Bitte deinstallieren Sie Gpg4win vor der Installation von GnuPG VS-Desktop. diff --git a/po/gpg4win-en.wxl b/po/gpg4win-en.wxl index 66181189..42871531 100644 --- a/po/gpg4win-en.wxl +++ b/po/gpg4win-en.wxl @@ -1,5 +1,6 @@ 1033 - A newer version of GnuPG Desktop is already installed. + A newer version of GnuPG VS-Desktop is already installed. Do you wish to overwrite this version? +Please uninstall Gpg4win before installing GnuPG VS-Desktop. diff --git a/src/Makefile.am b/src/Makefile.am index 97ccb293..2834534a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,796 +1,730 @@ # Makefile.am - Installer for GnuPG 4 Windows Makefile. # Copyright (C) 2005, 2006, 2007, 2008, 2009 g10 Code GmbH # # This file is part of Gpg4win. # # Gpg4win is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Gpg4win is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . EXTRA_DIST = pkg-config gpg4win.nsi gpg4win-src.nsi \ config.site config.nsi.in \ libiconv.def libintl.def loreley.mid \ gpg4win-splash.wav exdll.h g4wihelp.c desktopshellrun.cpp \ g4wihelp.nsi slideshow.cpp \ inst-sections.nsi installer.nsi installer-finish.nsi \ zlib.pc sha1sum.c mkportable.c \ mkportable-vanilla.h mkportable-full.h \ potomo Memento.nsh \ inst-gpg4win.nsi uninst-gpg4win.nsi \ inst-atk.nsi uninst-atk.nsi \ inst-expat.nsi uninst-expat.nsi \ inst-freetype.nsi uninst-freetype.nsi \ inst-fontconfig.nsi uninst-fontconfig.nsi \ inst-cairo.nsi uninst-cairo.nsi \ inst-gettext.nsi uninst-gettext.nsi \ inst-libffi.nsi uninst-libffi.nsi \ inst-glib.nsi uninst-glib.nsi \ inst-gnupg-w32.nsi uninst-gnupg-w32.nsi \ inst-gpa.nsi uninst-gpa.nsi \ inst-gpgme.nsi uninst-gpgme.nsi \ inst-paperkey.nsi uninst-paperkey.nsi \ inst-gpgol.nsi uninst-gpgol.nsi \ inst-gpgex.nsi uninst-gpgex.nsi \ inst-gdk-pixbuf.nsi uninst-gdk-pixbuf.nsi \ inst-gtk+.nsi uninst-gtk+.nsi \ inst-libassuan.nsi uninst-libassuan.nsi \ inst-libgpg-error.nsi uninst-libgpg-error.nsi \ inst-libiconv.nsi uninst-libiconv.nsi \ inst-libpng.nsi uninst-libpng.nsi \ inst-compendium.nsi uninst-compendium.nsi \ inst-man_advanced_de.nsi uninst-man_advanced_de.nsi \ inst-man_advanced_en.nsi uninst-man_advanced_en.nsi \ inst-man_novice_de.nsi uninst-man_novice_de.nsi \ inst-man_novice_en.nsi uninst-man_novice_en.nsi \ inst-pango.nsi uninst-pango.nsi \ inst-pinentry.nsi uninst-pinentry.nsi \ inst-pkgconfig.nsi uninst-pkgconfig.nsi \ inst-w32pth.nsi uninst-w32pth.nsi \ inst-zlib.nsi uninst-zlib.nsi \ inst-kconfig.nsi uninst-kconfig.nsi \ inst-kleopatra.nsi uninst-kleopatra.nsi \ inst-bzip2.nsi uninst-bzip2.nsi \ uninst-claws-mail.nsi uninst-claws-mail-cmds.nsi \ inst-qtbase.nsi uninst-qtbase.nsi \ inst-ki18n.nsi uninst-ki18n.nsi \ inst-kwidgetsaddons.nsi uninst-kwidgetsaddons.nsi \ inst-kcompletion.nsi uninst-kcompletion.nsi \ inst-kwindowsystem.nsi uninst-kwindowsystem.nsi \ inst-libkleo.nsi uninst-libkleo.nsi \ inst-kcoreaddons.nsi uninst-kcoreaddons.nsi \ inst-kcodecs.nsi uninst-kcodecs.nsi \ inst-kconfigwidgets.nsi uninst-kconfigwidgets.nsi \ inst-kxmlgui.nsi uninst-kxmlgui.nsi \ inst-kiconthemes.nsi uninst-kiconthemes.nsi \ inst-breeze-icons.nsi uninst-breeze-icons.nsi \ inst-karchive.nsi uninst-karchive.nsi \ inst-kcrash.nsi uninst-kcrash.nsi \ inst-kitemviews.nsi uninst-kitemviews.nsi \ inst-kitemmodels.nsi uninst-kitemmodels.nsi \ inst-kguiaddons.nsi uninst-kguiaddons.nsi \ inst-kmime.nsi uninst-kmime.nsi \ inst-kde-l10n.nsi uninst-kde-l10n.nsi \ inst-qtsvg.nsi uninst-qtsvg.nsi \ inst-qttools.nsi uninst-qttools.nsi \ inst-qttranslations.nsi uninst-qttranslations.nsi \ inst-qtwinextras.nsi uninst-qtwinextras.nsi \ inst-boost.nsi uninst-boost.nsi \ inst-scute.nsi uninst-scute.nsi \ inst-extra-cmake-modules.nsi uninst-extra-cmake-modules.nsi \ inst-gpg4win-tools.nsi uninst-gpg4win-tools.nsi \ inst-gpgme-browser.nsi \ inst-final.nsi index.theme \ slideshow/slides.dat \ slideshow/slide1-gpgol.png \ slideshow/slide2-gpgex.png \ slideshow/slide3-kleopatra.png \ slideshow/slide4-summary.png \ file-ext.ico gpg4win_readme_ll = en de ar es fr ru pt README_files = $(addsuffix .txt,$(addprefix README.,$(gpg4win_readme_ll))) gpg4win_howto_smime_ll = en de HOWTO_files = $(addsuffix .txt, \ $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll))) foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe mkportable.exe # Need to clean the dll because we bypassed automake. CLEANFILES = g4wihelp.dll desktopshellrun.o versioninfo.txt $(README_files) \ $(HOWTO_files) NEWS.tmp COMPONENTS-list.tmp \ license.blurb cdversioninfo.tmp slideshow.o \ $(foosum_exe) # Supported source packages. gpg4win_spkgs = glib libffi gdk-pixbuf gtk+ \ libgpg-error gpgme gpgol gpgex libpng \ gpa opencdk \ pinentry libassuan \ w32pth paperkey regex libiconv gettext scute gpg4win_qtpkgs = qtbase qttools qtwinextras qtsvg qttranslations # Source packages following the KDE pattern gpg4win_kdepkgs = kconfig kwidgetsaddons ki18n extra-cmake-modules \ kcompletion kwindowsystem kcoreaddons libkleo kcodecs \ kmime kconfigwidgets kxmlgui kguiaddons kitemviews \ kiconthemes kleopatra breeze-icons kitemmodels karchive \ gpg4win-tools kcrash # Supported source packages to build in an additional architecture gpg4win_expkgs = libgpg-error libassuan libiconv gettext w32pth gpgex gpgol \ gpgme # Some variables WINE = wine WINHOST = win10 WINLIGHT = c:/wix/light.exe # Extra options to configure for individual packages. # We can use $(idir) here for the installation prefix. gpg4win_pkg_libiconv_ex_configure = \ --enable-shared=no --enable-static=yes gpg4win_pkg_gettext_configure = \ --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \ CPPFLAGS=-I$(idir)/include CFLAGS=-O2 LDFLAGS=-L$(idir)/lib gpg4win_pkg_gettext_ex_configure = \ --with-lib-prefix=$(ex_idir) --with-libiconv-prefix=$(ex_idir) \ CPPFLAGS=-I$(ex_idir)/include CFLAGS=-O2 LDFLAGS=-L$(ex_idir)/lib # We only need gettext-runtime and there is sadly no top level # configure option for this gpg4win_pkg_gettext_make_dir = gettext-runtime gpg4win_pkg_gettext_make_dir_inst = gettext-runtime gpg4win_pkg_gettext_ex_make_dir = gettext-runtime gpg4win_pkg_gettext_ex_make_dir_inst = gettext-runtime gpg4win_pkg_glib_configure = \ --disable-modular-tests \ --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \ CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib CCC=$(host)-g++ gpg4win_pkg_glib_extracflags = -march=i486 gpg4win_pkg_gdk_pixbuf_configure = \ --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \ --with-included-loaders=yes \ CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib gpg4win_pkg_gtk__configure = \ CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib --disable-cups # The GnuPG package provides man pages which we have to convert. # We also create the MO files here. define gpg4win_pkg_gnupg2_post_install (for i in gpg2 gpgv2 gpgsm gpg-agent scdaemon gpg-connect-agent gpgconf ; \ do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \ sed `printf "s/_\b//g;s/\b.//g"` | \ sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \ done ; \ for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \ $(MKDIR_P) $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES || true; \ rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo 2>/dev/null \ || true; \ $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \ $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo; \ done) endef # Paperkey comes with a man pages which we have to convert. define gpg4win_pkg_paperkey_post_install (for i in paperkey ; \ do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \ sed `printf "s/_\b//g;s/\b.//g"` | \ sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \ done) endef # Build the reference manual. define gpg4win_pkg_gpgol_post_install ( cd $$$${pkgbdir}/doc; make pdf ) endef # We would like to use --with-libiconv-prefix and # --with-libintl-prefix, but these don't work with the cheesy # non-"libfoo.la" versions of iconv and gettext that we are using. #gpg4win_pkg_libgpg_error_configure = \ # --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) gpg4win_pkg_libgpg_error_configure = --silent \ CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib \ --enable-static gpg4win_pkg_libgpg_error_ex_configure = --silent \ --enable-static # We convert the PO files to UTF-8. FIXME: This should be done in # libgpg-error proper. define gpg4win_pkg_libgpg_error_post_install (for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \ rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo \ 2>/dev/null|| true; \ $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \ $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo; \ done) endef gpg4win_pkg_libassuan_configure = --silent --enable-static gpg4win_pkg_libassuan_ex_configure = --silent --enable-static gpg4win_pkg_libpng_configure = HAVE_SOLARIS_LD_FALSE=yes CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\" # We would like to use --with-libiconv-prefix and # --with-libintl-prefix, but these don't work with the cheesy # non-"libfoo.la" versions of iconv and gettext that we are using. gpg4win_pkg_pinentry_configure = \ --enable-pinentry-qt \ $(pinentry_enable_disable) \ --disable-pinentry-fltk \ --enable-pinentry-gtk2 \ CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib # --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) # The LDFLAGS is needed for -lintl for glib. The QT4 variables work # around the lack of cross compilation support in qt-dev. gpg4win_pkg_gpgme_configure = --silent \ --with-gpg-error-prefix=$(idir) --enable-static \ `test -n "@HAVE_PKG_GLIB@" && echo "--enable-w32-glib"` \ CFLAGS=-I$(idir)/include/glib-2.0/ \ LDFLAGS=-L$(idir)/lib \ --enable-languages=qt,cpp \ --disable-gpg-test \ --disable-gpgsm-test gpg4win_pkg_gpgme_ex_configure = --silent \ --with-gpg-error-prefix=$(ex_idir) --enable-static \ --with-libassuan-prefix=$(ex_idir) \ LDFLAGS=-L$(ex_idir)/lib \ --enable-languages=cpp \ --disable-gpg-test \ --disable-gpgsm-test gpg4win_pkg_gpa_configure = --silent \ --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \ --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \ --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir) gpg4win_pkg_gpgol_configure = --silent \ --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir) \ --with-libassuan-prefix=$(idir) --enable-mime-send gpg4win_pkg_gpgol_ex_configure = --silent \ --with-gpgme-prefix=$(ex_idir) --with-gpg-error-prefix=$(ex_idir) \ --with-libassuan-prefix=$(ex_idir) --enable-mime-send gpg4win_pkg_gpgex_configure = --silent \ --with-gpg-error-prefix=$(idir) \ --with-libassuan-prefix=$(idir) gpg4win_pkg_gpgex_ex_configure = --silent \ --with-gpg-error-prefix=$(ex_idir) \ --with-libassuan-prefix=$(ex_idir) gpg4win_pkg_paperkey_configure = --silent gpg4win_pkg_ki18n_configure = -DBUILD_WITH_QML=OFF gpg4win_pkg_kconfig_configure = -DKCONFIG_USE_DBUS=OFF gpg4win_pkg_qtbase_configure = ../$$$${pkg_version}/configure -opensource \ -confirm-license \ -xplatform win32-g++ \ -device-option CROSS_COMPILE=$(host)- \ -device-option PKG_CONFIG='$(host)-pkg-config' \ -no-use-gold-linker \ -release \ -shared \ -prefix $$$${pkgidir} \ -I '$(idir)/include' \ -L '$(idir)/lib' \ -no-icu \ -opengl desktop \ -no-glib \ -accessibility \ -nomake examples \ -nomake tests \ -no-sql-mysql \ -no-sql-sqlite \ -no-sql-odbc \ -no-sql-psql \ -no-sql-tds \ -qt-zlib \ -qt-libpng \ -qt-libjpeg \ -qt-freetype \ -qt-pcre \ -no-openssl \ -no-dbus \ -v # qtbase # invoke qmake with removed debug options as a workaround for # https://bugreports.qt-project.org/browse/QTBUG-30898 gpg4win_pkg_qtbase_make_args = \ QMAKE='$$$${pkgbdir}/bin/qmake' # Qmake still writes debug names in pkgconfig files. define gpg4win_pkg_qtbase_post_install (cd $$$${pkgbdir}; \ make install;) endef gpg4win_pkg_qttools_configure = \ "$(idir)/bin/qmake" ../$$$${pkg_version} define gpg4win_pkg_qttools_post_install (cd $$$${pkgbdir}; \ mkdir -p $$$${pkgidir}; \ cp -r bin lib include $$$${pkgidir}) endef # Qmake does not support setting the installation path. # really https://bugreports.qt.io/browse/QTBUG-12341 gpg4win_pkg_qtwinextras_configure = \ "$(idir)/bin/qmake" ../$$$${pkg_version} define gpg4win_pkg_qtwinextras_post_install (cd $$$${pkgbdir}; \ mkdir -p $$$${pkgidir}/bin; \ cp -r lib include $$$${pkgidir}; \ mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin;) endef gpg4win_pkg_qtsvg_configure = \ "$(idir)/bin/qmake" ../$$$${pkg_version} # XXX Adding the qtconf after qtsvg is a weird hack # because somhow (yay qmake) zlib is not linked if # the qt conf exists before that. The qt conf is # needed for qttranslations to find the correct path # of the translation tools. define gpg4win_pkg_qtsvg_post_install (cd $$$${pkgbdir}; \ mkdir -p $$$${pkgidir}; \ cp -r lib include plugins $$$${pkgidir}; \ mkdir -p $$$${pkgidir}/bin; \ mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin; \ echo "[Paths]" > $$$${pkgidir}/bin/qt.conf; \ echo "Prefix = .." >> $$$${pkgidir}/bin/qt.conf) endef gpg4win_pkg_qttranslations_configure = \ "$(idir)/bin/qmake" ../$$$${pkg_version} define gpg4win_pkg_qttranslations_post_install ( rm -f $$$${pkgidir}/qttranslations; \ mkdir -p $$$${pkgidir}; \ cp -r $$$${pkgbdir}/translations $$$${pkgidir}/qttranslations;) endef gpg4win_pkg_kleopatra_configure = \ -DFORCE_DISABLE_KCMUTILS=ON \ -DDISABLE_KWATCHGNUPG=ON \ -DRELEASE_SERVICE_VERSION=-Gpg4win-$(VERSION) gpg4win_pkg_kxmlgui_configure = \ -DFORCE_DISABLE_KGLOBALACCEL=ON \ -DFORCE_DISABLE_DBUS=ON \ -DXMLGUI_COMPILER_VERSION="i686-w64-mingw32-gcc" \ -DXMLGUI_DISTRIBUTION_TEXT="Gpg4win" gpg4win_pkg_breeze_icons_configure = \ -DBINARY_ICONS_RESOURCE=OFF # Supported make-only source packages. gpg4win_mpkgs = bzip2 zlib # Extra options for the make invocations for individual packages. # make_flags is used for building, make_args_inst is used for installing. gpg4win_pkg_bzip2_make_args = \ CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) gpg4win_pkg_bzip2_make_args_inst = \ PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) gpg4win_pkg_zlib_make_args = \ -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \ BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \ LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a # Supported binary packages. gpg4win_bpkgs = pkgconfig pango expat freetype fontconfig \ cairo atk gnupg-w32 kde-l10n # libiconv needs some special magic to generate a usable import # library. # define gpg4win_pkg_libiconv_post_install # (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib; \ # cd $$$${pkgidir}/lib; \ # $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def) # endef # libiconv needs some special magic to generate a usable import # library. Note that we include some internal symbols that are not # actually part of the DLL. They are needed by the AM_GNU_GETTEXT # configure test, but not used otherwise. # define gpg4win_pkg_gettext_post_install # (cp $(srcdir)/libintl.def $$$${pkgidir}/lib; \ # cd $$$${pkgidir}/lib; \ # $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def) # endef # Zlib needs some special magic to generate a libtool file. # We also install the pc file here. define gpg4win_pkg_zlib_post_install (mkdir $$$${pkgidir}/lib/pkgconfig || true; \ cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/; \ cd $$$${pkgidir}; \ echo "# Generated by libtool" > lib/libz.la \ echo "dlname='../bin/zlib1.dll'" >> lib/libz.la; \ echo "library_names='libz.dll.a'" >> lib/libz.la; \ echo "old_library='libz.a'" >> lib/libz.la; \ echo "dependency_libs=''" >> lib/libz.la; \ echo "current=1" >> lib/libz.la; \ echo "age=2" >> lib/libz.la; \ echo "revision=5" >> lib/libz.la; \ echo "installed=yes" >> lib/libz.la; \ echo "shouldnotlink=no" >> lib/libz.la; \ echo "dlopen=''" >> lib/libz.la; \ echo "dlpreopen=''" >> lib/libz.la; \ echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la) endef # We need to fix the prefix in the various packages using pkgconfig, # or we can't substitute it properly in our pkg-config wrapper. # glib also installs an empty charset.alias for mingw which creates # a stow conflict with the one from iconv. define gpg4win_pkg_glib_post_install (cd $$$${pkgidir}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`; \ rm $$$${pkgidir}/lib/charset.alias) endef define gpg4win_pkg_libffi_post_install (cd $$$${pkgidir}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_gdk_pixbuf_post_install (cd $$$${pkgidir}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_atk_post_install (cd $$$${pkgidir_dev}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_freetype_post_install (cd $$$${pkgidir_dev}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_fontconfig_post_install (cd $$$${pkgidir_dev}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_cairo_post_install (cd $$$${pkgidir_dev}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_pango_post_install (cd $$$${pkgidir_dev}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef define gpg4win_pkg_libpng_post_install (cd $$$${pkgidir}; \ perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`) endef # We don't use khelpcenter in kleopatra so remove the help links and # point to the correct common folder # TODO Needs to be fixed with current doc #define gpg4win_pkg_kleopatra_post_install # (for i in de en ; do \ # (cd $$$${pkgidir}/share/doc/HTML/$$$${i}; \ # perl -pi -e 's/help:\///g' `find . -name \*.html`; \ # perl -pi -e 's@common/@../../common/@g' `find . -name \*.html`); \ # done) #endef #define gpg4win_pkg_libiconv_post_install #(cp $(srcdir)/libiconv.def $$$${pkgidir}/lib; \ #cd $$$${pkgidir}/lib; \ #$(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def) #endef # Supported internal packages. Internal packages do not require any # special support. Thus, this variable is actually unused, and no # rules are added in gpg4win.mk. gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \ compendium +# Include installer targets for customized packages +-include gnupg-vsd/custom.mk + +stamps/stamp-msi-base: playground/install/gpg4win-$(VERSION).wixlib \ + shield.ico Makefile.am \ + $(top_srcdir)/doc/logo/gpg4win-msi*.bmp \ + $(top_srcdir)/po/gpg4win-de.wxl \ + $(top_srcdir)/po/gpg4win-en.wxl + ssh $(WINHOST) "mkdir AppData\\Local\\Temp\\gpg4win-$(VERSION)" || true + scp $(idir)/gpg4win-$(VERSION).wixlib $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) + scp $(top_srcdir)/packages/gnupg-msi-$(gpg4win_pkg_gnupg_msi_version)-bin.wixlib \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION); + scp $(top_srcdir)/src/shield.ico $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) + scp $(top_srcdir)/doc/logo/gpg4win-msi-header_install-493x58.bmp \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/header.bmp + scp $(top_srcdir)/doc/logo/gpg4win-msi-wizard_install-493x312.bmp \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/dialog.bmp + scp $(top_srcdir)/doc/logo/gpg4win-msi-wizard_install-493x312.bmp \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/dialog.bmp + scp $(top_srcdir)/doc/logo/gpg4win-msi-wizard_install-info-32x32.bmp \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/info.bmp + scp $(top_srcdir)/doc/logo/gpg4win-msi-wizard_install-exclamation-32x32.bmp \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/exclamation.bmp + scp $(top_srcdir)/po/gpg4win-en.wxl $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) + scp $(top_srcdir)/po/gpg4win-de.wxl $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) + scp WixUI_Gpg4win.wxs $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) + touch stamps/stamp-msi-base # Now do the bunch of the work. This is a bunch of dirty magic to # integrate our special makefile into automake, while not actually # including it (make should include it). This is in turn necessary # because automake can't deal with the elegant magic in the actual # Makefile. define INCLUDE_BY_MAKE include $(1) endef $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk)) clean-local: clean-gpg4win common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi \ $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list))) \ $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list))) +playground/install/gpg4win-$(VERSION).wixlib: \ + gpg4win-$(VERSION).wxs stamps/stamp-final \ + $(foosum_exe) \ + $(README_files) $(HOWTO_files) \ + license.blurb versioninfo.txt \ + WixUI_Gpg4win.wxs + ($(call SETVARS_WINE_TWO_DOLLAR,); \ + echo "Gpg4win" > $(srcdir)/playground/VERSION; \ + echo "$(VERSION)" >> $(srcdir)/playground/VERSION; \ + (ln -s $(idir) $$WINEINST; \ + ln -s $(ex_idir) $$WINEINSTEX; \ + ln -s `readlink -f $(top_srcdir)` $$WINESRC; \ + $(WINE) $$WIXPREFIX2/candle.exe \ + -dInstDir=k: \ + -dInstDirEx=j: \ + -dSrcDir=i:\\src \ + -dVersion=$$MSI_VERSION \ + -out k:\\gpg4win-$(VERSION).wixobj \ + -pedantic -wx i:\\src\\gpg4win-$(VERSION).wxs || exit 1;\ + $(WINE) $$WIXPREFIX2/candle.exe \ + -dInstDir=k: \ + -dInstDirEx=j: \ + -dSrcDir=i:\\src \ + -dVersion=$$MSI_VERSION \ + -out k:\\gpg4win-ui.wixobj \ + -pedantic -wx i:\\src\\WixUI_Gpg4win.wxs || exit 1;\ + \ + $(WINE) $$WIXPREFIX2/lit.exe \ + -out k:\\gpg4win-$(VERSION).wixlib \ + -bf \ + -wx \ + -pedantic \ + k:\\gpg4win-$(VERSION).wixobj k:\\gpg4win-ui.wixobj || exit 1; \ + \ + ) || ERR=1; (rm $$WINEINST; rm $$WINESRC; rm $$WINEINSTEX); \ + if [ -n "$$ERR" ]; then \ + exit 1; \ + fi) + +gpg4win-$(VERSION).wxs: gpg4win.nsi $(common_nsi) stamps/stamp-final \ + $(foosum_exe) \ + $(README_files) $(HOWTO_files) \ + versioninfo.txt make-msi.pl + perl make-msi.pl --guids $(srcdir)/make-msi.guids \ + --manifest gpg4win-$(VERSION).files \ + -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \ + -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@ # Prepare the versioninfo file. The pipeline extracts the last # occurrence of a package with the same name, sorts the entries and # writes the file with DOS line endings. This helps to avoid # duplicate entries in case one package has been rebuild (which is # common when developing a new version). versioninfo.txt: $(SHA1SUM) $(pkg_files) versioninfo.tmp set -e; \ ( while read a b; do echo "$$a $$(basename $$b)"; \ done < versioninfo.tmp \ | sort -k2 -sf | tac | uniq -f1 ; \ echo '=========== SHA-1 checksum ============= == package ==' \ ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt -rm versioninfo.tmp NEWS.tmp : $(top_srcdir)/NEWS awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \ !skip { sub(/^\(en\)/," *"); print }' \ <$(top_srcdir)/NEWS >NEWS.tmp NEWS.de : $(top_srcdir)/NEWS awk '/^#/ {next} /^\(en\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \ !skip { sub(/^\(de\)/,"-"); print }' \ <$(top_srcdir)/NEWS >NEWS.de; \ sed -i 's/^ / /' NEWS.de NEWS.en : $(top_srcdir)/NEWS awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \ !skip { sub(/^\(en\)/,"-"); print }' \ <$(top_srcdir)/NEWS >NEWS.en; \ sed -i 's/^ / /' NEWS.en COMPONENTS-list.tmp : $(top_srcdir)/NEWS awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print " "$$0}' \ < $(top_srcdir)/NEWS > COMPONENTS-list.tmp # For some nut-crazy reason someone thought it would be a great idea # if makensis changed to the directory of the source file at startup. # So we have to pull a couple of strings to correct this. installers/gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \ g4wihelp.dll \ $(foosum_exe) \ $(README_files) $(HOWTO_files) \ license.blurb versioninfo.txt $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \ -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi && \ mv gpg4win-$(VERSION).exe installers/gpg4win-$(VERSION).exe -installers/GnuPG-Desktop-$(VERSION)-de.msi: installers/GnuPG-Desktop-$(VERSION).msi - scp $(top_srcdir)/po/gpg4win-de.wxl $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) - ssh $(WINHOST) "cd AppData/Local/Temp/gpg4win-$(VERSION) && $(WINLIGHT) \ - -spdb \ - -ext WixUIExtension \ - -out GnuPG-Desktop-$(VERSION)-de.msi \ - -dcl:high \ - -cultures:de-de -loc gpg4win-de.wxl \ - -v -pedantic \ - \ - gpg4win-$(VERSION).wixlib \ - gnupg-w32-$(gpg4win_pkg_gnupg_w32_version).wixlib"; \ - scp $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/GnuPG-Desktop-$(VERSION)-de.msi \ - installers; - - -installers/GnuPG-Desktop-$(VERSION).msi: playground/install/gpg4win-$(VERSION).wixlib \ - shield.ico Makefile.am \ - $(top_srcdir)/doc/logo/gpg4win-msi*.bmp \ - gpg4win-all.wxl - ssh $(WINHOST) "mkdir AppData\\Local\\Temp\\gpg4win-$(VERSION)" || true - scp $(idir)/gpg4win-$(VERSION).wixlib $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) - scp $(top_srcdir)/packages/gnupg-w32-$(gpg4win_pkg_gnupg_w32_version).wixlib \ - $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION); - scp $(top_srcdir)/src/shield.ico $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) - scp $(top_srcdir)/doc/logo/gpg4win-msi-header_install-493x58.bmp \ - $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/header.bmp - scp $(top_srcdir)/doc/logo/gpg4win-msi-wizard_install-493x312.bmp \ - $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/dialog.bmp - scp $(top_srcdir)/doc/logo/gpg4win-msi-wizard_install-493x312.bmp \ - $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/dialog.bmp - scp $(top_srcdir)/po/gpg4win-en.wxl $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) - scp WixUI_Gpg4win.wxs $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION) - ssh $(WINHOST) "cd AppData/Local/Temp/gpg4win-$(VERSION) && $(WINLIGHT) \ - -spdb \ - -ext WixUIExtension \ - -out GnuPG-Desktop-$(VERSION).msi \ - -dcl:high \ - -cultures:en-us -loc gpg4win-en.wxl \ - -v -pedantic \ - \ - gpg4win-$(VERSION).wixlib \ - gnupg-w32-$(gpg4win_pkg_gnupg_w32_version).wixlib"; \ - scp $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/GnuPG-Desktop-$(VERSION).msi \ - installers; - -playground/install/gpg4win-$(VERSION).wixlib: \ - gpg4win-$(VERSION).wxs stamps/stamp-final \ - $(foosum_exe) \ - $(README_files) $(HOWTO_files) \ - license.blurb versioninfo.txt \ - WixUI_Gpg4win.wxs - if [ -z "$$(which $(WINE))" ]; then \ - echo "ERROR: For the msi-package wine needs to be installed."; \ - exit 1; \ - fi; - ( \ - if [ -z "$(WIXPREFIX)" ]; then \ - if [ -d `readlink -f ~/w32root/wixtools` ]; then \ - WIXPREFIX2=`readlink -f ~/w32root/wixtools`; \ - echo "Using $$WIXPREFIX2 as WIXPREFIX"; \ - else \ - echo "ERROR: You must set WIXPREFIX to an installation of wixtools."; \ - exit 1; \ - fi; \ - else \ - WIXPREFIX2="$(WIXPREFIX)"; \ - fi; \ - if [ -z "$$WINEPREFIX" ]; then \ - WINEPREFIX="$$HOME/.wine"; \ - if [ ! -e "$$WINEPREFIX/dosdevices" ]; then \ - echo "ERROR: No wine prefix found under $$WINEPREFIX"; \ - exit 1; \ - fi; \ - fi; \ - WINEINST=$$WINEPREFIX/dosdevices/k:; \ - WINESRC=$$WINEPREFIX/dosdevices/i:; \ - WINEINSTEX=$$WINEPREFIX/dosdevices/j:; \ - if [ -e "$$WINEINST" ]; then \ - echo "ERROR: $$WINEINST already exists. Please remove."; \ - exit 1; \ - fi; \ - if [ -e "$$WINESRC" ]; then \ - echo "ERROR: $$WINESRC already exists. Please remove."; \ - exit 1; \ - fi; \ - if [ -e "$$WINEINSTEX" ]; then \ - echo "ERROR: $$WINEINSTEX already exists. Please remove."; \ - exit 1; \ - fi; \ - echo "Gpg4win" > $(srcdir)/playground/VERSION; \ - echo "$(VERSION)" >> $(srcdir)/playground/VERSION; \ - MSI_VERSION=$$(echo $(VERSION) | tr -s \\-beta .); \ - (ln -s $(idir) $$WINEINST; \ - ln -s $(ex_idir) $$WINEINSTEX; \ - ln -s `readlink -f $(top_srcdir)` $$WINESRC; \ - $(WINE) $$WIXPREFIX2/candle.exe \ - -dInstDir=k: \ - -dInstDirEx=j: \ - -dSrcDir=i:\\src \ - -dVersion=$$MSI_VERSION \ - -out k:\\gpg4win-$(VERSION).wixobj \ - -pedantic -wx i:\\src\\gpg4win-$(VERSION).wxs || exit 1;\ - $(WINE) $$WIXPREFIX2/candle.exe \ - -dInstDir=k: \ - -dInstDirEx=j: \ - -dSrcDir=i:\\src \ - -dVersion=$$MSI_VERSION \ - -out k:\\gpg4win-ui.wixobj \ - -pedantic -wx i:\\src\\WixUI_Gpg4win.wxs || exit 1;\ - \ - $(WINE) $$WIXPREFIX2/lit.exe \ - -out k:\\gpg4win-$(VERSION).wixlib \ - -bf \ - -wx \ - -pedantic \ - k:\\gpg4win-$(VERSION).wixobj k:\\gpg4win-ui.wixobj || exit 1; \ - \ - ) || ERR=1; \ - (rm $$WINEINST; rm $$WINESRC; rm $$WINEINSTEX); \ - if [ -n "$$ERR" ]; then \ - exit 1; \ - fi \ - ) - -gpg4win-$(VERSION).wxs: gpg4win.nsi $(common_nsi) stamps/stamp-final \ - $(foosum_exe) \ - $(README_files) $(HOWTO_files) \ - versioninfo.txt make-msi.pl - perl make-msi.pl --guids $(srcdir)/make-msi.guids \ - --manifest gpg4win-$(VERSION).files \ - -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \ - -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@ - -.PHONY: msi -msi: installers/GnuPG-Desktop-$(VERSION).msi \ - installers/GnuPG-Desktop-$(VERSION)-de.msi - -wixscript: gpg4win-$(VERSION).wxs - stamps/stamp-dist-self: versioninfo.txt (set -e; cd ..; make dist-bzip2) touch stamps/stamp-dist-self installers/gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsii) \ stamps/stamp-final \ stamps/stamp-dist-self \ license.blurb $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \ -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi && \ mv gpg4win-src-$(VERSION).exe installers/gpg4win-src-$(VERSION).exe license.blurb: $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 cat $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 >$@ g4wihelp.dll: slideshow.cpp desktopshellrun.cpp g4wihelp.c exdll.h $(CC) -static-libgcc -I. -O2 -c -o desktopshellrun.o $(srcdir)/desktopshellrun.cpp $(CC) -static-libgcc -I. -O2 -c -o slideshow.o $(srcdir)/slideshow.cpp $(CC) -static-libgcc -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \ desktopshellrun.o slideshow.o -lwinmm -lgdi32 -luserenv -lshell32 \ -lole32 -loleaut32 -lshlwapi -lmsimg32 $(STRIP) g4wihelp.dll sha1sum.exe: sha1sum.c $(CC) -O2 -o $@ $^ $(STRIP) $@ md5sum.exe: sha1sum.c $(CC) -DBUILD_MD5SUM -O2 -o $@ $^ $(STRIP) $@ sha256sum.exe: sha1sum.c $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^ $(STRIP) $@ mkportable.exe: mkportable.c \ mkportable-vanilla.h mkportable-full.h $(CC) -O2 -o $@ $(srcdir)/mkportable.c $(STRIP) $@ all_full = installers/gpg4win-$(VERSION).exe all-local: $(all_full) $(all_src) @echo "###################################################" @echo " Gpg4win $(VERSION) successfully build!" @echo " Installers can be found under src/installers" @echo "###################################################" clean-local: rm -f installers/gpg4win-$(VERSION).exe \ installers/GnuPG-Desktop-$(VERSION).msi diff --git a/src/WixUI_Gpg4win.wxs b/src/WixUI_Gpg4win.wxs index 84d51ff3..73bb14e9 100644 --- a/src/WixUI_Gpg4win.wxs +++ b/src/WixUI_Gpg4win.wxs @@ -1,52 +1,52 @@ + + + + + diff --git a/src/gpg4win.mk.in b/src/gpg4win.mk.in index 2e2b5dc8..d0ab614f 100644 --- a/src/gpg4win.mk.in +++ b/src/gpg4win.mk.in @@ -1,764 +1,925 @@ # gpg4win.m4.in - Installer for GnuPG 4 Windows Makefile. -*- makefile -*- # Copyright (C) 2005, 2009 g10 Code GmbH # # This file is part of GPG4Win. # # GPG4Win is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # GPG4Win is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # No servicable parts below this line :) # These paths must be absolute, as we switch directories pretty often. root := $(shell pwd)/playground bdir := $(root)/build idir := $(root)/install ipdir := $(root)/install/pkgs tsdir := $(shell pwd)/${top_srcdir} pdir := $(shell pwd)/${top_srcdir}/patches ex_idir := $(root)/install-ex ex_ipdir := $(root)/install-ex/pkgs # We collect the names of all pkg files used. pkg_files = # The playground area is our scratch area, where we unpack, build and # install the packages. stamps/stamp-directories: $(MKDIR) stamps $(MKDIR) playground $(MKDIR) -p installers $(MKDIR) $(bdir) $(MKDIR) $(idir) $(MKDIR) $(ipdir) $(if $GPGEX_ADD_HOST, $(MKDIR) $(ex_idir)) $(if $GPGEX_ADD_HOST, $(MKDIR) $(ex_ipdir)) touch $(bdir)/versioninfo.txt touch stamps/stamp-directories # Frob the name $1 by converting all '-' and '+' characters to '_'. define FROB_macro $(subst +,_,$(subst -,_,$(1))) endef # Get the variable $(1) (which may contain '-' and '+' characters). define GETVAR $($(call FROB_macro,$(1))) endef # Set a couple of common variables. define SETVARS set -e; \ pkg="$(call GETVAR,gpg4win_pkg_$(1))"; \ pkg_version="$(1)-$(call GETVAR,gpg4win_pkg_$(1)_version)"; \ pkgsdir="$(bdir)/$$$${pkg_version}"; \ pkgbdir="$(bdir)/$$$${pkg_version}-build"; \ pkgpdir="$(pdir)/$$$${pkg_version}"; \ pkgpbdir="$(pdir)/$(1)"; \ pkgidir="$(ipdir)/$$$${pkg_version}"; \ pkg_dev="$(call GETVAR,gpg4win_pkg_$(1)_dev)"; \ pkg_version_dev="$(1)-dev-$(call GETVAR,gpg4win_pkg_$(1)_version)"; \ pkgidir_dev="$(ipdir)/$$$${pkg_version_dev}"; \ pkgcfg="$(call GETVAR,gpg4win_pkg_$(1)_configure)"; \ pkgextracflags="$(call GETVAR,gpg4win_pkg_$(1)_extracflags)"; \ pkgmkargs="$(call GETVAR,gpg4win_pkg_$(1)_make_args)"; \ pkgmkargs_inst="$(call GETVAR,gpg4win_pkg_$(1)_make_args_inst)";\ pkgmkdir="$(call GETVAR,gpg4win_pkg_$(1)_make_dir)"; \ pkgmkdir_inst="$(call GETVAR,gpg4win_pkg_$(1)_make_dir)"; \ export PKG_CONFIG="$(tsdir)/src/pkg-config"; \ export PKG_CONFIG_PATH="$(idir)/lib/pkgconfig"; \ export PKG_CONFIG_LIBDIR=""; \ export PATH="$(idir)/bin:$${PATH}"; \ export SYSROOT="$(idir)"; \ export CONFIG_SITE="$(tsdir)/src/config.site" endef # Set variables for building in an additional architecture define SETVARS_EX set -e; \ pkg="$(call GETVAR,gpg4win_pkg_$(1))"; \ pkg_version="$(1)-$(call GETVAR,gpg4win_pkg_$(1)_version)"; \ pkgsdir="$(bdir)/$$$${pkg_version}"; \ pkgbdir="$(bdir)/$$$${pkg_version}-ex-build"; \ pkgpdir="$(pdir)/$$$${pkg_version}"; \ pkgpbdir="$(pdir)/$(1)"; \ pkgidir="$(ex_ipdir)/$$$${pkg_version}"; \ pkgidir_dev="$(ex_ipdir)/$$$${pkg_version_dev}"; \ pkgcfg="$(call GETVAR,gpg4win_pkg_$(1)_ex_configure)"; \ pkgextracflags="$(call GETVAR,gpg4win_pkg_$(1)_ex_extracflags)"; \ pkgmkargs="$(call GETVAR,gpg4win_pkg_$(1)_ex_make_args)"; \ pkgmkargs_inst="$(call GETVAR,gpg4win_pkg_$(1)_ex_make_args_inst)"; \ pkgmkdir="$(call GETVAR,gpg4win_pkg_$(1)_ex_make_dir)"; \ pkgmkdir_inst="$(call GETVAR,gpg4win_pkg_$(1)_ex_make_dir)"; \ export PKG_CONFIG="$(tsdir)/src/pkg-config"; \ export PKG_CONFIG_PATH="$(ex_idir)/lib/pkgconfig"; \ export PKG_CONFIG_LIBDIR=""; \ export PATH="$(ex_idir)/bin:$${PATH}"; \ export SYSROOT="$(ex_idir)" endef +define SETVARS_WINE + set -e; \ + if [ -z "$$$$(which $(WINE))" ]; then \ + echo "ERROR: For the msi-package wine needs to be installed."; \ + exit 1; \ + fi; \ + if [ -z "$(WIXPREFIX)" ]; then \ + if [ -d `readlink -f ~/w32root/wixtools` ]; then \ + WIXPREFIX2=`readlink -f ~/w32root/wixtools`; \ + echo "Using $$$$WIXPREFIX2 as WIXPREFIX"; \ + else \ + echo "ERROR: You must set WIXPREFIX to an installation of wixtools."; \ + exit 1; \ + fi; \ + else \ + WIXPREFIX2="$(WIXPREFIX)"; \ + fi; \ + if [ -z "$$$$WINEPREFIX" ]; then \ + WINEPREFIX="$$$$HOME/.wine"; \ + if [ ! -e "$$$$WINEPREFIX/dosdevices" ]; then \ + echo "ERROR: No wine prefix found under $$WINEPREFIX"; \ + exit 1; \ + fi; \ + fi; \ + WINEINST=$$$$WINEPREFIX/dosdevices/k:; \ + WINESRC=$$$$WINEPREFIX/dosdevices/i:; \ + WINEINSTEX=$$$$WINEPREFIX/dosdevices/j:; \ + if [ -e "$$$$WINEINST" ]; then \ + echo "ERROR: $$$$WINEINST already exists. Please remove."; \ + exit 1; \ + fi; \ + if [ -e "$$$$WINESRC" ]; then \ + echo "ERROR: $$$$WINESRC already exists. Please remove."; \ + exit 1; \ + fi; \ + if [ -e "$$$$WINEINSTEX" ]; then \ + echo "ERROR: $$$$WINEINSTEX already exists. Please remove."; \ + exit 1; \ + fi; \ + MSI_VERSION=$$$$(echo $(VERSION) | tr -s \\-beta .) +endef + +# Same as above +define SETVARS_WINE_TWO_DOLLAR + set -e; \ + if [ -z "$$(which $(WINE))" ]; then \ + echo "ERROR: For the msi-package wine needs to be installed."; \ + exit 1; \ + fi; \ + if [ -z "$(WIXPREFIX)" ]; then \ + if [ -d `readlink -f ~/w32root/wixtools` ]; then \ + WIXPREFIX2=`readlink -f ~/w32root/wixtools`; \ + echo "Using $$WIXPREFIX2 as WIXPREFIX"; \ + else \ + echo "ERROR: You must set WIXPREFIX to an installation of wixtools."; \ + exit 1; \ + fi; \ + else \ + WIXPREFIX2="$(WIXPREFIX)"; \ + fi; \ + if [ -z "$$WINEPREFIX" ]; then \ + WINEPREFIX="$$HOME/.wine"; \ + if [ ! -e "$$WINEPREFIX/dosdevices" ]; then \ + echo "ERROR: No wine prefix found under $$WINEPREFIX"; \ + exit 1; \ + fi; \ + fi; \ + WINEINST=$$WINEPREFIX/dosdevices/k:; \ + WINESRC=$$WINEPREFIX/dosdevices/i:; \ + WINEINSTEX=$$WINEPREFIX/dosdevices/j:; \ + if [ -e "$$WINEINST" ]; then \ + echo "ERROR: $$WINEINST already exists. Please remove."; \ + exit 1; \ + fi; \ + if [ -e "$$WINESRC" ]; then \ + echo "ERROR: $$WINESRC already exists. Please remove."; \ + exit 1; \ + fi; \ + if [ -e "$$WINEINSTEX" ]; then \ + echo "ERROR: $$WINEINSTEX already exists. Please remove."; \ + exit 1; \ + fi; \ + MSI_VERSION=$$(echo $(VERSION) | tr -s \\-beta .) +endef + # Support macro. Unpack the archive $(1). define DEFLATE_macro rm -rf $$$${pkgsdir}; \ case "$(1)" in \ */qtbase*.*.tar.xz) \ $(TAR) -xJ --transform='s,^qtbase-everywhere-src,qtbase,' -f "$(1)" ;; \ */qttools*.*.tar.xz) \ $(TAR) -xJ --transform='s,^qttools-everywhere-src,qttools,' -f "$(1)" ;; \ */qtwinextras*.*.tar.xz) \ $(TAR) -xJ --transform='s,^qtwinextras-everywhere-src,qtwinextras,' -f "$(1)" ;; \ */qtsvg*.*.tar.xz) \ $(TAR) -xJ --transform='s,^qtsvg-everywhere-src,qtsvg,' -f "$(1)" ;; \ */qttranslations*.*.tar.xz) \ $(TAR) -xJ --transform='s,^qttranslations-everywhere-src,qttranslations,' -f "$(1)" ;; \ */boost*.*.tar.bz2) \ $(TAR) -xj --transform='s,^boost_1_60_0,boost-1.60.0,' -f "$(1)" ;; \ *.tar.gz | *.tgz) \ $(TAR) xzf "$(1)" ;; \ *.tar.bz2 | *.tbz2 | *.tbz) \ $(TAR) xjf "$(1)" ;; \ *.tar.xz ) \ $(TAR) xJf "$(1)" ;; \ *.exe ) \ cp "$(1)" . ;; \ *.zip) \ $(UNZIP) -o "$(1)" ;; \ esac endef # Support macro. Strip all exe files below $(1). define STRIP_macro if test -z '$(DEBUG)'; then \ (cd $(1); \ for f in `find . -name \*.exe -o -name \*.dll`; do \ echo Calling $(STRIP) "$$$${pkg_version}/$$$${f}"; \ $(STRIP) "$$$${f}"; done); \ fi endef # Support macro. Strip all exe files below $(1) using STRIP_EX. define STRIP_EX_macro if test -z '$(DEBUG)'; then \ (cd $(1); \ for f in `find . -name \*.exe -o -name \*.dll`; do \ echo Calling $(STRIP_EX) "$$$${pkg_version}/$$$${f}"; \ $(STRIP_EX) "$$$${f}"; done); \ fi endef define GETDEPS $(addprefix stamps/stamp-final-, $(call GETVAR,gpg4win_pkg_$(1)_deps)) endef define GETDEPS_EX $(addprefix stamps/stamp-final-ex-, $(call GETVAR,gpg4win_pkg_$(1)_ex_deps)) endef # Template for source packages to build for an additional host define EXPKG_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) stamps/stamp-$(1)-ex-00-unpack: stamps/stamp-$(1)-00-unpack $(call GETDEPS_EX,$(1)) touch stamps/stamp-$(1)-ex-00-unpack stamps/stamp-$(1)-ex-01-patch: stamps/stamp-$(1)-ex-00-unpack stamps/stamp-$(1)-01-patch touch stamps/stamp-$(1)-ex-01-patch stamps/stamp-$(1)-ex-02-configure: stamps/stamp-$(1)-ex-01-patch ($(call SETVARS_EX,$(1)); \ mkdir "$$$${pkgbdir}"; \ cd "$$$${pkgbdir}"; \ eval "../$$$${pkg_version}/configure" \ --prefix="$$$${pkgidir}" \ --host=$(GPGEX_ADD_HOST) \ --build=$(build) \ $$$${pkgcfg} CFLAGS=\"-mms-bitfields $$$${pkgextracflags}\";\ shopt -s nullglob; \ for pfile in "$$$${pkgpbdir}"/*.postcfg \ "$$$${pkgpdir}"/*.postcfg ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done; \ for pfile in "$$$${pkgpbdir}"/*.postcfg-build \ "$$$${pkgpdir}"/*.postcfg-build ; do \ (cd "$$$${pkgbdir}"; "$$$${pfile}") \ done) touch stamps/stamp-$(1)-ex-02-configure stamps/stamp-$(1)-ex-03-make: stamps/stamp-$(1)-ex-02-configure ($(call SETVARS_EX,$(1)); \ cd "$$$${pkgbdir}"; \ test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $(GPG4WIN_PARALLEL) $$$${pkgmkargs} \ ) touch stamps/stamp-$(1)-ex-03-make # Note that post_install must come last because it may be empty and # "; ;" is a syntax error. stamps/stamp-$(1)-ex-04-install: stamps/stamp-$(1)-ex-03-make ($(call SETVARS_EX,$(1)); \ cd "$$$${pkgbdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $$$${pkgmkargs_inst} install; \ $(call STRIP_EX_macro,"$$$${pkgidir}"); \ rm -f "$$$${pkgidir}/share/info/dir"; \ $(call gpg4win_pkg_$(call FROB_macro,$(1))_ex_post_install)) touch stamps/stamp-$(1)-ex-04-install stamps/stamp-$(1)-ex-05-stow: stamps/stamp-$(1)-ex-04-install ($(call SETVARS_EX,$(1)); \ cd $(ex_ipdir); \ $(STOW) -t `readlink -f $(ex_idir)` "$$$${pkg_version}") touch stamps/stamp-$(1)-ex-05-stow stamps/stamp-final-ex-$(1): stamps/stamp-$(1)-ex-05-stow touch stamps/stamp-final-ex-$(1) .PHONY : clean-ex-$(1) clean-ex-$(1): ($(call SETVARS_EX,$(1)); \ (cd $(ex_ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ rm -fR "$$$${pkg_version}")); \ rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}") rm -f stamps/stamp-final-ex-$(1) stamps/stamp-$(1)-ex-* endef define EXPKG_template $(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))), $(call EXPKG_template_,$1)) endef # Template for source packages. define SPKG_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1)) (cd $(bdir); \ $(call SETVARS,$(1)); \ $(call DEFLATE_macro,$$$${pkg})) touch stamps/stamp-$(1)-00-unpack stamps/stamp-$(1)-01-patch: stamps/stamp-$(1)-00-unpack (shopt -s nullglob; \ $(call SETVARS,$(1)); \ for pfile in "$$$${pkgpbdir}"/*.patch "$$$${pkgpdir}"/*.patch ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done) touch stamps/stamp-$(1)-01-patch stamps/stamp-$(1)-02-configure: stamps/stamp-$(1)-01-patch ($(call SETVARS,$(1)); \ mkdir "$$$${pkgbdir}"; \ cd "$$$${pkgbdir}"; \ eval "../$$$${pkg_version}/configure" \ --prefix="$$$${pkgidir}" \ --host=$(host) \ --build=$(build) \ $$$${pkgcfg} CFLAGS=\"-mms-bitfields $$$${pkgextracflags}\";\ shopt -s nullglob; \ for pfile in "$$$${pkgpbdir}"/*.postcfg \ "$$$${pkgpdir}"/*.postcfg ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done; \ for pfile in "$$$${pkgpbdir}"/*.postcfg-build \ "$$$${pkgpdir}"/*.postcfg-build ; do \ (cd "$$$${pkgbdir}"; "$$$${pfile}") \ done;) && \ touch stamps/stamp-$(1)-02-configure stamps/stamp-$(1)-03-make: stamps/stamp-$(1)-02-configure ($(call SETVARS,$(1)); \ cd "$$$${pkgbdir}"; \ test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $(GPG4WIN_PARALLEL) $$$${pkgmkargs}) touch stamps/stamp-$(1)-03-make # Note that post_install must come last because it may be empty and # "; ;" is a syntax error. stamps/stamp-$(1)-04-install: stamps/stamp-$(1)-03-make ($(call SETVARS,$(1)); \ cd "$$$${pkgbdir}"; \ cd "$$$${pkgmkdir_inst}"; \ $(MAKE) $(AM_MAKEFLAGS) $$$${pkgmkargs_inst} install; \ $(call STRIP_macro,"$$$${pkgidir}"); \ rm -f "$$$${pkgidir}/share/info/dir"; \ $(call gpg4win_pkg_$(call FROB_macro,$(1))_post_install)) touch stamps/stamp-$(1)-04-install stamps/stamp-$(1)-05-stow: stamps/stamp-$(1)-04-install ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version}") touch stamps/stamp-$(1)-05-stow stamps/stamp-final-$(1): stamps/stamp-$(1)-05-stow touch stamps/stamp-final-$(1) .PHONY : clean-$(1) clean-$(1): ($(call SETVARS,$(1)); \ (cd $(ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ rm -fR "$$$${pkg_version}")); \ rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}") rm -f stamps/stamp-final-$(1) stamps/stamp-$(1)-* endef define SPKG_template $(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))), $(call SPKG_template_,$1)) endef # Template for source packages using only make and no build # directory. define MPKG_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1)) (cd $(bdir); \ $(call SETVARS,$(1)); \ $(call DEFLATE_macro,$$$${pkg})) touch stamps/stamp-$(1)-00-unpack stamps/stamp-$(1)-01-patch: stamps/stamp-$(1)-00-unpack (shopt -s nullglob; \ $(call SETVARS,$(1)); \ for pfile in "$$$${pkgpbdir}"/*.patch "$$$${pkgpdir}"/*.patch ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done) touch stamps/stamp-$(1)-01-patch stamps/stamp-$(1)-03-make: stamps/stamp-$(1)-01-patch ($(call SETVARS,$(1)); \ cd "$$$${pkgsdir}"; \ test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $$$${pkgmkargs}) touch stamps/stamp-$(1)-03-make stamps/stamp-$(1)-04-install: stamps/stamp-$(1)-03-make ($(call SETVARS,$(1)); \ cd "$$$${pkgsdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $$$${pkgmkargs_inst} install; \ $(call STRIP_macro,"$$$${pkgidir}"); \ $(call gpg4win_pkg_$(call FROB_macro,$(1))_post_install)) touch stamps/stamp-$(1)-04-install stamps/stamp-$(1)-05-stow: stamps/stamp-$(1)-04-install ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version}") touch stamps/stamp-$(1)-05-stow stamps/stamp-final-$(1): stamps/stamp-$(1)-05-stow touch stamps/stamp-final-$(1) .PHONY : clean-$(1) clean-$(1): ($(call SETVARS,$(1)); \ (cd $(ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ rm -fR "$$$${pkg_version}")); \ rm -fR "$$$${pkgsdir}") rm -f stamps/stamp-final-$(1) stamps/stamp-$(1)-* endef define MPKG_template $(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))), $(call MPKG_template_,$1)) endef # Template for binary packages. define BPKG_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) pkg_files += $(call GETVAR,gpg4win_pkg_$(1)_dev) stamps/stamp-$(1)-00-install: stamps/stamp-directories $(call GETDEPS,$(1)) ($(call SETVARS,$(1)); \ $(MKDIR) "$$$${pkgidir}"; \ cd $$$${pkgidir}; \ $(call DEFLATE_macro,$$$${pkg})) touch stamps/stamp-$(1)-00-install # Note that post_install must come last because it may be empty and # "; ;" is a syntax error. stamps/stamp-$(1)-01-install-dev: stamps/stamp-$(1)-00-install ($(call SETVARS,$(1)); \ $(MKDIR) "$$$${pkgidir_dev}"; \ (cd $$$${pkgidir_dev}; \ $(call DEFLATE_macro,$$$${pkg_dev})); \ $(call gpg4win_pkg_$(call FROB_macro,$(1))_post_install)) touch stamps/stamp-$(1)-01-install-dev stamps/stamp-$(1)-02-stow: stamps/stamp-$(1)-01-install-dev ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version}") touch stamps/stamp-$(1)-02-stow stamps/stamp-$(1)-03-stow-dev: stamps/stamp-$(1)-02-stow ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version_dev}") touch stamps/stamp-$(1)-03-stow-dev stamps/stamp-final-$(1): stamps/stamp-$(1)-03-stow-dev touch stamps/stamp-final-$(1) .PHONY : clean-$(1) clean-$(1): ($(call SETVARS,$(1)); \ cd $(ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ $(STOW) -D "$$$${pkg_version_dev}"; \ rm -fR "$$$${pkg_version}" "$$$${pkg_version_dev}")) rm -f stamps/stamp-final-$(1) stamps/stamp-$(1)-* endef define BPKG_template $(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))), $(call BPKG_template_,$1)) endef # Template for qt packages. define QTPKG_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1)) (cd $(bdir); \ $(call SETVARS,$(1)); \ $(call DEFLATE_macro,$$$${pkg})) touch stamps/stamp-$(1)-00-unpack stamps/stamp-$(1)-01-patch: stamps/stamp-$(1)-00-unpack (shopt -s nullglob; \ $(call SETVARS,$(1)); \ for pfile in "$$$${pkgpbdir}"/*.patch "$$$${pkgpdir}"/*.patch ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done) touch stamps/stamp-$(1)-01-patch stamps/stamp-$(1)-02-configure: stamps/stamp-$(1)-01-patch ($(call SETVARS,$(1)); \ mkdir "$$$${pkgbdir}"; \ cd "$$$${pkgbdir}"; \ $$$${pkgcfg}) && \ touch stamps/stamp-$(1)-02-configure stamps/stamp-$(1)-03-make: stamps/stamp-$(1)-02-configure ($(call SETVARS,$(1)); \ cd "$$$${pkgbdir}"; \ test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $(GPG4WIN_PARALLEL) $$$${pkgmkargs}) touch stamps/stamp-$(1)-03-make # Note that post_install must come last because it may be empty and # "; ;" is a syntax error. stamps/stamp-$(1)-04-install: stamps/stamp-$(1)-03-make ($(call SETVARS,$(1)); \ $(call gpg4win_pkg_$(call FROB_macro,$(1))_post_install)) touch stamps/stamp-$(1)-04-install stamps/stamp-$(1)-05-stow: stamps/stamp-$(1)-04-install ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version}") touch stamps/stamp-$(1)-05-stow stamps/stamp-final-$(1): stamps/stamp-$(1)-05-stow touch stamps/stamp-final-$(1) .PHONY : clean-$(1) clean-$(1): ($(call SETVARS,$(1)); \ (cd $(ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ rm -fR "$$$${pkg_version}")); \ rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}") rm -f stamps/stamp-final-$(1) stamps/stamp-$(1)-* endef define QTPKG_template $(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))), $(call QTPKG_template_,$1)) endef # Template for internal packages. define IPKG_template stamps/stamp-final-$(1): stamps/stamp-directories $(call GETDEPS,$(1)) touch stamps/stamp-final-$(1) endef # Template for README files # (The final awk command converts the file endings). define README_template README.$(1).txt : versioninfo.txt NEWS.tmp $(top_srcdir)/doc/README.$(1).txt \ COMPONENTS-list.tmp $(top_srcdir)/doc/beta-warning.txt sed -e '/^;.*/d;/!VERSIONINFO!/{r versioninfo.txt' -e 'd;}' \ -e '/!NEWSFILE!/{r NEWS.tmp' -e 'd;}' \ -e '/!NEWSFILE!/{r NEWS.tmp' -e 'd;}' \ -e '/!COMPONENTS!/{r COMPONENTS-list.tmp' -e 'd;}' \ -e '/!PKG-COPYRIGHT!/{r $(top_srcdir)/doc/pkg-copyright.txt' -e 'd;}' \ -e 's,!VERSION!,$(VERSION),g' \ -e 's,!BUILD_ISODATE!,$(BUILD_ISODATE),g' \ < $(top_srcdir)/doc/README.$(1).txt \ | (if echo "$(VERSION)" | egrep 'svn|rc|beta|git' >/dev/null; then \ sed -e '/!BETA-WARNING!/{r $(top_srcdir)/doc/beta-warning.txt' \ -e 'd;}'; else sed -e 's,!BETA-WARNING!,,g'; fi) \ | awk '{printf "%s\r\n", $$$$0}' >README.$(1).txt endef define HOWTO_template HOWTO-$(1).$(2).txt : $(top_srcdir)/doc/HOWTO-$(1).$(2).txt sed -e '/^;.*/d' \ -e 's,!VERSION!,$(VERSION),g' \ -e 's,!BUILD_ISODATE!,$(BUILD_ISODATE),g' \ < $(top_srcdir)/doc/HOWTO-$(1).$(2).txt \ | awk '{printf "%s\r\n", $$$$0}' > HOWTO-$(1).$(2).txt endef # Special Template for boost. define BOOST_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1)) (cd $(bdir); \ $(call SETVARS,$(1)); \ $(call DEFLATE_macro,$$$${pkg})) touch stamps/stamp-$(1)-00-unpack stamps/stamp-$(1)-01-patch: stamps/stamp-$(1)-00-unpack (shopt -s nullglob; \ $(call SETVARS,$(1)); \ for pfile in "$$$${pkgpbdir}"/*.patch "$$$${pkgpdir}"/*.patch ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done) touch stamps/stamp-$(1)-01-patch stamps/stamp-$(1)-02-build: stamps/stamp-$(1)-01-patch ($(call SETVARS,$(1)); \ cd $$$${pkgsdir}/tools/build/; \ ./bootstrap.sh; \ cd $$$${pkgsdir}; \ echo "using gcc : mxe : $(host)-g++ : $(host)-windres $(host)-ar $(host)-ranlib ;" > "user-config.jam"; \ ./tools/build/b2 \ -a \ -q \ '$(GPG4WIN_PARALLEL)' \ --ignore-site-config \ --user-config=user-config.jam \ abi=ms \ address-model=32 \ architecture=x86 \ binary-format=pe \ link=shared \ target-os=windows \ threadapi=win32 \ threading=multi \ variant=release \ toolset=gcc-mxe \ cxxflags=-std=gnu++98 \ --layout=tagged \ --disable-icu \ --without-mpi \ --without-python \ --prefix=$$$${pkgidir} \ --exec-prefix=$$$${pkgidir}/bin \ --libdir=$$$${pkgidir}/lib \ --includedir=$$$${pkgidir}/include \ -sEXPAT_INCLUDE='$(idir)/include' \ -sEXPAT_LIBPATH='$(idir)/lib' \ -sBZIP2_INCLUDE='$(idir)/include' \ -sBZIP2_LIBPATH='$(idir)/lib' \ install) && \ touch stamps/stamp-$(1)-02-build stamps/stamp-$(1)-03-stow: stamps/stamp-$(1)-02-build ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version}") touch stamps/stamp-$(1)-03-stow stamps/stamp-final-$(1): stamps/stamp-$(1)-03-stow touch stamps/stamp-final-$(1) .PHONY : clean-$(1) clean-$(1): ($(call SETVARS,$(1)); \ (cd $(ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ rm -fR "$$$${pkg_version}")); \ rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}") rm -f stamps/stamp-final-$(1) stamps/stamp-$(1)-* endef # Template for source packages of KDE software define KDEPKG_template_ pkg_files += $(call GETVAR,gpg4win_pkg_$(1)) stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1)) (cd $(bdir); \ $(call SETVARS,$(1)); \ $(call DEFLATE_macro,$$$${pkg})) touch stamps/stamp-$(1)-00-unpack stamps/stamp-$(1)-01-patch: stamps/stamp-$(1)-00-unpack (shopt -s nullglob; \ $(call SETVARS,$(1)); \ cd "$$$${pkgsdir}"; \ sed -i 's/set(KF5_MIN_VERSION.*)/set(KF5_MIN_VERSION "5.72.0")/' CMakeLists.txt; \ sed -i 's/set(KF5_VERSION.*)/set(KF5_VERSION "5.72.0")/' CMakeLists.txt; \ sed -i 's/set(KMIME_VERSION.*)/set(KMIME_VERSION "5.2.40")/' CMakeLists.txt; \ sed -i 's/set(LIBKLEO_VERSION.*)/set(LIBKLEO_VERSION "5.4.40")/' CMakeLists.txt; \ sed -i 's/set(QT_REQUIRED_VERSION.*)/set(QT_REQUIRED_VERSION "5.10.0")/' CMakeLists.txt; \ sed -i 's/set(GPGME_REQUIRED_VERSION.*)/set(GPGME_REQUIRED_VERSION "1.10.0")/' CMakeLists.txt; \ for pfile in "$$$${pkgpbdir}"/*.patch "$$$${pkgpdir}"/*.patch ; do \ (cd "$$$${pkgsdir}"; "$$$${pfile}") \ done) touch stamps/stamp-$(1)-01-patch stamps/stamp-$(1)-02-configure: stamps/stamp-$(1)-01-patch ($(call SETVARS,$(1)); \ mkdir "$$$${pkgbdir}"; \ cd "$$$${pkgbdir}"; \ cmake \ -DCMAKE_INSTALL_PREFIX="$$$${pkgidir}" \ -DCMAKE_PREFIX_PATH="$$$${pkgidir}" \ -DCMAKE_TOOLCHAIN_FILE=$(abs_top_srcdir)/src/toolchain.cmake \ -DKDE_INSTALL_DATADIR="$$$${pkgidir}/share" \ -DBUILD_TESTING=False \ $$$${pkgcfg} $$$${pkgextracflags} "../$$$${pkg_version}") && \ touch stamps/stamp-$(1)-02-configure stamps/stamp-$(1)-03-make: stamps/stamp-$(1)-02-configure ($(call SETVARS,$(1)); \ cd "$$$${pkgbdir}"; \ test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \ $(MAKE) $(AM_MAKEFLAGS) $(GPG4WIN_PARALLEL) $$$${pkgmkargs}) touch stamps/stamp-$(1)-03-make # Note that post_install must come last because it may be empty and # "; ;" is a syntax error. stamps/stamp-$(1)-04-install: stamps/stamp-$(1)-03-make ($(call SETVARS,$(1)); \ cd "$$$${pkgbdir}"; \ cd "$$$${pkgmkdir_inst}"; \ $(MAKE) $(AM_MAKEFLAGS) $$$${pkgmkargs_inst} install; \ $(call STRIP_macro,"$$$${pkgidir}"); \ $(call gpg4win_pkg_$(call FROB_macro,$(1))_post_install)) touch stamps/stamp-$(1)-04-install stamps/stamp-$(1)-05-stow: stamps/stamp-$(1)-04-install ($(call SETVARS,$(1)); \ cd $(ipdir); \ $(STOW) "$$$${pkg_version}") touch stamps/stamp-$(1)-05-stow stamps/stamp-final-$(1): stamps/stamp-$(1)-05-stow touch stamps/stamp-final-$(1) .PHONY : clean-$(1) clean-$(1): ($(call SETVARS,$(1)); \ (cd $(ipdir) && \ ($(STOW) -D "$$$${pkg_version}"; \ rm -fR "$$$${pkg_version}")); \ rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}") rm -f stamps/stamp-final-$(1) stamps/stamp-$(1)-* endef define KDEPKG_template $(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))), $(call KDEPKG_template_,$1)) endef +define MSI_template + +.PHONY : $(1)-package +$(1)-package: installers/GnuPG-VS-Desktop-$(VERSION)-$(1).msi + +playground/install/$(1).wixlib: gnupg-vsd/$(1)/$(1).wxs + ($(call SETVARS_WINE,); \ + ( \ + ln -s $(idir) $$$$WINEINST; \ + ln -s $(ex_idir) $$$$WINEINSTEX; \ + ln -s `readlink -f $(top_srcdir)` $$$$WINESRC; \ + $(WINE) $$$$WIXPREFIX2/candle.exe \ + -dInstDir=k: \ + -dInstDirEx=j: \ + -dSrcDir=i:\\src \ + -dVersion=$$$$MSI_VERSION \ + -out k:\\$(1)-$(VERSION).wixobj \ + -pedantic -wx i:\\src\\gnupg-vsd\\$(1)\\$(1).wxs || exit 1;\ + $(WINE) $$$$WIXPREFIX2/lit.exe \ + -out k:\\$(1).wixlib \ + -bf \ + -wx \ + -pedantic \ + k:\\$(1)-$(VERSION).wixobj || exit 1; \ + \ + ) || ERR=1; \ + (rm $$$$WINEINST; rm $$$$WINESRC; rm $$$$WINEINSTEX); \ + if [ -n "$$$$ERR" ]; then \ + exit 1; \ + fi \ + ) + +# This is generated by make-msi.pl +gnupg-vsd/$(1)/$(1).wxs: gnupg-vsd/$(1)/VERSION.sig make-msi.pl gpg4win-$(VERSION).wxs + +gnupg-vsd/$(1)/VERSION.sig: gnupg-vsd/$(1)/VERSION + echo "----------SIGNING----------" + echo "using key: $(msi_signkey)" + cat gnupg-vsd/$(1)/VERSION + gpg --yes -o gnupg-vsd/$(1)/VERSION.sig -bau $(msi_signkey) gnupg-vsd/$(1)/VERSION + +gnupg-vsd/$(1)/VERSION: gnupg-vsd/custom.mk + echo "$(call GETVAR,msi_target_$(1)_VERSION)" > gnupg-vsd/$(1)/VERSION + +installers/GnuPG-VS-Desktop-$(VERSION)-$(1).msi: stamps/stamp-msi-base playground/install/$(1).wixlib \ + gnupg-vsd/$(1)/license.rtf + scp gnupg-vsd/$(1)/license.rtf \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION); \ + scp playground/install/$(1).wixlib \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION); \ + scp $(call GETVAR,msi_target_$(1)_branding)/*.bmp \ + $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION); \ + ssh $(WINHOST) "cd AppData/Local/Temp/gpg4win-$(VERSION) && $(WINLIGHT) \ + -spdb \ + -ext WixUIExtension \ + -out GnuPG-Desktop-$(VERSION)-$(1).msi \ + $(call GETVAR,msi_target_$(1)_l10n) \ + -dcl:high \ + -v -pedantic \ + \ + gpg4win-$(VERSION).wixlib \ + gnupg-msi-$(gpg4win_pkg_gnupg_msi_version)-bin.wixlib \ + $(1).wixlib"; \ + scp $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/GnuPG-Desktop-$(VERSION)-$(1).msi \ + installers; +endef # Insert the template for each source package. $(foreach spkg, $(gpg4win_spkgs), $(eval $(call SPKG_template,$(spkg)))) # Insert the template for each gpgEx architecture package. $(foreach expkg, $(gpg4win_expkgs), $(eval $(call EXPKG_template,$(expkg)))) # Insert the template for each make only source package. $(foreach mpkg, $(gpg4win_mpkgs), $(eval $(call MPKG_template,$(mpkg)))) # Insert the template for each binary package. $(foreach bpkg, $(gpg4win_bpkgs), $(eval $(call BPKG_template,$(bpkg)))) # Insert the template for each internal package. $(foreach ipkg, $(gpg4win_ipkgs), $(eval $(call IPKG_template,$(ipkg)))) # Insert the template for the README and HOWTO files. $(foreach rll, $(gpg4win_readme_ll), $(eval $(call README_template,$(rll)))) # Insert the template for KDE packages. $(foreach kdepkg, $(gpg4win_kdepkgs), $(eval $(call KDEPKG_template,$(kdepkg)))) # Insert the template for qt packages. $(foreach qtpkg, $(gpg4win_qtpkgs), $(eval $(call QTPKG_template,$(qtpkg)))) - $(foreach rll, $(gpg4win_howto_smime_ll), \ $(eval $(call HOWTO_template,SMIME,$(rll)))) $(eval $(call BOOST_template_,boost)) stamps/stamp-final: stamps/stamp-directories stamps/stamp-final: $(addprefix stamps/stamp-final-,$(gpg4win_build_list)) \ $(addprefix stamps/stamp-final-ex-,$(gpg4win_build_ex_list)) touch stamps/stamp-final $(bdir)/versioninfo.txt: stamps/stamp-final touch $(bdir)/versioninfo.txt - all-gpg4win: stamps/stamp-final # Just to check if we catched all stamps. clean-stamps: $(RM) -fR $(stamps) clean-gpg4win: $(RM) -fR playground stamps -.PHONY : all-gpg4win clean-stamps clean-gpg4win +stamps/stamp-versions-all-signed: \ + $(addsuffix /VERSION.sig, $(addprefix gnupg-vsd/,$(msi_targets))) \ + +msi: stamps/stamp-versions-all-signed \ + $(addsuffix .msi,$(addprefix installers/GnuPG-VS-Desktop-$(VERSION)-,$(msi_targets))) + if [ -z "$(addsuffix .msi,$(addprefix installers/GnuPG-VS-Desktop-$(VERSION)-,$(msi_targets)))" ]; then \ + echo "No MSI targets configured."; \ + fi + +.PHONY : all-gpg4win clean-stamps clean-gpg4win msi + +# Insert the template for msi packages. +$(foreach msipkg, $(msi_targets), $(eval $(call MSI_template,$(msipkg)))) # @emacs_local_vars_begin@ # @emacs_local_vars_read_only@ # @emacs_local_vars_end@ diff --git a/src/make-msi.pl b/src/make-msi.pl index 5233de85..69222472 100644 --- a/src/make-msi.pl +++ b/src/make-msi.pl @@ -1,1837 +1,1994 @@ #! /usr/bin/perl -w # make-msi.pl - MSI Installer for Gpg4win. # Copyright (C) 2007, 2019 g10 Code GmbH # # This file is part of Gpg4win. # # Gpg4win is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Gpg4win is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # FIXME: Here is how to support multiple languages in one MSI package, # using an undocumented feature: Create one MSI package in each # language, then create transformations: # MsiTran.Exe -g foo.en.msi foo.de.msi language.de.mst # Embed these transformations: # CScript.exe WiSubStg.vbs foo.en.msi language.de.mst 1031 # Change the summmary informations attribute (with Orca): # Languages = 1033, 1031 # Primary language must come first! # http://www.installsite.org/pages/de/artikel/embeddedlang/index.htm # http://forum.installsite.net/index.php?showtopic=16734 use strict; use warnings; use diagnostics; +use File::Basename; +use Cwd; # Default language. $::lang = 'en'; sub fail { print STDERR $_[0] . "\n"; exit 1; } # We use a new product and package code for every build (using pseudo # components), but a single constant upgrade code for all versions. # Note that Windows installer ignores the build part of the version # number (only the first three components are used). # # FIXME: Build upgrade table. # # We take a simplified view: Each file corresponds to exactly one # component. This means we need to generate GUIDs for these # components and remember them from one installer version to the next. # We do this automatically by means of a support file, make-msi.guids. %::guid = (); $::guid_file = 'make-msi.guids'; $::guid_changed = 0; sub fetch_guids { # FIXME: Check if file exists. open (FILE, "<$::guid_file") or return; while () { next if (/^#/); if (/(\S+)\s+(.+)\s*\r?\n$/) { $::guid{$2} = $1; } } close (FILE); } sub store_guids { # FIXME: Maybe allow to forget unused GUIDs. return if (not $::guid_changed); print STDERR "GUID list stored in $::guid_file changed, please commit!\n"; open (FILE, ">$::guid_file.bak") or die; print FILE "# This is an automatically generated file. DO NOT EDIT.\n"; foreach my $file (sort keys %::guid) { print FILE "$::guid{$file} $file\n"; } close FILE; rename "$::guid_file.bak", $::guid_file or die; } sub get_guid { my ($file) = @_; my $guid; if (defined $::guid{$file}) { return $::guid{$file}; } # Need to generate a new GUID. $::guid_changed = 1; $guid = uc `uuidgen`; chomp $guid; $::guid{$file} = $guid; return $guid; } $::files_file = ''; # We store the list of included files for temporary packaging, in case # WiX needs to be run on a different system. sub store_files { my ($parser) = @_; return if ($::files_file eq ''); open (FILE, ">$::files_file") or die; foreach my $name (@{$parser->{pkg_list}}) { my $pkg = $parser->{pkgs}->{$name}; next if ($#{$pkg->{files}} == -1); print FILE (join ("\n", map { "src/" . ($_->{source}) } @{$pkg->{files}})). "\n"; } close FILE; } sub lang_to_lcid { my ($lang) = @_; if ($lang eq 'en') { return 1033; } elsif ($lang eq 'de') { return 1031; } elsif ($lang eq 'ar') { return 1025; } elsif ($lang eq 'es') { return 3082; } elsif ($lang eq 'fr') { return 1036; } elsif ($lang eq 'ru') { return 1049; } return 0; } # NSIS parser # The parser data structure contains the following members: # # pre_depth: The current nesting depth of preprocessor conditionals. # pre_true: Depth of the last preprocessor conditional that was true. # pre_symbols: A hash of defined preprocessor symbols. # po: A hash of languages, each a hash of translated strings. # outpath: the current output path. # includedirs: An array of include directories to search through. # A couple of variables you can set: $::nsis_parser_warn = 1; $::nsis_parser_debug = 0; $::nsis_level_default = 1; $::nsis_level_optional = 1000; $::nsis_level_hidden = 2000; # Evaluate an expression. sub nsis_eval { my ($parser, $file, $expr) = @_; my $val = $expr; # Resolve outer double quotes, if any. if ($val =~ m/^"/) { if (not $val =~ s/^"(.*)"$/$1/) { fail "$file:$.: unmatched quote in expression: $expr"; } } my $iter = 0; while ($val =~ m/\$\{([^}]*)\}/) { my $varname = $1; my $varvalue; if (exists $parser->{pre_symbols}->{$varname}) { $varvalue = $parser->{pre_symbols}->{$varname}; } else { fail "$file:$.: undefined variable $varname in expression: $expr"; } $val =~ s/\$\{$varname\}/$varvalue/g; $iter++; if ($iter > 100) { fail "$file:$.: too many variable expansions in expression: $expr"; } } # # FIXME: For now. # if ($expr =~ m/\$/ or $expr !~ m/^\"/) # { # return $expr; # } # $val = eval $expr; return $val; } # Retrieve an evaluated symbol sub nsis_fetch { my ($parser, $symname) = @_; return undef if (not exists $parser->{pre_symbols}->{$symname}); return nsis_eval ($parser, '', $parser->{pre_symbols}->{$symname}); } # Evaluate an expression. sub nsis_translate { my ($parser, $file, $expr) = @_; my $val = $expr; my $iter = 0; while ($val =~ m/\$\((.*)\)/) { my $var = $1; if (exists $parser->{po}->{$::lang}->{$1}) { my $subst = $parser->{po}->{$::lang}->{$1}; $val =~ s/\$\($var\)/$subst/g; } else { fail "$file:$.: no translation for $val to language $::lang"; } $iter++; if ($iter > 100) { fail "$file:$.: too deep nesting of translations"; } } # Resolve outer double quotes, if any. $val =~ s/^"(.*)"$/$1/; $val =~ s/\$\r/\r/g; $val =~ s/\$\n/\n/g; $val =~ s/\$\"/"/g; return $val; } # Low level line input. sub nsis_get_line { my ($file) = @_; my $line = ''; while (<$file>) { $line = $line . $_; # Strip leading whitespace. $line =~ s/^\s*//; # Strip newline and trailing whitespace. $line =~ s/\s*\r?\n$//; # Combine multiple lines connected with backslashes. if ($line =~ m/^(.*)\\$/) { $line = $1 . ' '; next; } $_ = $line; last; } # Now break up the line into return $_; } # Tokenize the NSIS line. sub nsis_tokenize { my ($file, $line) = @_; my @tokens; my @line = split ('', $line); my $idx = 0; while ($idx <= $#line) { # The beginning of the current partial token. my $token = $idx; if ($line[$idx] eq '"') { $idx++; # Skip until end of string, indicated by double quote that # is not part of the $\" string. while ($idx <= $#line) { if (substr ($line, $idx, 3) eq '$\\"') { $idx += 3; } else { last if ($line[$idx] eq '"'); $idx++; } } fail "$file:$.:$idx: unterminated string from position $token" if ($idx > $#line); $idx++; fail "$file:$.:$idx: strings not separated" if ($idx <= $#line and $line[$idx] !~ m/\s/); } elsif ($line[$idx] eq '\'') { $idx++; # Skip until end of string, indicated by a single quote. while ($idx <= $#line) { last if ($line[$idx] eq '\''); $idx++; } fail "$file:$.:$idx: unterminated string from position $token" if ($idx > $#line); $idx++; fail "$file:$.:$idx: strings not separated" if ($idx <= $#line and $line[$idx] !~ m/\s/); } else { # Skip until end of token indicated by whitespace. while ($idx <= $#line) { fail "$file:$.:$idx: invalid character" if ($line[$idx] eq '"'); last if ($line[$idx] =~ m/\s/); $idx++; } } push @tokens, substr ($line, $token, $idx - $token); # Skip white space between arguments. while ($idx <= $#line and $line[$idx] =~ m/\s/) { $idx++; } } return @tokens; } # We suppress some warnings after first time. %::warn = (); # Parse the NSIS line. sub nsis_parse_line { my ($parser, $file, $line) = @_; # We first tokenize the line. my @tokens = nsis_tokenize ($file, $line); # We handle preprocessing directives here. print STDERR "Tokens: " . join (" AND ", @tokens) . "\n" if $::nsis_parser_debug; # We have special code dealing with ignored areas. if ($parser->{pre_depth} > $parser->{pre_true}) { if ($tokens[0] eq '!ifdef' or $tokens[0] eq '!ifndef') { fail "$file:$.: syntax error" if $#tokens != 1; $parser->{pre_depth}++; } elsif ($tokens[0] eq '!else') { fail "$file:$.: stray !else" if $parser->{pre_depth} == 0; if ($parser->{pre_depth} == $parser->{pre_true} + 1) { $parser->{pre_true}++; } } elsif ($tokens[0] eq '!endif') { fail "$file:$.: syntax error" if $#tokens != 0; fail "$file:$.: stray !endif" if $parser->{pre_depth} == 0; $parser->{pre_depth}--; } elsif ($tokens[0] eq '!macro') { fail "$file:$.: syntax error" if $#tokens < 1; # FIXME: We do not support macros at this point, although # support would not be too hard to add. Instead, we just # ignore their definition so it does not throw us off. print STDERR "$file:$.: warning: ignoring macro $tokens[1]\n" if $::nsis_parser_warn; $parser->{pre_depth}++; } elsif ($tokens[0] eq '!macroend') { # FIXME: See !macro. fail "$file:$.: stray !macroend" if $parser->{pre_depth} == 0; $parser->{pre_depth}--; } } else { # This is the parser for areas not ignored. if ($tokens[0] eq '!define') { if ($#tokens == 1) { # FIXME: Maybe define to 1? $parser->{pre_symbols}->{$tokens[1]} = ''; } elsif ($#tokens == 2) { $parser->{pre_symbols}->{$tokens[1]} = nsis_eval ($parser, $file, $tokens[2]); } else { fail "$file:$.: syntax error"; } } elsif ($tokens[0] eq '!undef') { fail "$file:$.: syntax error" if $#tokens != 1; delete $parser->{pre_symbols}->{$tokens[1]}; } elsif ($tokens[0] eq '!ifdef') { fail "$file:$.: syntax error" if $#tokens != 1; if (exists $parser->{pre_symbols}->{$tokens[1]}) { $parser->{pre_true}++; } $parser->{pre_depth}++; } elsif ($tokens[0] eq '!ifndef') { fail "$file:$.: syntax error" if $#tokens != 1; if (not exists $parser->{pre_symbols}->{$tokens[1]}) { $parser->{pre_true}++; } $parser->{pre_depth}++; } elsif ($tokens[0] eq '!else') { fail "$file:$.: stray !else" if $parser->{pre_depth} == 0; if ($parser->{pre_depth} == $parser->{pre_true}) { $parser->{pre_true}--; } elsif ($parser->{pre_depth} == $parser->{pre_true} + 1) { $parser->{pre_true}++; } } elsif ($tokens[0] eq '!endif') { fail "$file:$.: syntax error" if $#tokens != 0; fail "$file:$.: stray !endif" if $parser->{pre_depth} == 0; if ($parser->{pre_depth} == $parser->{pre_true}) { $parser->{pre_true}--; } $parser->{pre_depth}--; } elsif ($tokens[0] eq '!include') { fail "$file:$.: syntax error" if $#tokens != 1; if ($tokens[1] eq 'Memento.nsh') { print STDERR "Skipping $tokens[1]\n" if $::nsis_parser_debug; } else { print STDERR "Including $tokens[1]\n" if $::nsis_parser_debug; my $filename = nsis_eval ($parser, $file, $tokens[1]); # Recursion. nsis_parse_file ($parser, $filename); } } elsif ($tokens[0] eq '!macro') { fail "$file:$.: syntax error" if $#tokens < 1; # FIXME: We do not support macros at this point, although # support would not be too hard to add. Instead, we just # ignore their definition so it does not throw us off. print STDERR "$file:$.: warning: ignoring macro $tokens[1]\n" if $::nsis_parser_warn; $parser->{pre_depth}++; } elsif ($tokens[0] eq '!macroend') { # FIXME: See !macro. fail "$file:$.: stray !macroend" if $parser->{pre_depth} == 0; $parser->{pre_depth}--; } elsif ($tokens[0] eq '!cd' or $tokens[0] eq '!addplugindir') { if (not exists $::warn{"directive-$tokens[0]"}) { print STDERR "$file:$.: warning: ignoring $tokens[0] directive\n" if $::nsis_parser_warn; } $::warn{"directive-$tokens[0]"}++; } elsif ($tokens[0] eq '!addincludedir') { fail "$file:$.: syntax error" if $#tokens != 1; my $dir = nsis_eval ($parser, $file, $tokens[1]); unshift @{$parser->{includedirs}}, $dir; } elsif ($tokens[0] =~ m/^\!/ and $tokens[0] ne '!insertmacro') { # Note: It is essential that some !insertmacro invocations are # not expanded, namely those of SelectSection and UnselectSection, # which are used to track dependencies in Gpg4win. fail "$file:$.: compiler directive $tokens[0] not implemented"; } else { # Main processing routine. This is specific to the backend # and probably package. gpg4win_nsis_stubs ($parser, $file, @tokens); } } } # Parse the NSIS file. sub nsis_parse_file { my ($parser, $file) = @_; my $handle; if ($file eq '-') { $. = 0; $handle = *STDIN; } else { if (not -e $file and 1) { # Search for include file. Note: We do not change # directories, but that is OK for us. Also, we want to # avoid the system header files, as we don't control what # constructs they use, and in fact we want to treat their # macros and functions as atoms. my @includedirs = @{$parser->{includedirs}}; my $dir; foreach $dir (@includedirs) { if (-e $dir . '/' . $file) { $file = $dir . '/' . $file; last; } } } if (not open ($handle, "<$file")) { print STDERR "$file:$.: warning: " . "can not open include file $file: $!\n" if $::nsis_parser_warn; return; } } my $incomment = 0; while (defined nsis_get_line ($handle)) { $.++ if ($file eq '-'); # Check for our block comment if ($_ =~ m/^# BEGIN MSI IGNORE.*/) { $incomment = 1; } elsif ($_ =~ m/^# END MSI IGNORE.*/) { $incomment = 0; } next if $incomment; # Skip comment lines. next if $_ =~ m/^#/; # Skip empty lines. next if $_ =~ m/^$/; nsis_parse_line ($parser, $file, $_); } if ($incomment) { fail "$file:$.: error: Missing # END MSI IGNORE marker.\n"; } close $handle if ($file ne '-'); } # The Gpg4win stubs for the MSI backend to the NSIS converter. # Gpg4win specific state in $parser: # pkg: the current package (a hash reference), corresponds to certain sections. # pkgs: a hash ref of all packages encountered indexed by their frobbed name. # pkg_list: the order of packages (as frobbed names). # state: specifies a state for special parsing of certain parts. # dep_name: the current package for which we list dependencies (- for none) -# Ignored packages: -%::ignored_pkgs = ("gpa", "gtk_", "glib", "expat", "gdk_pixbuf", - "cairo", "fontconfig", "atk", "zlib", "libpng", - "freetype", "libffi", "pango"); - sub gpg4win_nsis_stubs { my ($parser, $file, $command, @args) = @_; $parser->{state} = "" if not defined $parser->{state}; if ($parser->{state} =~ m/^ignore-until-(.*)$/) { undef $parser->{state} if ($command eq $1); } # Section support. # # We parse SetOutPath and File directives in sections. # Everything else is ignored. elsif ($parser->{state} eq '' and ($command eq 'Section' or $command eq '${MementoSection}' or $command eq '${MementoUnselectedSection}')) { my $idx = 0; # Default install level for MSI is 3. my $level = $::nsis_level_default; my $hidden = 0; if ($command eq '${MementoUnselectedSection}') { # Default install level for MSI is 3. $level = $::nsis_level_optional; } # Check for options first. return if ($idx > $#args); if ($args[$idx] eq '/o') { # Default install level for MSI is 3. $level = $::nsis_level_optional; $idx++; } return if ($idx > $#args); my $title = nsis_eval ($parser, $file, $args[$idx++]); # Check for hidden flag. if (substr ($title, 0, 1) eq '-') { # Hidden packages are dependency tracked and never # installed by default unless required. $level = $::nsis_level_hidden; $hidden = 1; substr ($title, 0, 1) = ''; } # We only pay attention to special sections and those which # have a section index defined. if ($title eq 'startmenu') { # The special startmenu section contains all our shortcuts.\ $parser->{state} = 'section-startmenu'; return; } elsif ($idx > $#args) { return; } # Finally we can get the frobbed name of the package. my $name = $args[$idx++]; $name =~ s/^SEC_//; my $pkg = \%{$parser->{pkgs}->{$name}}; # Check for ignored packages - foreach my $ignored (%::ignored_pkgs) + # Ignored packages: + foreach my $ignored ("gpa", "gtk_", "glib", "expat", "gdk_pixbuf", + "cairo", "fontconfig", "atk", "zlib", "libpng", + "freetype", "libffi", "pango") { if ($name eq $ignored) { print STDERR "Ignoring package: " . $name . "\n" if $::nsis_parser_debug; return; } } $pkg->{name} = $name; # Replace - in names to avoid errors with identifies $pkg->{name} =~ s/-/_/g; $pkg->{title} = $title; $pkg->{level} = $level; $pkg->{hidden} = $hidden; $pkg->{features} = ''; # Remember the order of sections included. push @{$parser->{pkg_list}}, $name; $parser->{pkg} = $pkg; $parser->{state} = 'in-section'; } elsif ($parser->{state} eq 'in-section') { if ($command eq 'SectionEnd' or $command eq '${MementoSectionEnd}') { delete $parser->{pkg}; undef $parser->{state}; } elsif ($command eq 'SetOutPath') { fail "$file:$.: syntax error" if ($#args != 0); my $outpath = $args[0]; # if (not $outpath =~ s/^"\$INSTDIR\\?(.*)"$/$1/) if ($outpath =~ m/^"\$INSTDIR\\?(.*)"$/) { $parser->{outpath} = $1; } elsif ($outpath =~ m/^"\$APPDATA\\?(.*)"$/) { $parser->{outpath} = "%CommonAppDataFolder%\\" . $1; } elsif ($outpath =~ m/^"\$TEMP\\?(.*)"$/) { $parser->{outpath} = "%TEMP%\\" . $1; } elsif ($outpath =~ m/^"\$PLUGINSDIR\\?(.*)"$/) { $parser->{outpath} = "REMOVE_ME\\" . $1; } else { fail "$file:$.: unsupported out path: $args[0]"; } } elsif ($command eq 'File') { my $idx = 0; my $target; fail "$file:$.: not supported" if ($#args < 0 || $#args > 1); if ($#args == 1) { if ($args[0] eq '/nonfatal') { print STDERR "$file:$.: warning: skipping non-fatal file $args[1]\n" if $::nsis_parser_warn; return; } $target = $args[0]; if (not $target =~ s,^/oname=(.*)$,$1,) { fail "$file:$.: syntax error"; } # Temp files are due to overwrite attempts, which are # handled automatically by the Windows Installer. Ignore # them here. return if $target =~ m/\.tmp$/; $idx++; } my $source = nsis_eval ($parser, $file, $args[$idx]); if (not defined $target) { $target = $source; $target =~ s,^.*/([^/\\]+)$,$1,; } push @{$parser->{pkg}->{files}}, { source => $source, dir => $parser->{outpath}, target => $target }; } elsif ($command eq 'WriteRegStr') { fail "$file:$.: not supported" if ($#args != 3); my $root = $args[0]; my $key = $args[1]; $key =~ s/^"(.*)"$/$1/; my $name = $args[2]; $name =~ s/^"(.*)"$/$1/; my $value = $args[3]; $value =~ s/^"(.*)"$/$1/; $value =~ s/\$INSTDIR\\?/\[APPLICATIONFOLDER\]/g; push (@{$parser->{pkg}->{registry}}, { root => $root, key => $key, name => $name, value => $value, type => 'string' }); } } # Start menu shortcuts support. elsif ($parser->{state} eq 'section-startmenu') { if ($command eq 'SectionEnd' or $command eq '${MementoSectionEnd}') { undef $parser->{state}; } elsif ($command eq 'CreateShortCut') { fail "$file:$.: not supported" if ($#args != 7); # The link may contains a translatable string. my $link = $args[0]; # We filter for startmenu shortcuts, as the others are # just more of the same. Equivalently, we could filter # for a block between two labels. return if ($link !~ m/STARTMENU_FOLDER/); # Take the base name of the link. # FIXME: We want the manuals in a subdirectory. $link =~ s/^.*\\([^\\]*)\"$/$1/; $link =~ s/\.lnk$//; my $target = nsis_eval ($parser, $file, $args[1]); $target =~ s/^\$INSTDIR\\//; my $icon = $args[3]; $icon =~ s/^"(.*)"$/$1/; $icon =~ s/^\$INSTDIR\\/[APPLICATIONFOLDER]/; $icon = nsis_eval ($parser, $file, $icon); my $icon_idx = nsis_eval ($parser, $file, $args[4]); fail "$file:$.: not supported" if ($icon_idx ne ''); # The description contains a translatable string. my $description = $args[7]; $parser->{shortcuts}->{$target} = { link => $link, target => $target, icon => $icon, description => $description }; } } # LangString support. # # LangString directives must be stated at the top-level of the file. elsif ($parser->{state} eq '' and $command eq 'LangString') { fail "$file:$.: syntax error" if ($#args != 2); my $lang = $args[1]; $lang =~ s/^\$\{LANG_(\w*)\}$/$1/; if ($lang eq 'ENGLISH') { $lang = 'en'; } elsif ($lang eq 'GERMAN') { $lang = 'de'; } elsif ($lang eq 'ARABIC') { $lang = 'ar'; } elsif ($lang eq 'SPANISH') { $lang = 'es'; } elsif ($lang eq 'FRENCH') { $lang = 'fr'; } elsif ($lang eq 'RUSSIAN') { $lang = 'ru'; } elsif ($lang eq 'PORTUGUESE') { $lang = 'pt'; } elsif ($lang eq 'CZECH') { $lang = 'cz'; } elsif ($lang eq 'ITALIAN') { $lang = 'it'; } elsif ($lang eq 'SIMPCHINESE') { $lang = 'zh_CN'; } elsif ($lang eq 'TRADCHINESE') { $lang = 'zh_TW'; } elsif ($lang eq 'NORWEGIAN') { $lang = 'no'; } elsif ($lang eq 'DUTCH') { $lang = 'nl'; } else { fail "$file:$.: unsupported language ID $args[1]"; } $parser->{po}->{$lang}->{$args[0]} = $args[2]; } # Function support. # # Most functions are ignored. Some are of special interest and # are parsed separately. elsif ($parser->{state} eq '' and $command eq 'Function') { fail "$file:$.: syntax error" if ($#args != 0); if ($args[0] eq 'CalcDepends') { $parser->{state} = 'function-calc-depends'; } elsif ($args[0] eq 'CalcDefaults') { $parser->{state} = 'function-calc-defaults'; } else { # Functions we do not find interesting are skipped. print STDERR "$file:$.: warning: ignoring function $args[0]\n" if $::nsis_parser_warn; delete $parser->{dep_name}; $parser->{state} = 'ignore-until-FunctionEnd'; } } # Function calc-depends. # # This function gathers information about dependencies between # features. Features are identified by their frobbed names. The # format is as such: First, a couple of UnselectSection macros, # one for each dependency. Then SelectSection invocations for all # packages which should always be installed (mandatory), followed # by one block for each feature, consisting of a label "have_FOO:" # where FOO is the frobbed package name (in lowercase, usually), # followed by SelectSection invocations, one for each dependency, # and finally a "skip_FOO:" label to finish the block. # # The order of these statements and blocks must be so that a single pass # through the list is sufficient to resolve all dependencies, that means # in pre-fix order. elsif ($parser->{state} eq 'function-calc-depends') { if ($command eq 'FunctionEnd') { undef $parser->{state}; } elsif ($command =~ m/^have_(.*):$/) { $parser->{dep_name} = $1; $parser->{pkgs}->{$1}->{deps} = {}; } elsif ($command eq '!insertmacro') { fail "$file:$.: syntax error" if $#args < 0; if ($args[0] eq 'SelectSection') { fail "$file:$.: syntax error" if $#args != 1; my $name = $args[1]; $name =~ s/^\$\{SEC_(.*)\}$/$1/; if (not exists $parser->{dep_name}) { # A stray SelectSection chooses defaults. $parser->{pkgs}->{$name}->{features} .= " Absent='disallow'"; } else { my $dep_name = $parser->{dep_name}; print STDERR "DEP: Add " . $name . " as a dependency for " . $dep_name . "\n" if $::nsis_parser_debug; # Add $name as a dependency for $dep_name. $parser->{pkgs}->{$dep_name}->{deps}->{$name} = 1; } } } elsif ($command =~ m/^skip_(.*):$/) { fail "$file:$.: stray skip_FOO label" if not exists $parser->{dep_name}; my $dep_name = $parser->{dep_name}; my $dep_pkg = $parser->{pkgs}->{$dep_name}; # We resolve indirect dependencies right now. This works # because dependencies are required to be listed in # pre-fix order. foreach my $name (keys %{$parser->{pkgs}}) { my $pkg = $parser->{pkgs}->{$name}; # Check if $dep_name is a dependency for $name. if (exists $pkg->{deps}->{$dep_name}) { # Add all dependencies of $dep_name to $name. foreach my $dep (keys %{$dep_pkg->{deps}}) { $pkg->{deps}->{$dep} = $pkg->{deps}->{$dep_name} + 1 if (not defined $pkg->{deps}->{$dep}); } } } delete $parser->{dep_name}; } } # Function calc-depends. # # Format: # g4wihelp::config_fetch_bool "inst_FOO" elsif ($parser->{state} eq 'function-calc-defaults') { if ($command eq 'FunctionEnd') { undef $parser->{state}; } elsif ($command eq 'g4wihelp::config_fetch_bool') { fail "$file:$.: syntax error" if $#args != 0; if ($args[0] !~ m/^"inst_(.*)"$/) { fail "$file:$.: syntax error"; } $parser->{pkgs}->{$1}->{ini_inst} = 1; } } } # MSI generator. # Simple indentation tracking, for pretty printing. $::level = 0; sub dump_all { my ($parser) = @_; my $pkgname; # A running count for files within each feature. my $fileidx; # A running count for registry settings within each feature. my $regidx; # A running count for directories throughout the whole file. my $diridx = 0; # The current directory. my $cdir = ''; foreach $pkgname (@{$parser->{pkg_list}}) { my $pkg = $parser->{pkgs}->{$pkgname}; $fileidx = 0; foreach my $file (@{$pkg->{files}}) { if ($cdir ne $file->{dir}) { # We need to change the directory. We weed out empty # path elements, which also takes care of leading slashes. my @cdir = grep (!/^$/, split (/\\/, $cdir)); my @ndir = grep (!/^$/, split (/\\/, $file->{dir})); my $min; my $i; $min = $#cdir; $min = $#ndir if ($#ndir < $min); for ($i = 0; $i <= $min; $i++) { last if ($cdir[$i] ne $ndir[$i]) } my $j; for ($j = $i; $j <= $#cdir; $j++) { $::level -= 2; print ' ' x $::level . "\n"; } for ($j = $i; $j <= $#ndir; $j++) { print ' ' x $::level . "\n"; $diridx++; $::level += 2; } $cdir = $file->{dir}; } my $targetfull; if ($file->{dir} ne '') { $targetfull = $file->{dir} . '\\' . $file->{target}; } else { $targetfull = $file->{target}; } # 64 bit components if ($targetfull eq 'bin_64\\gpgol.dll' or $targetfull eq 'bin_64\\gpgex.dll') { print ' ' x $::level . "\n"; } else # 32 bit components { print ' ' x $::level . "\n"; } my $sourcefull; $sourcefull = $file->{source}; $sourcefull =~ s/playground\/install-ex/\$(var.InstDirEx)/; $sourcefull =~ s/playground\/install/\$(var.InstDir)/; $sourcefull =~ s/\.\//\$(var.SrcDir)\//; $sourcefull =~ s/\//\\/g; print ' ' x $::level . " \n"; # Does not help to avoid the warnings: DefaultLanguage='1033'. # EXCEPTIONS: if ($targetfull eq 'gpgex.dll') { print ' ' x $::level . " \n"; } # Create shortcuts. if (defined $parser->{shortcuts}->{$targetfull}) { my $shortcut = $parser->{shortcuts}->{$targetfull}; my $extra = ''; if (exists $shortcut->{description}) { my $desc = nsis_translate ($parser, '', $shortcut->{description}); $extra .= " Description='$desc'"; } # FIXME: WiX wants the icon to be known at compile time, so it needs a # source file, not a target file name. # if ($shortcut->{icon} ne '') # { # $extra .= " Icon='sm_$pkg->{name}_${fileidx}_icon'"; # } # FIXME: Note that the link name should better not # change, or it is not correctly replaced on updates. my $link = nsis_translate ($parser, '', $shortcut->{link}); print ' ' x $::level . " {icon} eq '') # { print "/>\n"; # } # else # { # print ">\n"; # print ' ' x $::level # . " \n"; # print ' ' x $::level # . " \n"; # } # Can't make these optional, so we don't do this. # print ' ' x $::level # . " \n"; } print ' ' x $::level . " \n"; if (defined $parser->{shortcuts}->{$targetfull}) { # http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg02746.html # -sice:ICE64 print ' ' x $::level . " \n"; } + if ($targetfull eq 'bin\\kleopatra.exe') + { + #TODO write registration for .p12 + } # EXCEPTIONS: if ($targetfull eq 'bin\\gpgol.dll' or $targetfull eq 'bin_64\\gpgol.dll') { # KeyPath=no as the file is the key path and the registry values # are only meta information for the files. print < EOF } elsif ($targetfull eq 'bin\\gpgex.dll' or $targetfull eq 'bin_64\\gpgex.dll') { print ' ' x $::level . " \n"; print ' ' x $::level . " \n"; print < EOF } # Close the component print ' ' x $::level . "\n"; $fileidx++; } $regidx = 0; foreach my $reg (@{$pkg->{registry}}) { my $target; my $root; if ($reg->{root} eq 'SHCTX') { $root = 'HKMU'; } else { $root = $reg->{root}; } my $localValue; # Some values need to be translated, like descriptions. if ($reg->{value} =~ m/^\$/) { $localValue = nsis_translate ($parser, '', $reg->{value}); } else { $localValue = $reg->{value}; } $target = '/REGISTRY/' . $reg->{root} . '/' . $reg->{key} . '/' . $reg->{name}; my $namepart=""; if ($reg->{name} ne "") { $namepart = "Name='$reg->{name}' "; } print ' ' x $::level . "\n"; print ' ' x $::level . " \n"; print ' ' x $::level . "\n"; $regidx++; } } my @cdir = grep (!/^$/, split (/\\/, $cdir)); my $j; for ($j = 0; $j <= $#cdir; $j++) { $::level -= 2; print ' ' x $::level . "\n"; } } sub dump_meat { my ($pkg) = @_; my $fileidx; my $regidx; $fileidx = 0; foreach my $file (@{$pkg->{files}}) { print ' ' x $::level . " \n"; $fileidx++; } $regidx = 0; foreach my $reg (@{$pkg->{registry}}) { print ' ' x $::level . " \n"; $regidx++; } } sub store_l10n { my ($parser) = @_; return if ($::l10n_file eq ''); open (FILE, ">$::l10n_file") or die; # Dump the localization foreach my $lang (keys %{$parser->{po}}) { my $codepage; my $langid = lang_to_lcid ($::lang); my $culture; if ($::lang eq 'ENGLISH') { $codepage = '1252'; $culture = 'en-us'; } elsif ($lang eq 'de') { $codepage = '1252'; $culture = 'de-de'; $langid = '1031'; } else { print STDERR "Ignored Language $lang\n"; next; } print FILE "\n"; print FILE " $langid\n"; my $key; foreach $key (keys %{$parser->{po}->{$lang}}) { print FILE " $parser->{po}->{$lang}->{$key}\n"; } print FILE "\n"; } } sub dump_all2 { my ($parser) = @_; my $pkgname; foreach $pkgname (@{$parser->{pkg_list}}) { my $pkg = $parser->{pkgs}->{$pkgname}; my $features; next if $pkg->{hidden}; $features = $pkg->{features}; # $features .= " Display='hidden'" if $pkg->{hidden}; $features .= " Description='$pkg->{description}'" if $pkg->{description}; my $title = nsis_translate ($parser, '', $pkg->{title}); print ' ' x $::level . "\n"; if ($pkg->{ini_inst}) { my $uc_pkgname = uc ($pkgname); print ' ' x $::level . "" . "INST_$uc_pkgname = \"true\"\n"; print ' ' x $::level . "" . "INST_$uc_pkgname = \"false\"\n"; } dump_meat ($pkg); foreach my $dep (keys %{$pkg->{deps}}) { $dep =~ s/-/_/g; my $deppkg = $parser->{pkgs}->{$dep}; # We use Level=1 because with InstallDefault followParent # the Level seems to specify some sort of minimum install # level or something (FIXME: confirm this). print ' ' x $::level . " \n"; $::level += 2; dump_meat ($deppkg); $::level -= 2; print ' ' x $::level . " \n"; } print ' ' x $::level . "\n"; } } +sub scan_dir { + my ($workdir) = @_; + + my @ret; + + my ($startdir) = &cwd; # keep track of where we began + + chdir($workdir) or die "Unable to enter dir $workdir:$!\n"; + opendir(DIR, ".") or die "Unable to open $workdir:$!\n"; + my @names = readdir(DIR) or die "Unable to read $workdir:$!\n"; + closedir(DIR); + + foreach my $name (@names){ + next if ($name eq "."); + next if ($name eq ".."); + + my $abspath = "$startdir/$workdir/$name"; + + if (-d "$abspath") { + foreach my $subname (&scan_dir($name)) { + push (@ret, $subname); + } + next; + } + push (@ret, $abspath); + } + + chdir($startdir) or + die "Unable to change to dir $startdir:$!\n"; + return @ret; +} + +sub dump_single_custom { + my ($workdir) = @_; + my $custom_name = basename($workdir); + open (FILE, ">$workdir/$custom_name.wxs") or die; + print FILE < + + + + + + + + + + + + + + + + + +EOF + my $fileidx = 0; + + foreach my $file (&scan_dir($workdir)) { + my $basename = basename($file); + my $dirname = dirname($file); + + if ($basename eq "$custom_name.wxs") { + next; + } + if ($basename eq "$custom_name.wixlib") { + next; + } + + if ($basename eq "$custom_name.wxs.include") { + print STDERR "Including: $basename\n"; + open (INCFILE, "<$workdir/$custom_name.wxs.include") or die; + while () + { + print FILE $_; + } + close (INCFILE); + } + + my $guid = get_guid ($file); + my $sourcefull = "\$(var.SrcDir)/" . $file; + $sourcefull =~ s/.*\/src\//\$(var.SrcDir)\//; + $sourcefull =~ s/\//\\/g; + + if ($dirname =~ /trusted-certs$/) { + $dirname = "GnuPGTrustedCerts"; + } elsif ($dirname =~ /extra-certs$/) { + $dirname = "GnuPGExtraCerts"; + } elsif ($basename eq "VERSION" || $basename eq "VERSION.sig") { + # The VERSION file is special and needs to go + # in the Gpg4win root folder. + $dirname = "APPLICATIONFOLDER"; + } + else { + $dirname = "GnuPGDataFolder"; + } + + print FILE ' ' x 6 . '' . "\n"; + + print FILE ' ' x 8 + . " \n"; + + print FILE ' ' x 6 . '' . "\n"; + + $fileidx += 1; + } + print FILE < + + +EOF + close FILE; +} + +sub dump_customs +{ + my ($startdir) = &cwd; + my ($workdir) = @_; + + chdir($workdir) or die "Unable to enter dir $workdir:$!\n"; + opendir(DIR, ".") or die "Unable to open $workdir:$!\n"; + my @names = readdir(DIR) or die "Unable to read $workdir:$!\n"; + closedir(DIR); + + foreach my $name (@names) { + next if ($name eq "."); + next if ($name eq ".."); + + if (-d $name){ # is this a directory? + dump_single_custom($name); + next; + } + print STDERR "Unknown file in vsd-custom directory. '$name' \n"; + chdir($startdir) or + die "Unable to change to dir $startdir:$!\n"; + } + chdir($startdir) or die "Unable to start dir $startdir!\n"; +} + +dump_customs("gnupg-vsd"); + # Just so that it is defined. $. = 0; my %parser = ( pre_depth => 0, pre_true => 0 ); my $parser = \%parser; fetch_guids (); while ($#ARGV >= 0 and $ARGV[0] =~ m/^-/) { my $opt = shift @ARGV; if ($opt =~ m/^--guids$/) { $::guid_file = shift @ARGV; } elsif ($opt =~ m/^--manifest$/) { $::files_file = shift @ARGV; } elsif ($opt =~ m/^-D([^=]*)=(.*)$/) { $parser->{pre_symbols}->{$1} = $2; } elsif ($opt =~ m/^-L(.*)$/) { $::lang = $1; # Test if it is supported. if (!lang_to_lcid ($::lang)) { print STDERR "language: $::lang is not supported."; exit 1; } } elsif ($opt eq '--usage') { print STDERR "Usage: $0 [-DNAME=VALUE...] NSIFILE\n"; print STDERR "Use --help or -h for more information.\n"; exit 1; } elsif ($opt eq '-h' or $opt eq '--help') { print STDERR "Usage: $0 [-DNAME=VALUE...] NSIFILE\n"; print STDERR "Convert the .nsi file NSIFILE to a WiX source file.\n"; print STDERR "Options:\n"; print STDERR " --guids NAME Save GUIDs into file NAME (default: $::guid_file)\n"; print STDERR " --manifest NAME Save included files into file NAME (default: $::files_file)\n"; print STDERR " -DNAME=VALUE Define preprocessor symbol NAME to VALUE\n"; print STDERR " -LLANG Build installer for language LANG (default: $::lang)\n"; print STDERR "\n"; print STDERR " -h|--help Print this help and exit\n"; exit 0; } else { print STDERR "$0: unknown option $opt\n"; print STDERR "Usage: $0 [-DNAME=VALUE...] NSIFILE\n"; print STDERR "Use --help or -h for more information.\n"; exit 1; } } if ($#ARGV < 0) { nsis_parse_file ($parser, '-'); } else { nsis_parse_file ($parser, $ARGV[0]); } # Add exceptions. # =============== $parser->{pkgs}->{gnupg}->{deps}->{gpg4win} = 1; # For debugging: # use Data::Dumper; # print Dumper ($parser); # exit; # Dump the gathered information. # ============================== $::l10n_file = "gpg4win-all.wxl"; my $BUILD_FILEVERSION = nsis_fetch ($parser, '_BUILD_FILEVERSION'); my $product_id = get_guid ("/PRODUCT/$BUILD_FILEVERSION"); my $upgrade_code = get_guid ("/UPGRADE/1"); my $INSTALL_DIR = nsis_fetch ($parser, 'INSTALL_DIR'); my $lcid = lang_to_lcid ($::lang); # Replacement regex for components: # :'<,'>s/.*Component: \(.*\) does not.*/ / print < - - = 601)]]> + + + + + + + - - + + + CMDLINE_INSTALLDIR CMDLINE_INSTALLDIR + EOF foreach my $pkgname (@{$parser->{pkg_list}}) { if (exists $parser->{pkgs}->{$pkgname}->{ini_inst}) { my $uc_pkgname = uc ($pkgname); print < EOF } } print < EOF $::level = 12; dump_all ($parser); print < EOF if (scalar keys %{$parser->{shortcuts}}) { - my $name = nsis_fetch ($parser, 'PRETTY_PACKAGE'); + my $name = "GnuPG VS-Desktop"; print < EOF } #print < #EOF print < - EOF $::level = 6; dump_all2 ($parser); # Removed this, because it is not localized: # print < EOF # Post-processing: We need to remember the GUIDs for later reuse, and # we remember the files we need in case we want to transfer them to a # different machine for invocation of WiX. store_guids (); store_l10n ($parser); store_files ($parser);