build: Update standard build-aux files.
[gnupg.git] / build-aux / speedo.mk
index 6d344f1..8a2053a 100644 (file)
@@ -58,10 +58,10 @@ help:
        @echo '  w32-installer  Build a Windows installer'
        @echo '  w32-source     Pack a source archive'
        @echo
-       @echo 'You may append INSTALL_REFIX=<dir> for native builds.'
+       @echo 'You may append INSTALL_PREFIX=<dir> for native builds.'
        @echo 'Prepend TARGET with "git-" to build from GIT repos.'
        @echo 'Prepend TARGET with "this-" to build from the source tarball.'
-
+       @echo 'Use CUSTOM_SWDB=1 for an already downloaded swdb.lst.'
 
 SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1
 
@@ -84,22 +84,22 @@ this-native-gui: check-tools
        $(SPEEDOMAKE) TARGETOS=native WHAT=this    WITH_GUI=1 all
 
 w32-installer: check-tools
-       $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=1 installer
+       $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=0 installer
 
 git-w32-installer: check-tools
-       $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=1 installer
+       $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 installer
 
 this-w32-installer: check-tools
-       $(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=1 installer
+       $(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=0 installer
 
 w32-source: check-tools
-       $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=1 dist-source
+       $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=0 dist-source
 
 git-w32-source: check-tools
-       $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=1 dist-source
+       $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 dist-source
 
 this-w32-source: check-tools
-       $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=1 dist-source
+       $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 dist-source
 
 
 # Set this to "git" to build from git,
@@ -108,11 +108,14 @@ this-w32-source: check-tools
 WHAT=git
 
 # Set target to "native" or "w32"
-TARGETOS=w32
+TARGETOS=
 
 # Set to 1 to build the GUI tools
 WITH_GUI=0
 
+# Set to 1 to use a pre-installed swdb.lst instead of the online version.
+CUSTOM_SWDB=0
+
 # Set to 1 to really download the swdb.
 UPD_SWDB=0
 
@@ -157,43 +160,54 @@ speedo_spkgs  = \
 
 ifeq ($(TARGETOS),w32)
 speedo_spkgs += \
-       zlib bzip2 libiconv gettext
+       zlib bzip2 adns libiconv
+ifeq ($(WITH_GUI),1)
+speedo_spkgs += gettext
+endif
 endif
 
 speedo_spkgs += \
        libassuan libksba gnupg
 
 ifeq ($(TARGETOS),w32)
+ifeq ($(WITH_GUI),1)
 speedo_spkgs += \
        libffi glib pkg-config
 endif
+endif
 
 speedo_spkgs += \
        gpgme
 
 ifeq ($(TARGETOS),w32)
+ifeq ($(WITH_GUI),1)
 speedo_spkgs += \
        libpng \
        gdk-pixbuf atk pixman cairo pango gtk+
 endif
+endif
 
 
 ifeq ($(WITH_GUI),1)
 speedo_spkgs += \
        pinentry gpa
-endif
-
 ifeq ($(TARGETOS),w32)
 speedo_spkgs += \
        gpgex
 endif
+endif
+
 
 # =====END LIST OF PACKAGES=====
 
 
-# Packages which are additionally build for 64 bit Windows
-speedo_w64_spkgs  = \
-       libgpg-error libiconv gettext libassuan gpgex
+# Packages which are additionally build for 64 bit Windows.  They are
+# only used for gpgex and thus we need to build them only if we want
+# a full installer.
+speedo_w64_spkgs  =
+ifeq ($(WITH_GUI),1)
+speedo_w64_spkgs += ibgpg-error libiconv gettext libassuan gpgex
+endif
 
 # Packages which use the gnupg autogen.sh build style
 speedo_gnupg_style = \
@@ -206,11 +220,18 @@ speedo_make_only_style = \
        zlib bzip2
 
 # Get the content of the software DB.
+ifeq ($(CUSTOM_SWDB),1)
+getswdb_options = --skip-download --skip-verify
+else
+getswdb_options =
+endif
 ifeq ($(UPD_SWDB),1)
-SWDB := $(shell $(topsrc)/build-aux/getswdb.sh && echo okay)
+SWDB := $(shell $(topsrc)/build-aux/getswdb.sh $(getswdb_options) && echo okay)
 ifeq ($(strip $(SWDB)),)
+ifneq ($(WHAT),git)
 $(error Error getting GnuPG software version database)
 endif
+endif
 
 # Version numbers of the released packages
 gnupg_ver = $(shell cat $(topsrc)/VERSION)
@@ -248,6 +269,9 @@ zlib_sha1 := $(shell awk '$$1=="zlib_sha1_gz" {print $$2}' swdb.lst)
 bzip2_ver  := $(shell awk '$$1=="bzip2_ver" {print $$2}' swdb.lst)
 bzip2_sha1 := $(shell awk '$$1=="bzip2_sha1_gz" {print $$2}' swdb.lst)
 
+adns_ver  := $(shell awk '$$1=="adns_ver" {print $$2}' swdb.lst)
+adns_sha1 := $(shell awk '$$1=="adns_sha1" {print $$2}' swdb.lst)
+
 $(info Information from the version database)
 $(info GnuPG ..........: $(gnupg_ver))
 $(info Libgpg-error ...: $(libgpg_error_ver))
@@ -256,6 +280,7 @@ $(info Libgcrypt ......: $(libgcrypt_ver))
 $(info Libassuan ......: $(libassuan_ver))
 $(info Zlib ...........: $(zlib_ver))
 $(info Bzip2 ..........: $(bzip2_ver))
+$(info ADNS ...........: $(adns_ver))
 $(info GPGME ..........: $(gpgme_ver))
 $(info Pinentry .......: $(pinentry_ver))
 $(info GPA ............: $(gpa_ver))
@@ -264,7 +289,6 @@ endif
 
 # Version number for external packages
 pkg_config_ver = 0.23
-zlib_ver = 1.2.8
 libiconv_ver = 1.14
 gettext_ver = 0.18.2.1
 libffi_ver = 3.0.13
@@ -277,7 +301,6 @@ pixman_ver = 0.32.4
 cairo_ver = 1.12.16
 gtk__ver = 2.24.17
 
-
 # The GIT repository.  Using a local repo is much faster.
 #gitrep = git://git.gnupg.org
 gitrep = ${HOME}/s
@@ -318,7 +341,7 @@ else ifeq ($(WHAT),git)
   speedo_pkg_libassuan_git = $(gitrep)/libassuan
   speedo_pkg_libassuan_gitref = master
   speedo_pkg_libgcrypt_git = $(gitrep)/libgcrypt
-  speedo_pkg_libgcrypt_gitref = LIBGCRYPT-1-6-BRANCH
+  speedo_pkg_libgcrypt_gitref = master
   speedo_pkg_libksba_git = $(gitrep)/libksba
   speedo_pkg_libksba_gitref = master
   speedo_pkg_gpgme_git = $(gitrep)/gpgme
@@ -355,6 +378,7 @@ endif
 speedo_pkg_pkg_config_tar = $(pkg2rep)/pkg-config-$(pkg_config_ver).tar.gz
 speedo_pkg_zlib_tar       = $(pkgrep)/zlib/zlib-$(zlib_ver).tar.gz
 speedo_pkg_bzip2_tar      = $(pkgrep)/bzip2/bzip2-$(bzip2_ver).tar.gz
+speedo_pkg_adns_tar       = $(pkg10rep)/adns/adns-$(adns_ver).tar.bz2
 speedo_pkg_libiconv_tar   = $(pkg2rep)/libiconv-$(libiconv_ver).tar.gz
 speedo_pkg_gettext_tar    = $(pkg2rep)/gettext-$(gettext_ver).tar.gz
 speedo_pkg_libffi_tar     = $(pkg2rep)/libffi-$(libffi_ver).tar.gz
@@ -382,22 +406,36 @@ speedo_pkg_libgcrypt_configure = --disable-static
 
 speedo_pkg_libksba_configure = --disable-static
 
-speedo_pkg_gnupg_configure = --enable-gpg2-is-gpg --disable-g13
+ifeq ($(TARGETOS),w32)
+speedo_pkg_gnupg_configure = --enable-gpg2-is-gpg --disable-g13 --disable-ntbtls
+else
+speedo_pkg_gnupg_configure = --disable-g13
+endif
 speedo_pkg_gnupg_extracflags = -g
 
+# Create the version info files only for W32 so that they won't get
+# installed if for example INSTALL_PREFIX=/usr/local is used.
+ifeq ($(TARGETOS),w32)
 define speedo_pkg_gnupg_post_install
 (set -e; \
  sed -n  's/.*PACKAGE_VERSION "\(.*\)"/\1/p' config.h >$(idir)/INST_VERSION; \
  sed -n  's/.*W32INFO_VI_PRODUCTVERSION \(.*\)/\1/p' common/w32info-rc.h \
     |sed 's/,/./g' >$(idir)/INST_PROD_VERSION )
 endef
-
+endif
 
 # The LDFLAGS is needed for -lintl for glib.
+ifeq ($(WITH_GUI),1)
 speedo_pkg_gpgme_configure = \
        --enable-static --enable-w32-glib --disable-w32-qt \
        --with-gpg-error-prefix=$(idir) \
        LDFLAGS=-L$(idir)/lib
+else
+speedo_pkg_gpgme_configure = \
+       --disable-static --disable-w32-glib --disable-w32-qt \
+       --with-gpg-error-prefix=$(idir) \
+       LDFLAGS=-L$(idir)/lib
+endif
 
 speedo_pkg_pinentry_configure = \
        --disable-pinentry-qt --disable-pinentry-qt4 --disable-pinentry-gtk \
@@ -414,11 +452,13 @@ speedo_pkg_gpa_configure = \
 
 speedo_pkg_gpgex_configure = \
        --with-gpg-error-prefix=$(idir) \
-       --with-libassuan-prefix=$(idir)
+       --with-libassuan-prefix=$(idir) \
+       --enable-gpa-only
 
 speedo_pkg_w64_gpgex_configure = \
        --with-gpg-error-prefix=$(idir6) \
-       --with-libassuan-prefix=$(idir6)
+       --with-libassuan-prefix=$(idir6) \
+       --enable-gpa-only
 
 
 #
@@ -564,15 +604,22 @@ endif
 
 
 BUILD_ISODATE=$(shell date -u +%Y-%m-%d)
+BUILD_DATESTR=$(subst -,,$(BUILD_ISODATE))
 
 # The next two macros will work only after gnupg has been build.
+ifeq ($(TARGETOS),w32)
 INST_VERSION=$(shell head -1 $(idir)/INST_VERSION)
 INST_PROD_VERSION=$(shell head -1 $(idir)/INST_PROD_VERSION)
+endif
 
 # List with packages
 speedo_build_list = $(speedo_spkgs)
 speedo_w64_build_list = $(speedo_w64_spkgs)
 
+# To avoid running external commands during the read phase (":=" style
+# assignments), we check that the targetos has been given
+ifneq ($(TARGETOS),)
+
 # Determine build and host system
 build := $(shell $(topsrc)/autogen.sh --silent --print-build)
 ifeq ($(TARGETOS),w32)
@@ -596,6 +643,9 @@ else
   speedo_makeopt=-j$(MAKE_J)
 endif
 
+# End non-empty TARGETOS
+endif
+
 
 
 # The playground area is our scratch area, where we unpack, build and
@@ -725,15 +775,16 @@ $(stampdir)/stamp-$(1)-00-unpack: $(stampdir)/stamp-directories
          elif [ -n "$$$${tar}" ]; then                 \
           echo "speedo: unpacking $(1) from $$$${tar}"; \
            case "$$$${tar}" in                         \
-             *.gz) opt=z ;;                            \
-             *.bz2) opt=j ;;                           \
-            *.xz) opt=J ;;                             \
-             *) opt= ;;                                        \
+             *.gz) pretar=zcat ;;                      \
+             *.bz2) pretar=bzcat ;;                    \
+            *.xz) pretar=xzcat ;;                      \
+             *) pretar=cat ;;                          \
            esac;                                       \
            [ -f tmp.tgz ] && rm tmp.tgz;                \
            case "$$$${tar}" in                         \
-            /*) tar x$$$${opt}f - < $$$${tar} ;;       \
-            *)  wget -q -O - $$$${tar} | tee tmp.tgz | tar x$$$${opt}f - ;; \
+            /*) $$$${pretar} < $$$${tar} | tar xf - ;; \
+            *)  wget -q -O - $$$${tar} | tee tmp.tgz   \
+                  | $$$${pretar} | tar x$$$${opt}f - ;; \
           esac;                                        \
           if [ -f tmp.tgz ]; then                      \
             if [ -n "$$$${sha1}" ]; then               \
@@ -975,11 +1026,13 @@ clean-speedo:
 #
 # Windows installer
 #
+# {{{
+ifeq ($(TARGETOS),w32)
 
 dist-source: all
        for i in 00 01 02 03; do sleep 1;touch PLAY/stamps/stamp-*-${i}-*;done
        (set -e;\
-        tarname="$(INST_NAME)-$(INST_VERSION)_$(BUILD_ISODATE).tar" ;\
+        tarname="$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).tar" ;\
         [ -f "$$tarname" ] && rm "$$tarname" ;\
          tar -C $(topsrc) -cf "$$tarname" --exclude-backups --exclude-vc \
              --transform='s,^\./,$(INST_NAME)-$(INST_VERSION)/,' \
@@ -991,16 +1044,20 @@ dist-source: all
        )
 
 
+# Extract the two latest news entries.  */
 $(bdir)/NEWS.tmp: $(topsrc)/NEWS
-       sed -e '/^#/d' <$(topsrc)/NEWS >$(bdir)/NEWS.tmp
+       awk '/^Notewo/ {if(okay>1){exit}; okay++};okay {print $0}' \
+           <$(topsrc)/NEWS  >$(bdir)/NEWS.tmp
 
-$(bdir)/README.txt: $(bdir)/NEWS.tmp $(w32src)/README.txt \
+$(bdir)/README.txt: $(bdir)/NEWS.tmp $(topsrc)/README $(w32src)/README.txt \
                     $(w32src)/pkg-copyright.txt
        sed -e '/^;.*/d;' \
-       -e '/!NEWSFILE!/{r NEWS.tmp' -e 'd;}' \
+       -e '/!NEWSFILE!/{r $(bdir)/NEWS.tmp' -e 'd;}' \
+       -e '/!GNUPGREADME!/{r $(topsrc)/README' -e 'd;}' \
         -e '/!PKG-COPYRIGHT!/{r $(w32src)/pkg-copyright.txt' -e 'd;}' \
         -e 's,!VERSION!,$(INST_VERSION),g' \
           < $(w32src)/README.txt \
+           | sed -e '/^#/d' \
            | awk '{printf "%s\r\n", $$0}' >$(bdir)/README.txt
 
 $(bdir)/g4wihelp.dll: $(w32src)/g4wihelp.c $(w32src)/exdll.h
@@ -1014,6 +1071,11 @@ w32_insthelpers: $(bdir)/g4wihelp.dll
 $(bdir)/inst-options.ini: $(w32src)/inst-options.ini
        cat $(w32src)/inst-options.ini >$(bdir)/inst-options.ini
 
+extra_installer_options =
+ifeq ($(WITH_GUI),1)
+extra_installer_options += -DWITH_GUI=1
+endif
+
 installer: all w32_insthelpers $(w32src)/inst-options.ini $(bdir)/README.txt
        $(MAKENSIS) -V2 \
                     -DINST_DIR=$(idir) \
@@ -1022,11 +1084,16 @@ installer: all w32_insthelpers $(w32src)/inst-options.ini $(bdir)/README.txt
                     -DTOP_SRCDIR=$(topsrc) \
                     -DW32_SRCDIR=$(w32src) \
                     -DBUILD_ISODATE=$(BUILD_ISODATE) \
+                    -DBUILD_DATESTR=$(BUILD_DATESTR) \
                    -DNAME=$(INST_NAME) \
                    -DVERSION=$(INST_VERSION) \
                    -DPROD_VERSION=$(INST_PROD_VERSION) \
-                   $(w32src)/inst.nsi
-       @echo "Ready: $(idir)/$(INST_NAME)-$(INST_VERSION)"
+                   $(extra_installer_options) $(w32src)/inst.nsi
+       @echo "Ready: $(idir)/$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).exe"
+
+endif
+# }}} W32
+
 
 #
 # Check availibility of standard tools