Skip to content

Commit

Permalink
Move libpng to //flutter/third_party/libpng (#50571)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
zanderso authored Feb 13, 2024
1 parent 838e8e7 commit fc500b2
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 216 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
7 changes: 7 additions & 0 deletions build/secondary/third_party/libpng/BUILD.gn
Original file line number Diff line number Diff line change
@@ -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" ]
}
2 changes: 1 addition & 1 deletion ci/licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==============================="
Expand Down
44 changes: 22 additions & 22 deletions ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
182 changes: 181 additions & 1 deletion ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -11908,4 +12088,4 @@ TO DO
Please send bug reports, offers of help, etc. to [email protected].
====================================================================================================

Total license count: 113
Total license count: 114
Loading

0 comments on commit fc500b2

Please sign in to comment.