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