blob: 11f57effb5ad4b09e0da78baaf36f53a98359d58 [file] [log] [blame]
[email protected]c6f27f22013-08-21 21:44:591# Copyright (c) 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Adenilson Cavalcanti78104f42017-09-29 03:24:525if (current_cpu == "arm" || current_cpu == "arm64") {
6 import("//build/config/arm.gni")
7}
8
[email protected]c6f27f22013-08-21 21:44:599config("zlib_config") {
[email protected]2ed04ae2013-10-07 20:17:1610 include_dirs = [ "." ]
[email protected]c6f27f22013-08-21 21:44:5911}
12
Noel Gordon09b784f2017-09-29 19:44:2513config("zlib_adler32_simd_config") {
14 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
15 defines = [ "ADLER32_SIMD_SSSE3" ]
16 }
17
18 if (current_cpu == "arm" || current_cpu == "arm64") {
19 if (arm_use_neon) {
20 defines = [ "ADLER32_SIMD_NEON" ]
21 }
22 }
23}
24
25source_set("zlib_adler32_simd") {
26 visibility = [ ":*" ]
27
28 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
29 sources = [
30 "adler32_simd.c",
31 "adler32_simd.h",
32 ]
33
34 if (!is_win || is_clang) {
35 cflags = [ "-mssse3" ]
36 }
37 }
38
39 if (current_cpu == "arm" || current_cpu == "arm64") {
40 if (arm_use_neon) {
41 sources = [
42 "adler32_simd.c",
43 "adler32_simd.h",
44 ]
45
46 if (!is_debug) {
47 # Use optimize_speed (-O3) to output the _smallest_ code.
48 configs -= [ "//build/config/compiler:default_optimization" ]
49 configs += [ "//build/config/compiler:optimize_speed" ]
50 }
51 }
52 }
53
54 configs -= [ "//build/config/compiler:chromium_code" ]
55 configs += [ "//build/config/compiler:no_chromium_code" ]
56
57 public_configs = [ ":zlib_adler32_simd_config" ]
58}
59
robert.bradford02a95e32014-11-05 14:59:3460static_library("zlib_x86_simd") {
dpranke43276212015-02-20 02:55:1961 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
scottmg1c240d272014-12-03 07:28:0062 sources = [
63 "crc_folding.c",
64 "fill_window_sse.c",
65 ]
Nico Weberf3b5bb22014-11-18 23:21:1766 if (!is_win || is_clang) {
scottmg1c240d272014-12-03 07:28:0067 cflags = [
68 "-msse4.2",
69 "-mpclmul",
70 ]
Nico Weberf3b5bb22014-11-18 23:21:1771 }
robert.bradford02a95e32014-11-05 14:59:3472 } else {
scottmg1c240d272014-12-03 07:28:0073 sources = [
74 "simd_stub.c",
75 ]
robert.bradford02a95e32014-11-05 14:59:3476 }
dprankede7d0dc2014-11-18 01:54:5577
78 configs -= [ "//build/config/compiler:chromium_code" ]
79 configs += [ "//build/config/compiler:no_chromium_code" ]
robert.bradford02a95e32014-11-05 14:59:3480}
81
brettw6dd952c72015-09-02 17:57:0582config("zlib_warnings") {
tfarinaf7698e02015-11-03 00:49:3983 if (is_clang && !is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
brettw6dd952c72015-09-02 17:57:0584 cflags = [ "-Wno-incompatible-pointer-types" ]
85 }
86}
87
[email protected]6a0f2772013-10-03 17:16:1188static_library("zlib") {
[email protected]6a0f2772013-10-03 17:16:1189 if (!is_win) {
90 # Don't stomp on "libzlib" on other platforms.
91 output_name = "chrome_zlib"
92 }
93
[email protected]c6f27f22013-08-21 21:44:5994 sources = [
95 "adler32.c",
96 "compress.c",
97 "crc32.c",
98 "crc32.h",
99 "deflate.c",
100 "deflate.h",
101 "gzclose.c",
102 "gzguts.h",
103 "gzlib.c",
104 "gzread.c",
105 "gzwrite.c",
106 "infback.c",
107 "inffast.c",
108 "inffast.h",
109 "inffixed.h",
110 "inflate.c",
111 "inflate.h",
112 "inftrees.c",
113 "inftrees.h",
mark6d9a6252017-02-15 06:15:29114 "names.h",
[email protected]c6f27f22013-08-21 21:44:59115 "trees.c",
116 "trees.h",
117 "uncompr.c",
robert.bradford02a95e32014-11-05 14:59:34118 "x86.h",
[email protected]c6f27f22013-08-21 21:44:59119 "zconf.h",
120 "zlib.h",
121 "zutil.c",
122 "zutil.h",
123 ]
124
Adenilson Cavalcanti78104f42017-09-29 03:24:52125 if (current_cpu == "arm" || current_cpu == "arm64") {
126 if (arm_use_neon) {
127 # TODO: handle InflateBack case, see crbug.com/769880.
128 sources -= [
129 "inffast.c",
130 "inflate.c",
131 ]
132 sources += [
133 "contrib/arm/chunkcopy.h",
134 "contrib/arm/inffast.c",
135 "contrib/arm/inflate.c",
136 ]
137 }
138 }
139
Noel Gordon09b784f2017-09-29 19:44:25140 defines = []
141 deps = []
142
dpranke43276212015-02-20 02:55:19143 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
robert.bradford02a95e32014-11-05 14:59:34144 sources += [ "x86.c" ]
Noel Gordon09b784f2017-09-29 19:44:25145
146 deps += [ ":zlib_adler32_simd" ]
147 }
148
149 if (current_cpu == "arm" || current_cpu == "arm64") {
150 if (arm_use_neon) {
151 deps += [ ":zlib_adler32_simd" ]
152 }
robert.bradford02a95e32014-11-05 14:59:34153 }
154
[email protected]bfac2722014-01-17 20:19:45155 configs -= [ "//build/config/compiler:chromium_code" ]
brettw6dd952c72015-09-02 17:57:05156 configs += [
157 "//build/config/compiler:no_chromium_code",
158
159 # Must be after no_chromium_code for warning flags to be ordered correctly.
160 ":zlib_warnings",
161 ]
[email protected]add138e32013-10-04 19:45:41162
Brett Wilsone53895272014-09-23 23:41:46163 public_configs = [ ":zlib_config" ]
Noel Gordon09b784f2017-09-29 19:44:25164
165 deps += [
166 ":zlib_x86_simd"
scottmg1c240d272014-12-03 07:28:00167 ]
[email protected]c6f27f22013-08-21 21:44:59168}
169
brettw6dd952c72015-09-02 17:57:05170config("minizip_warnings") {
171 visibility = [ ":*" ]
172 if (is_clang) {
173 # zlib uses `if ((a == b))` for some reason.
174 cflags = [ "-Wno-parentheses-equality" ]
175 }
176}
177
[email protected]c6f27f22013-08-21 21:44:59178static_library("minizip") {
179 sources = [
180 "contrib/minizip/ioapi.c",
181 "contrib/minizip/ioapi.h",
182 "contrib/minizip/iowin32.c",
183 "contrib/minizip/iowin32.h",
184 "contrib/minizip/unzip.c",
185 "contrib/minizip/unzip.h",
186 "contrib/minizip/zip.c",
187 "contrib/minizip/zip.h",
188 ]
189
190 if (!is_win) {
191 sources -= [
192 "contrib/minizip/iowin32.c",
193 "contrib/minizip/iowin32.h",
194 ]
[email protected]ab9ce6e2014-04-17 20:33:19195 }
takise33876392017-04-07 05:48:40196 if (is_mac || is_ios || is_android || is_nacl) {
[email protected]c6f27f22013-08-21 21:44:59197 # Mac, Android and the BSDs don't have fopen64, ftello64, or fseeko64. We
198 # use fopen, ftell, and fseek instead on these systems.
199 defines = [ "USE_FILE32API" ]
200 }
201
scottmg1c240d272014-12-03 07:28:00202 deps = [
203 ":zlib",
204 ]
[email protected]c6f27f22013-08-21 21:44:59205
[email protected]bfac2722014-01-17 20:19:45206 configs -= [ "//build/config/compiler:chromium_code" ]
brettw6dd952c72015-09-02 17:57:05207 configs += [
208 "//build/config/compiler:no_chromium_code",
209
210 # Must be after no_chromium_code for warning flags to be ordered correctly.
211 ":minizip_warnings",
212 ]
Noel Gordon09b784f2017-09-29 19:44:25213
Brett Wilsone53895272014-09-23 23:41:46214 public_configs = [ ":zlib_config" ]
[email protected]c6f27f22013-08-21 21:44:59215}