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