blob: 161d4f56aa3726f8ff8351ee260f36f8f982450f [file] [log] [blame]
brettw@chromium.org069e2b82014-04-30 16:47:24 +00001# 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
5config("zlib_config") {
6 include_dirs = [ "." ]
7}
8
robert.bradford10dd6862014-11-05 06:59:34 -08009static_library("zlib_x86_simd") {
dpranke4ba7cdd2015-02-19 18:55:19 -080010 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
scottmgb8135bf2014-12-02 23:28:00 -080011 sources = [
12 "crc_folding.c",
13 "fill_window_sse.c",
14 ]
Nico Weber0f60cc52014-11-18 15:21:17 -080015 if (!is_win || is_clang) {
scottmgb8135bf2014-12-02 23:28:00 -080016 cflags = [
17 "-msse4.2",
18 "-mpclmul",
19 ]
Nico Weber0f60cc52014-11-18 15:21:17 -080020 }
robert.bradford10dd6862014-11-05 06:59:34 -080021 } else {
scottmgb8135bf2014-12-02 23:28:00 -080022 sources = [
23 "simd_stub.c",
24 ]
robert.bradford10dd6862014-11-05 06:59:34 -080025 }
dpranke73636152014-11-17 17:54:55 -080026
27 configs -= [ "//build/config/compiler:chromium_code" ]
28 configs += [ "//build/config/compiler:no_chromium_code" ]
robert.bradford10dd6862014-11-05 06:59:34 -080029}
30
brettw3f3d1262015-09-02 10:57:05 -070031config("zlib_warnings") {
32 if (is_clang && !is_ios &&
33 (current_cpu == "x86" || current_cpu == "x64")) {
34 cflags = [ "-Wno-incompatible-pointer-types" ]
35 }
36}
37
brettw@chromium.org069e2b82014-04-30 16:47:24 +000038static_library("zlib") {
39 if (!is_win) {
40 # Don't stomp on "libzlib" on other platforms.
41 output_name = "chrome_zlib"
42 }
43
44 sources = [
45 "adler32.c",
46 "compress.c",
47 "crc32.c",
48 "crc32.h",
49 "deflate.c",
50 "deflate.h",
51 "gzclose.c",
52 "gzguts.h",
53 "gzlib.c",
54 "gzread.c",
55 "gzwrite.c",
56 "infback.c",
57 "inffast.c",
58 "inffast.h",
59 "inffixed.h",
60 "inflate.c",
61 "inflate.h",
62 "inftrees.c",
63 "inftrees.h",
64 "mozzconf.h",
65 "trees.c",
66 "trees.h",
67 "uncompr.c",
robert.bradford10dd6862014-11-05 06:59:34 -080068 "x86.h",
brettw@chromium.org069e2b82014-04-30 16:47:24 +000069 "zconf.h",
70 "zlib.h",
71 "zutil.c",
72 "zutil.h",
73 ]
74
dpranke4ba7cdd2015-02-19 18:55:19 -080075 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
robert.bradford10dd6862014-11-05 06:59:34 -080076 sources += [ "x86.c" ]
77 }
78
brettw@chromium.org069e2b82014-04-30 16:47:24 +000079 configs -= [ "//build/config/compiler:chromium_code" ]
brettw3f3d1262015-09-02 10:57:05 -070080 configs += [
81 "//build/config/compiler:no_chromium_code",
82
83 # Must be after no_chromium_code for warning flags to be ordered correctly.
84 ":zlib_warnings",
85 ]
brettw@chromium.org069e2b82014-04-30 16:47:24 +000086
Brett Wilson9bdea3f2014-09-23 16:41:46 -070087 public_configs = [ ":zlib_config" ]
scottmgb8135bf2014-12-02 23:28:00 -080088 deps = [
89 ":zlib_x86_simd",
90 ]
brettw@chromium.org069e2b82014-04-30 16:47:24 +000091}
92
brettw3f3d1262015-09-02 10:57:05 -070093config("minizip_warnings") {
94 visibility = [ ":*" ]
95 if (is_clang) {
96 # zlib uses `if ((a == b))` for some reason.
97 cflags = [ "-Wno-parentheses-equality" ]
98 }
99}
100
brettw@chromium.org069e2b82014-04-30 16:47:24 +0000101static_library("minizip") {
102 sources = [
103 "contrib/minizip/ioapi.c",
104 "contrib/minizip/ioapi.h",
105 "contrib/minizip/iowin32.c",
106 "contrib/minizip/iowin32.h",
107 "contrib/minizip/unzip.c",
108 "contrib/minizip/unzip.h",
109 "contrib/minizip/zip.c",
110 "contrib/minizip/zip.h",
111 ]
112
113 if (!is_win) {
114 sources -= [
115 "contrib/minizip/iowin32.c",
116 "contrib/minizip/iowin32.h",
117 ]
118 }
119 if (is_mac || is_ios || is_android) {
120 # Mac, Android and the BSDs don't have fopen64, ftello64, or fseeko64. We
121 # use fopen, ftell, and fseek instead on these systems.
122 defines = [ "USE_FILE32API" ]
123 }
124
scottmgb8135bf2014-12-02 23:28:00 -0800125 deps = [
126 ":zlib",
127 ]
brettw@chromium.org069e2b82014-04-30 16:47:24 +0000128
129 configs -= [ "//build/config/compiler:chromium_code" ]
brettw3f3d1262015-09-02 10:57:05 -0700130 configs += [
131 "//build/config/compiler:no_chromium_code",
132
133 # Must be after no_chromium_code for warning flags to be ordered correctly.
134 ":minizip_warnings",
135 ]
Brett Wilson9bdea3f2014-09-23 16:41:46 -0700136 public_configs = [ ":zlib_config" ]
brettw@chromium.org069e2b82014-04-30 16:47:24 +0000137}
138
jamesr@chromium.org8497dcc2014-08-13 00:22:04 +0000139static_library("zip") {
140 sources = [
141 "google/zip.cc",
142 "google/zip.h",
143 "google/zip_internal.cc",
144 "google/zip_internal.h",
145 "google/zip_reader.cc",
146 "google/zip_reader.h",
147 ]
148 deps = [
149 ":minizip",
150 "//base",
151 ]
brettw@chromium.org069e2b82014-04-30 16:47:24 +0000152}