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