From f202a1fdce78230e82f1e54e34277ae678e2c2b1 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Tue, 13 Feb 2024 07:08:45 -0800 Subject: [PATCH] Move libpng to //flutter/third_party/libpng (flutter/engine#50571) This is an example of moving a dependency to `//flutter/third_party` that requires forward/aliasing through the secondary build directory. Without forwarding, and only making changes to the `DEPS` file and rewriting paths in the engine repo, a `gn` invocation gets the following error: ``` ERROR at //third_party/freetype2/BUILD.gn:85:5: Can't load input file. "//third_party/libpng", ^--------------------- Unable to load: /Users/zra/flutter/engine/src/third_party/libpng/BUILD.gn I also checked in the secondary tree for: /Users/zra/flutter/engine/src/flutter/build/secondary/third_party/libpng/BUILD.gn ``` Another dependency, with a `BUILD.gn` file outside of the engine repo, is still referring to `libpng` by the old path. However, `gn` tells us that it is also checking under the secondary tree. We can put whatever we want in that `BUILD.gn` file to make `freetype2` happy. In this case it's easy, we just add a build rule there that forwards to `libpng`'s new location. There's only one wrinkle, which is that the dependency in the `group` target has to be `public_deps` rather than a simple `deps`. This is so that `public_deps` and `public_configs` of `//flutter/third_party/libpng` are correctly inherited by dependents of `//third_party/libpng`. --- DEPS | 2 +- .../secondary/third_party/libpng/BUILD.gn | 7 + engine/src/flutter/ci/licenses.sh | 2 +- .../flutter/ci/licenses_golden/excluded_files | 44 ++--- .../ci/licenses_golden/licenses_flutter | 182 +++++++++++++++++- .../flutter/ci/licenses_golden/tool_signature | 2 +- engine/src/flutter/skia/BUILD.gn | 4 +- .../src/flutter/tools/licenses/lib/main.dart | 2 +- .../src/flutter/tools/licenses/lib/paths.dart | 10 +- 9 files changed, 221 insertions(+), 34 deletions(-) create mode 100644 engine/src/flutter/build/secondary/third_party/libpng/BUILD.gn diff --git a/DEPS b/DEPS index b500c290c4..4bd6f85e59 100644 --- a/DEPS +++ b/DEPS @@ -636,7 +636,7 @@ deps = { 'src/flutter/third_party/libjpeg-turbo/src': Var('flutter_git') + '/third_party/libjpeg-turbo' + '@' + '0fb821f3b2e570b2783a94ccd9a2fb1f4916ae9f', - 'src/third_party/libpng': + 'src/flutter/third_party/libpng': Var('flutter_git') + '/third_party/libpng' + '@' + '9187b6e12756317f6d44fc669ac11dfc262bd192', 'src/flutter/third_party/libwebp': diff --git a/engine/src/flutter/build/secondary/third_party/libpng/BUILD.gn b/engine/src/flutter/build/secondary/third_party/libpng/BUILD.gn new file mode 100644 index 0000000000..44be77c9a3 --- /dev/null +++ b/engine/src/flutter/build/secondary/third_party/libpng/BUILD.gn @@ -0,0 +1,7 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +group("libpng") { + public_deps = [ "//flutter/third_party/libpng" ] +} diff --git a/engine/src/flutter/ci/licenses.sh b/engine/src/flutter/ci/licenses.sh index 7325b830ca..0de411c325 100755 --- a/engine/src/flutter/ci/licenses.sh +++ b/engine/src/flutter/ci/licenses.sh @@ -162,7 +162,7 @@ function verify_licenses() ( local actualLicenseCount actualLicenseCount="$(tail -n 1 flutter/ci/licenses_golden/licenses_flutter | tr -dc '0-9')" - local expectedLicenseCount=113 # When changing this number: Update the error message below as well describing the newly expected license types. + local expectedLicenseCount=114 # When changing this number: Update the error message below as well describing the newly expected license types. if [[ $actualLicenseCount -ne $expectedLicenseCount ]]; then echo "=============================== ERROR ===============================" diff --git a/engine/src/flutter/ci/licenses_golden/excluded_files b/engine/src/flutter/ci/licenses_golden/excluded_files index 5855ef4381..eb6faa7c88 100644 --- a/engine/src/flutter/ci/licenses_golden/excluded_files +++ b/engine/src/flutter/ci/licenses_golden/excluded_files @@ -651,6 +651,28 @@ ../../../flutter/third_party/libjpeg-turbo/src/simd/CMakeLists.txt ../../../flutter/third_party/libjpeg-turbo/src/structure.txt ../../../flutter/third_party/libjpeg-turbo/src/wrjpgcom.1 +../../../flutter/third_party/libpng/.git +../../../flutter/third_party/libpng/.travis.yml +../../../flutter/third_party/libpng/ANNOUNCE +../../../flutter/third_party/libpng/AUTHORS +../../../flutter/third_party/libpng/CHANGES +../../../flutter/third_party/libpng/CMakeLists.txt +../../../flutter/third_party/libpng/INSTALL +../../../flutter/third_party/libpng/Makefile.in +../../../flutter/third_party/libpng/README +../../../flutter/third_party/libpng/TODO +../../../flutter/third_party/libpng/TRADEMARK +../../../flutter/third_party/libpng/aclocal.m4 +../../../flutter/third_party/libpng/contrib +../../../flutter/third_party/libpng/libpng-manual.txt +../../../flutter/third_party/libpng/libpng.3 +../../../flutter/third_party/libpng/libpngpf.3 +../../../flutter/third_party/libpng/mips +../../../flutter/third_party/libpng/png.5 +../../../flutter/third_party/libpng/powerpc +../../../flutter/third_party/libpng/projects +../../../flutter/third_party/libpng/scripts +../../../flutter/third_party/libpng/tests ../../../flutter/third_party/libtess2/.git ../../../flutter/third_party/libtess2/.gitignore ../../../flutter/third_party/libtess2/Contrib/nanosvg.c @@ -2877,28 +2899,6 @@ ../../../third_party/libcxxabi/src/demangle/README.txt ../../../third_party/libcxxabi/test ../../../third_party/libcxxabi/www -../../../third_party/libpng/.git -../../../third_party/libpng/.travis.yml -../../../third_party/libpng/ANNOUNCE -../../../third_party/libpng/AUTHORS -../../../third_party/libpng/CHANGES -../../../third_party/libpng/CMakeLists.txt -../../../third_party/libpng/INSTALL -../../../third_party/libpng/Makefile.in -../../../third_party/libpng/README -../../../third_party/libpng/TODO -../../../third_party/libpng/TRADEMARK -../../../third_party/libpng/aclocal.m4 -../../../third_party/libpng/contrib -../../../third_party/libpng/libpng-manual.txt -../../../third_party/libpng/libpng.3 -../../../third_party/libpng/libpngpf.3 -../../../third_party/libpng/mips -../../../third_party/libpng/png.5 -../../../third_party/libpng/powerpc -../../../third_party/libpng/projects -../../../third_party/libpng/scripts -../../../third_party/libpng/tests ../../../third_party/perfetto/.clang-format ../../../third_party/perfetto/.clang-tidy ../../../third_party/perfetto/.git diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index 1b17db6d8f..970bc71de1 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -1112,6 +1112,186 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================================================== +==================================================================================================== +LIBRARY: libpng +ORIGIN: ../../../flutter/third_party/libpng/LICENSE +ORIGIN: ../../../flutter/third_party/libpng/png.h +TYPE: LicenseType.libpng +FILE: ../../../flutter/third_party/libpng/arm/arm_init.c +FILE: ../../../flutter/third_party/libpng/arm/filter_neon.S +FILE: ../../../flutter/third_party/libpng/arm/filter_neon_intrinsics.c +FILE: ../../../flutter/third_party/libpng/arm/palette_neon_intrinsics.c +FILE: ../../../flutter/third_party/libpng/config.h.in +FILE: ../../../flutter/third_party/libpng/example.c +FILE: ../../../flutter/third_party/libpng/intel/filter_sse2_intrinsics.c +FILE: ../../../flutter/third_party/libpng/intel/intel_init.c +FILE: ../../../flutter/third_party/libpng/libpng.pc.in +FILE: ../../../flutter/third_party/libpng/png.c +FILE: ../../../flutter/third_party/libpng/png.h +FILE: ../../../flutter/third_party/libpng/pngbar.jpg +FILE: ../../../flutter/third_party/libpng/pngbar.png +FILE: ../../../flutter/third_party/libpng/pngconf.h +FILE: ../../../flutter/third_party/libpng/pngdebug.h +FILE: ../../../flutter/third_party/libpng/pngerror.c +FILE: ../../../flutter/third_party/libpng/pngget.c +FILE: ../../../flutter/third_party/libpng/pnginfo.h +FILE: ../../../flutter/third_party/libpng/pnglibconf.h +FILE: ../../../flutter/third_party/libpng/pngmem.c +FILE: ../../../flutter/third_party/libpng/pngnow.png +FILE: ../../../flutter/third_party/libpng/pngpread.c +FILE: ../../../flutter/third_party/libpng/pngprefix.h +FILE: ../../../flutter/third_party/libpng/pngpriv.h +FILE: ../../../flutter/third_party/libpng/pngread.c +FILE: ../../../flutter/third_party/libpng/pngrio.c +FILE: ../../../flutter/third_party/libpng/pngrtran.c +FILE: ../../../flutter/third_party/libpng/pngrutil.c +FILE: ../../../flutter/third_party/libpng/pngset.c +FILE: ../../../flutter/third_party/libpng/pngstruct.h +FILE: ../../../flutter/third_party/libpng/pngtest.c +FILE: ../../../flutter/third_party/libpng/pngtest.png +FILE: ../../../flutter/third_party/libpng/pngtrans.c +FILE: ../../../flutter/third_party/libpng/pngusr.dfa +FILE: ../../../flutter/third_party/libpng/pngwio.c +FILE: ../../../flutter/third_party/libpng/pngwrite.c +FILE: ../../../flutter/third_party/libpng/pngwtran.c +FILE: ../../../flutter/third_party/libpng/pngwutil.c +---------------------------------------------------------------------------------------------------- +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= + +PNG Reference Library License version 2 +--------------------------------------- + +* Copyright (c) 1995-2019 The PNG Reference Library Authors. +* Copyright (c) 2018-2019 Cosmin Truta. +* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. +* Copyright (c) 1996-1997 Andreas Dilger. +* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + +2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are +Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners, and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + +1. The origin of this source code must not be misrepresented. + +2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + +3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. +==================================================================================================== + ==================================================================================================== LIBRARY: libjpeg-turbo ORIGIN: ../../../flutter/third_party/libjpeg-turbo/src/rdcolmap.c @@ -11908,4 +12088,4 @@ TO DO Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org. ==================================================================================================== -Total license count: 113 +Total license count: 114 diff --git a/engine/src/flutter/ci/licenses_golden/tool_signature b/engine/src/flutter/ci/licenses_golden/tool_signature index d1010563e7..20f94993a0 100644 --- a/engine/src/flutter/ci/licenses_golden/tool_signature +++ b/engine/src/flutter/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 8da7428befa41dc40c0a4c30b91ae97b +Signature: 7cfe768e86f1799dbfcbc149e00e4bb4 diff --git a/engine/src/flutter/skia/BUILD.gn b/engine/src/flutter/skia/BUILD.gn index 019c257335..5b914ce1b7 100644 --- a/engine/src/flutter/skia/BUILD.gn +++ b/engine/src/flutter/skia/BUILD.gn @@ -542,7 +542,7 @@ optional("png_decode") { "SK_CODEC_DECODES_ICO", ] - deps = [ "//third_party/libpng" ] + deps = [ "//flutter/third_party/libpng" ] sources = [ "$_skia_root/src/codec/SkIcoCodec.cpp", "$_skia_root/src/codec/SkPngCodec.cpp", @@ -553,7 +553,7 @@ optional("png_encode") { enabled = skia_use_libpng_encode && !skia_use_ndk_images public = skia_encode_png_public - deps = [ "//third_party/libpng" ] + deps = [ "//flutter/third_party/libpng" ] sources = skia_encode_png_srcs } diff --git a/engine/src/flutter/tools/licenses/lib/main.dart b/engine/src/flutter/tools/licenses/lib/main.dart index c0f7e64837..7ce08d1334 100644 --- a/engine/src/flutter/tools/licenses/lib/main.dart +++ b/engine/src/flutter/tools/licenses/lib/main.dart @@ -993,6 +993,7 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { '/flutter/third_party/inja/third_party/include/nlohmann/json.hpp': _RepositoryInjaJsonFile.new, '/flutter/third_party/libjpeg-turbo/src/LICENSE': _RepositoryLibJpegTurboLicenseFile.new, '/flutter/third_party/libjpeg-turbo/src/README.ijg': _RepositoryReadmeIjgFile.new, + '/flutter/third_party/libpng/LICENSE': _RepositoryLibPngLicenseFile.new, '/flutter/third_party/rapidjson/LICENSE': _RepositoryOpaqueLicenseFile.new, '/flutter/third_party/rapidjson/license.txt': _RepositoryOpaqueLicenseFile.new, '/fuchsia/sdk/linux/LICENSE.vulkan': _RepositoryFuchsiaSdkLinuxLicenseFile.new, @@ -1004,7 +1005,6 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { '/third_party/khronos/LICENSE': _RepositoryKhronosLicenseFile.new, '/third_party/libcxx/LICENSE.TXT': _RepositoryCxxStlDualLicenseFile.new, '/third_party/libcxxabi/LICENSE.TXT': _RepositoryCxxStlDualLicenseFile.new, - '/third_party/libpng/LICENSE': _RepositoryLibPngLicenseFile.new, '/third_party/vulkan-deps/vulkan-validation-layers/src/LICENSE.txt': _RepositoryVulkanApacheLicenseFile.new, }; diff --git a/engine/src/flutter/tools/licenses/lib/paths.dart b/engine/src/flutter/tools/licenses/lib/paths.dart index 7d8d647d6a..5935f179cb 100644 --- a/engine/src/flutter/tools/licenses/lib/paths.dart +++ b/engine/src/flutter/tools/licenses/lib/paths.dart @@ -50,6 +50,11 @@ final Set skippedPaths = { r'flutter/third_party/inja/third_party/amalgamate', // only used at build time r'flutter/third_party/inja/third_party/include/doctest', // seems to be a unit test library r'flutter/third_party/json/docs', + r'flutter/third_party/libpng/contrib', // not linked in + r'flutter/third_party/libpng/mips', // not linked in + r'flutter/third_party/libpng/powerpc', // not linked in + r'flutter/third_party/libpng/projects', // not linked in + r'flutter/third_party/libpng/scripts', // not linked in r'flutter/third_party/libtess2/Contrib/nanosvg.c', // only used by the ../Example r'flutter/third_party/libtess2/Contrib/nanosvg.h', // only used by the ../Example r'flutter/third_party/libtess2/Example', @@ -171,11 +176,6 @@ final Set skippedPaths = { r'third_party/libcxx/src/support/solaris', r'third_party/libcxx/utils', r'third_party/libcxxabi/www', - r'third_party/libpng/contrib', // not linked in - r'third_party/libpng/mips', // not linked in - r'third_party/libpng/powerpc', // not linked in - r'third_party/libpng/projects', // not linked in - r'third_party/libpng/scripts', // not linked in r'third_party/libxml', // dependency of the testing system that we don't actually use r'third_party/perfetto/debian', // contains nothing that ends up in the binary executable r'third_party/perfetto/infra', // contains nothing that ends up in the binary executable