nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 439 lines 12 kB view raw
1diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn 2new file mode 100644 3index 00000000000..9e54d4efe4e 4--- /dev/null 5+++ b/build/linux/unbundle/icu.gn 6@@ -0,0 +1,262 @@ 7+# Copyright 2016 The Chromium Authors 8+# Use of this source code is governed by a BSD-style license that can be 9+# found in the LICENSE file. 10+ 11+import("//build/config/linux/pkg_config.gni") 12+import("//build/shim_headers.gni") 13+ 14+group("icu") { 15+ public_deps = [ 16+ ":icui18n", 17+ ":icuuc", 18+ ] 19+} 20+ 21+config("icu_config") { 22+ defines = [ 23+ "USING_SYSTEM_ICU=1", 24+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC", 25+ 26+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility 27+ # on classes through the U_COMMON_API and U_I18N_API macros (among others). 28+ # When linking against the system ICU library, we want its symbols to have 29+ # public LTO visibility. This disables CFI checks for the ICU classes and 30+ # allows whole-program optimization to be applied to the rest of Chromium. 31+ # 32+ # Both U_COMMON_API and U_I18N_API macros would be defined to U_EXPORT only 33+ # when U_COMBINED_IMPLEMENTATION is defined (see unicode/utypes.h). Because 34+ # we override the default system UCHAR_TYPE (char16_t), it is not possible 35+ # to use U_COMBINED_IMPLEMENTATION at this moment, meaning the U_COMMON_API 36+ # and U_I18N_API macros are set to U_IMPORT which is an empty definition. 37+ # 38+ # Until building with UCHAR_TYPE=char16_t is supported, one way to apply 39+ # public visibility (and thus public LTO visibility) to all ICU classes is 40+ # to define U_IMPORT to have the same value as U_EXPORT. For more details, 41+ # please see: https://crbug.com/822820 42+ "U_IMPORT=U_EXPORT", 43+ ] 44+} 45+ 46+pkg_config("system_icui18n") { 47+ packages = [ "icu-i18n" ] 48+} 49+ 50+pkg_config("system_icuuc") { 51+ packages = [ "icu-uc" ] 52+} 53+ 54+source_set("icui18n") { 55+ public_deps = [ ":icui18n_shim" ] 56+ public_configs = [ 57+ ":icu_config", 58+ ":system_icui18n", 59+ ] 60+} 61+ 62+source_set("icuuc") { 63+ public_deps = [ ":icuuc_shim" ] 64+ public_configs = [ 65+ ":icu_config", 66+ ":system_icuuc", 67+ ] 68+} 69+ 70+group("icui18n_hidden_visibility") { 71+ public_deps = [ ":icui18n" ] 72+} 73+ 74+group("icuuc_hidden_visibility") { 75+ public_deps = [ ":icuuc" ] 76+} 77+ 78+shim_headers("icui18n_shim") { 79+ root_path = "source/i18n" 80+ headers = [ 81+ # This list can easily be updated using the commands below: 82+ # cd third_party/icu/source/i18n 83+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u 84+ "unicode/alphaindex.h", 85+ "unicode/basictz.h", 86+ "unicode/calendar.h", 87+ "unicode/choicfmt.h", 88+ "unicode/coleitr.h", 89+ "unicode/coll.h", 90+ "unicode/compactdecimalformat.h", 91+ "unicode/curramt.h", 92+ "unicode/currpinf.h", 93+ "unicode/currunit.h", 94+ "unicode/datefmt.h", 95+ "unicode/dcfmtsym.h", 96+ "unicode/decimfmt.h", 97+ "unicode/dtfmtsym.h", 98+ "unicode/dtitvfmt.h", 99+ "unicode/dtitvinf.h", 100+ "unicode/dtptngen.h", 101+ "unicode/dtrule.h", 102+ "unicode/fieldpos.h", 103+ "unicode/fmtable.h", 104+ "unicode/format.h", 105+ "unicode/fpositer.h", 106+ "unicode/gender.h", 107+ "unicode/gregocal.h", 108+ "unicode/listformatter.h", 109+ "unicode/measfmt.h", 110+ "unicode/measunit.h", 111+ "unicode/measure.h", 112+ "unicode/msgfmt.h", 113+ "unicode/numfmt.h", 114+ "unicode/numsys.h", 115+ "unicode/plurfmt.h", 116+ "unicode/plurrule.h", 117+ "unicode/rbnf.h", 118+ "unicode/rbtz.h", 119+ "unicode/regex.h", 120+ "unicode/region.h", 121+ "unicode/reldatefmt.h", 122+ "unicode/scientificnumberformatter.h", 123+ "unicode/search.h", 124+ "unicode/selfmt.h", 125+ "unicode/simpletz.h", 126+ "unicode/smpdtfmt.h", 127+ "unicode/sortkey.h", 128+ "unicode/stsearch.h", 129+ "unicode/tblcoll.h", 130+ "unicode/timezone.h", 131+ "unicode/tmunit.h", 132+ "unicode/tmutamt.h", 133+ "unicode/tmutfmt.h", 134+ "unicode/translit.h", 135+ "unicode/tzfmt.h", 136+ "unicode/tznames.h", 137+ "unicode/tzrule.h", 138+ "unicode/tztrans.h", 139+ "unicode/ucal.h", 140+ "unicode/ucol.h", 141+ "unicode/ucoleitr.h", 142+ "unicode/ucsdet.h", 143+ "unicode/udat.h", 144+ "unicode/udateintervalformat.h", 145+ "unicode/udatpg.h", 146+ "unicode/ufieldpositer.h", 147+ "unicode/uformattable.h", 148+ "unicode/ugender.h", 149+ "unicode/ulocdata.h", 150+ "unicode/umsg.h", 151+ "unicode/unirepl.h", 152+ "unicode/unum.h", 153+ "unicode/unumsys.h", 154+ "unicode/upluralrules.h", 155+ "unicode/uregex.h", 156+ "unicode/uregion.h", 157+ "unicode/ureldatefmt.h", 158+ "unicode/usearch.h", 159+ "unicode/uspoof.h", 160+ "unicode/utmscale.h", 161+ "unicode/utrans.h", 162+ "unicode/vtzone.h", 163+ ] 164+} 165+ 166+shim_headers("icuuc_shim") { 167+ root_path = "source/common" 168+ headers = [ 169+ # This list can easily be updated using the commands below: 170+ # cd third_party/icu/source/common 171+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u 172+ "unicode/appendable.h", 173+ "unicode/brkiter.h", 174+ "unicode/bytestream.h", 175+ "unicode/bytestrie.h", 176+ "unicode/bytestriebuilder.h", 177+ "unicode/caniter.h", 178+ "unicode/casemap.h", 179+ "unicode/char16ptr.h", 180+ "unicode/chariter.h", 181+ "unicode/dbbi.h", 182+ "unicode/docmain.h", 183+ "unicode/dtintrv.h", 184+ "unicode/edits.h", 185+ "unicode/enumset.h", 186+ "unicode/errorcode.h", 187+ "unicode/filteredbrk.h", 188+ "unicode/icudataver.h", 189+ "unicode/icuplug.h", 190+ "unicode/idna.h", 191+ "unicode/localematcher.h", 192+ "unicode/localpointer.h", 193+ "unicode/locdspnm.h", 194+ "unicode/locid.h", 195+ "unicode/messagepattern.h", 196+ "unicode/normalizer2.h", 197+ "unicode/normlzr.h", 198+ "unicode/parseerr.h", 199+ "unicode/parsepos.h", 200+ "unicode/platform.h", 201+ "unicode/ptypes.h", 202+ "unicode/putil.h", 203+ "unicode/rbbi.h", 204+ "unicode/rep.h", 205+ "unicode/resbund.h", 206+ "unicode/schriter.h", 207+ "unicode/simpleformatter.h", 208+ "unicode/std_string.h", 209+ "unicode/strenum.h", 210+ "unicode/stringpiece.h", 211+ "unicode/stringtriebuilder.h", 212+ "unicode/symtable.h", 213+ "unicode/ubidi.h", 214+ "unicode/ubiditransform.h", 215+ "unicode/ubrk.h", 216+ "unicode/ucasemap.h", 217+ "unicode/ucat.h", 218+ "unicode/uchar.h", 219+ "unicode/ucharstrie.h", 220+ "unicode/ucharstriebuilder.h", 221+ "unicode/uchriter.h", 222+ "unicode/uclean.h", 223+ "unicode/ucnv.h", 224+ "unicode/ucnv_cb.h", 225+ "unicode/ucnv_err.h", 226+ "unicode/ucnvsel.h", 227+ "unicode/uconfig.h", 228+ "unicode/ucurr.h", 229+ "unicode/udata.h", 230+ "unicode/udisplaycontext.h", 231+ "unicode/uenum.h", 232+ "unicode/uidna.h", 233+ "unicode/uiter.h", 234+ "unicode/uldnames.h", 235+ "unicode/ulistformatter.h", 236+ "unicode/uloc.h", 237+ "unicode/umachine.h", 238+ "unicode/umisc.h", 239+ "unicode/unifilt.h", 240+ "unicode/unifunct.h", 241+ "unicode/unimatch.h", 242+ "unicode/uniset.h", 243+ "unicode/unistr.h", 244+ "unicode/unorm.h", 245+ "unicode/unorm2.h", 246+ "unicode/uobject.h", 247+ "unicode/urename.h", 248+ "unicode/urep.h", 249+ "unicode/ures.h", 250+ "unicode/uscript.h", 251+ "unicode/uset.h", 252+ "unicode/usetiter.h", 253+ "unicode/ushape.h", 254+ "unicode/usprep.h", 255+ "unicode/ustring.h", 256+ "unicode/ustringtrie.h", 257+ "unicode/utext.h", 258+ "unicode/utf.h", 259+ "unicode/utf16.h", 260+ "unicode/utf32.h", 261+ "unicode/utf8.h", 262+ "unicode/utf_old.h", 263+ "unicode/utrace.h", 264+ "unicode/utypes.h", 265+ "unicode/uvernum.h", 266+ "unicode/uversion.h", 267+ ] 268+} 269diff --git a/build/linux/unbundle/replace_gn_files.py b/build/linux/unbundle/replace_gn_files.py 270new file mode 100755 271index 00000000000..1aed7bca99d 272--- /dev/null 273+++ b/build/linux/unbundle/replace_gn_files.py 274@@ -0,0 +1,65 @@ 275+#!/usr/bin/env python3 276+# Copyright 2016 The Chromium Authors 277+# Use of this source code is governed by a BSD-style license that can be 278+# found in the LICENSE file. 279+ 280+""" 281+Replaces GN files in tree with files from here that 282+make the build use system libraries. 283+""" 284+ 285+import argparse 286+import os 287+import shutil 288+import sys 289+ 290+ 291+REPLACEMENTS = { 292+ 'icu': 'third_party/icu/BUILD.gn', 293+ 'protobuf': 'build/secondary/third_party/protobuf/BUILD.gn', 294+ 'zlib': 'third_party/zlib/BUILD.gn', 295+} 296+ 297+ 298+def DoMain(argv): 299+ my_dirname = os.path.dirname(__file__) 300+ source_tree_root = os.path.abspath( 301+ os.path.join(my_dirname, '..', '..', '..')) 302+ 303+ parser = argparse.ArgumentParser() 304+ parser.add_argument('--system-libraries', nargs='*', default=[]) 305+ parser.add_argument('--undo', action='store_true') 306+ 307+ args = parser.parse_args(argv) 308+ 309+ handled_libraries = set() 310+ for lib, path in REPLACEMENTS.items(): 311+ if lib not in args.system_libraries: 312+ continue 313+ handled_libraries.add(lib) 314+ 315+ if args.undo: 316+ # Restore original file, and also remove the backup. 317+ # This is meant to restore the source tree to its original state. 318+ os.rename(os.path.join(source_tree_root, path + '.orig'), 319+ os.path.join(source_tree_root, path)) 320+ else: 321+ # Create a backup copy for --undo. 322+ shutil.copyfile(os.path.join(source_tree_root, path), 323+ os.path.join(source_tree_root, path + '.orig')) 324+ 325+ # Copy the GN file from directory of this script to target path. 326+ shutil.copyfile(os.path.join(my_dirname, '%s.gn' % lib), 327+ os.path.join(source_tree_root, path)) 328+ 329+ unhandled_libraries = set(args.system_libraries) - handled_libraries 330+ if unhandled_libraries: 331+ print('Unrecognized system libraries requested: %s' % ', '.join( 332+ sorted(unhandled_libraries)), file=sys.stderr) 333+ return 1 334+ 335+ return 0 336+ 337+ 338+if __name__ == '__main__': 339+ sys.exit(DoMain(sys.argv[1:])) 340diff --git a/build/linux/unbundle/zlib.gn b/build/linux/unbundle/zlib.gn 341new file mode 100644 342index 00000000000..fa2bbffd25f 343--- /dev/null 344+++ b/build/linux/unbundle/zlib.gn 345@@ -0,0 +1,63 @@ 346+# Copyright 2016 The Chromium Authors 347+# Use of this source code is governed by a BSD-style license that can be 348+# found in the LICENSE file. 349+ 350+import("//build/shim_headers.gni") 351+ 352+shim_headers("zlib_shim") { 353+ root_path = "." 354+ headers = [ "zlib.h" ] 355+ additional_includes = [ "third_party" ] 356+ 357+} 358+ 359+config("system_zlib") { 360+ defines = [ "USE_SYSTEM_ZLIB=1" ] 361+} 362+ 363+config("zlib_config") { 364+ configs = [ ":system_zlib" ] 365+} 366+ 367+source_set("zlib") { 368+ public_deps = [ ":zlib_shim" ] 369+ libs = [ "z" ] 370+ public_configs = [ ":system_zlib" ] 371+} 372+ 373+shim_headers("minizip_shim") { 374+ root_path = "contrib" 375+ headers = [ 376+ "minizip/crypt.h", 377+ "minizip/ioapi.h", 378+ "minizip/iowin32.h", 379+ "minizip/mztools.h", 380+ "minizip/unzip.h", 381+ "minizip/zip.h", 382+ ] 383+} 384+ 385+source_set("minizip") { 386+ deps = [ ":minizip_shim" ] 387+ libs = [ "minizip" ] 388+} 389+ 390+static_library("zip") { 391+ sources = [ 392+ "google/zip.cc", 393+ "google/zip.h", 394+ "google/zip_internal.cc", 395+ "google/zip_internal.h", 396+ "google/zip_reader.cc", 397+ "google/zip_reader.h", 398+ ] 399+ deps = [ ":minizip" ] 400+} 401+ 402+static_library("compression_utils") { 403+ sources = [ 404+ "google/compression_utils.cc", 405+ "google/compression_utils.h", 406+ ] 407+ deps = [ ":zlib" ] 408+} 409diff --git a/build/shim_headers.gni b/build/shim_headers.gni 410index dc57d12ed0c..1d24e0ad00e 100644 411--- a/build/shim_headers.gni 412+++ b/build/shim_headers.gni 413@@ -7,6 +7,11 @@ template("shim_headers") { 414 shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}" 415 config(config_name) { 416 include_dirs = [ shim_headers_path ] 417+ if (defined(invoker.additional_includes)) { 418+ foreach(i, invoker.additional_includes) { 419+ include_dirs += [ shim_headers_path + "/" + i ] 420+ } 421+ } 422 } 423 action(action_name) { 424 script = "//tools/generate_shim_headers.py" 425@@ -26,11 +31,12 @@ template("shim_headers") { 426 args += invoker.headers 427 outputs = [] 428 foreach(h, invoker.headers) { 429- outputs += [ shim_headers_path + "/" + rebase_path(invoker.root_path,"//") + "/" + h ] 430+ outputs += [ shim_headers_path + "/" + 431+ rebase_path(invoker.root_path, "//") + "/" + h ] 432 } 433 } 434 group(target_name) { 435- deps = [ ":${action_name}" ] 436+ public_deps = [ ":${action_name}" ] 437 all_dependent_configs = [ ":${config_name}" ] 438 } 439 }