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