summaryrefslogtreecommitdiff
path: root/recipes/zlib/0001-Add-a-meson-port.patch
blob: d80ea80ef847bca4a2c65eddc790c7e56b2011a4 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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