1 # speedo.mk - Speedo rebuilds speedily.
2 # Copyright (C) 2008, 2014 g10 Code GmbH
4 # speedo is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # speedo is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, see <http://www.gnu.org/licenses/>.
17 # speedo builds gnupg-related packages from GIT and installs them in a
18 # user directory, thereby providing a non-obstrusive test environment.
19 # speedo does only work with GNU make. The build system is similar to
20 # that of gpg4win. The following commands are supported:
22 # make -f speedo.mk all pkg2rep=/dir/with/tarballs
26 # Builds all packages and installs them under PLAY/inst. At the end,
27 # speedo prints commands that can be executed in the local shell to
28 # make use of the installed packages.
30 # make -f speedo.mk clean
32 # make -f speedo.mk clean-PACKAGE
34 # Removes all packages or the package PACKAGE from the installation
35 # and build tree. A subsequent make will rebuild these (and only
38 # make -f speedo.mk report
40 # make -f speedo.mk report-PACKAGE
42 # Lists packages and versions.
45 # We need to know our own name.
46 SPEEDO_MK := $(realpath $(lastword $(MAKEFILE_LIST)))
48 .PHONY : help native native-gui w32-installer w32-source
49 .PHONY : git-native git-native-gui git-w32-installer git-w32-source
50 .PHONY : this-native this-native-gui this-w32-installer this-w32-source
53 @echo 'usage: make -f speedo.mk TARGET'
54 @echo ' with TARGET being one of:'
55 @echo ' help This help'
56 @echo ' native Native build of the GnuPG core'
57 @echo ' native-gui Ditto but with pinentry and GPA'
58 @echo ' w32-installer Build a Windows installer'
59 @echo ' w32-source Pack a source archive'
61 @echo 'You may append INSTALL_PREFIX=<dir> for native builds.'
62 @echo 'Prepend TARGET with "git-" to build from GIT repos.'
63 @echo 'Prepend TARGET with "this-" to build from the source tarball.'
64 @echo 'Use CUSTOM_SWDB=1 for an already downloaded swdb.lst.'
66 SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1
69 $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=0 all
71 git-native: check-tools
72 $(SPEEDOMAKE) TARGETOS=native WHAT=git WITH_GUI=0 all
74 this-native: check-tools
75 $(SPEEDOMAKE) TARGETOS=native WHAT=this WITH_GUI=0 all
77 native-gui: check-tools
78 $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=1 all
80 git-native-gui: check-tools
81 $(SPEEDOMAKE) TARGETOS=native WHAT=git WITH_GUI=1 all
83 this-native-gui: check-tools
84 $(SPEEDOMAKE) TARGETOS=native WHAT=this WITH_GUI=1 all
86 w32-installer: check-tools
87 $(SPEEDOMAKE) TARGETOS=w32 WHAT=release WITH_GUI=0 installer
89 git-w32-installer: check-tools
90 $(SPEEDOMAKE) TARGETOS=w32 WHAT=git WITH_GUI=0 installer
92 this-w32-installer: check-tools
93 $(SPEEDOMAKE) TARGETOS=w32 WHAT=this WITH_GUI=0 installer
95 w32-source: check-tools
96 $(SPEEDOMAKE) TARGETOS=w32 WHAT=release WITH_GUI=0 dist-source
98 git-w32-source: check-tools
99 $(SPEEDOMAKE) TARGETOS=w32 WHAT=git WITH_GUI=0 dist-source
101 this-w32-source: check-tools
102 $(SPEEDOMAKE) TARGETOS=w32 WHAT=git WITH_GUI=0 dist-source
105 # Set this to "git" to build from git,
106 # to "release" from tarballs,
107 # to "this" from the unpacked sources.
110 # Set target to "native" or "w32"
113 # Set to 1 to build the GUI tools
116 # Set to 1 to use a pre-installed swdb.lst instead of the online version.
119 # Set to 1 to really download the swdb.
122 # Set to the location of the directory with tarballs of
124 TARBALLS=$(shell pwd)/../tarballs
126 # Number of parallel make jobs
129 # Name to use for the w32 installer and sources
132 # Use this to override the installaion directory for native builds.
137 # They must be absolute, as we switch directories pretty often.
138 root := $(shell pwd)/PLAY
140 bdir := $(root)/build
141 bdir6:= $(root)/build-w64
142 ifeq ($(INSTALL_PREFIX),none)
145 idir := $(abspath $(INSTALL_PREFIX))
147 idir6:= $(root)/inst-w64
148 stampdir := $(root)/stamps
149 topsrc := $(shell cd $(dir $(SPEEDO_MK)).. && pwd)
150 auxsrc := $(topsrc)/build-aux/speedo
151 patdir := $(topsrc)/build-aux/speedo/patches
152 w32src := $(topsrc)/build-aux/speedo/w32
154 # =====BEGIN LIST OF PACKAGES=====
155 # The packages that should be built. The order is also the build order.
156 # Fixme: Do we need to build pkg-config for cross-building?
159 libgpg-error npth libgcrypt
161 ifeq ($(TARGETOS),w32)
163 zlib bzip2 adns libiconv
165 speedo_spkgs += gettext
170 libassuan libksba gnupg
172 ifeq ($(TARGETOS),w32)
175 libffi glib pkg-config
182 ifeq ($(TARGETOS),w32)
186 gdk-pixbuf atk pixman cairo pango gtk+
194 ifeq ($(TARGETOS),w32)
201 # =====END LIST OF PACKAGES=====
204 # Packages which are additionally build for 64 bit Windows. They are
205 # only used for gpgex and thus we need to build them only if we want
209 speedo_w64_spkgs += ibgpg-error libiconv gettext libassuan gpgex
212 # Packages which use the gnupg autogen.sh build style
213 speedo_gnupg_style = \
214 libgpg-error npth libgcrypt \
215 libassuan libksba gnupg gpgme \
218 # Packages which use only make and no build directory
219 speedo_make_only_style = \
222 # Get the content of the software DB.
223 ifeq ($(CUSTOM_SWDB),1)
224 getswdb_options = --skip-download --skip-verify
229 SWDB := $(shell $(topsrc)/build-aux/getswdb.sh $(getswdb_options) && echo okay)
230 ifeq ($(strip $(SWDB)),)
232 $(error Error getting GnuPG software version database)
236 # Version numbers of the released packages
237 gnupg_ver = $(shell cat $(topsrc)/VERSION)
239 libgpg_error_ver := $(shell awk '$$1=="libgpg_error_ver" {print $$2}' swdb.lst)
240 libgpg_error_sha1:= $(shell awk '$$1=="libgpg_error_sha1" {print $$2}' swdb.lst)
242 npth_ver := $(shell awk '$$1=="npth_ver" {print $$2}' swdb.lst)
243 npth_sha1 := $(shell awk '$$1=="npth_sha1" {print $$2}' swdb.lst)
245 libgcrypt_ver := $(shell awk '$$1=="libgcrypt_ver" {print $$2}' swdb.lst)
246 libgcrypt_sha1 := $(shell awk '$$1=="libgcrypt_sha1" {print $$2}' swdb.lst)
248 libassuan_ver := $(shell awk '$$1=="libassuan_ver" {print $$2}' swdb.lst)
249 libassuan_sha1 := $(shell awk '$$1=="libassuan_sha1" {print $$2}' swdb.lst)
251 libksba_ver := $(shell awk '$$1=="libksba_ver" {print $$2}' swdb.lst)
252 libksba_sha1 := $(shell awk '$$1=="libksba_sha1" {print $$2}' swdb.lst)
254 gpgme_ver := $(shell awk '$$1=="gpgme_ver" {print $$2}' swdb.lst)
255 gpgme_sha1 := $(shell awk '$$1=="gpgme_sha1" {print $$2}' swdb.lst)
257 pinentry_ver := $(shell awk '$$1=="pinentry_ver" {print $$2}' swdb.lst)
258 pinentry_sha1 := $(shell awk '$$1=="pinentry_sha1" {print $$2}' swdb.lst)
260 gpa_ver := $(shell awk '$$1=="gpa_ver" {print $$2}' swdb.lst)
261 gpa_sha1 := $(shell awk '$$1=="gpa_sha1" {print $$2}' swdb.lst)
263 gpgex_ver := $(shell awk '$$1=="gpgex_ver" {print $$2}' swdb.lst)
264 gpgex_sha1 := $(shell awk '$$1=="gpgex_sha1" {print $$2}' swdb.lst)
266 zlib_ver := $(shell awk '$$1=="zlib_ver" {print $$2}' swdb.lst)
267 zlib_sha1 := $(shell awk '$$1=="zlib_sha1_gz" {print $$2}' swdb.lst)
269 bzip2_ver := $(shell awk '$$1=="bzip2_ver" {print $$2}' swdb.lst)
270 bzip2_sha1 := $(shell awk '$$1=="bzip2_sha1_gz" {print $$2}' swdb.lst)
272 adns_ver := $(shell awk '$$1=="adns_ver" {print $$2}' swdb.lst)
273 adns_sha1 := $(shell awk '$$1=="adns_sha1" {print $$2}' swdb.lst)
275 $(info Information from the version database)
276 $(info GnuPG ..........: $(gnupg_ver))
277 $(info Libgpg-error ...: $(libgpg_error_ver))
278 $(info Npth ...........: $(npth_ver))
279 $(info Libgcrypt ......: $(libgcrypt_ver))
280 $(info Libassuan ......: $(libassuan_ver))
281 $(info Zlib ...........: $(zlib_ver))
282 $(info Bzip2 ..........: $(bzip2_ver))
283 $(info ADNS ...........: $(adns_ver))
284 $(info GPGME ..........: $(gpgme_ver))
285 $(info Pinentry .......: $(pinentry_ver))
286 $(info GPA ............: $(gpa_ver))
287 $(info GpgEX.... ......: $(gpgex_ver))
290 # Version number for external packages
291 pkg_config_ver = 0.23
293 gettext_ver = 0.18.2.1
297 gdk_pixbuf_ver = 2.26.5
304 # The GIT repository. Using a local repo is much faster.
305 #gitrep = git://git.gnupg.org
308 # The tarball directories
309 pkgrep = ftp://ftp.gnupg.org/gcrypt
310 pkg10rep = ftp://ftp.g10code.com/g10code
311 pkg2rep = $(TARBALLS)
313 # For each package, the following variables can be defined:
315 # speedo_pkg_PACKAGE_git: The GIT repository that should be built.
316 # speedo_pkg_PACKAGE_gitref: The GIT revision to checkout
318 # speedo_pkg_PACKAGE_tar: URL to the tar file that should be built.
320 # Exactly one of the above variables is required. Note that this
321 # version of speedo does not cache repositories or tar files, and does
322 # not test the integrity of the downloaded software. If you care
323 # about this, you can also specify filenames to locally verified files.
324 # Filenames are differentiated from URLs by starting with a slash '/'.
326 # speedo_pkg_PACKAGE_configure: Extra arguments to configure.
328 # speedo_pkg_PACKAGE_make_args: Extra arguments to make.
330 # speedo_pkg_PACKAGE_make_args_inst: Extra arguments to make install.
332 # Note that you can override the defaults in this file in a local file
336 else ifeq ($(WHAT),git)
337 speedo_pkg_libgpg_error_git = $(gitrep)/libgpg-error
338 speedo_pkg_libgpg_error_gitref = master
339 speedo_pkg_npth_git = $(gitrep)/npth
340 speedo_pkg_npth_gitref = master
341 speedo_pkg_libassuan_git = $(gitrep)/libassuan
342 speedo_pkg_libassuan_gitref = master
343 speedo_pkg_libgcrypt_git = $(gitrep)/libgcrypt
344 speedo_pkg_libgcrypt_gitref = master
345 speedo_pkg_libksba_git = $(gitrep)/libksba
346 speedo_pkg_libksba_gitref = master
347 speedo_pkg_gpgme_git = $(gitrep)/gpgme
348 speedo_pkg_gpgme_gitref = master
349 speedo_pkg_pinentry_git = $(gitrep)/pinentry
350 speedo_pkg_pinentry_gitref = master
351 speedo_pkg_gpa_git = $(gitrep)/gpa
352 speedo_pkg_gpa_gitref = master
353 speedo_pkg_gpgex_git = $(gitrep)/gpgex
354 speedo_pkg_gpgex_gitref = master
355 else ifeq ($(WHAT),release)
356 speedo_pkg_libgpg_error_tar = \
357 $(pkgrep)/libgpg-error/libgpg-error-$(libgpg_error_ver).tar.bz2
358 speedo_pkg_npth_tar = \
359 $(pkgrep)/npth/npth-$(npth_ver).tar.bz2
360 speedo_pkg_libassuan_tar = \
361 $(pkgrep)/libassuan/libassuan-$(libassuan_ver).tar.bz2
362 speedo_pkg_libgcrypt_tar = \
363 $(pkgrep)/libgcrypt/libgcrypt-$(libgcrypt_ver).tar.bz2
364 speedo_pkg_libksba_tar = \
365 $(pkgrep)/libksba/libksba-$(libksba_ver).tar.bz2
366 speedo_pkg_gpgme_tar = \
367 $(pkgrep)/gpgme/gpgme-$(gpgme_ver).tar.bz2
368 speedo_pkg_pinentry_tar = \
369 $(pkgrep)/pinentry/pinentry-$(pinentry_ver).tar.bz2
370 speedo_pkg_gpa_tar = \
371 $(pkgrep)/gpa/gpa-$(gpa_ver).tar.bz2
372 speedo_pkg_gpgex_tar = \
373 $(pkg10rep)/gpgex/gpgex-$(gpgex_ver).tar.bz2
375 $(error invalid value for WHAT (use on of: git release this))
378 speedo_pkg_pkg_config_tar = $(pkg2rep)/pkg-config-$(pkg_config_ver).tar.gz
379 speedo_pkg_zlib_tar = $(pkgrep)/zlib/zlib-$(zlib_ver).tar.gz
380 speedo_pkg_bzip2_tar = $(pkgrep)/bzip2/bzip2-$(bzip2_ver).tar.gz
381 speedo_pkg_adns_tar = $(pkg10rep)/adns/adns-$(adns_ver).tar.bz2
382 speedo_pkg_libiconv_tar = $(pkg2rep)/libiconv-$(libiconv_ver).tar.gz
383 speedo_pkg_gettext_tar = $(pkg2rep)/gettext-$(gettext_ver).tar.gz
384 speedo_pkg_libffi_tar = $(pkg2rep)/libffi-$(libffi_ver).tar.gz
385 speedo_pkg_glib_tar = $(pkg2rep)/glib-$(glib_ver).tar.xz
386 speedo_pkg_libpng_tar = $(pkg2rep)/libpng-$(libpng_ver).tar.bz2
387 speedo_pkg_gdk_pixbuf_tar = $(pkg2rep)/gdk-pixbuf-$(gdk_pixbuf_ver).tar.xz
388 speedo_pkg_atk_tar = $(pkg2rep)/atk-$(atk_ver).tar.bz2
389 speedo_pkg_pango_tar = $(pkg2rep)/pango-$(pango_ver).tar.bz2
390 speedo_pkg_pixman_tar = $(pkg2rep)/pixman-$(pixman_ver).tar.gz
391 speedo_pkg_cairo_tar = $(pkg2rep)/cairo-$(cairo_ver).tar.xz
392 speedo_pkg_gtk__tar = $(pkg2rep)/gtk+-$(gtk__ver).tar.xz
396 # Package build options
399 speedo_pkg_libgpg_error_configure = --enable-static
400 speedo_pkg_w64_libgpg_error_configure = --enable-static
402 speedo_pkg_libassuan_configure = --enable-static
403 speedo_pkg_w64_libassuan_configure = --enable-static
405 speedo_pkg_libgcrypt_configure = --disable-static
407 speedo_pkg_libksba_configure = --disable-static
409 ifeq ($(TARGETOS),w32)
410 speedo_pkg_gnupg_configure = --enable-gpg2-is-gpg --disable-g13 --disable-ntbtls
412 speedo_pkg_gnupg_configure = --disable-g13
414 speedo_pkg_gnupg_extracflags = -g
416 # Create the version info files only for W32 so that they won't get
417 # installed if for example INSTALL_PREFIX=/usr/local is used.
418 ifeq ($(TARGETOS),w32)
419 define speedo_pkg_gnupg_post_install
421 sed -n 's/.*PACKAGE_VERSION "\(.*\)"/\1/p' config.h >$(idir)/INST_VERSION; \
422 sed -n 's/.*W32INFO_VI_PRODUCTVERSION \(.*\)/\1/p' common/w32info-rc.h \
423 |sed 's/,/./g' >$(idir)/INST_PROD_VERSION )
427 # The LDFLAGS is needed for -lintl for glib.
429 speedo_pkg_gpgme_configure = \
430 --enable-static --enable-w32-glib --disable-w32-qt \
431 --with-gpg-error-prefix=$(idir) \
432 LDFLAGS=-L$(idir)/lib
434 speedo_pkg_gpgme_configure = \
435 --disable-static --disable-w32-glib --disable-w32-qt \
436 --with-gpg-error-prefix=$(idir) \
437 LDFLAGS=-L$(idir)/lib
440 speedo_pkg_pinentry_configure = \
441 --disable-pinentry-qt --disable-pinentry-qt4 --disable-pinentry-gtk \
442 --enable-pinentry-gtk2 \
443 --with-glib-prefix=$(idir) --with-gtk-prefix=$(idir) \
444 CPPFLAGS=-I$(idir)/include \
445 LDFLAGS=-L$(idir)/lib \
446 CXXFLAGS=-static-libstdc++
448 speedo_pkg_gpa_configure = \
449 --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
450 --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
451 --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
453 speedo_pkg_gpgex_configure = \
454 --with-gpg-error-prefix=$(idir) \
455 --with-libassuan-prefix=$(idir) \
458 speedo_pkg_w64_gpgex_configure = \
459 --with-gpg-error-prefix=$(idir6) \
460 --with-libassuan-prefix=$(idir6) \
468 ifeq ($(TARGETOS),w32)
469 speedo_pkg_zlib_make_args = \
470 -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
472 speedo_pkg_zlib_make_args_inst = \
473 -fwin32/Makefile.gcc \
474 BINARY_PATH=$(idir)/bin INCLUDE_PATH=$(idir)/include \
475 LIBRARY_PATH=$(idir)/lib SHARED_MODE=1 IMPLIB=libz.dll.a
477 # Zlib needs some special magic to generate a libtool file.
478 # We also install the pc file here.
479 define speedo_pkg_zlib_post_install
480 (set -e; mkdir $(idir)/lib/pkgconfig || true; \
481 cp $(auxsrc)/zlib.pc $(idir)/lib/pkgconfig/; \
483 echo "# Generated by libtool" > lib/libz.la \
484 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la; \
485 echo "library_names='libz.dll.a'" >> lib/libz.la; \
486 echo "old_library='libz.a'" >> lib/libz.la; \
487 echo "dependency_libs=''" >> lib/libz.la; \
488 echo "current=1" >> lib/libz.la; \
489 echo "age=2" >> lib/libz.la; \
490 echo "revision=5" >> lib/libz.la; \
491 echo "installed=yes" >> lib/libz.la; \
492 echo "shouldnotlink=no" >> lib/libz.la; \
493 echo "dlopen=''" >> lib/libz.la; \
494 echo "dlpreopen=''" >> lib/libz.la; \
495 echo "libdir=\"$(idir)/lib\"" >> lib/libz.la)
500 ifeq ($(TARGETOS),w32)
501 speedo_pkg_bzip2_make_args = \
502 CC="$(host)-gcc" AR="$(host)-ar" RANLIB="$(host)-ranlib"
504 speedo_pkg_bzip2_make_args_inst = \
505 PREFIX=$(idir) CC="$(host)-gcc" AR="$(host)-ar" RANLIB="$(host)-ranlib"
508 speedo_pkg_w64_libiconv_configure = \
509 --enable-shared=no --enable-static=yes
511 speedo_pkg_gettext_configure = \
512 --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
513 CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
514 speedo_pkg_w64_gettext_configure = \
515 --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
516 CPPFLAGS=-I$(idir6)/include LDFLAGS=-L$(idir6)/lib
517 speedo_pkg_gettext_extracflags = -O2
518 # We only need gettext-runtime and there is sadly no top level
519 # configure option for this
520 speedo_pkg_gettext_make_dir = gettext-runtime
523 speedo_pkg_glib_configure = \
524 --disable-modular-tests \
525 --with-libiconv=gnu \
526 CPPFLAGS=-I$(idir)/include \
527 LDFLAGS=-L$(idir)/lib \
529 LIBFFI_CFLAGS=-I$(idir)/lib/libffi-$(libffi_ver)/include \
530 LIBFFI_LIBS=\"-L$(idir)/lib -lffi\"
531 ifeq ($(TARGETOS),w32)
532 speedo_pkg_glib_extracflags = -march=i486
535 ifeq ($(TARGETOS),w32)
536 speedo_pkg_libpng_configure = \
537 CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" \
538 LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\"
540 speedo_pkg_libpng_configure = \
541 CPPFLAGS=\"-I$(idir)/include\" \
542 LDFLAGS=\"-L$(idir)/lib\"
545 ifneq ($(TARGETOS),w32)
546 speedo_pkg_gdk_pixbuf_configure = --without-libtiff --without-libjpeg
549 speedo_pkg_pixman_configure = \
550 CPPFLAGS=-I$(idir)/include \
551 LDFLAGS=-L$(idir)/lib
553 ifeq ($(TARGETOS),w32)
554 speedo_pkg_cairo_configure = \
555 --disable-qt --disable-ft --disable-fc \
556 --enable-win32 --enable-win32-font \
557 CPPFLAGS=-I$(idir)/include \
558 LDFLAGS=-L$(idir)/lib
560 speedo_pkg_cairo_configure = \
562 CPPFLAGS=-I$(idir)/include \
563 LDFLAGS=-L$(idir)/lib
566 speedo_pkg_pango_configure = \
568 CPPFLAGS=-I$(idir)/include \
569 LDFLAGS=-L$(idir)/lib
571 speedo_pkg_gtk__configure = \
573 CPPFLAGS=-I$(idir)/include \
574 LDFLAGS=-L$(idir)/lib
581 report: report-speedo
585 ifeq ($(TARGETOS),w32)
586 STRIP = i686-w64-mingw32-strip
590 W32CC = i686-w64-mingw32-gcc
595 # The generic speedo code
600 SHA1SUM := $(shell $(topsrc)/build-aux/getswdb.sh --find-sha1sum)
601 ifeq ($(SHA1SUM),false)
602 $(error The sha1sum tool is missing)
606 BUILD_ISODATE=$(shell date -u +%Y-%m-%d)
607 BUILD_DATESTR=$(subst -,,$(BUILD_ISODATE))
609 # The next two macros will work only after gnupg has been build.
610 ifeq ($(TARGETOS),w32)
611 INST_VERSION=$(shell head -1 $(idir)/INST_VERSION)
612 INST_PROD_VERSION=$(shell head -1 $(idir)/INST_PROD_VERSION)
616 speedo_build_list = $(speedo_spkgs)
617 speedo_w64_build_list = $(speedo_w64_spkgs)
619 # To avoid running external commands during the read phase (":=" style
620 # assignments), we check that the targetos has been given
623 # Determine build and host system
624 build := $(shell $(topsrc)/autogen.sh --silent --print-build)
625 ifeq ($(TARGETOS),w32)
626 speedo_autogen_buildopt := --build-w32
627 speedo_autogen_buildopt6 := --build-w64
628 host := $(shell $(topsrc)/autogen.sh --silent --print-host --build-w32)
629 host6:= $(shell $(topsrc)/autogen.sh --silent --print-host --build-w64)
630 speedo_host_build_option := --host=$(host) --build=$(build)
631 speedo_host_build_option6 := --host=$(host6) --build=$(build)
632 speedo_w32_cflags := -mms-bitfields
634 speedo_autogen_buildopt :=
636 speedo_host_build_option :=
643 speedo_makeopt=-j$(MAKE_J)
646 # End non-empty TARGETOS
651 # The playground area is our scratch area, where we unpack, build and
652 # install the packages.
653 $(stampdir)/stamp-directories:
654 $(MKDIR) $(root) || true
655 $(MKDIR) $(stampdir) || true
656 $(MKDIR) $(sdir) || true
657 $(MKDIR) $(bdir) || true
658 $(MKDIR) $(idir) || true
659 ifeq ($(TARGETOS),w32)
660 $(MKDIR) $(bdir6) || true
661 $(MKDIR) $(idir6) || true
663 touch $(stampdir)/stamp-directories
665 # Frob the name $1 by converting all '-' and '+' characters to '_'.
667 $(subst +,_,$(subst -,_,$(1)))
670 # Get the variable $(1) (which may contain '-' and '+' characters).
672 $($(call FROB_macro,$(1)))
675 # Set a couple of common variables.
678 git="$(call GETVAR,speedo_pkg_$(1)_git)"; \
679 gitref="$(call GETVAR,speedo_pkg_$(1)_gitref)"; \
680 tar="$(call GETVAR,speedo_pkg_$(1)_tar)"; \
681 sha1="$(call GETVAR,$(1)_sha1)"; \
682 pkgsdir="$(sdir)/$(1)"; \
683 if [ "$(1)" = "gnupg" ]; then \
687 pkgsdir="$(topsrc)"; \
689 pkgbdir="$(bdir)/$(1)"; \
690 pkgcfg="$(call GETVAR,speedo_pkg_$(1)_configure)"; \
691 tmp="$(speedo_w32_cflags) \
692 $(call GETVAR,speedo_pkg_$(1)_extracflags)"; \
693 if [ x$$$$(echo "$$$$tmp" | tr -d '[:space:]')x != xx ]; then \
694 pkgextracflags="CFLAGS=\"$$$$tmp\""; \
698 pkgmkdir="$(call GETVAR,speedo_pkg_$(1)_make_dir)"; \
699 pkgmkargs="$(call GETVAR,speedo_pkg_$(1)_make_args)"; \
700 pkgmkargs_inst="$(call GETVAR,speedo_pkg_$(1)_make_args_inst)"; \
701 pkgmkargs_uninst="$(call GETVAR,speedo_pkg_$(1)_make_args_uninst)"; \
702 export PKG_CONFIG="/usr/bin/pkg-config"; \
703 export PKG_CONFIG_PATH="$(idir)/lib/pkgconfig"; \
704 [ "$(TARGETOS)" != native ] && export PKG_CONFIG_LIBDIR=""; \
705 export SYSROOT="$(idir)"; \
706 export PATH="$(idir)/bin:$${PATH}"; \
707 export LD_LIBRARY_PATH="$(idir)/lib:$${LD_LIBRARY_PATH}"
712 git="$(call GETVAR,speedo_pkg_$(1)_git)"; \
713 gitref="$(call GETVAR,speedo_pkg_$(1)_gitref)"; \
714 tar="$(call GETVAR,speedo_pkg_$(1)_tar)"; \
715 sha1="$(call GETVAR,$(1)_sha1)"; \
716 pkgsdir="$(sdir)/$(1)"; \
717 if [ "$(1)" = "gnupg" ]; then \
721 pkgsdir="$(topsrc)"; \
723 pkgbdir="$(bdir6)/$(1)"; \
724 pkgcfg="$(call GETVAR,speedo_pkg_w64_$(1)_configure)"; \
725 tmp="$(speedo_w32_cflags) \
726 $(call GETVAR,speedo_pkg_$(1)_extracflags)"; \
727 if [ x$$$$(echo "$$$$tmp" | tr -d '[:space:]')x != xx ]; then \
728 pkgextracflags="CFLAGS=\"$$$$tmp\""; \
732 pkgmkdir="$(call GETVAR,speedo_pkg_$(1)_make_dir)"; \
733 pkgmkargs="$(call GETVAR,speedo_pkg_$(1)_make_args)"; \
734 pkgmkargs_inst="$(call GETVAR,speedo_pkg_$(1)_make_args_inst)"; \
735 pkgmkargs_uninst="$(call GETVAR,speedo_pkg_$(1)_make_args_uninst)"; \
736 export PKG_CONFIG="/usr/bin/pkg-config"; \
737 export PKG_CONFIG_PATH="$(idir6)/lib/pkgconfig"; \
738 [ "$(TARGETOS)" != native ] && export PKG_CONFIG_LIBDIR=""; \
739 export SYSROOT="$(idir6)"; \
740 export PATH="$(idir6)/bin:$${PATH}"; \
741 export LD_LIBRARY_PATH="$(idir6)/lib:$${LD_LIBRARY_PATH}"
745 # Template for source packages.
747 # Note that the gnupg package is special: The package source dir is
748 # the same as the topsrc dir and thus we need to detect the gnupg
749 # package and cd to that directory. We also test that no in-source build
750 # has been done. autogen.sh is not run for gnupg.
754 $(stampdir)/stamp-$(1)-00-unpack: $(stampdir)/stamp-directories
756 @echo "speedo: * $(1)"
758 @(set -e; cd $(sdir); \
759 $(call SETVARS,$(1)); \
760 if [ "$(WHAT)" = "this" ]; then \
761 echo "speedo: using included source"; \
762 elif [ "$(1)" = "gnupg" ]; then \
764 if [ -f config.log ]; then \
765 echo "GnuPG has already been build in-source" >&2 ;\
766 echo "Please run \"make distclean\" and retry" >&2 ;\
769 echo "speedo: unpacking gnupg not needed"; \
770 elif [ -n "$$$${git}" ]; then \
771 echo "speedo: unpacking $(1) from $$$${git}:$$$${gitref}"; \
772 git clone -b "$$$${gitref}" "$$$${git}" "$$$${pkg}"; \
774 AUTOGEN_SH_SILENT=1 ./autogen.sh; \
775 elif [ -n "$$$${tar}" ]; then \
776 echo "speedo: unpacking $(1) from $$$${tar}"; \
777 case "$$$${tar}" in \
778 *.gz) pretar=zcat ;; \
779 *.bz2) pretar=bzcat ;; \
780 *.xz) pretar=xzcat ;; \
783 [ -f tmp.tgz ] && rm tmp.tgz; \
784 case "$$$${tar}" in \
785 /*) $$$${pretar} < $$$${tar} | tar xf - ;; \
786 *) wget -q -O - $$$${tar} | tee tmp.tgz \
787 | $$$${pretar} | tar x$$$${opt}f - ;; \
789 if [ -f tmp.tgz ]; then \
790 if [ -n "$$$${sha1}" ]; then \
791 tmp=$$$$($(SHA1SUM) <tmp.tgz|cut -d' ' -f1);\
792 if [ "$$$${tmp}" != "$$$${sha1}" ]; then \
794 echo "speedo: ERROR: checksum mismatch for $(1)";\
800 echo "speedo: Warning: No checksum known for $(1)";\
805 base=`echo "$$$${tar}" | sed -e 's,^.*/,,' \
806 | sed -e 's,\.tar.*$$$$,,'`; \
807 mv $$$${base} $(1); \
808 patch="$(patdir)/$(1)-$$$${base#$(1)-}.patch";\
809 if [ -x "$$$${patch}" ]; then \
810 echo "speedo: applying patch $$$${patch}"; \
811 cd $(1); "$$$${patch}"; \
812 elif [ -f "$$$${patch}" ]; then \
813 echo "speedo: warning: $$$${patch} is not executable"; \
816 echo "speedo: unpacking $(1) from UNKNOWN"; \
818 @touch $(stampdir)/stamp-$(1)-00-unpack
820 $(stampdir)/stamp-$(1)-01-configure: $(stampdir)/stamp-$(1)-00-unpack
821 @echo "speedo: configuring $(1)"
822 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
823 @echo "speedo: configure run not required"
824 else ifneq ($(findstring $(1),$(speedo_gnupg_style)),)
825 @($(call SETVARS,$(1)); \
826 mkdir "$$$${pkgbdir}"; \
827 cd "$$$${pkgbdir}"; \
828 if [ -n "$(speedo_autogen_buildopt)" ]; then \
829 eval AUTOGEN_SH_SILENT=1 w32root="$(idir)" \
830 "$$$${pkgsdir}/autogen.sh" \
831 $(speedo_autogen_buildopt) \
832 $$$${pkgcfg} $$$${pkgextracflags}; \
834 eval "$$$${pkgsdir}/configure" \
836 --enable-maintainer-mode \
838 $$$${pkgcfg} $$$${pkgextracflags}; \
841 @($(call SETVARS,$(1)); \
842 mkdir "$$$${pkgbdir}"; \
843 cd "$$$${pkgbdir}"; \
844 eval "$$$${pkgsdir}/configure" \
845 --silent $(speedo_host_build_option) \
847 $$$${pkgcfg} $$$${pkgextracflags}; \
850 @touch $(stampdir)/stamp-$(1)-01-configure
852 # Note that unpack has no 64 bit version becuase it is just the source.
853 # Fixme: We should use templates to create the standard and w64
854 # version of these rules.
855 $(stampdir)/stamp-w64-$(1)-01-configure: $(stampdir)/stamp-$(1)-00-unpack
856 @echo "speedo: configuring $(1) (64 bit)"
857 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
858 @echo "speedo: configure run not required"
859 else ifneq ($(findstring $(1),$(speedo_gnupg_style)),)
860 @($(call SETVARS_W64,$(1)); \
861 mkdir "$$$${pkgbdir}"; \
862 cd "$$$${pkgbdir}"; \
863 if [ -n "$(speedo_autogen_buildopt)" ]; then \
864 eval AUTOGEN_SH_SILENT=1 w64root="$(idir6)" \
865 "$$$${pkgsdir}/autogen.sh" \
866 $(speedo_autogen_buildopt6) \
867 $$$${pkgcfg} $$$${pkgextracflags}; \
869 eval "$$$${pkgsdir}/configure" \
871 --enable-maintainer-mode \
872 --prefix="$(idir6)" \
873 $$$${pkgcfg} $$$${pkgextracflags}; \
876 @($(call SETVARS_W64,$(1)); \
877 mkdir "$$$${pkgbdir}"; \
878 cd "$$$${pkgbdir}"; \
879 eval "$$$${pkgsdir}/configure" \
880 --silent $(speedo_host_build_option6) \
881 --prefix="$(idir6)" \
882 $$$${pkgcfg} $$$${pkgextracflags}; \
885 @touch $(stampdir)/stamp-w64-$(1)-01-configure
888 $(stampdir)/stamp-$(1)-02-make: $(stampdir)/stamp-$(1)-01-configure
889 @echo "speedo: making $(1)"
890 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
891 @($(call SETVARS,$(1)); \
892 cd "$$$${pkgsdir}"; \
893 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
894 if test "$$$${pkg}" = zlib -a "$(TARGETOS)" != w32 ; then \
895 ./configure --prefix="$(idir)" ; \
897 $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
899 @($(call SETVARS,$(1)); \
900 cd "$$$${pkgbdir}"; \
901 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
902 $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
904 @touch $(stampdir)/stamp-$(1)-02-make
906 $(stampdir)/stamp-w64-$(1)-02-make: $(stampdir)/stamp-w64-$(1)-01-configure
907 @echo "speedo: making $(1) (64 bit)"
908 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
909 @($(call SETVARS_W64,$(1)); \
910 cd "$$$${pkgsdir}"; \
911 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
912 $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
914 @($(call SETVARS_W64,$(1)); \
915 cd "$$$${pkgbdir}"; \
916 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
917 $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
919 @touch $(stampdir)/stamp-w64-$(1)-02-make
921 # Note that post_install must come last because it may be empty and
922 # "; ;" is a syntax error.
923 $(stampdir)/stamp-$(1)-03-install: $(stampdir)/stamp-$(1)-02-make
924 @echo "speedo: installing $(1)"
925 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
926 @($(call SETVARS,$(1)); \
927 cd "$$$${pkgsdir}"; \
928 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
929 $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install V=0;\
930 $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
932 @($(call SETVARS,$(1)); \
933 cd "$$$${pkgbdir}"; \
934 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
935 $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install-strip V=0;\
936 $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
938 touch $(stampdir)/stamp-$(1)-03-install
940 $(stampdir)/stamp-w64-$(1)-03-install: $(stampdir)/stamp-w64-$(1)-02-make
941 @echo "speedo: installing $(1) (64 bit)"
942 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
943 @($(call SETVARS_W64,$(1)); \
944 cd "$$$${pkgsdir}"; \
945 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
946 $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install V=0;\
947 $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
949 @($(call SETVARS_W64,$(1)); \
950 cd "$$$${pkgbdir}"; \
951 test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
952 $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install-strip V=0;\
953 $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
955 touch $(stampdir)/stamp-w64-$(1)-03-install
957 $(stampdir)/stamp-final-$(1): $(stampdir)/stamp-$(1)-03-install
958 @echo "speedo: $(1) done"
959 @touch $(stampdir)/stamp-final-$(1)
961 $(stampdir)/stamp-w64-final-$(1): $(stampdir)/stamp-w64-$(1)-03-install
962 @echo "speedo: $(1) (64 bit) done"
963 @touch $(stampdir)/stamp-w64-final-$(1)
967 @echo "speedo: uninstalling $(1)"
968 @($(call SETVARS,$(1)); \
969 (cd "$$$${pkgbdir}" 2>/dev/null && \
970 $(MAKE) --no-print-directory \
971 $$$${pkgmkargs_uninst} uninstall V=0 ) || true;\
972 if [ "$(1)" = "gnupg" ]; then \
973 rm -fR "$$$${pkgbdir}" || true ;\
975 rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}" || true;\
977 -rm -f $(stampdir)/stamp-final-$(1) $(stampdir)/stamp-$(1)-*
981 build-$(1): $(stampdir)/stamp-final-$(1)
986 @($(call SETVARS,$(1)); \
988 if [ -n "$$$${git}" ]; then \
989 if [ -e "$$$${pkgsdir}/.git" ]; then \
990 cd "$$$${pkgsdir}" && \
995 elif [ -n "$$$${tar}" ]; then \
996 base=`echo "$$$${tar}" | sed -e 's,^.*/,,' \
997 | sed -e 's,\.tar.*$$$$,,'`; \
1004 # Insert the template for each source package.
1005 $(foreach spkg, $(speedo_spkgs), $(eval $(call SPKG_template,$(spkg))))
1007 $(stampdir)/stamp-final: $(stampdir)/stamp-directories
1008 ifeq ($(TARGETOS),w32)
1009 $(stampdir)/stamp-final: $(addprefix $(stampdir)/stamp-w64-final-,$(speedo_w64_build_list))
1011 $(stampdir)/stamp-final: $(addprefix $(stampdir)/stamp-final-,$(speedo_build_list))
1012 touch $(stampdir)/stamp-final
1014 all-speedo: $(stampdir)/stamp-final
1016 report-speedo: $(addprefix report-,$(speedo_build_list))
1018 # Just to check if we catched all stamps.
1020 $(RM) -fR $(stampdir)
1030 ifeq ($(TARGETOS),w32)
1033 for i in 00 01 02 03; do sleep 1;touch PLAY/stamps/stamp-*-${i}-*;done
1035 tarname="$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).tar" ;\
1036 [ -f "$$tarname" ] && rm "$$tarname" ;\
1037 tar -C $(topsrc) -cf "$$tarname" --exclude-backups --exclude-vc \
1038 --transform='s,^\./,$(INST_NAME)-$(INST_VERSION)/,' \
1039 --anchored --exclude './PLAY' . ;\
1040 tar --totals -rf "$$tarname" --exclude-backups --exclude-vc \
1041 --transform='s,^,$(INST_NAME)-$(INST_VERSION)/,' \
1042 PLAY/stamps/stamp-*-00-unpack PLAY/src ;\
1047 # Extract the two latest news entries. */
1048 $(bdir)/NEWS.tmp: $(topsrc)/NEWS
1049 awk '/^Notewo/ {if(okay>1){exit}; okay++};okay {print $0}' \
1050 <$(topsrc)/NEWS >$(bdir)/NEWS.tmp
1052 $(bdir)/README.txt: $(bdir)/NEWS.tmp $(topsrc)/README $(w32src)/README.txt \
1053 $(w32src)/pkg-copyright.txt
1055 -e '/!NEWSFILE!/{r $(bdir)/NEWS.tmp' -e 'd;}' \
1056 -e '/!GNUPGREADME!/{r $(topsrc)/README' -e 'd;}' \
1057 -e '/!PKG-COPYRIGHT!/{r $(w32src)/pkg-copyright.txt' -e 'd;}' \
1058 -e 's,!VERSION!,$(INST_VERSION),g' \
1059 < $(w32src)/README.txt \
1061 | awk '{printf "%s\r\n", $$0}' >$(bdir)/README.txt
1063 $(bdir)/g4wihelp.dll: $(w32src)/g4wihelp.c $(w32src)/exdll.h
1064 (set -e; cd $(bdir); \
1065 $(W32CC) -I. -shared -O2 -o g4wihelp.dll $(w32src)/g4wihelp.c \
1067 $(STRIP) g4wihelp.dll)
1069 w32_insthelpers: $(bdir)/g4wihelp.dll
1071 $(bdir)/inst-options.ini: $(w32src)/inst-options.ini
1072 cat $(w32src)/inst-options.ini >$(bdir)/inst-options.ini
1074 extra_installer_options =
1075 ifeq ($(WITH_GUI),1)
1076 extra_installer_options += -DWITH_GUI=1
1079 installer: all w32_insthelpers $(w32src)/inst-options.ini $(bdir)/README.txt
1081 -DINST_DIR=$(idir) \
1082 -DINST6_DIR=$(idir6) \
1083 -DBUILD_DIR=$(bdir) \
1084 -DTOP_SRCDIR=$(topsrc) \
1085 -DW32_SRCDIR=$(w32src) \
1086 -DBUILD_ISODATE=$(BUILD_ISODATE) \
1087 -DBUILD_DATESTR=$(BUILD_DATESTR) \
1088 -DNAME=$(INST_NAME) \
1089 -DVERSION=$(INST_VERSION) \
1090 -DPROD_VERSION=$(INST_PROD_VERSION) \
1091 $(extra_installer_options) $(w32src)/inst.nsi
1092 @echo "Ready: $(idir)/$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).exe"
1099 # Check availibility of standard tools
1105 # Mark phony targets
1107 .PHONY: all all-speedo report-speedo clean-stamps clean-speedo installer \
1108 w32_insthelpers check-tools