dart-source: init (#482877)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
stdenv,
|
||||
fetchurl,
|
||||
unzip,
|
||||
bintools,
|
||||
versionCheckHook,
|
||||
runCommand,
|
||||
cctools,
|
||||
@@ -48,7 +47,12 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
cp -R . $out
|
||||
''
|
||||
+ lib.optionalString (stdenv.hostPlatform.isLinux) ''
|
||||
find $out/bin -executable -type f -exec patchelf --set-interpreter ${bintools.dynamicLinker} {} \;
|
||||
find $out/bin -type f -executable | while read f; do
|
||||
if patchelf --print-interpreter "$f" >/dev/null 2>&1; then
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "${lib.makeLibraryPath [ (lib.getLib stdenv.cc.cc) ]}" "$f"
|
||||
fi
|
||||
done
|
||||
''
|
||||
+ ''
|
||||
runHook postInstall
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
||||
index b041a075..27dc22ed 100644
|
||||
--- a/build/config/compiler/BUILD.gn
|
||||
+++ b/build/config/compiler/BUILD.gn
|
||||
@@ -430,6 +430,10 @@ config("compiler") {
|
||||
}
|
||||
}
|
||||
|
||||
+ cflags_c += string_split(getenv("CFLAGS"), " ")
|
||||
+ cflags_cc += string_split(getenv("CXXFLAGS"), " ")
|
||||
+ ldflags += string_split(getenv("LDFLAGS"), " ")
|
||||
+
|
||||
# Assign any flags set for the C compiler to asmflags so that they are sent
|
||||
# to the assembler. The Windows assembler takes different types of flags
|
||||
# so only do so for posix platforms.
|
||||
@@ -0,0 +1,261 @@
|
||||
{
|
||||
bintools,
|
||||
buildPackages,
|
||||
callPackage,
|
||||
cacert,
|
||||
curlMinimal,
|
||||
dart,
|
||||
debug ? false,
|
||||
fetchurl,
|
||||
gn,
|
||||
gitMinimal,
|
||||
gitSetupHook,
|
||||
icu,
|
||||
jq,
|
||||
lib,
|
||||
nix-update,
|
||||
pax-utils,
|
||||
pkg-config,
|
||||
python312,
|
||||
ripgrep,
|
||||
runCommand,
|
||||
samurai,
|
||||
stdenv,
|
||||
versionCheckHook,
|
||||
writeShellScript,
|
||||
writeText,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "3.11.0";
|
||||
|
||||
tools = callPackage ../../flutter/engine/tools.nix { inherit (stdenv) hostPlatform buildPlatform; };
|
||||
|
||||
getArchInfo =
|
||||
platform:
|
||||
let
|
||||
arch = if platform.isx86_64 then "x64" else platform.linuxArch;
|
||||
in
|
||||
{
|
||||
inherit arch;
|
||||
outSuffix = lib.strings.toUpper arch;
|
||||
};
|
||||
|
||||
targetArchInfo = getArchInfo stdenv.hostPlatform;
|
||||
|
||||
buildArchInfo = getArchInfo stdenv.buildPlatform;
|
||||
|
||||
python3 = python312.withPackages (
|
||||
ps: with ps; [
|
||||
httplib2
|
||||
six
|
||||
]
|
||||
);
|
||||
|
||||
src =
|
||||
runCommand "dart-source-deps"
|
||||
{
|
||||
pname = "dart-source-deps";
|
||||
inherit version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cacert
|
||||
curlMinimal
|
||||
gitMinimal
|
||||
pax-utils
|
||||
python3
|
||||
tools.cipd
|
||||
];
|
||||
|
||||
env = {
|
||||
NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
DEPOT_TOOLS_UPDATE = "0";
|
||||
DEPOT_TOOLS_COLLECT_METRICS = "0";
|
||||
PYTHONDONTWRITEBYTECODE = "1";
|
||||
CIPD_HTTP_USER_AGENT = "standard-nix-build";
|
||||
};
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-7y6kNpjWpc8+4Rhv+GuMnV5xHCQ5om2/3woZOJ8wYSc=";
|
||||
}
|
||||
''
|
||||
mkdir source
|
||||
cd source
|
||||
source ${../../../../build-support/fetchgit/deterministic-git}
|
||||
export -f clean_git
|
||||
export -f make_deterministic_repo
|
||||
cp ${writeText ".gclient" ''
|
||||
solutions = [{
|
||||
'name': 'sdk',
|
||||
'url': 'https://dart.googlesource.com/sdk.git@${version}',
|
||||
}]
|
||||
target_os = ['linux']
|
||||
target_cpu = ['x64', 'arm64', 'riscv64']
|
||||
target_cpu_only = True
|
||||
''} .gclient
|
||||
export PATH=${python3}/bin:$PATH:${tools.depot_tools}
|
||||
python3 ${tools.depot_tools}/gclient.py sync --no-history --nohooks --noprehooks
|
||||
find sdk -name ".versions" -type d -exec rm -rf {} +
|
||||
rm --recursive --force sdk/buildtools/sysroot
|
||||
rm --recursive --force sdk/buildtools/linux-arm64
|
||||
rm --recursive --force sdk/buildtools/reclient
|
||||
rm --recursive --force sdk/buildtools/*/clang
|
||||
find sdk -type f \( -name "*.snapshot" -o -name "*.dill" -o -name "*.sym" \) -delete
|
||||
rm --recursive --force sdk/tools/sdks/dart-sdk
|
||||
find . -type l ! -exec test -e {} \; -delete
|
||||
find . -name "ChangeLog*" -delete
|
||||
rm --force .gclient .gclient_entries .gclient_previous_sync_commits .last_sync_hashes
|
||||
rm --recursive --force .cipd .cipd_cache
|
||||
find . -name ".git" -type d -prune -exec rm --recursive --force {} +
|
||||
find . -name ".git*" -exec rm --recursive --force {} +
|
||||
find . \( \
|
||||
-name ".build-id" -o \
|
||||
-name ".svn" -o \
|
||||
-name "*~" -o \
|
||||
-name "#*#" \
|
||||
\) -exec rm --recursive --force {} +
|
||||
for elf in $(scanelf --recursive --all --format "%F" sdk | sort); do
|
||||
rm --force "$elf"
|
||||
done
|
||||
find . -name "__pycache__" -type d -exec rm --recursive --force {} +
|
||||
find . -name "*.pyc" -delete
|
||||
cp --recursive sdk $out
|
||||
'';
|
||||
in
|
||||
dart.overrideAttrs (oldAttrs: {
|
||||
inherit version src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gitMinimal
|
||||
gitSetupHook
|
||||
python312
|
||||
ripgrep
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
|
||||
icu
|
||||
zlib
|
||||
];
|
||||
|
||||
patches = [
|
||||
./gcc13.patch
|
||||
./zlib-not-found.patch
|
||||
./custom-flags.patch
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
|
||||
./unbundle.patch
|
||||
./unbundle-icu.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed --in-place 's/"-fsanitize=memory"//g' build/config/compiler/BUILD.gn
|
||||
patchShebangs runtime/tools/
|
||||
sed --in-place 's/ldflags = pkgresult\[4\]/ldflags = []/' build/config/linux/pkg_config.gni
|
||||
cp ${
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/chromium/chromium/631a813125b886a52274653144019fd1681a0e97/build/config/linux/pkg-config.py";
|
||||
hash = "sha256-9coRpgCewlkFXSGrMVkudaZUll0IFc9jDRBP+2PloOI=";
|
||||
}
|
||||
} build/config/linux/pkg-config.py
|
||||
''
|
||||
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||
sed --in-place "s/default='pkg-config'/default='${stdenv.cc.targetPrefix}pkg-config'/g" build/config/linux/pkg-config.py
|
||||
mkdir --parents .bin-tools
|
||||
ln --symbolic $(command -v ${buildPackages.stdenv.cc.targetPrefix}g++) .bin-tools/${stdenv.buildPlatform.parsed.cpu.name}-linux-gnu-g++
|
||||
ln --symbolic $(command -v ${buildPackages.stdenv.cc.targetPrefix}gcc) .bin-tools/${stdenv.buildPlatform.parsed.cpu.name}-linux-gnu-gcc
|
||||
ln --symbolic $(command -v ${buildPackages.stdenv.cc.targetPrefix}ar) .bin-tools/${stdenv.buildPlatform.parsed.cpu.name}-linux-gnu-ar
|
||||
export PATH=$PWD/.bin-tools:$PATH
|
||||
''
|
||||
+ ''
|
||||
ln --symbolic ${buildPackages.dart} tools/sdks/dart-sdk
|
||||
ln --symbolic --force ${lib.getExe buildPackages.gn} buildtools/gn
|
||||
mkdir --parents buildtools/ninja
|
||||
ln --symbolic --force ${lib.getExe buildPackages.samurai} buildtools/ninja/ninja
|
||||
python3 tools/generate_package_config.py
|
||||
python3 tools/generate_sdk_version_file.py
|
||||
echo "" > tools/bots/dartdoc_footer.html
|
||||
rm third_party/devtools/web/devtools_analytics.js
|
||||
JOBS_COUNT=''${NIX_BUILD_CORES:-2}
|
||||
rg --no-ignore -l 'google-analytics\.com' . \
|
||||
| rg -v "\.map\$" \
|
||||
| xargs --no-run-if-empty -t -n 1 -P "$JOBS_COUNT" \
|
||||
sed --in-place --regexp-extended 's|([^/]+\.)?google-analytics\.com|0\.0\.0\.0|g'
|
||||
rg --no-ignore -l 'UA-[0-9]+-[0-9]+' . \
|
||||
| xargs --no-run-if-empty -t -n 1 -P "$JOBS_COUNT" \
|
||||
sed --in-place --regexp-extended 's|UA-[0-9]+-[0-9]+|UA-2137-0|g'
|
||||
''
|
||||
+ lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
|
||||
for _lib in icu zlib; do
|
||||
find . -type f -path "*third_party/$_lib/*" \
|
||||
\! -path "*third_party/$_lib/chromium/*" \
|
||||
\! -path "*third_party/$_lib/google/*" \
|
||||
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
|
||||
-delete
|
||||
done
|
||||
python3 build/linux/unbundle/replace_gn_files.py --system-libraries icu zlib
|
||||
''
|
||||
+ ''
|
||||
git init
|
||||
git add .
|
||||
git commit --message="stub" --quiet
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
python3 ./tools/build.py \
|
||||
--no-clang \
|
||||
--mode=${if debug then "debug" else "release"} \
|
||||
--arch=${targetArchInfo.arch} \
|
||||
--gn-args="${targetArchInfo.arch}_toolchain_prefix=\"${stdenv.cc}/bin/${stdenv.cc.targetPrefix}\"" \
|
||||
''
|
||||
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||
--gn-args="dart_target_arch=\"${targetArchInfo.arch}\"" \
|
||||
--gn-args="dart_host_arch=\"${buildArchInfo.arch}\"" \
|
||||
--gn-args="${buildArchInfo.arch}_toolchain_prefix=\"${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}\"" \
|
||||
--gn-args="host_cpu=\"${buildArchInfo.arch}\"" \
|
||||
--gn-args="dart_force_runtime_snapshot_deps=true" \
|
||||
--gn-args="host_toolchain_prefix=\"${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}\"" \
|
||||
--gn-args="target_cpu=\"${targetArchInfo.arch}\"" \
|
||||
''
|
||||
+ lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
|
||||
--gn-args="dart_embed_icu_data=false dart_snapshot_kind=\"app-jit\"" \
|
||||
''
|
||||
+ ''
|
||||
--gn-args="dart_sysroot=\"\"" \
|
||||
--no-verify-sdk-hash \
|
||||
create_sdk runtime
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
pushd out/${if debug then "Debug" else "Release"}${
|
||||
if (stdenv.hostPlatform == stdenv.buildPlatform) then targetArchInfo.outSuffix else "*"
|
||||
}/dart-sdk
|
||||
rm LICENSE README revision
|
||||
cp --recursive . $out
|
||||
popd
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeShellScript "update-dart" ''
|
||||
${lib.getExe nix-update} --version=$(${lib.getExe curlMinimal} --fail --location --silent https://storage.googleapis.com/dart-archive/channels/stable/release/latest/VERSION | ${lib.getExe jq} --raw-output .version)
|
||||
'';
|
||||
|
||||
meta = oldAttrs.meta // {
|
||||
platforms = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
||||
};
|
||||
})
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/runtime/bin/ffi_test/ffi_test_functions_generated.cc
|
||||
+++ b/runtime/bin/ffi_test/ffi_test_functions_generated.cc
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cmath>
|
||||
+#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
--- a/runtime/bin/ffi_test/ffi_test_functions.cc
|
||||
+++ b/runtime/bin/ffi_test/ffi_test_functions.cc
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cmath>
|
||||
+#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 0d936b3e64e1e629bd29fa4dd84240f5c5344092 Mon Sep 17 00:00:00 2001
|
||||
From: LN Liberda <lauren@selfisekai.rocks>
|
||||
Date: Tue, 26 Nov 2024 19:28:59 +0100
|
||||
Subject: [PATCH] build: option to not embed icu data
|
||||
|
||||
Bug: none
|
||||
---
|
||||
runtime/bin/BUILD.gn | 11 ++++++++---
|
||||
runtime/runtime_args.gni | 3 +++
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
|
||||
index 90dc09a0c02..8f88873dc18 100644
|
||||
--- a/runtime/bin/BUILD.gn
|
||||
+++ b/runtime/bin/BUILD.gn
|
||||
@@ -795,7 +795,6 @@ template("dart_executable") {
|
||||
}
|
||||
deps = [
|
||||
":crashpad",
|
||||
- ":icudtl_cc",
|
||||
"//third_party/boringssl",
|
||||
"//third_party/icu:icui18n",
|
||||
"//third_party/icu:icuuc",
|
||||
@@ -804,7 +803,11 @@ template("dart_executable") {
|
||||
if (is_fuchsia) {
|
||||
deps += [ "$fuchsia_sdk/pkg/fdio" ]
|
||||
}
|
||||
- defines = [ "DART_EMBED_ICU_DATA" ] + extra_defines
|
||||
+ defines = extra_defines
|
||||
+ if (dart_embed_icu_data) {
|
||||
+ defines += [ "DART_EMBED_ICU_DATA" ]
|
||||
+ deps += [ ":icudtl_cc" ]
|
||||
+ }
|
||||
if (exclude_kernel_service) {
|
||||
defines += [ "EXCLUDE_CFE_AND_KERNEL_PLATFORM" ]
|
||||
}
|
||||
@@ -1004,10 +1004,12 @@
|
||||
"..:add_empty_macho_section_config",
|
||||
]
|
||||
extra_deps = [
|
||||
- ":icudtl_cc",
|
||||
"..:libdart_aotruntime",
|
||||
"../platform:libdart_platform_aotruntime",
|
||||
]
|
||||
+ if (dart_embed_icu_data) {
|
||||
+ extra_deps += [":icudtl_cc"]
|
||||
+ }
|
||||
extra_sources = [
|
||||
"builtin.cc",
|
||||
"gzip.cc",
|
||||
diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni
|
||||
index fbcfeb157fb..061e8f74a5c 100644
|
||||
--- a/runtime/runtime_args.gni
|
||||
+++ b/runtime/runtime_args.gni
|
||||
@@ -77,6 +77,9 @@ declare_args() {
|
||||
|
||||
# Whether to support dynamic loading and interpretation of Dart bytecode.
|
||||
dart_dynamic_modules = false
|
||||
+
|
||||
+ # Whether to embed ICU data inside the runtime binary.
|
||||
+ dart_embed_icu_data = true
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
@@ -0,0 +1,439 @@
|
||||
diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn
|
||||
new file mode 100644
|
||||
index 00000000000..9e54d4efe4e
|
||||
--- /dev/null
|
||||
+++ b/build/linux/unbundle/icu.gn
|
||||
@@ -0,0 +1,262 @@
|
||||
+# Copyright 2016 The Chromium Authors
|
||||
+# Use of this source code is governed by a BSD-style license that can be
|
||||
+# found in the LICENSE file.
|
||||
+
|
||||
+import("//build/config/linux/pkg_config.gni")
|
||||
+import("//build/shim_headers.gni")
|
||||
+
|
||||
+group("icu") {
|
||||
+ public_deps = [
|
||||
+ ":icui18n",
|
||||
+ ":icuuc",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+config("icu_config") {
|
||||
+ defines = [
|
||||
+ "USING_SYSTEM_ICU=1",
|
||||
+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
|
||||
+
|
||||
+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
|
||||
+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
|
||||
+ # When linking against the system ICU library, we want its symbols to have
|
||||
+ # public LTO visibility. This disables CFI checks for the ICU classes and
|
||||
+ # allows whole-program optimization to be applied to the rest of Chromium.
|
||||
+ #
|
||||
+ # Both U_COMMON_API and U_I18N_API macros would be defined to U_EXPORT only
|
||||
+ # when U_COMBINED_IMPLEMENTATION is defined (see unicode/utypes.h). Because
|
||||
+ # we override the default system UCHAR_TYPE (char16_t), it is not possible
|
||||
+ # to use U_COMBINED_IMPLEMENTATION at this moment, meaning the U_COMMON_API
|
||||
+ # and U_I18N_API macros are set to U_IMPORT which is an empty definition.
|
||||
+ #
|
||||
+ # Until building with UCHAR_TYPE=char16_t is supported, one way to apply
|
||||
+ # public visibility (and thus public LTO visibility) to all ICU classes is
|
||||
+ # to define U_IMPORT to have the same value as U_EXPORT. For more details,
|
||||
+ # please see: https://crbug.com/822820
|
||||
+ "U_IMPORT=U_EXPORT",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+pkg_config("system_icui18n") {
|
||||
+ packages = [ "icu-i18n" ]
|
||||
+}
|
||||
+
|
||||
+pkg_config("system_icuuc") {
|
||||
+ packages = [ "icu-uc" ]
|
||||
+}
|
||||
+
|
||||
+source_set("icui18n") {
|
||||
+ public_deps = [ ":icui18n_shim" ]
|
||||
+ public_configs = [
|
||||
+ ":icu_config",
|
||||
+ ":system_icui18n",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+source_set("icuuc") {
|
||||
+ public_deps = [ ":icuuc_shim" ]
|
||||
+ public_configs = [
|
||||
+ ":icu_config",
|
||||
+ ":system_icuuc",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+group("icui18n_hidden_visibility") {
|
||||
+ public_deps = [ ":icui18n" ]
|
||||
+}
|
||||
+
|
||||
+group("icuuc_hidden_visibility") {
|
||||
+ public_deps = [ ":icuuc" ]
|
||||
+}
|
||||
+
|
||||
+shim_headers("icui18n_shim") {
|
||||
+ root_path = "source/i18n"
|
||||
+ headers = [
|
||||
+ # This list can easily be updated using the commands below:
|
||||
+ # cd third_party/icu/source/i18n
|
||||
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
|
||||
+ "unicode/alphaindex.h",
|
||||
+ "unicode/basictz.h",
|
||||
+ "unicode/calendar.h",
|
||||
+ "unicode/choicfmt.h",
|
||||
+ "unicode/coleitr.h",
|
||||
+ "unicode/coll.h",
|
||||
+ "unicode/compactdecimalformat.h",
|
||||
+ "unicode/curramt.h",
|
||||
+ "unicode/currpinf.h",
|
||||
+ "unicode/currunit.h",
|
||||
+ "unicode/datefmt.h",
|
||||
+ "unicode/dcfmtsym.h",
|
||||
+ "unicode/decimfmt.h",
|
||||
+ "unicode/dtfmtsym.h",
|
||||
+ "unicode/dtitvfmt.h",
|
||||
+ "unicode/dtitvinf.h",
|
||||
+ "unicode/dtptngen.h",
|
||||
+ "unicode/dtrule.h",
|
||||
+ "unicode/fieldpos.h",
|
||||
+ "unicode/fmtable.h",
|
||||
+ "unicode/format.h",
|
||||
+ "unicode/fpositer.h",
|
||||
+ "unicode/gender.h",
|
||||
+ "unicode/gregocal.h",
|
||||
+ "unicode/listformatter.h",
|
||||
+ "unicode/measfmt.h",
|
||||
+ "unicode/measunit.h",
|
||||
+ "unicode/measure.h",
|
||||
+ "unicode/msgfmt.h",
|
||||
+ "unicode/numfmt.h",
|
||||
+ "unicode/numsys.h",
|
||||
+ "unicode/plurfmt.h",
|
||||
+ "unicode/plurrule.h",
|
||||
+ "unicode/rbnf.h",
|
||||
+ "unicode/rbtz.h",
|
||||
+ "unicode/regex.h",
|
||||
+ "unicode/region.h",
|
||||
+ "unicode/reldatefmt.h",
|
||||
+ "unicode/scientificnumberformatter.h",
|
||||
+ "unicode/search.h",
|
||||
+ "unicode/selfmt.h",
|
||||
+ "unicode/simpletz.h",
|
||||
+ "unicode/smpdtfmt.h",
|
||||
+ "unicode/sortkey.h",
|
||||
+ "unicode/stsearch.h",
|
||||
+ "unicode/tblcoll.h",
|
||||
+ "unicode/timezone.h",
|
||||
+ "unicode/tmunit.h",
|
||||
+ "unicode/tmutamt.h",
|
||||
+ "unicode/tmutfmt.h",
|
||||
+ "unicode/translit.h",
|
||||
+ "unicode/tzfmt.h",
|
||||
+ "unicode/tznames.h",
|
||||
+ "unicode/tzrule.h",
|
||||
+ "unicode/tztrans.h",
|
||||
+ "unicode/ucal.h",
|
||||
+ "unicode/ucol.h",
|
||||
+ "unicode/ucoleitr.h",
|
||||
+ "unicode/ucsdet.h",
|
||||
+ "unicode/udat.h",
|
||||
+ "unicode/udateintervalformat.h",
|
||||
+ "unicode/udatpg.h",
|
||||
+ "unicode/ufieldpositer.h",
|
||||
+ "unicode/uformattable.h",
|
||||
+ "unicode/ugender.h",
|
||||
+ "unicode/ulocdata.h",
|
||||
+ "unicode/umsg.h",
|
||||
+ "unicode/unirepl.h",
|
||||
+ "unicode/unum.h",
|
||||
+ "unicode/unumsys.h",
|
||||
+ "unicode/upluralrules.h",
|
||||
+ "unicode/uregex.h",
|
||||
+ "unicode/uregion.h",
|
||||
+ "unicode/ureldatefmt.h",
|
||||
+ "unicode/usearch.h",
|
||||
+ "unicode/uspoof.h",
|
||||
+ "unicode/utmscale.h",
|
||||
+ "unicode/utrans.h",
|
||||
+ "unicode/vtzone.h",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+shim_headers("icuuc_shim") {
|
||||
+ root_path = "source/common"
|
||||
+ headers = [
|
||||
+ # This list can easily be updated using the commands below:
|
||||
+ # cd third_party/icu/source/common
|
||||
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
|
||||
+ "unicode/appendable.h",
|
||||
+ "unicode/brkiter.h",
|
||||
+ "unicode/bytestream.h",
|
||||
+ "unicode/bytestrie.h",
|
||||
+ "unicode/bytestriebuilder.h",
|
||||
+ "unicode/caniter.h",
|
||||
+ "unicode/casemap.h",
|
||||
+ "unicode/char16ptr.h",
|
||||
+ "unicode/chariter.h",
|
||||
+ "unicode/dbbi.h",
|
||||
+ "unicode/docmain.h",
|
||||
+ "unicode/dtintrv.h",
|
||||
+ "unicode/edits.h",
|
||||
+ "unicode/enumset.h",
|
||||
+ "unicode/errorcode.h",
|
||||
+ "unicode/filteredbrk.h",
|
||||
+ "unicode/icudataver.h",
|
||||
+ "unicode/icuplug.h",
|
||||
+ "unicode/idna.h",
|
||||
+ "unicode/localematcher.h",
|
||||
+ "unicode/localpointer.h",
|
||||
+ "unicode/locdspnm.h",
|
||||
+ "unicode/locid.h",
|
||||
+ "unicode/messagepattern.h",
|
||||
+ "unicode/normalizer2.h",
|
||||
+ "unicode/normlzr.h",
|
||||
+ "unicode/parseerr.h",
|
||||
+ "unicode/parsepos.h",
|
||||
+ "unicode/platform.h",
|
||||
+ "unicode/ptypes.h",
|
||||
+ "unicode/putil.h",
|
||||
+ "unicode/rbbi.h",
|
||||
+ "unicode/rep.h",
|
||||
+ "unicode/resbund.h",
|
||||
+ "unicode/schriter.h",
|
||||
+ "unicode/simpleformatter.h",
|
||||
+ "unicode/std_string.h",
|
||||
+ "unicode/strenum.h",
|
||||
+ "unicode/stringpiece.h",
|
||||
+ "unicode/stringtriebuilder.h",
|
||||
+ "unicode/symtable.h",
|
||||
+ "unicode/ubidi.h",
|
||||
+ "unicode/ubiditransform.h",
|
||||
+ "unicode/ubrk.h",
|
||||
+ "unicode/ucasemap.h",
|
||||
+ "unicode/ucat.h",
|
||||
+ "unicode/uchar.h",
|
||||
+ "unicode/ucharstrie.h",
|
||||
+ "unicode/ucharstriebuilder.h",
|
||||
+ "unicode/uchriter.h",
|
||||
+ "unicode/uclean.h",
|
||||
+ "unicode/ucnv.h",
|
||||
+ "unicode/ucnv_cb.h",
|
||||
+ "unicode/ucnv_err.h",
|
||||
+ "unicode/ucnvsel.h",
|
||||
+ "unicode/uconfig.h",
|
||||
+ "unicode/ucurr.h",
|
||||
+ "unicode/udata.h",
|
||||
+ "unicode/udisplaycontext.h",
|
||||
+ "unicode/uenum.h",
|
||||
+ "unicode/uidna.h",
|
||||
+ "unicode/uiter.h",
|
||||
+ "unicode/uldnames.h",
|
||||
+ "unicode/ulistformatter.h",
|
||||
+ "unicode/uloc.h",
|
||||
+ "unicode/umachine.h",
|
||||
+ "unicode/umisc.h",
|
||||
+ "unicode/unifilt.h",
|
||||
+ "unicode/unifunct.h",
|
||||
+ "unicode/unimatch.h",
|
||||
+ "unicode/uniset.h",
|
||||
+ "unicode/unistr.h",
|
||||
+ "unicode/unorm.h",
|
||||
+ "unicode/unorm2.h",
|
||||
+ "unicode/uobject.h",
|
||||
+ "unicode/urename.h",
|
||||
+ "unicode/urep.h",
|
||||
+ "unicode/ures.h",
|
||||
+ "unicode/uscript.h",
|
||||
+ "unicode/uset.h",
|
||||
+ "unicode/usetiter.h",
|
||||
+ "unicode/ushape.h",
|
||||
+ "unicode/usprep.h",
|
||||
+ "unicode/ustring.h",
|
||||
+ "unicode/ustringtrie.h",
|
||||
+ "unicode/utext.h",
|
||||
+ "unicode/utf.h",
|
||||
+ "unicode/utf16.h",
|
||||
+ "unicode/utf32.h",
|
||||
+ "unicode/utf8.h",
|
||||
+ "unicode/utf_old.h",
|
||||
+ "unicode/utrace.h",
|
||||
+ "unicode/utypes.h",
|
||||
+ "unicode/uvernum.h",
|
||||
+ "unicode/uversion.h",
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/build/linux/unbundle/replace_gn_files.py b/build/linux/unbundle/replace_gn_files.py
|
||||
new file mode 100755
|
||||
index 00000000000..1aed7bca99d
|
||||
--- /dev/null
|
||||
+++ b/build/linux/unbundle/replace_gn_files.py
|
||||
@@ -0,0 +1,65 @@
|
||||
+#!/usr/bin/env python3
|
||||
+# Copyright 2016 The Chromium Authors
|
||||
+# Use of this source code is governed by a BSD-style license that can be
|
||||
+# found in the LICENSE file.
|
||||
+
|
||||
+"""
|
||||
+Replaces GN files in tree with files from here that
|
||||
+make the build use system libraries.
|
||||
+"""
|
||||
+
|
||||
+import argparse
|
||||
+import os
|
||||
+import shutil
|
||||
+import sys
|
||||
+
|
||||
+
|
||||
+REPLACEMENTS = {
|
||||
+ 'icu': 'third_party/icu/BUILD.gn',
|
||||
+ 'protobuf': 'build/secondary/third_party/protobuf/BUILD.gn',
|
||||
+ 'zlib': 'third_party/zlib/BUILD.gn',
|
||||
+}
|
||||
+
|
||||
+
|
||||
+def DoMain(argv):
|
||||
+ my_dirname = os.path.dirname(__file__)
|
||||
+ source_tree_root = os.path.abspath(
|
||||
+ os.path.join(my_dirname, '..', '..', '..'))
|
||||
+
|
||||
+ parser = argparse.ArgumentParser()
|
||||
+ parser.add_argument('--system-libraries', nargs='*', default=[])
|
||||
+ parser.add_argument('--undo', action='store_true')
|
||||
+
|
||||
+ args = parser.parse_args(argv)
|
||||
+
|
||||
+ handled_libraries = set()
|
||||
+ for lib, path in REPLACEMENTS.items():
|
||||
+ if lib not in args.system_libraries:
|
||||
+ continue
|
||||
+ handled_libraries.add(lib)
|
||||
+
|
||||
+ if args.undo:
|
||||
+ # Restore original file, and also remove the backup.
|
||||
+ # This is meant to restore the source tree to its original state.
|
||||
+ os.rename(os.path.join(source_tree_root, path + '.orig'),
|
||||
+ os.path.join(source_tree_root, path))
|
||||
+ else:
|
||||
+ # Create a backup copy for --undo.
|
||||
+ shutil.copyfile(os.path.join(source_tree_root, path),
|
||||
+ os.path.join(source_tree_root, path + '.orig'))
|
||||
+
|
||||
+ # Copy the GN file from directory of this script to target path.
|
||||
+ shutil.copyfile(os.path.join(my_dirname, '%s.gn' % lib),
|
||||
+ os.path.join(source_tree_root, path))
|
||||
+
|
||||
+ unhandled_libraries = set(args.system_libraries) - handled_libraries
|
||||
+ if unhandled_libraries:
|
||||
+ print('Unrecognized system libraries requested: %s' % ', '.join(
|
||||
+ sorted(unhandled_libraries)), file=sys.stderr)
|
||||
+ return 1
|
||||
+
|
||||
+ return 0
|
||||
+
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ sys.exit(DoMain(sys.argv[1:]))
|
||||
diff --git a/build/linux/unbundle/zlib.gn b/build/linux/unbundle/zlib.gn
|
||||
new file mode 100644
|
||||
index 00000000000..fa2bbffd25f
|
||||
--- /dev/null
|
||||
+++ b/build/linux/unbundle/zlib.gn
|
||||
@@ -0,0 +1,63 @@
|
||||
+# Copyright 2016 The Chromium Authors
|
||||
+# Use of this source code is governed by a BSD-style license that can be
|
||||
+# found in the LICENSE file.
|
||||
+
|
||||
+import("//build/shim_headers.gni")
|
||||
+
|
||||
+shim_headers("zlib_shim") {
|
||||
+ root_path = "."
|
||||
+ headers = [ "zlib.h" ]
|
||||
+ additional_includes = [ "third_party" ]
|
||||
+
|
||||
+}
|
||||
+
|
||||
+config("system_zlib") {
|
||||
+ defines = [ "USE_SYSTEM_ZLIB=1" ]
|
||||
+}
|
||||
+
|
||||
+config("zlib_config") {
|
||||
+ configs = [ ":system_zlib" ]
|
||||
+}
|
||||
+
|
||||
+source_set("zlib") {
|
||||
+ public_deps = [ ":zlib_shim" ]
|
||||
+ libs = [ "z" ]
|
||||
+ public_configs = [ ":system_zlib" ]
|
||||
+}
|
||||
+
|
||||
+shim_headers("minizip_shim") {
|
||||
+ root_path = "contrib"
|
||||
+ headers = [
|
||||
+ "minizip/crypt.h",
|
||||
+ "minizip/ioapi.h",
|
||||
+ "minizip/iowin32.h",
|
||||
+ "minizip/mztools.h",
|
||||
+ "minizip/unzip.h",
|
||||
+ "minizip/zip.h",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+source_set("minizip") {
|
||||
+ deps = [ ":minizip_shim" ]
|
||||
+ libs = [ "minizip" ]
|
||||
+}
|
||||
+
|
||||
+static_library("zip") {
|
||||
+ sources = [
|
||||
+ "google/zip.cc",
|
||||
+ "google/zip.h",
|
||||
+ "google/zip_internal.cc",
|
||||
+ "google/zip_internal.h",
|
||||
+ "google/zip_reader.cc",
|
||||
+ "google/zip_reader.h",
|
||||
+ ]
|
||||
+ deps = [ ":minizip" ]
|
||||
+}
|
||||
+
|
||||
+static_library("compression_utils") {
|
||||
+ sources = [
|
||||
+ "google/compression_utils.cc",
|
||||
+ "google/compression_utils.h",
|
||||
+ ]
|
||||
+ deps = [ ":zlib" ]
|
||||
+}
|
||||
diff --git a/build/shim_headers.gni b/build/shim_headers.gni
|
||||
index dc57d12ed0c..1d24e0ad00e 100644
|
||||
--- a/build/shim_headers.gni
|
||||
+++ b/build/shim_headers.gni
|
||||
@@ -7,6 +7,11 @@ template("shim_headers") {
|
||||
shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}"
|
||||
config(config_name) {
|
||||
include_dirs = [ shim_headers_path ]
|
||||
+ if (defined(invoker.additional_includes)) {
|
||||
+ foreach(i, invoker.additional_includes) {
|
||||
+ include_dirs += [ shim_headers_path + "/" + i ]
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
action(action_name) {
|
||||
script = "//tools/generate_shim_headers.py"
|
||||
@@ -26,11 +31,12 @@ template("shim_headers") {
|
||||
args += invoker.headers
|
||||
outputs = []
|
||||
foreach(h, invoker.headers) {
|
||||
- outputs += [ shim_headers_path + "/" + rebase_path(invoker.root_path,"//") + "/" + h ]
|
||||
+ outputs += [ shim_headers_path + "/" +
|
||||
+ rebase_path(invoker.root_path, "//") + "/" + h ]
|
||||
}
|
||||
}
|
||||
group(target_name) {
|
||||
- deps = [ ":${action_name}" ]
|
||||
+ public_deps = [ ":${action_name}" ]
|
||||
all_dependent_configs = [ ":${config_name}" ]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/runtime/bin/BUILD.gn
|
||||
+++ b/runtime/bin/BUILD.gn
|
||||
@@ -1152,6 +1152,7 @@
|
||||
deps = [
|
||||
"//third_party/boringssl", # for secure_socket_utils_test
|
||||
"//third_party/perfetto:libprotozero", # for timeline_test
|
||||
+ "//third_party/zlib", # for gzip
|
||||
]
|
||||
|
||||
if (is_fuchsia) {
|
||||
@@ -12765,6 +12765,13 @@ with pkgs;
|
||||
|
||||
dart = callPackage ../development/compilers/dart { };
|
||||
|
||||
inherit
|
||||
({
|
||||
dart-source = callPackage ../development/compilers/dart/source { };
|
||||
})
|
||||
dart-source
|
||||
;
|
||||
|
||||
pub2nix = recurseIntoAttrs (callPackage ../build-support/dart/pub2nix { });
|
||||
|
||||
buildDartApplication = callPackage ../build-support/dart/build-dart-application { };
|
||||
|
||||
Reference in New Issue
Block a user