speedo,w32: Disable FLTK pinentry.
[gnupg.git] / build-aux / speedo.mk
1 # speedo.mk - Speedo rebuilds speedily.
2 # Copyright (C) 2008, 2014 g10 Code GmbH
3 #
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.
8 #
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.
13 #
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/>.
16
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:
21 #
22 #   make -f speedo.mk all  pkg2rep=/dir/with/tarballs
23 # or
24 #   make -f speedo.mk
25 #
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.
29 #
30 #   make -f speedo.mk clean
31 # or
32 #   make -f speedo.mk clean-PACKAGE
33 #
34 # Removes all packages or the package PACKAGE from the installation
35 # and build tree.  A subsequent make will rebuild these (and only
36 # these) packages.
37 #
38 #   make -f speedo.mk report
39 # or
40 #   make -f speedo.mk report-PACKAGE
41 #
42 # Lists packages and versions.
43 #
44
45 # We need to know our own name.
46 SPEEDO_MK := $(realpath $(lastword $(MAKEFILE_LIST)))
47
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
51
52 help:
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'
60         @echo '  w32-release        Build a Windows release'
61         @echo '  w32-sign-installer Sign the installer'
62         @echo
63         @echo 'You may append INSTALL_PREFIX=<dir> for native builds.'
64         @echo 'Prepend TARGET with "git-" to build from GIT repos.'
65         @echo 'Prepend TARGET with "this-" to build from the source tarball.'
66         @echo 'Use SELFCHECK=0 for a non-released version.'
67         @echo 'Use CUSTOM_SWDB=1 for an already downloaded swdb.lst.'
68
69 SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1
70
71 native: check-tools
72         $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=0 all
73
74 git-native: check-tools
75         $(SPEEDOMAKE) TARGETOS=native WHAT=git     WITH_GUI=0 all
76
77 this-native: check-tools
78         $(SPEEDOMAKE) TARGETOS=native WHAT=this    WITH_GUI=0 all
79
80 native-gui: check-tools
81         $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=1 all
82
83 git-native-gui: check-tools
84         $(SPEEDOMAKE) TARGETOS=native WHAT=git     WITH_GUI=1 all
85
86 this-native-gui: check-tools
87         $(SPEEDOMAKE) TARGETOS=native WHAT=this    WITH_GUI=1 all
88
89 w32-installer: check-tools
90         $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=0 installer
91
92 git-w32-installer: check-tools
93         $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 installer
94
95 this-w32-installer: check-tools
96         $(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=0 \
97                                                    CUSTOM_SWDB=1 installer
98
99 w32-source: check-tools
100         $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=0 dist-source
101
102 git-w32-source: check-tools
103         $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 dist-source
104
105 this-w32-source: check-tools
106         $(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=0 \
107                                                    CUSTOM_SWDB=1 dist-source
108
109 w32-release: check-tools
110         $(SPEEDOMAKE) TARGETOS=w32 WHAT=release    WITH_GUI=0 SELFCHECK=0 \
111                                                    installer-from-source
112
113 w32-sign-installer: check-tools
114         $(SPEEDOMAKE) TARGETOS=w32 WHAT=release    WITH_GUI=0 SELFCHECK=0 \
115                                                    sign-installer
116
117 w32-release-offline: check-tools
118         $(SPEEDOMAKE) TARGETOS=w32 WHAT=release    WITH_GUI=0 SELFCHECK=0 \
119           CUSTOM_SWDB=1 pkgrep=${HOME}/b pkg10rep=${HOME}/b  \
120           installer-from-source
121
122
123 # Set this to "git" to build from git,
124 #          to "release" from tarballs,
125 #          to "this" from the unpacked sources.
126 WHAT=git
127
128 # Set target to "native" or "w32"
129 TARGETOS=
130
131 # Set to 1 to build the GUI tools
132 WITH_GUI=0
133
134 # Set to 1 to use a pre-installed swdb.lst instead of the online version.
135 CUSTOM_SWDB=0
136
137 # Set to 1 to really download the swdb.
138 UPD_SWDB=0
139
140 # Set to 0 to skip the GnuPG version self-check
141 SELFCHECK=1
142
143 # Set to the location of the directory with tarballs of
144 # external packages.
145 TARBALLS=$(shell pwd)/../tarballs
146
147 #  Number of parallel make jobs
148 MAKE_J=3
149
150 # Name to use for the w32 installer and sources
151 INST_NAME=gnupg-w32
152
153 # Use this to override the installaion directory for native builds.
154 INSTALL_PREFIX=none
155
156 # The Authenticode key used to sign the Windows installer
157 AUTHENTICODE_KEY=${HOME}/.gnupg/g10code-authenticode-key.p12
158
159
160 # Directory names.
161 # They must be absolute, as we switch directories pretty often.
162 root := $(shell pwd)/PLAY
163 sdir := $(root)/src
164 bdir := $(root)/build
165 bdir6:= $(root)/build-w64
166 ifeq ($(INSTALL_PREFIX),none)
167 idir := $(root)/inst
168 else
169 idir := $(abspath $(INSTALL_PREFIX))
170 endif
171 idir6:= $(root)/inst-w64
172 stampdir := $(root)/stamps
173 topsrc := $(shell cd $(dir $(SPEEDO_MK)).. && pwd)
174 auxsrc := $(topsrc)/build-aux/speedo
175 patdir := $(topsrc)/build-aux/speedo/patches
176 w32src := $(topsrc)/build-aux/speedo/w32
177
178 # =====BEGIN LIST OF PACKAGES=====
179 # The packages that should be built.  The order is also the build order.
180 # Fixme: Do we need to build pkg-config for cross-building?
181
182 speedo_spkgs  = \
183         libgpg-error npth libgcrypt
184
185 ifeq ($(TARGETOS),w32)
186 speedo_spkgs += \
187         zlib bzip2 sqlite
188 ifeq ($(WITH_GUI),1)
189 speedo_spkgs += gettext libiconv
190 endif
191 endif
192
193 speedo_spkgs += \
194         libassuan libksba
195
196 ifeq ($(TARGETOS),w32)
197 speedo_spkgs += \
198         ntbtls
199 endif
200
201 speedo_spkgs += \
202         gnupg
203
204 ifeq ($(TARGETOS),w32)
205 ifeq ($(WITH_GUI),1)
206 speedo_spkgs += \
207         libffi glib pkg-config
208 endif
209 endif
210
211 speedo_spkgs += \
212         gpgme
213
214 ifeq ($(TARGETOS),w32)
215 ifeq ($(WITH_GUI),1)
216 speedo_spkgs += \
217         libpng \
218         gdk-pixbuf atk pixman cairo pango gtk+
219 endif
220 endif
221
222 ifeq ($(TARGETOS),w32)
223
224 speedo_spkgs += pinentry
225 ifeq ($(WITH_GUI),1)
226 speedo_spkgs += gpa gpgex
227 endif
228
229 else
230
231 ifeq ($(WITH_GUI),1)
232 speedo_spkgs += pinentry gpa
233 endif
234
235 endif
236
237
238 # =====END LIST OF PACKAGES=====
239
240
241 # Packages which are additionally build for 64 bit Windows.  They are
242 # only used for gpgex and thus we need to build them only if we want
243 # a full installer.
244 speedo_w64_spkgs  =
245 ifeq ($(WITH_GUI),1)
246 speedo_w64_spkgs += libgpg-error libiconv gettext libassuan gpgex
247 endif
248
249 # Packages which use the gnupg autogen.sh build style
250 speedo_gnupg_style = \
251         libgpg-error npth libgcrypt  \
252         libassuan libksba ntbtls gnupg gpgme \
253         pinentry gpa gpgex
254
255 # Packages which use only make and no build directory
256 speedo_make_only_style = \
257         zlib bzip2
258
259 # Get the content of the software DB.
260 ifeq ($(CUSTOM_SWDB),1)
261 getswdb_options = --skip-download --skip-verify
262 else
263 getswdb_options =
264 endif
265 ifeq ($(SELFCHECK),0)
266 getswdb_options += --skip-selfcheck
267 endif
268 ifeq ($(UPD_SWDB),1)
269 SWDB := $(shell $(topsrc)/build-aux/getswdb.sh $(getswdb_options) && echo okay)
270 ifeq ($(strip $(SWDB)),)
271 ifneq ($(WHAT),git)
272 $(error Error getting GnuPG software version database)
273 endif
274 endif
275
276 # Version numbers of the released packages
277 gnupg_ver_this = $(shell cat $(topsrc)/VERSION)
278
279 gnupg_ver        := $(shell awk '$$1=="gnupg22_ver" {print $$2}' swdb.lst)
280
281 libgpg_error_ver := $(shell awk '$$1=="libgpg_error_ver" {print $$2}' swdb.lst)
282 libgpg_error_sha1:= $(shell awk '$$1=="libgpg_error_sha1" {print $$2}' swdb.lst)
283 libgpg_error_sha2:= $(shell awk '$$1=="libgpg_error_sha2" {print $$2}' swdb.lst)
284
285 npth_ver  := $(shell awk '$$1=="npth_ver" {print $$2}' swdb.lst)
286 npth_sha1 := $(shell awk '$$1=="npth_sha1" {print $$2}' swdb.lst)
287 npth_sha2 := $(shell awk '$$1=="npth_sha2" {print $$2}' swdb.lst)
288
289 libgcrypt_ver  := $(shell awk '$$1=="libgcrypt_ver" {print $$2}' swdb.lst)
290 libgcrypt_sha1 := $(shell awk '$$1=="libgcrypt_sha1" {print $$2}' swdb.lst)
291 libgcrypt_sha2 := $(shell awk '$$1=="libgcrypt_sha2" {print $$2}' swdb.lst)
292
293 libassuan_ver  := $(shell awk '$$1=="libassuan_ver" {print $$2}' swdb.lst)
294 libassuan_sha1 := $(shell awk '$$1=="libassuan_sha1" {print $$2}' swdb.lst)
295 libassuan_sha2 := $(shell awk '$$1=="libassuan_sha2" {print $$2}' swdb.lst)
296
297 libksba_ver  := $(shell awk '$$1=="libksba_ver" {print $$2}' swdb.lst)
298 libksba_sha1 := $(shell awk '$$1=="libksba_sha1" {print $$2}' swdb.lst)
299 libksba_sha2 := $(shell awk '$$1=="libksba_sha2" {print $$2}' swdb.lst)
300
301 ntbtls_ver  := $(shell awk '$$1=="ntbtls_ver" {print $$2}' swdb.lst)
302 ntbtls_sha1 := $(shell awk '$$1=="ntbtls_sha1" {print $$2}' swdb.lst)
303 ntbtls_sha2 := $(shell awk '$$1=="ntbtls_sha2" {print $$2}' swdb.lst)
304
305 gpgme_ver  := $(shell awk '$$1=="gpgme_ver" {print $$2}' swdb.lst)
306 gpgme_sha1 := $(shell awk '$$1=="gpgme_sha1" {print $$2}' swdb.lst)
307 gpgme_sha2 := $(shell awk '$$1=="gpgme_sha2" {print $$2}' swdb.lst)
308
309 pinentry_ver  := $(shell awk '$$1=="pinentry_ver" {print $$2}' swdb.lst)
310 pinentry_sha1 := $(shell awk '$$1=="pinentry_sha1" {print $$2}' swdb.lst)
311 pinentry_sha2 := $(shell awk '$$1=="pinentry_sha2" {print $$2}' swdb.lst)
312
313 gpa_ver  := $(shell awk '$$1=="gpa_ver" {print $$2}' swdb.lst)
314 gpa_sha1 := $(shell awk '$$1=="gpa_sha1" {print $$2}' swdb.lst)
315 gpa_sha2 := $(shell awk '$$1=="gpa_sha2" {print $$2}' swdb.lst)
316
317 gpgex_ver  := $(shell awk '$$1=="gpgex_ver" {print $$2}' swdb.lst)
318 gpgex_sha1 := $(shell awk '$$1=="gpgex_sha1" {print $$2}' swdb.lst)
319 gpgex_sha2 := $(shell awk '$$1=="gpgex_sha2" {print $$2}' swdb.lst)
320
321 zlib_ver  := $(shell awk '$$1=="zlib_ver" {print $$2}' swdb.lst)
322 zlib_sha1 := $(shell awk '$$1=="zlib_sha1_gz" {print $$2}' swdb.lst)
323 zlib_sha2 := $(shell awk '$$1=="zlib_sha2_gz" {print $$2}' swdb.lst)
324
325 bzip2_ver  := $(shell awk '$$1=="bzip2_ver" {print $$2}' swdb.lst)
326 bzip2_sha1 := $(shell awk '$$1=="bzip2_sha1_gz" {print $$2}' swdb.lst)
327 bzip2_sha2 := $(shell awk '$$1=="bzip2_sha2_gz" {print $$2}' swdb.lst)
328
329 sqlite_ver  := $(shell awk '$$1=="sqlite_ver" {print $$2}' swdb.lst)
330 sqlite_sha1 := $(shell awk '$$1=="sqlite_sha1_gz" {print $$2}' swdb.lst)
331 sqlite_sha2 := $(shell awk '$$1=="sqlite_sha2_gz" {print $$2}' swdb.lst)
332
333
334 $(info Information from the version database)
335 $(info GnuPG ..........: $(gnupg_ver) (building $(gnupg_ver_this)))
336 $(info Libgpg-error ...: $(libgpg_error_ver))
337 $(info Npth ...........: $(npth_ver))
338 $(info Libgcrypt ......: $(libgcrypt_ver))
339 $(info Libassuan ......: $(libassuan_ver))
340 $(info Libksba ........: $(libksba_ver))
341 $(info Zlib ...........: $(zlib_ver))
342 $(info Bzip2 ..........: $(bzip2_ver))
343 $(info SQLite .........: $(sqlite_ver))
344 $(info NtbTLS .. ......: $(ntbtls_ver))
345 $(info GPGME ..........: $(gpgme_ver))
346 $(info Pinentry .......: $(pinentry_ver))
347 $(info GPA ............: $(gpa_ver))
348 $(info GpgEX.... ......: $(gpgex_ver))
349 endif
350
351 # Version number for external packages
352 pkg_config_ver = 0.23
353 libiconv_ver = 1.14
354 gettext_ver = 0.18.2.1
355 libffi_ver = 3.0.13
356 glib_ver = 2.34.3
357 libpng_ver = 1.4.12
358 gdk_pixbuf_ver = 2.26.5
359 atk_ver = 1.32.0
360 pango_ver = 1.29.4
361 pixman_ver = 0.32.4
362 cairo_ver = 1.12.16
363 gtk__ver = 2.24.17
364
365 # The GIT repository.  Using a local repo is much faster.
366 #gitrep = git://git.gnupg.org
367 gitrep = ${HOME}/s
368
369 # The tarball directories
370 pkgrep = ftp://ftp.gnupg.org/gcrypt
371 pkg10rep = ftp://ftp.g10code.com/g10code
372 pkg2rep = $(TARBALLS)
373
374 # For each package, the following variables can be defined:
375 #
376 # speedo_pkg_PACKAGE_git: The GIT repository that should be built.
377 # speedo_pkg_PACKAGE_gitref: The GIT revision to checkout
378 #
379 # speedo_pkg_PACKAGE_tar: URL to the tar file that should be built.
380 #
381 # Exactly one of the above variables is required.  Note that this
382 # version of speedo does not cache repositories or tar files, and does
383 # not test the integrity of the downloaded software.  If you care
384 # about this, you can also specify filenames to locally verified files.
385 # Filenames are differentiated from URLs by starting with a slash '/'.
386 #
387 # speedo_pkg_PACKAGE_configure: Extra arguments to configure.
388 #
389 # speedo_pkg_PACKAGE_make_args: Extra arguments to make.
390 #
391 # speedo_pkg_PACKAGE_make_args_inst: Extra arguments to make install.
392 #
393 # Note that you can override the defaults in this file in a local file
394 # "config.mk"
395
396 ifeq ($(WHAT),this)
397 else ifeq ($(WHAT),git)
398   speedo_pkg_libgpg_error_git = $(gitrep)/libgpg-error
399   speedo_pkg_libgpg_error_gitref = master
400   speedo_pkg_npth_git = $(gitrep)/npth
401   speedo_pkg_npth_gitref = master
402   speedo_pkg_libassuan_git = $(gitrep)/libassuan
403   speedo_pkg_libassuan_gitref = master
404   speedo_pkg_libgcrypt_git = $(gitrep)/libgcrypt
405   speedo_pkg_libgcrypt_gitref = master
406   speedo_pkg_libksba_git = $(gitrep)/libksba
407   speedo_pkg_libksba_gitref = master
408   speedo_pkg_ntbtls_git = $(gitrep)/ntbtls
409   speedo_pkg_ntbtls_gitref = master
410   speedo_pkg_gpgme_git = $(gitrep)/gpgme
411   speedo_pkg_gpgme_gitref = master
412   speedo_pkg_pinentry_git = $(gitrep)/pinentry
413   speedo_pkg_pinentry_gitref = master
414   speedo_pkg_gpa_git = $(gitrep)/gpa
415   speedo_pkg_gpa_gitref = master
416   speedo_pkg_gpgex_git = $(gitrep)/gpgex
417   speedo_pkg_gpgex_gitref = master
418 else ifeq ($(WHAT),release)
419   speedo_pkg_libgpg_error_tar = \
420         $(pkgrep)/libgpg-error/libgpg-error-$(libgpg_error_ver).tar.bz2
421   speedo_pkg_npth_tar = \
422         $(pkgrep)/npth/npth-$(npth_ver).tar.bz2
423   speedo_pkg_libassuan_tar = \
424         $(pkgrep)/libassuan/libassuan-$(libassuan_ver).tar.bz2
425   speedo_pkg_libgcrypt_tar = \
426         $(pkgrep)/libgcrypt/libgcrypt-$(libgcrypt_ver).tar.bz2
427   speedo_pkg_libksba_tar = \
428         $(pkgrep)/libksba/libksba-$(libksba_ver).tar.bz2
429   speedo_pkg_ntbtls_tar = \
430         $(pkgrep)/ntbtls/ntbtls-$(ntbtls_ver).tar.bz2
431   speedo_pkg_gpgme_tar = \
432         $(pkgrep)/gpgme/gpgme-$(gpgme_ver).tar.bz2
433   speedo_pkg_pinentry_tar = \
434         $(pkgrep)/pinentry/pinentry-$(pinentry_ver).tar.bz2
435   speedo_pkg_gpa_tar = \
436         $(pkgrep)/gpa/gpa-$(gpa_ver).tar.bz2
437   speedo_pkg_gpgex_tar = \
438         $(pkg10rep)/gpgex/gpgex-$(gpgex_ver).tar.bz2
439 else
440   $(error invalid value for WHAT (use on of: git release this))
441 endif
442
443 speedo_pkg_pkg_config_tar = $(pkg2rep)/pkg-config-$(pkg_config_ver).tar.gz
444 speedo_pkg_zlib_tar       = $(pkgrep)/zlib/zlib-$(zlib_ver).tar.gz
445 speedo_pkg_bzip2_tar      = $(pkgrep)/bzip2/bzip2-$(bzip2_ver).tar.gz
446 speedo_pkg_sqlite_tar     = $(pkgrep)/sqlite/sqlite-autoconf-$(sqlite_ver).tar.gz
447 speedo_pkg_libiconv_tar   = $(pkg2rep)/libiconv-$(libiconv_ver).tar.gz
448 speedo_pkg_gettext_tar    = $(pkg2rep)/gettext-$(gettext_ver).tar.gz
449 speedo_pkg_libffi_tar     = $(pkg2rep)/libffi-$(libffi_ver).tar.gz
450 speedo_pkg_glib_tar       = $(pkg2rep)/glib-$(glib_ver).tar.xz
451 speedo_pkg_libpng_tar     = $(pkg2rep)/libpng-$(libpng_ver).tar.bz2
452 speedo_pkg_gdk_pixbuf_tar = $(pkg2rep)/gdk-pixbuf-$(gdk_pixbuf_ver).tar.xz
453 speedo_pkg_atk_tar        = $(pkg2rep)/atk-$(atk_ver).tar.bz2
454 speedo_pkg_pango_tar      = $(pkg2rep)/pango-$(pango_ver).tar.bz2
455 speedo_pkg_pixman_tar     = $(pkg2rep)/pixman-$(pixman_ver).tar.gz
456 speedo_pkg_cairo_tar      = $(pkg2rep)/cairo-$(cairo_ver).tar.xz
457 speedo_pkg_gtk__tar       = $(pkg2rep)/gtk+-$(gtk__ver).tar.xz
458
459
460 #
461 # Package build options
462 #
463
464 speedo_pkg_libgpg_error_configure = --enable-static
465 speedo_pkg_w64_libgpg_error_configure = --enable-static
466
467 speedo_pkg_libassuan_configure = --enable-static
468 speedo_pkg_w64_libassuan_configure = --enable-static
469
470 speedo_pkg_libgcrypt_configure = --disable-static
471
472 speedo_pkg_libksba_configure = --disable-static
473
474 # For now we build ntbtls only static
475 speedo_pkg_ntbtls_configure = --enable-static --disable-shared
476
477 ifeq ($(TARGETOS),w32)
478 speedo_pkg_gnupg_configure = \
479         --disable-g13 --enable-ntbtls \
480         --enable-build-timestamp
481 else
482 speedo_pkg_gnupg_configure = --disable-g13
483 endif
484 speedo_pkg_gnupg_extracflags = -g
485
486 # Create the version info files only for W32 so that they won't get
487 # installed if for example INSTALL_PREFIX=/usr/local is used.
488 ifeq ($(TARGETOS),w32)
489 define speedo_pkg_gnupg_post_install
490 (set -e; \
491  sed -n  's/.*PACKAGE_VERSION "\(.*\)"/\1/p' config.h >$(idir)/INST_VERSION; \
492  sed -n  's/.*W32INFO_VI_PRODUCTVERSION \(.*\)/\1/p' common/w32info-rc.h \
493     |sed 's/,/./g' >$(idir)/INST_PROD_VERSION )
494 endef
495 endif
496
497 # The LDFLAGS is needed for -lintl for glib.
498 ifeq ($(WITH_GUI),1)
499 speedo_pkg_gpgme_configure = \
500         --enable-static --enable-w32-glib --disable-w32-qt \
501         --with-gpg-error-prefix=$(idir) \
502         LDFLAGS=-L$(idir)/lib
503 else
504 speedo_pkg_gpgme_configure = \
505         --disable-static --disable-w32-glib --disable-w32-qt \
506         --with-gpg-error-prefix=$(idir) \
507         LDFLAGS=-L$(idir)/lib
508 endif
509
510
511 ifeq ($(TARGETOS),w32)
512 speedo_pkg_pinentry_configure = --disable-pinentry-gtk2
513 else
514 speedo_pkg_pinentry_configure = --enable-pinentry-gtk2
515 endif
516 speedo_pkg_pinentry_configure += \
517         --disable-pinentry-qt5   \
518         --disable-pinentry-qt    \
519         --disable-pinentry-fltk  \
520         --disable-pinentry-tty   \
521         CPPFLAGS=-I$(idir)/include   \
522         LDFLAGS=-L$(idir)/lib        \
523         CXXFLAGS=-static-libstdc++
524
525
526 speedo_pkg_gpa_configure = \
527         --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
528         --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
529         --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
530
531 speedo_pkg_gpgex_configure = \
532         --with-gpg-error-prefix=$(idir) \
533         --with-libassuan-prefix=$(idir) \
534         --enable-gpa-only
535
536 speedo_pkg_w64_gpgex_configure = \
537         --with-gpg-error-prefix=$(idir6) \
538         --with-libassuan-prefix=$(idir6) \
539         --enable-gpa-only
540
541
542 #
543 # External packages
544 #
545
546 ifeq ($(TARGETOS),w32)
547 speedo_pkg_zlib_make_args = \
548         -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
549
550 speedo_pkg_zlib_make_args_inst = \
551         -fwin32/Makefile.gcc \
552         BINARY_PATH=$(idir)/bin INCLUDE_PATH=$(idir)/include \
553         LIBRARY_PATH=$(idir)/lib SHARED_MODE=1 IMPLIB=libz.dll.a
554
555 # Zlib needs some special magic to generate a libtool file.
556 # We also install the pc file here.
557 define speedo_pkg_zlib_post_install
558 (set -e; mkdir $(idir)/lib/pkgconfig || true;           \
559 cp $(auxsrc)/zlib.pc $(idir)/lib/pkgconfig/;            \
560 cd $(idir);                                             \
561 echo "# Generated by libtool" > lib/libz.la             \
562 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
563 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
564 echo "old_library='libz.a'" >> lib/libz.la;             \
565 echo "dependency_libs=''" >> lib/libz.la;               \
566 echo "current=1" >> lib/libz.la;                        \
567 echo "age=2" >> lib/libz.la;                            \
568 echo "revision=5" >> lib/libz.la;                       \
569 echo "installed=yes" >> lib/libz.la;                    \
570 echo "shouldnotlink=no" >> lib/libz.la;                 \
571 echo "dlopen=''" >> lib/libz.la;                        \
572 echo "dlpreopen=''" >> lib/libz.la;                     \
573 echo "libdir=\"$(idir)/lib\"" >> lib/libz.la)
574 endef
575
576 endif
577
578 ifeq ($(TARGETOS),w32)
579 speedo_pkg_bzip2_make_args = \
580         CC="$(host)-gcc" AR="$(host)-ar" RANLIB="$(host)-ranlib"
581
582 speedo_pkg_bzip2_make_args_inst = \
583         PREFIX=$(idir) CC="$(host)-gcc" AR="$(host)-ar" RANLIB="$(host)-ranlib"
584 endif
585
586 speedo_pkg_w64_libiconv_configure = \
587         --enable-shared=no --enable-static=yes
588
589 speedo_pkg_gettext_configure = \
590         --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
591         CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
592 speedo_pkg_w64_gettext_configure = \
593         --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
594         CPPFLAGS=-I$(idir6)/include LDFLAGS=-L$(idir6)/lib
595 speedo_pkg_gettext_extracflags = -O2
596 # We only need gettext-runtime and there is sadly no top level
597 # configure option for this
598 speedo_pkg_gettext_make_dir = gettext-runtime
599
600
601 speedo_pkg_glib_configure = \
602         --disable-modular-tests \
603         --with-libiconv=gnu \
604         CPPFLAGS=-I$(idir)/include \
605         LDFLAGS=-L$(idir)/lib \
606         CCC=$(host)-g++ \
607         LIBFFI_CFLAGS=-I$(idir)/lib/libffi-$(libffi_ver)/include \
608         LIBFFI_LIBS=\"-L$(idir)/lib -lffi\"
609 ifeq ($(TARGETOS),w32)
610 speedo_pkg_glib_extracflags = -march=i486
611 endif
612
613 ifeq ($(TARGETOS),w32)
614 speedo_pkg_libpng_configure = \
615         CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" \
616         LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\"
617 else
618 speedo_pkg_libpng_configure = \
619         CPPFLAGS=\"-I$(idir)/include\" \
620         LDFLAGS=\"-L$(idir)/lib\"
621 endif
622
623 ifneq ($(TARGETOS),w32)
624 speedo_pkg_gdk_pixbuf_configure = --without-libtiff --without-libjpeg
625 endif
626
627 speedo_pkg_pixman_configure = \
628         CPPFLAGS=-I$(idir)/include \
629         LDFLAGS=-L$(idir)/lib
630
631 ifeq ($(TARGETOS),w32)
632 speedo_pkg_cairo_configure = \
633         --disable-qt --disable-ft --disable-fc \
634         --enable-win32 --enable-win32-font \
635         CPPFLAGS=-I$(idir)/include \
636         LDFLAGS=-L$(idir)/lib
637 else
638 speedo_pkg_cairo_configure = \
639         --disable-qt \
640         CPPFLAGS=-I$(idir)/include \
641         LDFLAGS=-L$(idir)/lib
642 endif
643
644 speedo_pkg_pango_configure = \
645         --disable-gtk-doc  \
646         CPPFLAGS=-I$(idir)/include \
647         LDFLAGS=-L$(idir)/lib
648
649 speedo_pkg_gtk__configure = \
650         --disable-cups \
651         CPPFLAGS=-I$(idir)/include \
652         LDFLAGS=-L$(idir)/lib
653
654
655 # ---------
656
657 all: all-speedo
658
659 report: report-speedo
660
661 clean: clean-speedo
662
663 ifeq ($(TARGETOS),w32)
664 STRIP = i686-w64-mingw32-strip
665 else
666 STRIP = strip
667 endif
668 W32CC = i686-w64-mingw32-gcc
669
670 -include config.mk
671
672 #
673 #  The generic speedo code
674 #
675
676 MKDIR=mkdir
677 MAKENSIS=makensis
678 SHA1SUM := $(shell $(topsrc)/build-aux/getswdb.sh --find-sha1sum)
679 ifeq ($(SHA1SUM),false)
680 $(error The sha1sum tool is missing)
681 endif
682 SHA2SUM := $(shell $(topsrc)/build-aux/getswdb.sh --find-sha256sum)
683 ifeq ($(SHA2SUM),false)
684 $(error The sha256sum tool is missing)
685 endif
686
687
688 BUILD_ISODATE=$(shell date -u +%Y-%m-%d)
689 BUILD_DATESTR=$(subst -,,$(BUILD_ISODATE))
690
691 # The next two macros will work only after gnupg has been build.
692 ifeq ($(TARGETOS),w32)
693 INST_VERSION=$(shell head -1 $(idir)/INST_VERSION)
694 INST_PROD_VERSION=$(shell head -1 $(idir)/INST_PROD_VERSION)
695 endif
696
697 # List with packages
698 speedo_build_list = $(speedo_spkgs)
699 speedo_w64_build_list = $(speedo_w64_spkgs)
700
701 # To avoid running external commands during the read phase (":=" style
702 # assignments), we check that the targetos has been given
703 ifneq ($(TARGETOS),)
704
705 # Determine build and host system
706 build := $(shell $(topsrc)/autogen.sh --silent --print-build)
707 ifeq ($(TARGETOS),w32)
708   speedo_autogen_buildopt := --build-w32
709   speedo_autogen_buildopt6 := --build-w64
710   host := $(shell $(topsrc)/autogen.sh --silent --print-host --build-w32)
711   host6:= $(shell $(topsrc)/autogen.sh --silent --print-host --build-w64)
712   speedo_host_build_option := --host=$(host) --build=$(build)
713   speedo_host_build_option6 := --host=$(host6) --build=$(build)
714   speedo_w32_cflags := -mms-bitfields
715 else
716   speedo_autogen_buildopt :=
717   host :=
718   speedo_host_build_option :=
719   speedo_w32_cflags :=
720 endif
721
722 ifeq ($(MAKE_J),)
723   speedo_makeopt=
724 else
725   speedo_makeopt=-j$(MAKE_J)
726 endif
727
728 # End non-empty TARGETOS
729 endif
730
731
732
733 # The playground area is our scratch area, where we unpack, build and
734 # install the packages.
735 $(stampdir)/stamp-directories:
736         $(MKDIR) $(root) || true
737         $(MKDIR) $(stampdir) || true
738         $(MKDIR) $(sdir)  || true
739         $(MKDIR) $(bdir)  || true
740         $(MKDIR) $(idir)   || true
741 ifeq ($(TARGETOS),w32)
742         $(MKDIR) $(bdir6)  || true
743         $(MKDIR) $(idir6)   || true
744 endif
745         touch $(stampdir)/stamp-directories
746
747 # Frob the name $1 by converting all '-' and '+' characters to '_'.
748 define FROB_macro
749 $(subst +,_,$(subst -,_,$(1)))
750 endef
751
752 # Get the variable $(1) (which may contain '-' and '+' characters).
753 define GETVAR
754 $($(call FROB_macro,$(1)))
755 endef
756
757 # Set a couple of common variables.
758 define SETVARS
759         pkg="$(1)";                                                     \
760         git="$(call GETVAR,speedo_pkg_$(1)_git)";                       \
761         gitref="$(call GETVAR,speedo_pkg_$(1)_gitref)";                 \
762         tar="$(call GETVAR,speedo_pkg_$(1)_tar)";                       \
763         ver="$(call GETVAR,$(1)_ver)";                                  \
764         sha2="$(call GETVAR,$(1)_sha2)";                                \
765         sha1="$(call GETVAR,$(1)_sha1)";                                \
766         pkgsdir="$(sdir)/$(1)";                                         \
767         if [ "$(1)" = "gnupg" ]; then                                   \
768           git='';                                                       \
769           gitref='';                                                    \
770           tar='';                                                       \
771           pkgsdir="$(topsrc)";                                          \
772         fi;                                                             \
773         pkgbdir="$(bdir)/$(1)";                                         \
774         pkgcfg="$(call GETVAR,speedo_pkg_$(1)_configure)";              \
775         tmp="$(speedo_w32_cflags)                                       \
776              $(call GETVAR,speedo_pkg_$(1)_extracflags)";               \
777         if [ x$$$$(echo "$$$$tmp" | tr -d '[:space:]')x != xx ]; then   \
778           pkgextracflags="CFLAGS=\"$$$$tmp\"";                          \
779         else                                                            \
780           pkgextracflags=;                                              \
781         fi;                                                             \
782         pkgmkdir="$(call GETVAR,speedo_pkg_$(1)_make_dir)";             \
783         pkgmkargs="$(call GETVAR,speedo_pkg_$(1)_make_args)";           \
784         pkgmkargs_inst="$(call GETVAR,speedo_pkg_$(1)_make_args_inst)"; \
785         pkgmkargs_uninst="$(call GETVAR,speedo_pkg_$(1)_make_args_uninst)"; \
786         export PKG_CONFIG="/usr/bin/pkg-config";                        \
787         export PKG_CONFIG_PATH="$(idir)/lib/pkgconfig";                 \
788         [ "$(TARGETOS)" != native ] && export PKG_CONFIG_LIBDIR="";     \
789         export SYSROOT="$(idir)";                                       \
790         export PATH="$(idir)/bin:$${PATH}";                             \
791         export LD_LIBRARY_PATH="$(idir)/lib:$${LD_LIBRARY_PATH}"
792 endef
793
794 define SETVARS_W64
795         pkg="$(1)";                                                     \
796         git="$(call GETVAR,speedo_pkg_$(1)_git)";                       \
797         gitref="$(call GETVAR,speedo_pkg_$(1)_gitref)";                 \
798         tar="$(call GETVAR,speedo_pkg_$(1)_tar)";                       \
799         ver="$(call GETVAR,$(1)_ver)";                                  \
800         sha2="$(call GETVAR,$(1)_sha2)";                                \
801         sha1="$(call GETVAR,$(1)_sha1)";                                \
802         pkgsdir="$(sdir)/$(1)";                                         \
803         if [ "$(1)" = "gnupg" ]; then                                   \
804           git='';                                                       \
805           gitref='';                                                    \
806           tar='';                                                       \
807           pkgsdir="$(topsrc)";                                          \
808         fi;                                                             \
809         pkgbdir="$(bdir6)/$(1)";                                        \
810         pkgcfg="$(call GETVAR,speedo_pkg_w64_$(1)_configure)";          \
811         tmp="$(speedo_w32_cflags)                                       \
812              $(call GETVAR,speedo_pkg_$(1)_extracflags)";               \
813         if [ x$$$$(echo "$$$$tmp" | tr -d '[:space:]')x != xx ]; then   \
814           pkgextracflags="CFLAGS=\"$$$$tmp\"";                          \
815         else                                                            \
816           pkgextracflags=;                                              \
817         fi;                                                             \
818         pkgmkdir="$(call GETVAR,speedo_pkg_$(1)_make_dir)";             \
819         pkgmkargs="$(call GETVAR,speedo_pkg_$(1)_make_args)";           \
820         pkgmkargs_inst="$(call GETVAR,speedo_pkg_$(1)_make_args_inst)"; \
821         pkgmkargs_uninst="$(call GETVAR,speedo_pkg_$(1)_make_args_uninst)"; \
822         export PKG_CONFIG="/usr/bin/pkg-config";                        \
823         export PKG_CONFIG_PATH="$(idir6)/lib/pkgconfig";                \
824         [ "$(TARGETOS)" != native ] && export PKG_CONFIG_LIBDIR="";     \
825         export SYSROOT="$(idir6)";                                      \
826         export PATH="$(idir6)/bin:$${PATH}";                            \
827         export LD_LIBRARY_PATH="$(idir6)/lib:$${LD_LIBRARY_PATH}"
828 endef
829
830
831 # Template for source packages.
832
833 # Note that the gnupg package is special: The package source dir is
834 # the same as the topsrc dir and thus we need to detect the gnupg
835 # package and cd to that directory.  We also test that no in-source build
836 # has been done.  autogen.sh is not run for gnupg.
837 #
838 define SPKG_template
839
840 $(stampdir)/stamp-$(1)-00-unpack: $(stampdir)/stamp-directories
841         @echo "speedo: /*"
842         @echo "speedo:  *   $(1)"
843         @echo "speedo:  */"
844         @(set -e; cd $(sdir);                           \
845          $(call SETVARS,$(1));                          \
846          if [ "$(WHAT)" = "this" ]; then                \
847            echo "speedo: using included source";        \
848          elif [ "$(1)" = "gnupg" ]; then                \
849            cd $$$${pkgsdir};                            \
850            if [ -f config.log ]; then                   \
851              echo "GnuPG has already been build in-source" >&2  ;\
852              echo "Please run \"make distclean\" and retry" >&2 ;\
853              exit 1 ;                                   \
854            fi;                                          \
855            echo "speedo: unpacking gnupg not needed";   \
856          elif [ -n "$$$${git}" ]; then                  \
857            echo "speedo: unpacking $(1) from $$$${git}:$$$${gitref}"; \
858            git clone -b "$$$${gitref}" "$$$${git}" "$$$${pkg}"; \
859            cd "$$$${pkg}";                              \
860            AUTOGEN_SH_SILENT=1 ./autogen.sh;            \
861          elif [ -n "$$$${tar}" ]; then                  \
862            echo "speedo: unpacking $(1) from $$$${tar}"; \
863            case "$$$${tar}" in                          \
864              *.gz) pretar=zcat ;;                       \
865              *.bz2) pretar=bzcat ;;                     \
866              *.xz) pretar=xzcat ;;                      \
867              *) pretar=cat ;;                           \
868            esac;                                        \
869            [ -f tmp.tgz ] && rm tmp.tgz;                \
870            case "$$$${tar}" in                          \
871              /*) $$$${pretar} < $$$${tar} | tar xf - ;; \
872              *)  wget -q -O - $$$${tar} | tee tmp.tgz   \
873                   | $$$${pretar} | tar x$$$${opt}f - ;; \
874            esac;                                        \
875            if [ -f tmp.tgz ]; then                      \
876              if [ -n "$$$${sha2}" ]; then               \
877                tmp=$$$$($(SHA2SUM) <tmp.tgz|cut -d' ' -f1);\
878                if [ "$$$${tmp}" != "$$$${sha2}" ]; then \
879                  echo "speedo:";                        \
880                  echo "speedo: ERROR: SHA-256 checksum mismatch for $(1)";\
881                  echo "speedo:";                        \
882                  exit 1;                                \
883                fi;                                      \
884              elif [ -n "$$$${sha1}" ]; then            \
885                tmp=$$$$($(SHA1SUM) <tmp.tgz|cut -d' ' -f1);\
886                if [ "$$$${tmp}" != "$$$${sha1}" ]; then \
887                  echo "speedo:";                        \
888                  echo "speedo: ERROR: SHA-1 checksum mismatch for $(1)";\
889                  echo "speedo:";                        \
890                  exit 1;                                \
891                fi;                                      \
892              else                                       \
893                echo "speedo:";                          \
894                echo "speedo: Warning: No checksum known for $(1)";\
895                echo "speedo:";                          \
896              fi;                                        \
897              rm tmp.tgz;                                \
898            fi;                                          \
899            base=`echo "$$$${tar}" | sed -e 's,^.*/,,'   \
900                  | sed -e 's,\.tar.*$$$$,,'`;           \
901            mv $$$${base} $(1);                          \
902            patch="$(patdir)/$(1)-$$$${base#$(1)-}.patch";\
903            patchx="$(patdir)/$(1).patch";               \
904            if [ -x "$$$${patch}" ]; then                \
905              echo "speedo: applying patch $$$${patch}"; \
906              cd $(1); "$$$${patch}";                    \
907            elif [ -x "$$$${patchx}" ]; then             \
908              echo "speedo: applying patch $$$${patchx}";\
909              cd $(1); "$$$${patchx}";                   \
910            elif [ -f "$$$${patch}" ]; then              \
911              echo "speedo: warning: $$$${patch} is not executable"; \
912            fi;                                          \
913          else                                           \
914            echo "speedo: unpacking $(1) from UNKNOWN";  \
915          fi)
916         @touch $(stampdir)/stamp-$(1)-00-unpack
917
918 $(stampdir)/stamp-$(1)-01-configure: $(stampdir)/stamp-$(1)-00-unpack
919         @echo "speedo: configuring $(1)"
920 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
921         @echo "speedo: configure run not required"
922 else ifneq ($(findstring $(1),$(speedo_gnupg_style)),)
923         @($(call SETVARS,$(1));                         \
924          mkdir "$$$${pkgbdir}";                         \
925          cd "$$$${pkgbdir}";                            \
926          if [ -n "$(speedo_autogen_buildopt)" ]; then   \
927             eval AUTOGEN_SH_SILENT=1 w32root="$(idir)"  \
928                "$$$${pkgsdir}/autogen.sh"               \
929                $(speedo_autogen_buildopt)               \
930                $$$${pkgcfg} $$$${pkgextracflags};       \
931          else                                           \
932             eval "$$$${pkgsdir}/configure"              \
933                --silent                                 \
934                --enable-maintainer-mode                 \
935                --prefix="$(idir)"                       \
936                $$$${pkgcfg} $$$${pkgextracflags};       \
937          fi)
938 else
939         @($(call SETVARS,$(1));                         \
940          mkdir "$$$${pkgbdir}";                         \
941          cd "$$$${pkgbdir}";                            \
942          eval "$$$${pkgsdir}/configure"                 \
943              --silent $(speedo_host_build_option)       \
944              --prefix="$(idir)"                         \
945              $$$${pkgcfg}  $$$${pkgextracflags};        \
946          )
947 endif
948         @touch $(stampdir)/stamp-$(1)-01-configure
949
950 # Note that unpack has no 64 bit version becuase it is just the source.
951 # Fixme: We should use templates to create the standard and w64
952 # version of these rules.
953 $(stampdir)/stamp-w64-$(1)-01-configure: $(stampdir)/stamp-$(1)-00-unpack
954         @echo "speedo: configuring $(1) (64 bit)"
955 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
956         @echo "speedo: configure run not required"
957 else ifneq ($(findstring $(1),$(speedo_gnupg_style)),)
958         @($(call SETVARS_W64,$(1));                     \
959          mkdir "$$$${pkgbdir}";                         \
960          cd "$$$${pkgbdir}";                            \
961          if [ -n "$(speedo_autogen_buildopt)" ]; then   \
962             eval AUTOGEN_SH_SILENT=1 w64root="$(idir6)" \
963                "$$$${pkgsdir}/autogen.sh"               \
964                $(speedo_autogen_buildopt6)              \
965                $$$${pkgcfg} $$$${pkgextracflags};       \
966          else                                           \
967             eval "$$$${pkgsdir}/configure"              \
968                --silent                                 \
969                --enable-maintainer-mode                 \
970                --prefix="$(idir6)"                      \
971                $$$${pkgcfg} $$$${pkgextracflags};       \
972          fi)
973 else
974         @($(call SETVARS_W64,$(1));                     \
975          mkdir "$$$${pkgbdir}";                         \
976          cd "$$$${pkgbdir}";                            \
977          eval "$$$${pkgsdir}/configure"                 \
978              --silent $(speedo_host_build_option6)      \
979              --prefix="$(idir6)"                        \
980              $$$${pkgcfg} $$$${pkgextracflags};         \
981          )
982 endif
983         @touch $(stampdir)/stamp-w64-$(1)-01-configure
984
985
986 $(stampdir)/stamp-$(1)-02-make: $(stampdir)/stamp-$(1)-01-configure
987         @echo "speedo: making $(1)"
988 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
989         @($(call SETVARS,$(1));                         \
990           cd "$$$${pkgsdir}";                           \
991           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
992           if test "$$$${pkg}" = zlib -a "$(TARGETOS)" != w32 ; then \
993             ./configure --prefix="$(idir)" ; \
994           fi ;\
995           $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
996 else
997         @($(call SETVARS,$(1));                         \
998           cd "$$$${pkgbdir}";                           \
999           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1000           $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
1001 endif
1002         @touch $(stampdir)/stamp-$(1)-02-make
1003
1004 $(stampdir)/stamp-w64-$(1)-02-make: $(stampdir)/stamp-w64-$(1)-01-configure
1005         @echo "speedo: making $(1) (64 bit)"
1006 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
1007         @($(call SETVARS_W64,$(1));                             \
1008           cd "$$$${pkgsdir}";                           \
1009           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1010           $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
1011 else
1012         @($(call SETVARS_W64,$(1));                             \
1013           cd "$$$${pkgbdir}";                           \
1014           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1015           $(MAKE) --no-print-directory $(speedo_makeopt) $$$${pkgmkargs} V=0)
1016 endif
1017         @touch $(stampdir)/stamp-w64-$(1)-02-make
1018
1019 # Note that post_install must come last because it may be empty and
1020 # "; ;" is a syntax error.
1021 $(stampdir)/stamp-$(1)-03-install: $(stampdir)/stamp-$(1)-02-make
1022         @echo "speedo: installing $(1)"
1023 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
1024         @($(call SETVARS,$(1));                         \
1025           cd "$$$${pkgsdir}";                           \
1026           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1027           $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install V=0;\
1028           $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
1029 else
1030         @($(call SETVARS,$(1));                         \
1031           cd "$$$${pkgbdir}";                           \
1032           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1033           $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install-strip V=0;\
1034           $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
1035 endif
1036         touch $(stampdir)/stamp-$(1)-03-install
1037
1038 $(stampdir)/stamp-w64-$(1)-03-install: $(stampdir)/stamp-w64-$(1)-02-make
1039         @echo "speedo: installing $(1) (64 bit)"
1040 ifneq ($(findstring $(1),$(speedo_make_only_style)),)
1041         @($(call SETVARS_W64,$(1));                             \
1042           cd "$$$${pkgsdir}";                           \
1043           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1044           $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install V=0;\
1045           $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
1046 else
1047         @($(call SETVARS_W64,$(1));                             \
1048           cd "$$$${pkgbdir}";                           \
1049           test -n "$$$${pkgmkdir}" && cd "$$$${pkgmkdir}"; \
1050           $(MAKE) --no-print-directory $$$${pkgmkargs_inst} install-strip V=0;\
1051           $(call speedo_pkg_$(call FROB_macro,$(1))_post_install))
1052 endif
1053         touch $(stampdir)/stamp-w64-$(1)-03-install
1054
1055 $(stampdir)/stamp-final-$(1): $(stampdir)/stamp-$(1)-03-install
1056         @($(call SETVARS,$(1));                                  \
1057           printf "%-14s %-12s %s\n" $(1) "$$$${ver}" "$$$${sha1}" \
1058               >> $(bdir)/pkg-versions.txt)
1059         @echo "speedo: $(1) done"
1060         @touch $(stampdir)/stamp-final-$(1)
1061
1062 $(stampdir)/stamp-w64-final-$(1): $(stampdir)/stamp-w64-$(1)-03-install
1063         @echo "speedo: $(1) (64 bit) done"
1064         @touch $(stampdir)/stamp-w64-final-$(1)
1065
1066 .PHONY : clean-$(1)
1067 clean-$(1):
1068         @echo "speedo: uninstalling $(1)"
1069         @($(call SETVARS,$(1));                           \
1070          (cd "$$$${pkgbdir}" 2>/dev/null &&               \
1071           $(MAKE) --no-print-directory                    \
1072            $$$${pkgmkargs_uninst} uninstall V=0 ) || true;\
1073          if [ "$(1)" = "gnupg" ]; then                    \
1074            rm -fR "$$$${pkgbdir}" || true                ;\
1075          else                                             \
1076            rm -fR "$$$${pkgsdir}" "$$$${pkgbdir}" || true;\
1077          fi)
1078         -rm -f $(stampdir)/stamp-final-$(1) $(stampdir)/stamp-$(1)-*
1079
1080
1081 .PHONY : build-$(1)
1082 build-$(1): $(stampdir)/stamp-final-$(1)
1083
1084
1085 .PHONY : report-$(1)
1086 report-$(1):
1087         @($(call SETVARS,$(1));                         \
1088          echo -n $(1):\  ;                              \
1089          if [ -n "$$$${git}" ]; then                    \
1090            if [ -e "$$$${pkgsdir}/.git" ]; then         \
1091              cd "$$$${pkgsdir}" &&                      \
1092              git describe ;                             \
1093            else                                         \
1094              echo missing;                              \
1095            fi                                           \
1096          elif [ -n "$$$${tar}" ]; then                  \
1097            base=`echo "$$$${tar}" | sed -e 's,^.*/,,'   \
1098                  | sed -e 's,\.tar.*$$$$,,'`;           \
1099            echo $$$${base} ;                            \
1100          fi)
1101
1102 endef
1103
1104
1105 # Insert the template for each source package.
1106 $(foreach spkg, $(speedo_spkgs), $(eval $(call SPKG_template,$(spkg))))
1107
1108 $(stampdir)/stamp-final: $(stampdir)/stamp-directories clean-pkg-versions
1109 ifeq ($(TARGETOS),w32)
1110 $(stampdir)/stamp-final: $(addprefix $(stampdir)/stamp-w64-final-,$(speedo_w64_build_list))
1111 endif
1112 $(stampdir)/stamp-final: $(addprefix $(stampdir)/stamp-final-,$(speedo_build_list))
1113         touch $(stampdir)/stamp-final
1114
1115 clean-pkg-versions:
1116         @: >$(bdir)/pkg-versions.txt
1117
1118 all-speedo: $(stampdir)/stamp-final
1119
1120 report-speedo: $(addprefix report-,$(speedo_build_list))
1121
1122 # Just to check if we catched all stamps.
1123 clean-stamps:
1124         $(RM) -fR $(stampdir)
1125
1126 clean-speedo:
1127         $(RM) -fR PLAY
1128
1129
1130 #
1131 # Windows installer
1132 #
1133 # {{{
1134 ifeq ($(TARGETOS),w32)
1135
1136 dist-source: installer
1137         for i in 00 01 02 03; do sleep 1;touch PLAY/stamps/stamp-*-${i}-*;done
1138         (set -e;\
1139          tarname="$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).tar" ;\
1140          [ -f "$$tarname" ] && rm "$$tarname" ;\
1141          tar -C $(topsrc) -cf "$$tarname" --exclude-backups --exclude-vcs \
1142              --transform='s,^\./,$(INST_NAME)-$(INST_VERSION)/,' \
1143              --anchored --exclude './PLAY' . ;\
1144          tar --totals -rf "$$tarname" --exclude-backups --exclude-vcs \
1145               --transform='s,^,$(INST_NAME)-$(INST_VERSION)/,' \
1146              PLAY/stamps/stamp-*-00-unpack PLAY/src swdb.lst swdb.lst.sig ;\
1147          [ -f "$$tarname".xz ] && rm "$$tarname".xz;\
1148          xz "$$tarname" ;\
1149         )
1150
1151
1152 # Extract the two latest news entries.  */
1153 $(bdir)/NEWS.tmp: $(topsrc)/NEWS
1154         awk '/^Notewo/ {if(okay>1){exit}; okay++};okay {print $0}' \
1155             <$(topsrc)/NEWS  >$(bdir)/NEWS.tmp
1156
1157 # Sort the file with the package versions.
1158 $(bdir)/pkg-versions.sorted: $(bdir)/pkg-versions.txt
1159         grep -v '^gnupg ' <$(bdir)/pkg-versions.txt \
1160             | sort | uniq >$(bdir)/pkg-versions.sorted
1161
1162 $(bdir)/README.txt: $(bdir)/NEWS.tmp $(topsrc)/README $(w32src)/README.txt \
1163                     $(w32src)/pkg-copyright.txt $(bdir)/pkg-versions.sorted
1164         sed -e '/^;.*/d;' \
1165         -e '/!NEWSFILE!/{r $(bdir)/NEWS.tmp' -e 'd;}' \
1166         -e '/!GNUPGREADME!/{r $(topsrc)/README' -e 'd;}' \
1167         -e '/!PKG-COPYRIGHT!/{r $(w32src)/pkg-copyright.txt' -e 'd;}' \
1168         -e '/!PKG-VERSIONS!/{r $(bdir)/pkg-versions.sorted' -e 'd;}' \
1169         -e 's,!VERSION!,$(INST_VERSION),g' \
1170            < $(w32src)/README.txt \
1171            | sed -e '/^#/d' \
1172            | awk '{printf "%s\r\n", $$0}' >$(bdir)/README.txt
1173
1174 $(bdir)/g4wihelp.dll: $(w32src)/g4wihelp.c $(w32src)/exdll.h
1175         (set -e; cd $(bdir); \
1176          $(W32CC) -I. -shared -O2 -o g4wihelp.dll $(w32src)/g4wihelp.c \
1177                   -lwinmm -lgdi32; \
1178          $(STRIP) g4wihelp.dll)
1179
1180 w32_insthelpers: $(bdir)/g4wihelp.dll
1181
1182 $(bdir)/inst-options.ini: $(w32src)/inst-options.ini
1183         cat $(w32src)/inst-options.ini >$(bdir)/inst-options.ini
1184
1185 extra_installer_options =
1186 ifeq ($(WITH_GUI),1)
1187 extra_installer_options += -DWITH_GUI=1
1188 endif
1189
1190 installer: all w32_insthelpers $(w32src)/inst-options.ini $(bdir)/README.txt
1191         $(MAKENSIS) -V2 \
1192                     -DINST_DIR=$(idir) \
1193                     -DINST6_DIR=$(idir6) \
1194                     -DBUILD_DIR=$(bdir) \
1195                     -DTOP_SRCDIR=$(topsrc) \
1196                     -DW32_SRCDIR=$(w32src) \
1197                     -DBUILD_ISODATE=$(BUILD_ISODATE) \
1198                     -DBUILD_DATESTR=$(BUILD_DATESTR) \
1199                     -DNAME=$(INST_NAME) \
1200                     -DVERSION=$(INST_VERSION) \
1201                     -DPROD_VERSION=$(INST_PROD_VERSION) \
1202                     $(extra_installer_options) $(w32src)/inst.nsi
1203         @echo "Ready: $(idir)/$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).exe"
1204
1205
1206 define MKSWDB_commands
1207  ( pref="#+macro: gnupg22_w32_" ;\
1208    echo "$${pref}ver  $(INST_VERSION)_$(BUILD_DATESTR)"  ;\
1209    echo "$${pref}date $(2)" ;\
1210    echo "$${pref}size $$(wc -c <$(1)|awk '{print int($$1/1024)}')k";\
1211    echo "$${pref}sha1 $$(sha1sum <$(1)|cut -d' ' -f1)" ;\
1212    echo "$${pref}sha2 $$(sha256sum <$(1)|cut -d' ' -f1)" ;\
1213  ) | tee $(1).swdb
1214 endef
1215
1216
1217 # Build the installer from the source tarball.
1218 installer-from-source: dist-source
1219         (set -e;\
1220          [ -d PLAY-release ] && rm -rf PLAY-release; \
1221          mkdir PLAY-release;\
1222          cd PLAY-release; \
1223          tar xJf "../$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).tar.xz";\
1224          cd $(INST_NAME)-$(INST_VERSION); \
1225          $(MAKE) -f build-aux/speedo.mk this-w32-installer SELFCHECK=0;\
1226          reldate="$$(date -u +%Y-%m-%d)" ;\
1227          exefile="$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).exe" ;\
1228          cp "PLAY/inst/$$exefile" ../.. ;\
1229          exefile="../../$$exefile" ;\
1230          $(call MKSWDB_commands,$${exefile},$${reldate}); \
1231         )
1232
1233 # This target repeats some of the installer-from-source steps but it
1234 # is intended to be called interactively, so that the passphrase can be
1235 # entered.
1236 sign-installer:
1237         @(set -e; \
1238          cd PLAY-release; \
1239          cd $(INST_NAME)-$(INST_VERSION); \
1240          reldate="$$(date -u +%Y-%m-%d)" ;\
1241          exefile="$(INST_NAME)-$(INST_VERSION)_$(BUILD_DATESTR).exe" ;\
1242          echo "speedo: /*" ;\
1243          echo "speedo:  * Signing installer" ;\
1244          echo "speedo:  * Key: $(AUTHENTICODE_KEY)";\
1245          echo "speedo:  */" ;\
1246          osslsigncode sign -pkcs12 $(AUTHENTICODE_KEY) -askpass \
1247             -h sha256 -in "PLAY/inst/$$exefile" -out "../../$$exefile" ;\
1248          exefile="../../$$exefile" ;\
1249          $(call MKSWDB_commands,$${exefile},$${reldate}); \
1250          echo "speedo: /*" ;\
1251          echo "speedo:  * Verification result" ;\
1252          echo "speedo:  */" ;\
1253          osslsigncode verify $${exefile} \
1254         )
1255
1256
1257
1258 endif
1259 # }}} W32
1260
1261
1262 #
1263 # Check availibility of standard tools
1264 #
1265 check-tools:
1266
1267
1268 #
1269 # Mark phony targets
1270 #
1271 .PHONY: all all-speedo report-speedo clean-stamps clean-speedo installer \
1272         w32_insthelpers check-tools clean-pkg-versions