OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/linux/pkg_config.gni") | 5 import("//build/config/linux/pkg_config.gni") |
6 | 6 |
7 if (is_linux) { | 7 if (is_linux) { |
8 # This is a dependency on NSS with no libssl. On Linux we use a built-in SSL | 8 # This is a dependency on NSS with no libssl. On Linux we use a built-in SSL |
9 # library but the system NSS libraries. Non-Linux platforms using NSS use the | 9 # library but the system NSS libraries. Non-Linux platforms using NSS use the |
10 # hermetic one in //third_party/nss. | 10 # hermetic one in //third_party/nss. |
11 # | 11 # |
12 # Generally you should depend on //crypto:platform instead of using this | 12 # Generally you should depend on //crypto:platform instead of using this |
13 # config since that will properly pick up NSS or OpenSSL depending on | 13 # config since that will properly pick up NSS or OpenSSL depending on |
14 # platform and build config. | 14 # platform and build config. |
15 pkg_config("system_nss_no_ssl_config") { | 15 pkg_config("system_nss_no_ssl_config") { |
16 packages = [ "nss" ] | 16 packages = [ "nss" ] |
17 extra_args = [ "-v", "-lssl3" ] | 17 extra_args = [ |
| 18 "-v", |
| 19 "-lssl3", |
| 20 ] |
18 } | 21 } |
19 } else { | 22 } else { |
20 include_nss_root_certs = is_ios | 23 include_nss_root_certs = is_ios |
21 include_nss_libpkix = is_ios | 24 include_nss_libpkix = is_ios |
22 | 25 |
23 config("nspr_config") { | 26 config("nspr_config") { |
24 defines = [ "NO_NSPR_10_SUPPORT" ] | 27 defines = [ "NO_NSPR_10_SUPPORT" ] |
25 include_dirs = [ | 28 include_dirs = [ |
26 "nspr/pr/include", | 29 "nspr/pr/include", |
27 "nspr/lib/ds", | 30 "nspr/lib/ds", |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 "nspr/pr/src/threads/prcthr.c", | 203 "nspr/pr/src/threads/prcthr.c", |
201 "nspr/pr/src/threads/prdump.c", | 204 "nspr/pr/src/threads/prdump.c", |
202 "nspr/pr/src/threads/prmon.c", | 205 "nspr/pr/src/threads/prmon.c", |
203 "nspr/pr/src/threads/prrwlock.c", | 206 "nspr/pr/src/threads/prrwlock.c", |
204 "nspr/pr/src/threads/prsem.c", | 207 "nspr/pr/src/threads/prsem.c", |
205 "nspr/pr/src/threads/prtpd.c", | 208 "nspr/pr/src/threads/prtpd.c", |
206 ] | 209 ] |
207 | 210 |
208 public_configs = [ ":nspr_config" ] | 211 public_configs = [ ":nspr_config" ] |
209 | 212 |
210 configs -= [ | 213 configs -= [ "//build/config/compiler:chromium_code" ] |
211 "//build/config/compiler:chromium_code", | |
212 ] | |
213 if (is_win) { | 214 if (is_win) { |
214 configs -= [ | 215 configs -= [ |
215 "//build/config/win:unicode", # Requires 8-bit mode. | 216 "//build/config/win:unicode", # Requires 8-bit mode. |
216 "//build/config/win:lean_and_mean", # Won"t compile with lean and mean. | 217 "//build/config/win:lean_and_mean", # Won"t compile with lean and mean. |
217 ] | 218 ] |
218 } | 219 } |
219 configs += [ "//build/config/compiler:no_chromium_code" ] | 220 configs += [ "//build/config/compiler:no_chromium_code" ] |
220 | 221 |
221 cflags = [] | 222 cflags = [] |
222 defines = [ | 223 defines = [ |
223 "_NSPR_BUILD_", | 224 "_NSPR_BUILD_", |
224 "FORCE_PR_LOG", | 225 "FORCE_PR_LOG", |
225 ] | 226 ] |
226 | 227 |
227 include_dirs = [ | 228 include_dirs = [ "nspr/pr/include/private" ] |
228 "nspr/pr/include/private", | |
229 ] | |
230 | 229 |
231 if (is_win) { | 230 if (is_win) { |
232 cflags = [ | 231 cflags = [ |
233 "/wd4554", # Check precidence. | 232 "/wd4554", # Check precidence. |
234 "/wd4267", # Conversion from size_t to "type". | 233 "/wd4267", # Conversion from size_t to "type". |
235 ] | 234 ] |
236 defines += [ | 235 defines += [ |
237 "XP_PC", | 236 "XP_PC", |
238 "WIN32", | 237 "WIN32", |
239 "WIN95", | 238 "WIN95", |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 "_PR_PTHREADS", | 306 "_PR_PTHREADS", |
308 "HAVE_BSD_FLOCK", | 307 "HAVE_BSD_FLOCK", |
309 "HAVE_DLADDR", | 308 "HAVE_DLADDR", |
310 "HAVE_LCHOWN", | 309 "HAVE_LCHOWN", |
311 "HAVE_SOCKLEN_T", | 310 "HAVE_SOCKLEN_T", |
312 "HAVE_STRERROR", | 311 "HAVE_STRERROR", |
313 ] | 312 ] |
314 } | 313 } |
315 | 314 |
316 if (is_mac) { | 315 if (is_mac) { |
317 defines += [ | 316 defines += [ "HAVE_CRT_EXTERNS_H" ] |
318 "HAVE_CRT_EXTERNS_H", | |
319 ] | |
320 libs = [ | 317 libs = [ |
321 "CoreFoundation.framework", | 318 "CoreFoundation.framework", |
322 "CoreServices.framework", | 319 "CoreServices.framework", |
323 ] | 320 ] |
324 } | 321 } |
325 | 322 |
326 if (is_clang) { | 323 if (is_clang) { |
327 cflags += [ | 324 cflags += [ |
328 # nspr uses a bunch of deprecated functions (NSLinkModule etc) in | 325 # nspr uses a bunch of deprecated functions (NSLinkModule etc) in |
329 # prlink.c on mac. | 326 # prlink.c on mac. |
330 "-Wno-deprecated-declarations", | 327 "-Wno-deprecated-declarations", |
| 328 |
331 # nspr passes "const char*" through "void*". | 329 # nspr passes "const char*" through "void*". |
332 "-Wno-incompatible-pointer-types", | 330 "-Wno-incompatible-pointer-types", |
| 331 |
333 # nspr passes "int*" through "unsigned int*". | 332 # nspr passes "int*" through "unsigned int*". |
334 "-Wno-pointer-sign", | 333 "-Wno-pointer-sign", |
| 334 ] |
335 | 335 |
336 "-Wno-incompatible-pointer-types", | 336 # nspr uses assert(!"foo") instead of assert(false && "foo"). |
337 "-Wno-pointer-sign", | 337 configs -= [ "//build/config/clang:extra_warnings" ] |
338 ] | |
339 } | 338 } |
340 } | 339 } |
341 | 340 |
342 component("nss") { | 341 component("nss") { |
343 output_name = "crnss" | 342 output_name = "crnss" |
344 sources = [ | 343 sources = [ |
345 # Ensure at least one object file is produced, so that MSVC does not | 344 # Ensure at least one object file is produced, so that MSVC does not |
346 # warn when creating the static/shared library. See the note for | 345 # warn when creating the static/shared library. See the note for |
347 # the "nssckbi" target for why the "nss" target was split as such. | 346 # the "nssckbi" target for why the "nss" target was split as such. |
348 "nss/lib/nss/nssver.c", | 347 "nss/lib/nss/nssver.c", |
349 ] | 348 ] |
350 | 349 |
351 public_deps = [ ":nss_static" ] | 350 public_deps = [ |
| 351 ":nss_static", |
| 352 ] |
352 | 353 |
353 if (include_nss_root_certs) { | 354 if (include_nss_root_certs) { |
354 public_deps += [ ":nssckbi" ] | 355 public_deps += [ ":nssckbi" ] |
355 } | 356 } |
356 | 357 |
357 if (component_mode == "shared_library") { | 358 if (component_mode == "shared_library") { |
358 if (is_mac) { | 359 if (is_mac) { |
359 ldflags = [ "-all_load" ] | 360 ldflags = [ "-all_load" ] |
360 } else if (is_win) { | 361 } else if (is_win) { |
361 # Pass the def file to the linker. | 362 # Pass the def file to the linker. |
362 ldflags = [ | 363 ldflags = |
363 "/DEF:" + rebase_path("nss/exports_win.def", root_build_dir) | 364 [ "/DEF:" + rebase_path("nss/exports_win.def", root_build_dir) ] |
364 ] | |
365 } | 365 } |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 config("nssckbi_config") { | 369 config("nssckbi_config") { |
370 include_dirs = [ "nss/lib/ckfw/builtins" ] | 370 include_dirs = [ "nss/lib/ckfw/builtins" ] |
371 } | 371 } |
372 | 372 |
373 # This is really more of a pseudo-target to work around the fact that | 373 # This is really more of a pseudo-target to work around the fact that |
374 # a single static_library target cannot contain two object files of the | 374 # a single static_library target cannot contain two object files of the |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 "nss/lib/ckfw/nssckmdt.h", | 422 "nss/lib/ckfw/nssckmdt.h", |
423 "nss/lib/ckfw/nssckt.h", | 423 "nss/lib/ckfw/nssckt.h", |
424 "nss/lib/ckfw/object.c", | 424 "nss/lib/ckfw/object.c", |
425 "nss/lib/ckfw/session.c", | 425 "nss/lib/ckfw/session.c", |
426 "nss/lib/ckfw/sessobj.c", | 426 "nss/lib/ckfw/sessobj.c", |
427 "nss/lib/ckfw/slot.c", | 427 "nss/lib/ckfw/slot.c", |
428 "nss/lib/ckfw/token.c", | 428 "nss/lib/ckfw/token.c", |
429 "nss/lib/ckfw/wrap.c", | 429 "nss/lib/ckfw/wrap.c", |
430 ] | 430 ] |
431 | 431 |
432 configs -= [ | 432 configs -= [ "//build/config/compiler:chromium_code" ] |
433 "//build/config/compiler:chromium_code" | |
434 ] | |
435 | 433 |
436 if (is_win) { | 434 if (is_win) { |
437 configs -= [ | 435 configs -= [ "//build/config/win:unicode" ] # Requires 8-bit mode. |
438 "//build/config/win:unicode", # Requires 8-bit mode. | |
439 ] | |
440 } | 436 } |
441 configs += [ "//build/config/compiler:no_chromium_code" ] | 437 configs += [ "//build/config/compiler:no_chromium_code" ] |
442 | 438 |
443 include_dirs = [ "nss/lib/ckfw" ] | 439 include_dirs = [ "nss/lib/ckfw" ] |
444 public_configs = [ ":nssckbi_config" ] | 440 public_configs = [ ":nssckbi_config" ] |
445 | 441 |
446 public_deps = [ | 442 public_deps = [ |
447 ":nss_static", | 443 ":nss_static", |
448 ] | 444 ] |
449 } | 445 } |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 "nss/lib/util/utilpars.h", | 859 "nss/lib/util/utilpars.h", |
864 "nss/lib/util/utilparst.h", | 860 "nss/lib/util/utilparst.h", |
865 "nss/lib/util/utilrename.h", | 861 "nss/lib/util/utilrename.h", |
866 ] | 862 ] |
867 | 863 |
868 sources -= [ | 864 sources -= [ |
869 # mpi_arm.c is included by mpi_arm_mac.c. | 865 # mpi_arm.c is included by mpi_arm_mac.c. |
870 # NOTE: mpi_arm.c can be used directly on Linux. mpi_arm.c will need | 866 # NOTE: mpi_arm.c can be used directly on Linux. mpi_arm.c will need |
871 # to be excluded conditionally if we start to build NSS on Linux. | 867 # to be excluded conditionally if we start to build NSS on Linux. |
872 "nss/lib/freebl/mpi/mpi_arm.c", | 868 "nss/lib/freebl/mpi/mpi_arm.c", |
| 869 |
873 # primes.c is included by mpprime.c. | 870 # primes.c is included by mpprime.c. |
874 "nss/lib/freebl/mpi/primes.c", | 871 "nss/lib/freebl/mpi/primes.c", |
| 872 |
875 # unix_rand.c and win_rand.c are included by sysrand.c. | 873 # unix_rand.c and win_rand.c are included by sysrand.c. |
876 "nss/lib/freebl/unix_rand.c", | 874 "nss/lib/freebl/unix_rand.c", |
877 "nss/lib/freebl/win_rand.c", | 875 "nss/lib/freebl/win_rand.c", |
| 876 |
878 # debug_module.c is included by pk11load.c. | 877 # debug_module.c is included by pk11load.c. |
879 "nss/lib/pk11wrap/debug_module.c", | 878 "nss/lib/pk11wrap/debug_module.c", |
880 ] | 879 ] |
881 | 880 |
882 configs -= [ | 881 configs -= [ "//build/config/compiler:chromium_code" ] |
883 "//build/config/compiler:chromium_code" | |
884 ] | |
885 if (is_win) { | 882 if (is_win) { |
886 configs -= [ | 883 configs -= [ "//build/config/win:unicode" ] # Requires 8-bit mode. |
887 "//build/config/win:unicode", # Requires 8-bit mode. | |
888 ] | |
889 } | 884 } |
890 configs += [ "//build/config/compiler:no_chromium_code" ] | 885 configs += [ "//build/config/compiler:no_chromium_code" ] |
891 public_configs = [ ":nss_static_config" ] | 886 public_configs = [ ":nss_static_config" ] |
892 | 887 |
893 cflags = [] | 888 cflags = [] |
894 | 889 |
895 # Only need the defines and includes not in nss_static_config. | 890 # Only need the defines and includes not in nss_static_config. |
896 defines = [ | 891 defines = [ |
897 "MP_API_COMPATIBLE", | 892 "MP_API_COMPATIBLE", |
898 "NSS_DISABLE_DBM", | 893 "NSS_DISABLE_DBM", |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 "nss/lib/freebl/poly1305/poly1305.c", | 1100 "nss/lib/freebl/poly1305/poly1305.c", |
1106 ] | 1101 ] |
1107 } else { | 1102 } else { |
1108 sources -= [ | 1103 sources -= [ |
1109 "nss/lib/freebl/chacha20/chacha20_vec.c", | 1104 "nss/lib/freebl/chacha20/chacha20_vec.c", |
1110 "nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c", | 1105 "nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c", |
1111 ] | 1106 ] |
1112 } | 1107 } |
1113 | 1108 |
1114 if (is_mac || is_ios) { | 1109 if (is_mac || is_ios) { |
1115 sources -= [ | 1110 sources -= [ "nss/lib/freebl/mpi/mpi_amd64.c" ] |
1116 "nss/lib/freebl/mpi/mpi_amd64.c", | |
1117 ] | |
1118 cflags += [ | 1111 cflags += [ |
1119 "-include", | 1112 "-include", |
1120 rebase_path("//third_party/nss/nss/lib/freebl/nss_build_config_mac.h", | 1113 rebase_path("//third_party/nss/nss/lib/freebl/nss_build_config_mac.h", |
1121 root_build_dir), | 1114 root_build_dir), |
1122 ] | 1115 ] |
1123 defines += [ | 1116 defines += [ |
1124 "XP_UNIX", | 1117 "XP_UNIX", |
1125 "DARWIN", | 1118 "DARWIN", |
1126 "HAVE_STRERROR", | 1119 "HAVE_STRERROR", |
1127 "HAVE_BSD_FLOCK", | 1120 "HAVE_BSD_FLOCK", |
(...skipping 24 matching lines...) Expand all Loading... |
1152 "NSS_X86", | 1145 "NSS_X86", |
1153 "_X86_", | 1146 "_X86_", |
1154 "MP_ASSEMBLY_MULTIPLY", | 1147 "MP_ASSEMBLY_MULTIPLY", |
1155 "MP_ASSEMBLY_SQUARE", | 1148 "MP_ASSEMBLY_SQUARE", |
1156 "MP_ASSEMBLY_DIV_2DX1D", | 1149 "MP_ASSEMBLY_DIV_2DX1D", |
1157 "MP_USE_UINT_DIGIT", | 1150 "MP_USE_UINT_DIGIT", |
1158 "MP_NO_MP_WORD", | 1151 "MP_NO_MP_WORD", |
1159 "USE_HW_AES", | 1152 "USE_HW_AES", |
1160 "INTEL_GCM", | 1153 "INTEL_GCM", |
1161 ] | 1154 ] |
1162 sources -= [ | 1155 sources -= [ "nss/lib/freebl/mpi/mpi_amd64.c" ] |
1163 "nss/lib/freebl/mpi/mpi_amd64.c", | |
1164 ] | |
1165 | |
1166 } else if (cpu_arch == "x64") { | 1156 } else if (cpu_arch == "x64") { |
1167 sources -= [ | 1157 sources -= [ |
1168 "nss/lib/freebl/intel-aes-x86-masm.asm", | 1158 "nss/lib/freebl/intel-aes-x86-masm.asm", |
1169 "nss/lib/freebl/mpi/mpi_amd64.c", | 1159 "nss/lib/freebl/mpi/mpi_amd64.c", |
1170 "nss/lib/freebl/mpi/mpi_x86_asm.c", | 1160 "nss/lib/freebl/mpi/mpi_x86_asm.c", |
1171 ] | 1161 ] |
1172 defines += [ | 1162 defines += [ |
1173 "NSS_USE_64", | 1163 "NSS_USE_64", |
1174 "NSS_X86_OR_X64", | 1164 "NSS_X86_OR_X64", |
1175 "NSS_X64", | 1165 "NSS_X64", |
1176 "_AMD64_", | 1166 "_AMD64_", |
1177 "MP_CHAR_STORE_SLOW", | 1167 "MP_CHAR_STORE_SLOW", |
1178 "MP_IS_LITTLE_ENDIAN", | 1168 "MP_IS_LITTLE_ENDIAN", |
1179 "WIN64", | 1169 "WIN64", |
1180 ] | 1170 ] |
1181 } | 1171 } |
1182 } else { | 1172 } else { |
1183 # Not Windows. | 1173 # Not Windows. |
1184 sources -= [ | 1174 sources -= [ |
1185 # mpi_x86_asm.c contains MSVC inline assembly code. | 1175 # mpi_x86_asm.c contains MSVC inline assembly code. |
1186 "nss/lib/freebl/mpi/mpi_x86_asm.c", | 1176 "nss/lib/freebl/mpi/mpi_x86_asm.c", |
1187 ] | 1177 ] |
1188 } | 1178 } |
1189 | 1179 |
1190 if (is_clang) { | 1180 if (is_clang) { |
1191 cflags += [ | 1181 cflags += [ |
1192 # nss doesn"t explicitly cast between different enum types. | 1182 # nss doesn"t explicitly cast between different enum types. |
1193 "-Wno-conversion", | 1183 "-Wno-conversion", |
| 1184 |
1194 # nss passes "const char*" through "void*". | 1185 # nss passes "const char*" through "void*". |
1195 "-Wno-incompatible-pointer-types", | 1186 "-Wno-incompatible-pointer-types", |
| 1187 |
1196 # nss prefers `a && b || c` over `(a && b) || c`. | 1188 # nss prefers `a && b || c` over `(a && b) || c`. |
1197 "-Wno-logical-op-parentheses", | 1189 "-Wno-logical-op-parentheses", |
| 1190 |
1198 # nss doesn"t use exhaustive switches on enums | 1191 # nss doesn"t use exhaustive switches on enums |
1199 "-Wno-switch", | 1192 "-Wno-switch", |
| 1193 |
1200 # nss has some `unsigned < 0` checks. | 1194 # nss has some `unsigned < 0` checks. |
1201 "-Wno-tautological-compare", | 1195 "-Wno-tautological-compare", |
1202 ] | 1196 ] |
1203 } | 1197 } |
1204 | 1198 |
1205 public_deps = [ | 1199 public_deps = [ |
1206 ":nspr", | 1200 ":nspr", |
1207 ] | 1201 ] |
1208 deps = [ | 1202 deps = [ |
1209 ":nspr", | 1203 ":nspr", |
1210 "//third_party/sqlite", | 1204 "//third_party/sqlite", |
1211 ] | 1205 ] |
1212 | 1206 |
1213 if (is_win && cpu_arch == "x86") { | 1207 if (is_win && cpu_arch == "x86") { |
1214 deps += [ ":nss_static_avx" ] | 1208 deps += [ ":nss_static_avx" ] |
1215 } | 1209 } |
1216 } | 1210 } |
1217 } # Windows/Mac/iOS. | 1211 } # Windows/Mac/iOS. |
1218 | |
OLD | NEW |