aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-03-03 09:21:30 -0500
committerGravatar Mike Klein <mtklein@chromium.org>2017-03-03 15:41:24 +0000
commite459afd6ce2c2ccbad500dc2e77e0ac287af90eb (patch)
treec4f8fd5eb74eaefae0eb3731e3033106c8d70ae3
parent05cb4c3e509449b0b7332ad563acfcb194b86a07 (diff)
Strengthen is_official_build, update docs.
This makes is_official_build turn off all development targets and features in Skia, including building third-party dependencies from source. This will intentionally break some external users, who will find themselves no longer able to find third-party headers or link against third-party libraries. These users have been building with our testing third-party dependencies unknowingly. They'll need to either explicitly turn back on building each dependency from source (skia_use_system_foo=false) or disable that dependency entirely (skia_use_foo=false). is_skia_standalone is now basically !is_official_build, so I've propagated that through, removing is_skia_standalone. In a few places we were using it as a stand-in for defined(ndk), so I've just written defined(ndk) there. Duh. gn_to_bp: is_offical_build's new strength also makes gn_to_bp.py simpler to write. In spirit, Android builds are official Skia builds that also build DM and nanobench. It seems that SkJumper (src/jumper/*) is (unintentionally) enabled on Android. Switching to an is_official_build would have disabled that. But as that accidental launch seems to have gone fine, I've kept it explicitly enabled. In the end, no changes to Android.bp or its SkUserConfig.h. The -Mini builder no longer needs to explicitly disable tools. CQ_INCLUDE_TRYBOTS=skia.primary:Build-Ubuntu-Clang-x86_64-Release-Mini Change-Id: Id06e53268a5caf55c6046ada354a0863c3031c73 Reviewed-on: https://skia-review.googlesource.com/9190 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r--BUILD.gn14
-rw-r--r--gn/BUILDCONFIG.gn2
-rw-r--r--gn/gn_to_bp.py15
-rw-r--r--infra/bots/recipe_modules/compile/example.expected/Build-Ubuntu-Clang-x86_64-Release-Mini.json2
-rw-r--r--infra/bots/recipe_modules/flavor/gn_flavor.py3
-rw-r--r--site/user/build.md46
-rw-r--r--third_party/expat/BUILD.gn2
-rw-r--r--third_party/freetype2/BUILD.gn5
-rw-r--r--third_party/icu/BUILD.gn2
-rw-r--r--third_party/jsoncpp/BUILD.gn2
-rw-r--r--third_party/libjpeg-turbo/BUILD.gn2
-rw-r--r--third_party/libpng/BUILD.gn2
-rw-r--r--third_party/libwebp/BUILD.gn2
-rw-r--r--third_party/lua/BUILD.gn2
-rw-r--r--third_party/zlib/BUILD.gn2
15 files changed, 51 insertions, 52 deletions
diff --git a/BUILD.gn b/BUILD.gn
index b23277c374..419b0822e1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -6,10 +6,6 @@
import("gn/android_framework_defines.gni")
import("gn/shared_sources.gni")
-if (!defined(is_skia_standalone)) {
- is_skia_standalone = false
-}
-
declare_args() {
skia_use_angle = false
skia_use_expat = true
@@ -29,11 +25,11 @@ declare_args() {
skia_enable_android_framework_defines = false
skia_enable_discrete_gpu = true
skia_enable_effects = true
- skia_enable_jumper = is_skia_standalone
+ skia_enable_jumper = !is_official_build
skia_enable_gpu = true
skia_enable_pdf = true
- skia_enable_tools = is_skia_standalone
- skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
+ skia_enable_tools = !is_official_build
+ skia_enable_vulkan_debug_layers = !is_official_build && is_debug
skia_vulkan_sdk = getenv("VULKAN_SDK")
}
declare_args() {
@@ -667,7 +663,7 @@ component("skia") {
if (is_android) {
deps += [ "//third_party/expat" ]
- if (is_skia_standalone && ndk != "") {
+ if (defined(ndk) && ndk != "") {
deps += [ "//third_party/cpu-features" ]
}
sources += [ "src/ports/SkDebug_android.cpp" ]
@@ -1449,7 +1445,7 @@ if (skia_enable_tools) {
}
}
- if (is_android && is_skia_standalone && ndk != "") {
+ if (is_android && defined(ndk) && ndk != "") {
copy("gdbserver") {
sources = [
"$ndk/$ndk_gdbserver",
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index a89931b432..9582c46663 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -3,8 +3,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-is_skia_standalone = true
-
# It's best to keep the names and defaults of is_foo flags consistent with Chrome.
declare_args() {
diff --git a/gn/gn_to_bp.py b/gn/gn_to_bp.py
index 94db28b3cd..58a8dd563c 100644
--- a/gn/gn_to_bp.py
+++ b/gn/gn_to_bp.py
@@ -188,14 +188,12 @@ cc_test {
# We'll run GN to get the main source lists and include directories for Skia.
gn_args = {
- 'skia_enable_vulkan_debug_layers': 'false',
- 'skia_use_system_expat': 'true',
- 'skia_use_system_jsoncpp': 'true',
- 'skia_use_system_libpng': 'true',
- 'skia_use_system_zlib': 'true',
- 'skia_use_vulkan': 'true',
- 'target_cpu': '"none"',
- 'target_os': '"android"',
+ 'is_official_build': 'true',
+ 'skia_enable_jumper': 'true',
+ 'skia_enable_tools': 'true',
+ 'skia_use_vulkan': 'true',
+ 'target_cpu': '"none"',
+ 'target_os': '"android"',
}
gn_args = ' '.join(sorted('%s=%s' % (k,v) for (k,v) in gn_args.iteritems()))
@@ -243,6 +241,7 @@ nanobench_srcs = {s for s in nanobench_srcs if not s.endswith('.h')}
# Most defines go into SkUserConfig.h, where they're seen by Skia and its users.
# Start with the defines :skia uses, minus a couple. We'll add more in a bit.
defines = [str(d) for d in js['targets']['//:skia']['defines']]
+defines.remove('NDEBUG') # Let the Android build control this.
defines.remove('SKIA_IMPLEMENTATION=1') # Only libskia should have this define.
# For architecture specific files, it's easier to just read the same source
diff --git a/infra/bots/recipe_modules/compile/example.expected/Build-Ubuntu-Clang-x86_64-Release-Mini.json b/infra/bots/recipe_modules/compile/example.expected/Build-Ubuntu-Clang-x86_64-Release-Mini.json
index f975e13374..9e3de4b794 100644
--- a/infra/bots/recipe_modules/compile/example.expected/Build-Ubuntu-Clang-x86_64-Release-Mini.json
+++ b/infra/bots/recipe_modules/compile/example.expected/Build-Ubuntu-Clang-x86_64-Release-Mini.json
@@ -99,7 +99,7 @@
"[CUSTOM_/_B_WORK]/skia/bin/gn",
"gen",
"[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Release-Mini/Release",
- "--args=cc=\"[START_DIR]/clang_linux/bin/clang\" cxx=\"[START_DIR]/clang_linux/bin/clang++\" extra_ldflags=[\"-fuse-ld=lld\"] is_component_build=true is_debug=false is_official_build=true skia_enable_effects=false skia_enable_gpu=false skia_enable_pdf=false skia_enable_tools=false skia_use_expat=false skia_use_libjpeg_turbo=false skia_use_libpng=false skia_use_libwebp=false skia_use_zlib=false target_cpu=\"x86_64\""
+ "--args=cc=\"[START_DIR]/clang_linux/bin/clang\" cxx=\"[START_DIR]/clang_linux/bin/clang++\" extra_ldflags=[\"-fuse-ld=lld\"] is_component_build=true is_debug=false is_official_build=true skia_enable_effects=false skia_enable_gpu=false skia_enable_pdf=false skia_use_expat=false skia_use_libjpeg_turbo=false skia_use_libpng=false skia_use_libwebp=false skia_use_zlib=false target_cpu=\"x86_64\""
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py
index af20893dd9..bfff36e39d 100644
--- a/infra/bots/recipe_modules/flavor/gn_flavor.py
+++ b/infra/bots/recipe_modules/flavor/gn_flavor.py
@@ -80,11 +80,10 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
if extra_config == 'Mini':
args.update({
'is_component_build': 'true', # Proves we can link a coherent .so.
- 'is_official_build': 'true', # No debug symbols.
+ 'is_official_build': 'true', # No debug symbols, no tools.
'skia_enable_effects': 'false',
'skia_enable_gpu': 'false',
'skia_enable_pdf': 'false',
- 'skia_enable_tools': 'false', # Some tools need GPU or effects.
'skia_use_expat': 'false',
'skia_use_libjpeg_turbo': 'false',
'skia_use_libpng': 'false',
diff --git a/site/user/build.md b/site/user/build.md
index 17f7857fe4..36ef63c89d 100644
--- a/site/user/build.md
+++ b/site/user/build.md
@@ -7,6 +7,32 @@ Skia](./download).
Skia uses [GN](https://chromium.googlesource.com/chromium/src/tools/gn/) to
configure its builds.
+`is_official_build` and Third-party Dependencies
+------------------------------------------------
+
+Most users of Skia should set `is_official_build=true`, and most developers
+should leave it to its `false` default.
+
+This mode configures Skia in a way that's suitable to ship: an optimized build
+with no debug symbols, dynamically linked against its third-party dependencies
+using the ordinary library search path.
+
+In contrast, the developer-oriented default is an unoptimized build with full
+debug symbols and all third-party dependencies built from source and embedded
+into libskia. This is how do all our manual and automated testing.
+
+Skia offers several features that make use of third-party libraries, like
+libpng, libwebp, or libjpeg-turbo to decode images, or ICU and sftnly to subset
+fonts. All these third-party dependencies are optional and can be controlled
+by a GN argument that looks something like `skia_use_foo` for appropriate
+`foo`.
+
+If `skia_use_foo` is enabled, enabling `skia_use_system_foo` will build and
+link Skia against the headers and libaries found on the system paths.
+`is_official_build=true` enables all `skia_use_system_foo` by default. You can
+use `extra_cflags` and `extra_ldflags` to add include or library paths if
+needed.
+
Quickstart
----------
@@ -142,23 +168,3 @@ We have added a GN-to-CMake translator mainly for use with IDEs that like CMake
project descriptions. This is not meant for any purpose beyond development.
bin/gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py
-
-Third-party Dependencies
-------------------------
-
-Skia offers several features that make use of third-party libraries, like
-libpng, libwebp, or libjpeg-turbo to decode images, or ICU and sftnly to subset
-fonts. All these third-party dependencies are optional, and can be controlled
-by a GN argument that looks something like `skia_use_foo` for appropriate
-`foo`.
-
-Most of these third-party dependencies can also be satisfied by pre-built
-system libraries. If `skia_use_foo` is enabled, turn on `skia_use_system_foo`
-to build and link Skia against the headers and libaries found on the system
-paths. You can use `extra_cflags` and `extra_ldflags` to add include or
-library paths if needed.
-
-By default Skia will build and embed its own copies of these third-party
-libraries. This configuration is for development only. We do not recommend
-shipping Skia this way. However, this is the only configuration of Skia that
-receives significant testing.
diff --git a/third_party/expat/BUILD.gn b/third_party/expat/BUILD.gn
index 3277389e08..d2a5d3664a 100644
--- a/third_party/expat/BUILD.gn
+++ b/third_party/expat/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_expat = false
+ skia_use_system_expat = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/freetype2/BUILD.gn b/third_party/freetype2/BUILD.gn
index d543dac347..7ccaa1dc96 100644
--- a/third_party/freetype2/BUILD.gn
+++ b/third_party/freetype2/BUILD.gn
@@ -4,8 +4,9 @@
# found in the LICENSE file.
declare_args() {
- # TODO: false? i.e. build from source all the time for testing?
- skia_use_system_freetype2 = !(is_android || sanitize == "MSAN")
+ # TODO: build from source all the time for testing?
+ skia_use_system_freetype2 =
+ is_official_build || !(is_android || sanitize == "MSAN")
}
import("../third_party.gni")
diff --git a/third_party/icu/BUILD.gn b/third_party/icu/BUILD.gn
index e3815ee64f..1d54c46edd 100644
--- a/third_party/icu/BUILD.gn
+++ b/third_party/icu/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_icu = false
+ skia_use_system_icu = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/jsoncpp/BUILD.gn b/third_party/jsoncpp/BUILD.gn
index 34150c08b0..ff8351f2cf 100644
--- a/third_party/jsoncpp/BUILD.gn
+++ b/third_party/jsoncpp/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_jsoncpp = false
+ skia_use_system_jsoncpp = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/libjpeg-turbo/BUILD.gn b/third_party/libjpeg-turbo/BUILD.gn
index 6254235762..37b589d350 100644
--- a/third_party/libjpeg-turbo/BUILD.gn
+++ b/third_party/libjpeg-turbo/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_libjpeg_turbo = false
+ skia_use_system_libjpeg_turbo = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/libpng/BUILD.gn b/third_party/libpng/BUILD.gn
index 3e97f5569a..6a4c65732c 100644
--- a/third_party/libpng/BUILD.gn
+++ b/third_party/libpng/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_libpng = false
+ skia_use_system_libpng = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/libwebp/BUILD.gn b/third_party/libwebp/BUILD.gn
index 1157e4ba3b..3e9bd06020 100644
--- a/third_party/libwebp/BUILD.gn
+++ b/third_party/libwebp/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_libwebp = false
+ skia_use_system_libwebp = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/lua/BUILD.gn b/third_party/lua/BUILD.gn
index 9967dcd675..14ce4175b9 100644
--- a/third_party/lua/BUILD.gn
+++ b/third_party/lua/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_lua = false
+ skia_use_system_lua = is_official_build
}
import("../third_party.gni")
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn
index e7776f5ffb..00eb327590 100644
--- a/third_party/zlib/BUILD.gn
+++ b/third_party/zlib/BUILD.gn
@@ -4,7 +4,7 @@
# found in the LICENSE file.
declare_args() {
- skia_use_system_zlib = false
+ skia_use_system_zlib = is_official_build
}
import("../third_party.gni")