Update kleopatra
[gpg4win.git] / src / gpg4win.mk.in
index 45ed31d..9e20bf9 100644 (file)
@@ -1,5 +1,5 @@
 # gpg4win.m4.in - Installer for GnuPG 4 Windows Makefile.   -*- makefile -*-
-# Copyright (C) 2005 g10 Code GmbH
+# Copyright (C) 2005, 2009 g10 Code GmbH
 # 
 # This file is part of GPG4Win.
 # 
@@ -29,6 +29,8 @@ ipdir := $(root)/install/pkgs
 tsdir := $(shell pwd)/${top_srcdir}
 pdir := $(shell pwd)/${top_srcdir}/patches
 
+# 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.
@@ -69,16 +71,12 @@ define SETVARS
        pkgmkargs_inst="$(call GETVAR,gpg4win_pkg_$(1)_make_args_inst)";\
        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
 
-# Support macro.  Record version number of file $(1).
-define VERSIONINFO_macro
-         $(SHA1SUM) "$(1)" >> "$(bdir)/versioninfo.txt" 
-endef
-
 # Support macro.  Unpack the archive $(1).
 define DEFLATE_macro
        case "$(1)" in                  \
@@ -103,15 +101,20 @@ define STRIP_macro
        fi
 endef
 
+define GETDEPS
+  $(addprefix stamps/stamp-final-, $(call GETVAR,gpg4win_pkg_$(1)_deps))
+endef
+
 
 # Template for source packages.
 
-define SPKG_template
+define SPKG_template_
+
+pkg_files += $(call GETVAR,gpg4win_pkg_$(1))
 
-stamps/stamp-$(1)-00-unpack: stamps/stamp-directories 
+stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1))
        (cd $(bdir);                                    \
         $(call SETVARS,$(1));                          \
-        $(call VERSIONINFO_macro,$$$${pkg});           \
         $(call DEFLATE_macro,$$$${pkg}))
        touch stamps/stamp-$(1)-00-unpack
 
@@ -148,7 +151,8 @@ stamps/stamp-$(1)-04-install: stamps/stamp-$(1)-03-make
        ($(call SETVARS,$(1));                          \
          cd "$$$${pkgbdir}";                           \
          $(MAKE) $(AM_MAKEFLAGS) $$$${pkgmkargs_inst} install; \
-         $(call STRIP_macro,"$$$${pkgidir}"); \
+         $(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
 
@@ -172,16 +176,22 @@ clean-$(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
+define MPKG_template_
 
-stamps/stamp-$(1)-00-unpack: stamps/stamp-directories 
+pkg_files += $(call GETVAR,gpg4win_pkg_$(1))
+
+stamps/stamp-$(1)-00-unpack: stamps/stamp-directories $(call GETDEPS,$(1))
        (cd $(bdir);                                    \
         $(call SETVARS,$(1));                          \
-        $(call VERSIONINFO_macro,$$$${pkg});           \
         $(call DEFLATE_macro,$$$${pkg}))
        touch stamps/stamp-$(1)-00-unpack
 
@@ -226,17 +236,24 @@ clean-$(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
+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 
+stamps/stamp-$(1)-00-install: stamps/stamp-directories $(call GETDEPS,$(1))
        ($(call SETVARS,$(1));                          \
         $(MKDIR) "$$$${pkgidir}";                      \
         cd $$$${pkgidir};                              \
-        $(call VERSIONINFO_macro,$$$${pkg});           \
         $(call DEFLATE_macro,$$$${pkg}))
        touch stamps/stamp-$(1)-00-install
 
@@ -246,7 +263,6 @@ stamps/stamp-$(1)-01-install-dev: stamps/stamp-$(1)-00-install
        ($(call SETVARS,$(1));                          \
         $(MKDIR) "$$$${pkgidir_dev}";                  \
         (cd $$$${pkgidir_dev};                         \
-          $(call VERSIONINFO_macro,$$$${pkg_dev});      \
          $(call DEFLATE_macro,$$$${pkg_dev}));         \
         $(call gpg4win_pkg_$(call FROB_macro,$(1))_post_install))
        touch stamps/stamp-$(1)-01-install-dev
@@ -277,15 +293,36 @@ clean-$(1):
 
 endef
 
+define BPKG_template
+$(if $(filter-out no, $(call GETVAR,gpg4win_pkg_$(1))),
+  $(call BPKG_template_,$1))
+endef
 
-# Template for source packages.
+
+# Template for internal packages.
 
 define IPKG_template
 
-stamps/stamp-final-$(1): stamps/stamp-directories 
+stamps/stamp-final-$(1): stamps/stamp-directories $(call GETDEPS,$(1))
        touch stamps/stamp-final-$(1)
 endef
 
+# Template for README files
+
+define README_template
+README.$(1).txt : versioninfo.txt NEWS.tmp $(top_srcdir)/doc/README.$(1).txt \
+                  $(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 '/!PKG-COPYRIGHT!/{r $(top_srcdir)/doc/pkg-copyright.txt' -e 'd;}' \
+        -e 's,!VERSION!,$(VERSION),g' \
+          < $(top_srcdir)/doc/README.$(1).txt \
+          | (if echo "$(VERSION)" | egrep 'svn|rc|beta' >/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
 
 # Insert the template for each source package.
 $(foreach spkg, $(gpg4win_spkgs), $(eval $(call SPKG_template,$(spkg))))
@@ -299,10 +336,17 @@ $(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 each README file.
+$(foreach rll, $(gpg4win_readme_ll), $(eval $(call README_template,$(rll))))
+
 stamps/stamp-final: stamps/stamp-directories
 stamps/stamp-final: $(addprefix stamps/stamp-final-,$(gpg4win_build_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.