Skip to content

Commit

Permalink
Add various self-explanatory changes
Browse files Browse the repository at this point in the history
* meson: On Linux when compiling with gcc, use zlib.map

Otherwise some symbols are not visible, and as meson sets
rpath to the path of our built libz, things then fail when
for example compiling against a system-wide libpng with:

undefined reference to `gzdirect@ZLIB_1.2.2.3'

* meson: install headers and a pkg-config file
* Add windows resource file
* Add zlib.def for windows dll
* Add MSVC required defines
* Import latest LICENSE.build and readme.txt
  • Loading branch information
nirbheek authored and sarum9in committed May 21, 2018
1 parent d33c66d commit 933a624
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
19 changes: 19 additions & 0 deletions LICENSE.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2018 The Meson development team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 34 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
project('zlib', 'c', version : '1.2.11', license : 'zlib')

cc = meson.get_compiler('c')

link_args = []
if cc.get_id() == 'msvc'
add_project_arguments('-D_CRT_SECURE_NO_DEPRECATE',
'-D_CRT_NONSTDC_NO_DEPRECATE', language : 'c')
elif cc.get_id() == 'gcc' and host_machine.system() != 'windows'
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
link_args += [vflag]
endif

src = files([
'adler32.c',
'crc32.c',
Expand All @@ -17,10 +28,32 @@ src = files([
'gzread.c',
'gzwrite.c'])

zlib = library('z', src)
headers = files(['zconf.h', 'zlib.h'])

if host_machine.system() == 'windows'
win = import('windows')
win_args = []
if cc.get_id() != 'msvc'
win_args += '-DGCC_WINDRES'
endif
src += win.compile_resources('win32/zlib1.rc', args : win_args)
endif

zlib = library('z', src,
link_args : link_args,
vs_module_defs : 'win32/zlib.def',
install : true)

incdir = include_directories('.')

zlib_dep = declare_dependency(
link_with : zlib,
include_directories : incdir)

install_headers(headers)

pkg = import('pkgconfig')

pkg.generate(name: 'zlib',
description: 'zlib compression library',
libraries: zlib)
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
This is a repository that provides Wrap packaging to Zlib. The exact
format is not yet clear so this is flying at the seats of pants.
This repository contains a Meson build definition for project zlib.

For more information please see http://mesonbuild.com.

0 comments on commit 933a624

Please sign in to comment.