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