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