blob: 0eb118f0bfd5e9ded8fb2fd63ee4b0a3db1cbdce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# file : libz/buildfile
# copyright : Copyright (c) 2018-2019 Code Synthesis Ltd
# license : zlib License; see accompanying LICENSE file
lib{z}: {h c}{*} {def}{zlib} {file}{zlib.map}
tclass = $c.target.class
tsys = $c.target.system
windows = ($tclass == 'windows')
# Include the generated config header into the distribution (so that we don't
# pick up an installed one) and don't remove it when cleaning in src (so that
# clean results in a state identical to distributed).
#
h{zconf}: in{zconf}
{
dist = true
clean = ($src_root != $out_root)
in.symbol = '@'
in.substitution = lax
HAVE_UNISTD_H = ($windows ? 0 : 1)
HAVE_STDARG_H = ($windows ? 0 : 1)
}
# Build options.
#
if! $windows
c.poptions += -DHAVE_HIDDEN
switch $tclass, $tsys
{
case 'linux' | 'bsd'
c.poptions += -D_LARGEFILE64_SOURCE=1
case 'windows', 'win32-msvc'
c.poptions += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
}
# Note that we add "-I$src_base" for the headers auto-generating machinery to
# work properly.
#
c.poptions =+ "-I$out_base" "-I$src_base"
switch $c.class, $tsys
{
case 'gcc'
{
# Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem
# to care about these and it is not easy to disable specific warnings in a
# way that works across compilers/version (some -Wno-* options are only
# recognized in newer versions).
#
c.coptions += -Wno-all -Wno-extra
# Disable the Clang targeting MSVC warnings.
#
if ($c.id == 'clang' && $tsys == 'win32-msvc')
c.coptions += -Wno-deprecated-declarations
}
case 'msvc'
{
# Disable warnings that pop up with /W3.
#
c.coptions += /wd4267
}
}
switch $tclass
{
case 'linux' | 'bsd'
{
# Make sure all symbols are resolvable.
#
c.loptions += -Wl,--no-undefined
c.loptions += "-Wl,--version-script=$src_base/zlib.map"
}
}
# Export options.
#
lib{z}: cc.export.poptions = "-I$out_base" "-I$src_base"
# See bootstrap.build for details.
#
if $version.pre_release
lib{z}: bin.lib.version = @"-$version.project_id"
else
lib{z}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version"
# Install the bare minimum of headers (note: not recreating subdirectories).
#
h{*}: install = false
for h: zconf zlib
h{$h}@./: install = include/
|