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