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