Skip to content

Commit 171a3ea

Browse files
committed
Add Meson build system
Based on the wrap in Meson's wrapdb.
1 parent babeaa8 commit 171a3ea

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

LICENSE.build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 The Meson development team
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

meson.build

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
project('zlib', 'c', version : '1.4.1.1', license : 'zlib')
2+
3+
cc = meson.get_compiler('c')
4+
5+
link_args = []
6+
compile_args = []
7+
if cc.get_id() == 'msvc'
8+
add_project_arguments('-D_CRT_SECURE_NO_DEPRECATE',
9+
'-D_CRT_NONSTDC_NO_DEPRECATE', language : 'c')
10+
else
11+
# Don't spam consumers of this wrap with these warnings
12+
compile_args += cc.get_supported_arguments(['-Wno-implicit-fallthrough',
13+
'-Wno-implicit-function-declaration'])
14+
if cc.get_id() == 'gcc' and host_machine.system() != 'windows'
15+
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
16+
link_args += [vflag]
17+
endif
18+
endif
19+
20+
src = files([
21+
'adler32.c',
22+
'crc32.c',
23+
'deflate.c',
24+
'infback.c',
25+
'inffast.c',
26+
'inflate.c',
27+
'inftrees.c',
28+
'trees.c',
29+
'zutil.c',
30+
'compress.c',
31+
'uncompr.c',
32+
'gzclose.c',
33+
'gzlib.c',
34+
'gzread.c',
35+
'gzwrite.c'])
36+
37+
headers = files(['zconf.h', 'zlib.h'])
38+
39+
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
40+
win = import('windows')
41+
win_args = []
42+
if cc.get_id() != 'msvc'
43+
win_args += '-DGCC_WINDRES'
44+
endif
45+
src += win.compile_resources('win32/zlib1.rc', args : win_args)
46+
endif
47+
48+
if get_option('solo')
49+
compile_args += ['-DZ_SOLO']
50+
endif
51+
52+
zlib = library('z', src,
53+
c_args : compile_args,
54+
link_args : link_args,
55+
vs_module_defs : 'win32/zlib.def',
56+
install : true)
57+
58+
incdir = include_directories('.')
59+
60+
zlib_dep = declare_dependency(
61+
link_with : zlib,
62+
include_directories : incdir)
63+
64+
install_headers(headers)
65+
66+
pkg = import('pkgconfig')
67+
68+
pkg.generate(zlib,
69+
name: 'zlib',
70+
description: 'zlib compression library')
71+
72+
meson.override_dependency('zlib', zlib_dep)

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option('solo', type: 'boolean', value: false, description: 'Build a minimal zlib without file I/O API')

0 commit comments

Comments
 (0)