summaryrefslogtreecommitdiff
path: root/recipes/zlib
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-05-20 10:31:17 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-05-22 07:07:04 +0530
commit85950cbb16048f85d2ba9c41bbf7136125afe97f (patch)
tree5b5ff733b45938f47fb4a348c6b2bc6b603aeaa3 /recipes/zlib
parent11da7d9907afee9b205248c0dd09c3803355f7a6 (diff)
zlib.recipe: Add a meson port
Diffstat (limited to 'recipes/zlib')
-rw-r--r--recipes/zlib/0001-Add-a-meson-port.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/recipes/zlib/0001-Add-a-meson-port.patch b/recipes/zlib/0001-Add-a-meson-port.patch
new file mode 100644
index 00000000..d80ea80e
--- /dev/null
+++ b/recipes/zlib/0001-Add-a-meson-port.patch
@@ -0,0 +1,150 @@
+From 6bef188df07f7b97ce7e714b0e3793b38413a916 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Tue, 21 Mar 2017 22:42:09 +0530
+Subject: [PATCH 1/4] Add meson build files for building on Windows
+
+Quick-and-dirty, based on the 1.2.8 version from Meson's wrapdb:
+https://wrapdb.mesonbuild.com/zlib
+
+Only for Windows for now. Will be expanded to support all the features
+of the actual zlib build system (such as symbol visibility).
+---
+ meson.build | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+ create mode 100644 meson.build
+
+diff --git a/meson.build b/meson.build
+new file mode 100644
+index 0000000..3cf1f72
+--- /dev/null
++++ b/meson.build
+@@ -0,0 +1,14 @@
++project('zlib', 'c', version : '1.2.11', license : 'zlib')
++
++src = ['adler32.c', 'crc32.c', 'deflate.c', 'infback.c', 'inffast.c', 'inflate.c',
++'inftrees.c', 'trees.c', 'zutil.c',
++'compress.c', 'uncompr.c', 'gzclose.c', 'gzlib.c', 'gzread.c', 'gzwrite.c']
++
++zlib = library('z', src,
++ c_args : ['-DZLIB_DLL'],
++ version : meson.project_version())
++
++incdir = include_directories('.')
++
++zlib_dep = declare_dependency(link_with : zlib,
++ include_directories : incdir)
+--
+2.17.0
+
+
+From 1c5a2490c459481e41a66245fac8f825c4937945 Mon Sep 17 00:00:00 2001
+From: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Wed, 14 Mar 2018 02:51:02 +0100
+Subject: [PATCH 2/4] meson: set install to true
+
+---
+ meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/meson.build b/meson.build
+index 3cf1f72..792865c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -6,6 +6,7 @@ src = ['adler32.c', 'crc32.c', 'deflate.c', 'infback.c', 'inffast.c', 'inflate.c
+
+ zlib = library('z', src,
+ c_args : ['-DZLIB_DLL'],
++ install : true,
+ version : meson.project_version())
+
+ incdir = include_directories('.')
+--
+2.17.0
+
+
+From 74a0a924ce01a3cc606a719c6a953bc7d11d6b4d Mon Sep 17 00:00:00 2001
+From: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Sun, 25 Mar 2018 17:37:59 +0200
+Subject: [PATCH 3/4] 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.build | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 792865c..37a84f4 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1,11 +1,21 @@
+ project('zlib', 'c', version : '1.2.11', license : 'zlib')
+
++link_args = []
++
++cc = meson.get_compiler('c')
++
++if cc.get_id() == 'gcc' and host_machine.system() == 'linux'
++ vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
++ link_args += [vflag]
++endif
++
+ src = ['adler32.c', 'crc32.c', 'deflate.c', 'infback.c', 'inffast.c', 'inflate.c',
+ 'inftrees.c', 'trees.c', 'zutil.c',
+ 'compress.c', 'uncompr.c', 'gzclose.c', 'gzlib.c', 'gzread.c', 'gzwrite.c']
+
+ zlib = library('z', src,
+ c_args : ['-DZLIB_DLL'],
++ link_args : link_args,
+ install : true,
+ version : meson.project_version())
+
+--
+2.17.0
+
+
+From b5edeea0083e77e6213607229cc89a7a0769fabd Mon Sep 17 00:00:00 2001
+From: Matthew Waters <matthew@centricular.com>
+Date: Thu, 15 Mar 2018 11:11:22 +1100
+Subject: [PATCH 4/4] meson: install headers and a pkg-config file
+
+---
+ meson.build | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 37a84f4..34819bb 100644
+--- a/meson.build
++++ b/meson.build
+@@ -9,10 +9,14 @@ if cc.get_id() == 'gcc' and host_machine.system() == 'linux'
+ link_args += [vflag]
+ endif
+
++pkg = import('pkgconfig')
++
+ src = ['adler32.c', 'crc32.c', 'deflate.c', 'infback.c', 'inffast.c', 'inflate.c',
+ 'inftrees.c', 'trees.c', 'zutil.c',
+ 'compress.c', 'uncompr.c', 'gzclose.c', 'gzlib.c', 'gzread.c', 'gzwrite.c']
+
++headers = ['zconf.h', 'zlib.h']
++
+ zlib = library('z', src,
+ c_args : ['-DZLIB_DLL'],
+ link_args : link_args,
+@@ -23,3 +27,10 @@ incdir = include_directories('.')
+
+ zlib_dep = declare_dependency(link_with : zlib,
+ include_directories : incdir)
++
++install_headers(headers)
++
++pkg.generate(name: 'zlib',
++ description: 'zlib compression library',
++ version: meson.project_version(),
++ libraries: zlib)
+--
+2.17.0
+