xref: /aosp_15_r20/external/freetype/Android.bp (revision 63949dbd25bcc50c4e1178497ff9e9574d44fc5a)
1package {
2    default_applicable_licenses: ["external_freetype_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20    name: "external_freetype_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-Apache-2.0",
24        "SPDX-license-identifier-BSD-3-Clause",
25        "SPDX-license-identifier-FSFAP",
26        "SPDX-license-identifier-FTL",
27        "SPDX-license-identifier-MIT",
28
29        // For src/autofit/ft-hb.{h|c}. This file is not used but included from source file.
30        // "SPDX-license-Identifier-MIT-Modern-Variant"
31
32        // TODO: Following licenses left from original. Check where these licenses are came from.
33        "SPDX-license-identifier-BSD",
34        "SPDX-license-identifier-ISC",
35        "SPDX-license-identifier-LGPL",
36        "legacy_unencumbered",
37    ],
38    license_text: [
39        "LICENSE.TXT",
40        "LICENSE",
41        "NOTICE",
42
43        "docs/FTL.TXT",
44        "LICENSE_APACHE2.TXT",
45        "LICENSE_MIT.TXT",
46        "LICENSE_BSD_3_CLAUSE.TXT",
47        "LICENSE_MIT_MODERN_VARIANT.TXT",
48    ],
49}
50
51cc_defaults {
52    name: "libft2_defaults",
53    host_supported: true,
54    // TODO(b/153609531): remove when no longer needed.
55    native_bridge_supported: true,
56
57    // compile in ARM mode, since the glyph loader/renderer is a hotspot
58    // when loading complex pages in the browser
59    arch: {
60        arm: {
61            instruction_set: "arm",
62        },
63    },
64
65    srcs: [
66        "src/autofit/autofit.c",
67        "src/base/ftbase.c",
68        "src/base/ftbbox.c",
69        "src/base/ftbitmap.c",
70        "src/base/ftdebug.c",
71        "src/base/ftfstype.c",
72        "src/base/ftgasp.c",
73        "src/base/ftglyph.c",
74        "src/base/ftinit.c",
75        "src/base/ftmm.c",
76        "src/base/ftstroke.c",
77        "src/base/fttype1.c",
78        "src/base/ftsystem.c",
79        "src/cid/type1cid.c",
80        "src/cff/cff.c",
81        "src/gzip/ftgzip.c",
82        "src/psaux/psaux.c",
83        "src/pshinter/pshinter.c",
84        "src/psnames/psnames.c",
85        "src/raster/raster.c",
86        "src/sdf/sdf.c",
87        "src/sfnt/sfnt.c",
88        "src/smooth/smooth.c",
89        "src/svg/svg.c",
90        "src/truetype/truetype.c",
91        "src/type1/type1.c",
92    ],
93
94    export_include_dirs: ["include"],
95
96    cflags: [
97        "-W",
98        "-Wall",
99        "-Werror",
100
101        "-DDARWIN_NO_CARBON",
102        "-DFT2_BUILD_LIBRARY",
103
104        "-O2",
105
106        // Upstream ignores unused parameter warning
107        "-Wno-unused-parameter",
108        // Disabling some of modules results in warnings
109        "-Wno-unused-variable",
110        // Temporary disables unused function warning
111        "-Wno-unused-function",
112    ],
113}
114
115cc_library {
116    name: "libft2",
117    defaults: ["libft2_defaults"],
118
119    cflags: [
120        // Usually these are defined in include/freetype/config/ftoption.h
121        // we have commented them and defined them here to allow for the
122        // no dependency variant libft2.nodep below.
123        "-DFT_CONFIG_OPTION_USE_PNG",
124        "-DFT_CONFIG_OPTION_USE_ZLIB",
125        "-DFT_CONFIG_OPTION_SYSTEM_ZLIB",
126
127        // the following is for testing only, and should not be used in final
128        // builds of the product
129        // "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER",
130    ],
131
132    shared_libs: [
133        "libpng",
134        "libz",
135    ],
136
137    target: {
138        android: {
139            cflags: [
140                "-fPIC",
141                "-DPIC",
142            ],
143        },
144        not_windows: {
145            cflags: [
146                "-fPIC",
147                "-DPIC",
148            ],
149        },
150        windows: {
151            enabled: true,
152        },
153    },
154
155    llndk: {
156        private: true,
157        symbol_file: "libft2.map.txt",
158    },
159    sdk_version: "current",
160    min_sdk_version: "apex_inherit",
161    apex_available: [
162        "com.android.mediaprovider",
163        "//apex_available:platform"
164    ],
165}
166
167// variant of libft2 without any library dependencies.
168cc_library_static {
169    name: "libft2.nodep",
170    vendor_available: true,
171    defaults: ["libft2_defaults"],
172}
173
174// Following defines unused files that is under licenses that are different
175// from default licenses.
176
177license {
178    name: "external_freetype_license.builds.unused.unix.GPLv2",
179    visibility: ["//visibility:private"],
180    license_kinds: [
181      "SPDX-license-identifier-GPL-2.0-with-autoconf-exception",
182    ],
183    license_text: [
184        "builds/unix/LICENSE_GPLv2_WITH_AUTOCONF_EXCEPTION.TXT",
185    ],
186}
187
188filegroup {
189    name: "freetype.builds.unix.GPLv2",
190    visibility: ["//visibility:private"],
191    licenses: ["external_freetype_license.builds.unused.unix.GPLv2"],
192    srcs: ["builds/unix/pkg.m4"],
193}
194
195license {
196    name: "external_freetype_license.builds.unused.unix.GPLv3",
197    visibility: ["//visibility:private"],
198    license_kinds: [
199      "SPDX-license-identifier-GPL-3.0-with-autoconf-exception",
200    ],
201    license_text: [
202        // For builds/unix/ax_pthread.m4
203        "builds/unix/LICENSE_GPLv3_WITH_AUTOCONF_EXCEPTION.TXT",
204    ],
205}
206
207filegroup {
208    name: "freetype.builds.unix.GPLv3",
209    visibility: ["//visibility:private"],
210    licenses: ["external_freetype_license.builds.unused.unix.GPLv3"],
211    srcs: ["builds/unix/ax_pthread.m4"],
212}
213
214license {
215    name: "external_freetype_license.builds.unused.zlib",
216    visibility: ["//visibility:private"],
217    license_kinds: [
218        "SPDX-license-identifier-Zlib",
219    ],
220    license_text: [
221        "src/gzip/LICENSE_ZLIB.TXT"
222    ],
223}
224
225filegroup {
226    name: "freetype.unused.zlib",
227    visibility: ["//visibility:private"],
228    licenses: ["external_freetype_license.builds.unused.zlib"],
229    srcs: [
230        "src/gzip/adler32.c",
231        "src/gzip/crc32.c",
232        "src/gzip/crc32.h",  // No license header
233        "src/gzip/ftzconf.h",
234        "src/gzip/gzguts.h",
235        "src/gzip/inffast.c",
236        "src/gzip/inffast.h",
237        "src/gzip/inffixed.h",  // No license header
238        "src/gzip/inflate.c",
239        "src/gzip/inflate.h",
240        "src/gzip/inftrees.c",
241        "src/gzip/inftrees.h",
242        "src/gzip/zlib.h",
243        "src/gzip/zutil.c",
244        "src/gzip/zutil.h",
245    ],
246}
247
248license {
249    name: "external_freetype_license.unused.base.pcf",
250    visibility: ["//visibility:private"],
251    license_kinds: [
252      "SPDX-license-identifier-FTL",
253      "SPDX-license-identifier-MIT",
254      "legacy_notice",  // For src/base/pcf/pcfutil.c
255    ],
256    license_text: [
257        "docs/FTL.TXT",
258        "LICENSE_MIT.TXT",
259    ],
260}
261
262filegroup {
263    name: "freetype.unused.base.pcf",
264    visibility: ["//visibility:private"],
265    licenses: ["external_freetype_license.unused.base.pcf"],
266    srcs: [
267        "src/pcf/module.mk",
268        "src/pcf/pcfdrivr.c",
269        "src/pcf/pcfdrivr.h",
270        "src/pcf/pcferror.h",
271        "src/pcf/pcf.h",
272        "src/pcf/pcfread.c",
273        "src/pcf/pcfread.h",
274        "src/pcf/pcfutil.c",
275        "src/pcf/pcfutil.h",
276        "src/pcf/README",
277        "src/pcf/rules.mk",
278    ],
279}
280
281dirgroup {
282    name: "trusty_dirgroup_external_freetype",
283    dirs: ["."],
284    visibility: ["//trusty/vendor/google/aosp/scripts"],
285}
286