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