xref: /aosp_15_r20/external/pdfium/Android.bp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
2//     CONSULT THE OWNERS AND [email protected] BEFORE
3//     DEPENDING ON IT IN YOUR PROJECT. ***
4package {
5    default_applicable_licenses: ["external_pdfium_license"],
6}
7
8// Added automatically by a large-scale-change that took the approach of
9// 'apply every license found to every target'. While this makes sure we respect
10// every license restriction, it may not be entirely correct.
11//
12// e.g. GPL in an MIT project might only apply to the contrib/ directory.
13//
14// Please consider splitting the single license below into multiple licenses,
15// taking care not to lose any license_kind information, and overriding the
16// default license using the 'licenses: [...]' property on targets as needed.
17//
18// For unused files, consider creating a 'fileGroup' with "//visibility:private"
19// to attach the license to, and including a comment whether the files may be
20// used in the current project.
21// See: http://go/android-license-faq
22license {
23    name: "external_pdfium_license",
24    visibility: [":__subpackages__"],
25    license_kinds: [
26        "SPDX-license-identifier-Apache-2.0",
27        "SPDX-license-identifier-Artistic",
28        "SPDX-license-identifier-BSD",
29        "SPDX-license-identifier-FTL",
30        "SPDX-license-identifier-MIT",
31        "SPDX-license-identifier-OFL", // by exception only
32        "SPDX-license-identifier-Zlib",
33        "SPDX-license-identifier-libtiff",
34        "legacy_unencumbered",
35    ],
36    license_text: [
37        "LICENSE",
38    ],
39}
40
41cc_defaults {
42    name: "pdfium-common",
43    cflags: [
44        "-O3",
45        "-fstrict-aliasing",
46        "-fprefetch-loop-arrays",
47        "-fexceptions",
48
49        "-Wno-implicit-fallthrough",
50        "-Wno-missing-field-initializers",
51        "-Wno-non-virtual-dtor",
52        "-Wno-unused-parameter",
53
54        // pdfium_common_config
55        "-DOPJ_STATIC",
56        "-DPNG_PREFIX",
57        "-DPNG_USE_READ_MACROS",
58
59        // Do not export functions by default. Export only functions annotated
60        // with FPDF_EXPORT.
61        "-fvisibility=hidden",
62
63        // Macro definitions to enable FPDF_EXPORT.
64        "-DCOMPONENT_BUILD",
65        "-DFPDF_IMPLEMENTATION",
66    ],
67
68    arch: {
69        arm: {
70            instruction_set: "arm",
71        },
72    },
73
74    include_dirs: [
75        "external/freetype/include",
76    ],
77
78    header_libs: [
79        "pdfium-headers",
80        "pdfium-third-party-headers",
81    ],
82}
83
84cc_defaults {
85    name: "pdfium-core",
86
87    defaults: [
88        "pdfium-common",
89    ],
90
91    exclude_srcs: [
92        "**/*_unittest.cpp",
93        "**/*_embeddertest.cpp",
94    ],
95    sdk_version: "current",
96    min_sdk_version: "apex_inherit",
97    apex_available: [
98        "com.android.mediaprovider",
99        "//apex_available:platform",
100    ],
101    stl: "c++_static",
102}
103
104cc_library_headers {
105    name: "pdfium-headers",
106    export_include_dirs: ["."],
107    sdk_version: "current",
108    min_sdk_version: "apex_inherit",
109    apex_available: [
110        "com.android.mediaprovider",
111        "//apex_available:platform",
112    ],
113}
114
115cc_library_headers {
116    name: "pdfium-third-party-headers",
117    export_include_dirs: ["third_party"],
118    sdk_version: "current",
119    min_sdk_version: "apex_inherit",
120    apex_available: [
121        "com.android.mediaprovider",
122        "//apex_available:platform",
123    ],
124}
125
126cc_library_shared {
127    name: "libpdfium",
128    defaults: ["pdfium-core"],
129
130    whole_static_libs: [
131        "libpdfium-fpdfsdk",
132    ],
133
134    // Transitivity is not supported for static libraries (yet).
135    // Lists the whole transitivity closure here.
136    static_libs: [
137        "libpdfium-agg",
138        "libpdfium-cmaps",
139        "libpdfium-constants",
140        "libpdfium-edit",
141        "libpdfium-fdrm",
142        "libpdfium-font",
143        "libpdfium-formfiller",
144        "libpdfium-fpdfdoc",
145        "libpdfium-fpdftext",
146        "libpdfium-fxcodec",
147        "libpdfium-fxcrt",
148        "libpdfium-fxge",
149        "libpdfium-fxjs",
150        "libpdfium-libopenjpeg2",
151        "libpdfium-page",
152        "libpdfium-parser",
153        "libpdfium-pwl",
154        "libpdfium-render",
155        "libpdfium-skia_shared",
156        "libpdfium-third_party-base",
157        "libpdfium-lcms2",
158    ],
159
160    // TODO: figure out why turning on exceptions requires manually linking libdl
161    shared_libs: [
162        "libdl",
163        "libft2",
164        "libicu",
165        "libjpeg",
166        "libz",
167    ],
168
169    ldflags: [
170        "-Wl,-icf=all",
171    ],
172
173    export_include_dirs: ["public"],
174}
175
176cc_library_static {
177    name: "libpdfium_static",
178    defaults: ["pdfium-core"],
179
180    whole_static_libs: [
181        "libpdfium-fpdfsdk",
182        "libpdfium-agg",
183        "libpdfium-cmaps",
184        "libpdfium-constants",
185        "libpdfium-edit",
186        "libpdfium-fdrm",
187        "libpdfium-font",
188        "libpdfium-formfiller",
189        "libpdfium-fpdfdoc",
190        "libpdfium-fpdftext",
191        "libpdfium-fxcodec",
192        "libpdfium-fxcrt",
193        "libpdfium-fxge",
194        "libpdfium-fxjs",
195        "libpdfium-libopenjpeg2",
196        "libpdfium-page",
197        "libpdfium-parser",
198        "libpdfium-pwl",
199        "libpdfium-render",
200        "libpdfium-skia_shared",
201        "libpdfium-third_party-base",
202        "libpdfium-lcms2",
203    ],
204
205    export_include_dirs: ["public"],
206}
207
208subdirs = ["third_party"]
209