• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
16//     CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
17//     DEPENDING ON IT IN YOUR PROJECT. ***
18package {
19    default_applicable_licenses: ["external_python_cpython2_license"],
20}
21
22// Added automatically by a large-scale-change that took the approach of
23// 'apply every license found to every target'. While this makes sure we respect
24// every license restriction, it may not be entirely correct.
25//
26// e.g. GPL in an MIT project might only apply to the contrib/ directory.
27//
28// Please consider splitting the single license below into multiple licenses,
29// taking care not to lose any license_kind information, and overriding the
30// default license using the 'licenses: [...]' property on targets as needed.
31//
32// For unused files, consider creating a 'fileGroup' with "//visibility:private"
33// to attach the license to, and including a comment whether the files may be
34// used in the current project.
35// See: http://go/android-license-faq
36license {
37    name: "external_python_cpython2_license",
38    visibility: [":__subpackages__"],
39    license_kinds: [
40        "SPDX-license-identifier-0BSD",
41        "SPDX-license-identifier-Apache-2.0",
42        "SPDX-license-identifier-BSD",
43        "SPDX-license-identifier-CC0-1.0",
44        "SPDX-license-identifier-GPL",
45        "SPDX-license-identifier-GPL-2.0",
46        "SPDX-license-identifier-GPL-3.0",
47        "SPDX-license-identifier-LGPL-2.1",
48        "SPDX-license-identifier-MIT",
49        "SPDX-license-identifier-MPL",
50        "SPDX-license-identifier-PSF-2.0",
51        "SPDX-license-identifier-Zlib",
52        "legacy_by_exception_only", // by exception only
53        "legacy_notice",
54        "legacy_unencumbered",
55    ],
56    license_text: [
57        "LICENSE",
58    ],
59}
60
61subdirs = [
62    "Lib",
63]
64
65cc_defaults {
66    name: "py2-interp-defaults",
67    cflags: [
68        "-fwrapv",
69        "-O3",
70        "-Wall",
71        "-Wstrict-prototypes",
72        "-DPy_BUILD_CORE",
73        "-Werror",
74        "-Wno-invalid-source-encoding",
75        "-Wno-int-conversion",
76        "-Wno-missing-field-initializers",
77        "-Wno-null-pointer-arithmetic",
78        "-Wno-register",
79        "-Wno-shift-count-overflow",
80        "-Wno-sign-compare",
81        "-Wno-strict-prototypes",
82        "-Wno-tautological-compare",
83        "-Wno-tautological-constant-out-of-range-compare",
84        "-Wno-unused-parameter",
85        "-Wno-unused-result",
86    ],
87    local_include_dirs: ["Include"],
88    target: {
89        android_arm: {
90            local_include_dirs: ["android_arm/pyconfig"],
91        },
92        android_arm64: {
93            local_include_dirs: ["android_arm64/pyconfig"],
94        },
95        android_x86: {
96            local_include_dirs: ["android_x86/pyconfig"],
97        },
98        linux_bionic: {
99            // NB linux_bionic is a 'host' architecture but it uses the bionic libc like 'android'
100            // targets so use the android pyconfig.
101            local_include_dirs: ["android_x86_64/pyconfig"],
102        },
103        android_x86_64: {
104            local_include_dirs: ["android_x86_64/pyconfig"],
105        },
106        // Regenerate include dirs with android_regen.sh
107        darwin_x86_64: {
108            local_include_dirs: ["darwin_x86_64/pyconfig"],
109            cflags: [
110                "-Wno-deprecated-declarations",
111                "-Wno-pointer-arith",
112            ],
113        },
114        linux_glibc_x86: {
115            enabled: false,
116        },
117        linux_musl_x86: {
118            enabled: false,
119        },
120        linux_glibc_x86_64: {
121            local_include_dirs: ["linux_x86_64/pyconfig"],
122            cflags: ["-Werror"],
123        },
124        linux_musl_x86_64: {
125            local_include_dirs: ["linux_x86_64/pyconfig"],
126            cflags: ["-Werror"],
127        },
128        windows: {
129            enabled: false,
130        },
131    },
132    host_supported: true,
133    compile_multilib: "both",
134    multilib: {
135        lib32: {
136            suffix: "32",
137        },
138        lib64: {
139            suffix: "64",
140        },
141    },
142}
143
144cc_library_static {
145    name: "py2-interp-parser",
146    defaults: ["py2-interp-defaults"],
147    srcs: [
148        "Parser/acceler.c",
149        "Parser/bitset.c",
150        "Parser/firstsets.c",
151        "Parser/grammar.c",
152        "Parser/grammar1.c",
153        "Parser/listnode.c",
154        "Parser/metagrammar.c",
155        "Parser/myreadline.c",
156        "Parser/node.c",
157        "Parser/parser.c",
158        "Parser/parsetok.c",
159        "Parser/pgen.c",
160        "Parser/tokenizer.c",
161    ],
162}
163
164cc_library_static {
165    name: "py2-interp-object",
166    defaults: ["py2-interp-defaults"],
167    srcs: [
168        "Objects/abstract.c",
169        "Objects/boolobject.c",
170        "Objects/bufferobject.c",
171        "Objects/bytes_methods.c",
172        "Objects/bytearrayobject.c",
173        "Objects/capsule.c",
174        "Objects/cellobject.c",
175        "Objects/classobject.c",
176        "Objects/cobject.c",
177        "Objects/codeobject.c",
178        "Objects/complexobject.c",
179        "Objects/descrobject.c",
180        "Objects/enumobject.c",
181        "Objects/exceptions.c",
182        "Objects/genobject.c",
183        "Objects/fileobject.c",
184        "Objects/floatobject.c",
185        "Objects/frameobject.c",
186        "Objects/funcobject.c",
187        "Objects/intobject.c",
188        "Objects/iterobject.c",
189        "Objects/listobject.c",
190        "Objects/longobject.c",
191        "Objects/dictobject.c",
192        "Objects/memoryobject.c",
193        "Objects/methodobject.c",
194        "Objects/moduleobject.c",
195        "Objects/object.c",
196        "Objects/obmalloc.c",
197        "Objects/rangeobject.c",
198        "Objects/setobject.c",
199        "Objects/sliceobject.c",
200        "Objects/stringobject.c",
201        "Objects/structseq.c",
202        "Objects/tupleobject.c",
203        "Objects/typeobject.c",
204        "Objects/weakrefobject.c",
205        "Objects/unicodeobject.c",
206        "Objects/unicodectype.c",
207    ],
208}
209
210cc_library_static {
211    name: "py2-interp-python",
212    defaults: ["py2-interp-defaults"],
213    target: {
214        linux: {
215            cflags: [
216                "-DPLATFORM=\"linux2\"",
217            ],
218        },
219        darwin_x86_64: {
220            cflags: [
221                "-DPLATFORM=\"darwin\"",
222            ],
223        },
224    },
225    srcs: [
226        "Python/_warnings.c",
227        "Python/Python-ast.c",
228        "Python/asdl.c",
229        "Python/ast.c",
230        "Python/bltinmodule.c",
231        "Python/ceval.c",
232        "Python/compile.c",
233        "Python/codecs.c",
234        "Python/errors.c",
235        "Python/frozen.c",
236        "Python/frozenmain.c",
237        "Python/future.c",
238        "Python/getargs.c",
239        "Python/getcompiler.c",
240        "Python/getcopyright.c",
241        "Python/getplatform.c",
242        "Python/getversion.c",
243        "Python/graminit.c",
244        "Python/import.c",
245        "Python/importdl.c",
246        "Python/marshal.c",
247        "Python/modsupport.c",
248        "Python/mystrtoul.c",
249        "Python/mysnprintf.c",
250        "Python/peephole.c",
251        "Python/pyarena.c",
252        "Python/pyctype.c",
253        "Python/pyfpe.c",
254        "Python/pymath.c",
255        "Python/pystate.c",
256        "Python/pythonrun.c",
257        "Python/random.c",
258        "Python/structmember.c",
259        "Python/symtable.c",
260        "Python/sysmodule.c",
261        "Python/traceback.c",
262        "Python/getopt.c",
263        "Python/pystrcmp.c",
264        "Python/pystrtod.c",
265        "Python/dtoa.c",
266        "Python/formatter_unicode.c",
267        "Python/formatter_string.c",
268        "Python/dynload_shlib.c",
269        "Python/thread.c",
270    ],
271}
272
273cc_defaults {
274    name: "py2-launcher-defaults",
275    defaults: ["py2-interp-defaults"],
276    cflags: [
277        "-DVERSION=\"2.7\"",
278        "-DVPATH=\"\"",
279        "-DPREFIX=\"\"",
280        "-DEXEC_PREFIX=\"\"",
281        "-DPYTHONPATH=\"..:\"",
282        "-DANDROID_SKIP_ZIP_PATH",
283        "-DANDROID_SKIP_EXEC_PREFIX_PATH",
284        "-DANDROID_LIB_PYTHON_PATH=\"internal/stdlib\"",
285        "-DDATE=\"Dec 31 1969\"",
286        "-DTIME=\"23:59:59\"",
287    ],
288    static_libs: [
289        "libbase",
290        "libcrypto_static",
291        "libexpat",
292        "liblog",
293        "libssl",
294        "libz",
295    ],
296    target: {
297        linux_glibc_x86_64: {
298            host_ldlibs: ["-lutil"],
299        },
300        darwin: {
301            host_ldlibs: [
302                "-framework SystemConfiguration",
303                "-framework CoreFoundation",
304            ],
305        },
306        host: {
307            static_libs: ["libsqlite"],
308        },
309        // Use shared libsqlite for device side, otherwise
310        // the executable size will be really huge.
311        android: {
312            shared_libs: ["libsqlite"],
313        },
314    },
315}
316
317cc_library_static {
318    name: "py2-launcher-lib",
319    defaults: ["py2-launcher-defaults"],
320    srcs: [
321        "Modules/gcmodule.c",
322        "Modules/getpath.c",
323        "Modules/config.c",
324        "Modules/getbuildinfo.c",
325        // Default built-in extension py2-c-modules.
326        "Modules/threadmodule.c",
327        "Modules/signalmodule.c",
328        "Modules/posixmodule.c",
329        "Modules/errnomodule.c",
330        "Modules/pwdmodule.c",
331        "Modules/_sre.c",
332        "Modules/_codecsmodule.c",
333        "Modules/_weakref.c",
334        "Modules/zipimport.c",
335        "Modules/symtablemodule.c",
336        "Modules/main.c",
337    ],
338    // NOTE: Please update Modules/config.c if new lib get added in the static_libs.
339    whole_static_libs: [
340        // Be careful the order of these three static libraries below due to
341        // missing symbols issues.
342        "py2-interp-object",
343        "py2-interp-python",
344        "py2-interp-parser",
345        "py2-c-module-array",
346        "py2-c-module-cmath",
347        "py2-c-module-math",
348        "py2-c-module-_struct",
349        "py2-c-module-time",
350        "py2-c-module-operator",
351        "py2-c-module-_testcapi",
352        "py2-c-module-_random",
353        "py2-c-module-_collections",
354        "py2-c-module-_heapq",
355        "py2-c-module-itertools",
356        "py2-c-module-strop",
357        "py2-c-module-_functools",
358        "py2-c-module-datetime",
359        "py2-c-module-_bisect",
360        "py2-c-module-unicodedata",
361        "py2-c-module-_io",
362        "py2-c-module-fcntl",
363        "py2-c-module-select",
364        "py2-c-module-mmap",
365        "py2-c-module-_csv",
366        "py2-c-module-_socket",
367        "py2-c-module-termios",
368        "py2-c-module-_ssl",
369        "py2-c-module-_md5",
370        "py2-c-module-_sha",
371        "py2-c-module-_sha256",
372        "py2-c-module-_sha512",
373        "py2-c-module-binascii",
374        "py2-c-module-parser",
375        "py2-c-module-cStringIO",
376        "py2-c-module-cPickle",
377        "py2-c-module-xxsubtype",
378        "py2-c-module-future_builtins",
379        "py2-c-module-_json",
380        "py2-c-module-_hotshot",
381        "py2-c-module-_lsprof",
382        "py2-c-module-grp",
383        "py2-c-module-syslog",
384        "py2-c-module-audioop",
385        "py2-c-module-resource",
386        "py2-c-module-_multibytecodec",
387        "py2-c-module-_codecs_kr",
388        "py2-c-module-_codecs_jp",
389        "py2-c-module-_codecs_cn",
390        "py2-c-module-_codecs_tw",
391        "py2-c-module-_codecs_hk",
392        "py2-c-module-_codecs_iso2022",
393        "py2-c-module-_multiprocessing",
394        "py2-c-module-zlib",
395        "py2-c-module-pyexpat",
396        "py2-c-module-_sqlite3",
397        "py2-c-module-_ctypes_test",
398        "py2-c-module-_ctypes",
399    ],
400    target: {
401        darwin: {
402            whole_static_libs: ["py2-c-module-_scproxy"],
403        },
404    },
405}
406
407cc_binary {
408    name: "py2-launcher",
409    defaults: ["py2-launcher-defaults"],
410    srcs: ["Launcher/launcher_main.cpp"],
411    static_libs: ["py2-launcher-lib"],
412}
413
414cc_binary {
415    name: "py2-launcher-autorun",
416    defaults: ["py2-launcher-defaults"],
417    srcs: ["Launcher/launcher_main.cpp"],
418    static_libs: ["py2-launcher-lib"],
419    cflags: ["-DANDROID_AUTORUN"],
420}
421
422python_binary_host {
423    name: "py2-cmd",
424    autorun: false,
425    version: {
426        py2: {
427            enabled: true,
428            embedded_launcher: true,
429        },
430        py3: {
431            enabled: false,
432        },
433    },
434}
435
436// Enabled extension py2-c-modules.
437
438cc_library_static {
439    name: "py2-c-module-array",
440    defaults: ["py2-interp-defaults"],
441    srcs: [
442        "Modules/arraymodule.c",
443    ],
444}
445
446cc_library_static {
447    name: "py2-c-module-cmath",
448    defaults: ["py2-interp-defaults"],
449    srcs: [
450        "Modules/cmathmodule.c",
451        "Modules/_math.c",
452    ],
453}
454
455cc_library_static {
456    name: "py2-c-module-math",
457    defaults: ["py2-interp-defaults"],
458    srcs: [
459        "Modules/mathmodule.c",
460        "Modules/_math.c",
461    ],
462}
463
464cc_library_static {
465    name: "py2-c-module-_struct",
466    defaults: ["py2-interp-defaults"],
467    srcs: [
468        "Modules/_struct.c",
469    ],
470}
471
472cc_library_static {
473    name: "py2-c-module-time",
474    defaults: ["py2-interp-defaults"],
475    srcs: [
476        "Modules/timemodule.c",
477    ],
478}
479
480cc_library_static {
481    name: "py2-c-module-operator",
482    defaults: ["py2-interp-defaults"],
483    srcs: [
484        "Modules/operator.c",
485    ],
486}
487
488cc_library_static {
489    name: "py2-c-module-_testcapi",
490    defaults: ["py2-interp-defaults"],
491    srcs: [
492        "Modules/_testcapimodule.c",
493    ],
494}
495
496cc_library_static {
497    name: "py2-c-module-_random",
498    defaults: ["py2-interp-defaults"],
499    srcs: [
500        "Modules/_randommodule.c",
501    ],
502}
503
504cc_library_static {
505    name: "py2-c-module-_collections",
506    defaults: ["py2-interp-defaults"],
507    srcs: [
508        "Modules/_collectionsmodule.c",
509    ],
510}
511
512cc_library_static {
513    name: "py2-c-module-_heapq",
514    defaults: ["py2-interp-defaults"],
515    srcs: [
516        "Modules/_heapqmodule.c",
517    ],
518}
519
520cc_library_static {
521    name: "py2-c-module-itertools",
522    defaults: ["py2-interp-defaults"],
523    srcs: [
524        "Modules/itertoolsmodule.c",
525    ],
526}
527
528cc_library_static {
529    name: "py2-c-module-strop",
530    defaults: ["py2-interp-defaults"],
531    srcs: [
532        "Modules/stropmodule.c",
533    ],
534}
535
536cc_library_static {
537    name: "py2-c-module-_functools",
538    defaults: ["py2-interp-defaults"],
539    srcs: [
540        "Modules/_functoolsmodule.c",
541    ],
542}
543
544cc_library_static {
545    name: "py2-c-module-datetime",
546    defaults: ["py2-interp-defaults"],
547    srcs: [
548        "Modules/datetimemodule.c",
549    ],
550}
551
552cc_library_static {
553    name: "py2-c-module-_bisect",
554    defaults: ["py2-interp-defaults"],
555    srcs: [
556        "Modules/_bisectmodule.c",
557    ],
558}
559
560cc_library_static {
561    name: "py2-c-module-unicodedata",
562    defaults: ["py2-interp-defaults"],
563    srcs: [
564        "Modules/unicodedata.c",
565    ],
566}
567
568cc_library_static {
569    name: "py2-c-module-_io",
570    defaults: ["py2-interp-defaults"],
571    srcs: [
572        "Modules/_io/bufferedio.c",
573        "Modules/_io/bytesio.c",
574        "Modules/_io/fileio.c",
575        "Modules/_io/iobase.c",
576        "Modules/_io/_iomodule.c",
577        "Modules/_io/stringio.c",
578        "Modules/_io/textio.c",
579    ],
580    local_include_dirs: [
581        "Modules/_io",
582    ],
583}
584
585cc_library_static {
586    name: "py2-c-module-fcntl",
587    defaults: ["py2-interp-defaults"],
588    srcs: [
589        "Modules/fcntlmodule.c",
590    ],
591}
592
593cc_library_static {
594    name: "py2-c-module-select",
595    defaults: ["py2-interp-defaults"],
596    srcs: [
597        "Modules/selectmodule.c",
598    ],
599}
600
601cc_library_static {
602    name: "py2-c-module-mmap",
603    defaults: ["py2-interp-defaults"],
604    srcs: [
605        "Modules/mmapmodule.c",
606    ],
607}
608
609cc_library_static {
610    name: "py2-c-module-_csv",
611    defaults: ["py2-interp-defaults"],
612    srcs: [
613        "Modules/_csv.c",
614    ],
615}
616
617cc_library_static {
618    name: "py2-c-module-_socket",
619    defaults: ["py2-interp-defaults"],
620    srcs: [
621        "Modules/socketmodule.c",
622        "Modules/timemodule.c",
623    ],
624}
625
626cc_library_static {
627    name: "py2-c-module-termios",
628    defaults: ["py2-interp-defaults"],
629    srcs: [
630        "Modules/termios.c",
631    ],
632}
633
634cc_library_static {
635    name: "py2-c-module-_ssl",
636    defaults: ["py2-interp-defaults"],
637    srcs: ["Modules/_ssl.c"],
638    cflags: ["-Wno-incompatible-pointer-types-discards-qualifiers"],
639    static_libs: [
640        "libssl",
641        "libcrypto_static",
642    ],
643}
644
645cc_library_static {
646    name: "py2-c-module-_md5",
647    defaults: ["py2-interp-defaults"],
648    srcs: [
649        "Modules/md5module.c",
650        "Modules/md5.c",
651    ],
652}
653
654cc_library_static {
655    name: "py2-c-module-_sha",
656    defaults: ["py2-interp-defaults"],
657    srcs: [
658        "Modules/shamodule.c",
659    ],
660}
661
662cc_library_static {
663    name: "py2-c-module-_sha256",
664    defaults: ["py2-interp-defaults"],
665    srcs: [
666        "Modules/sha256module.c",
667    ],
668}
669
670cc_library_static {
671    name: "py2-c-module-_sha512",
672    defaults: ["py2-interp-defaults"],
673    srcs: [
674        "Modules/sha512module.c",
675    ],
676}
677
678cc_library_static {
679    name: "py2-c-module-binascii",
680    defaults: ["py2-interp-defaults"],
681    srcs: [
682        "Modules/binascii.c",
683    ],
684}
685
686cc_library_static {
687    name: "py2-c-module-parser",
688    defaults: ["py2-interp-defaults"],
689    srcs: [
690        "Modules/parsermodule.c",
691    ],
692}
693
694cc_library_static {
695    name: "py2-c-module-cStringIO",
696    defaults: ["py2-interp-defaults"],
697    srcs: [
698        "Modules/cStringIO.c",
699    ],
700}
701
702cc_library_static {
703    name: "py2-c-module-cPickle",
704    defaults: ["py2-interp-defaults"],
705    srcs: [
706        "Modules/cPickle.c",
707    ],
708}
709
710cc_library_static {
711    name: "py2-c-module-xxsubtype",
712    defaults: ["py2-interp-defaults"],
713    srcs: [
714        "Modules/xxsubtype.c",
715    ],
716}
717
718cc_library_static {
719    name: "py2-c-module-future_builtins",
720    defaults: ["py2-interp-defaults"],
721    srcs: [
722        "Modules/future_builtins.c",
723    ],
724}
725
726cc_library_static {
727    name: "py2-c-module-_json",
728    defaults: ["py2-interp-defaults"],
729    srcs: [
730        "Modules/_json.c",
731    ],
732}
733
734cc_library_static {
735    name: "py2-c-module-_hotshot",
736    defaults: ["py2-interp-defaults"],
737    srcs: [
738        "Modules/_hotshot.c",
739    ],
740}
741
742cc_library_static {
743    name: "py2-c-module-_lsprof",
744    defaults: ["py2-interp-defaults"],
745    srcs: [
746        "Modules/_lsprof.c",
747        "Modules/rotatingtree.c",
748    ],
749}
750
751cc_library_static {
752    name: "py2-c-module-grp",
753    defaults: ["py2-interp-defaults"],
754    srcs: [
755        "Modules/grpmodule.c",
756        "Modules/rotatingtree.c",
757    ],
758}
759
760cc_library_static {
761    name: "py2-c-module-syslog",
762    defaults: ["py2-interp-defaults"],
763    srcs: [
764        "Modules/syslogmodule.c",
765    ],
766}
767
768cc_library_static {
769    name: "py2-c-module-audioop",
770    defaults: ["py2-interp-defaults"],
771    srcs: [
772        "Modules/audioop.c",
773    ],
774}
775
776cc_library_static {
777    name: "py2-c-module-resource",
778    defaults: ["py2-interp-defaults"],
779    srcs: [
780        "Modules/resource.c",
781    ],
782}
783
784cc_library_static {
785    name: "py2-c-module-_multibytecodec",
786    defaults: ["py2-interp-defaults"],
787    srcs: [
788        "Modules/cjkcodecs/multibytecodec.c",
789    ],
790}
791
792cc_library_static {
793    name: "py2-c-module-_codecs_kr",
794    defaults: ["py2-interp-defaults"],
795    srcs: ["Modules/cjkcodecs/_codecs_kr.c"],
796}
797
798cc_library_static {
799    name: "py2-c-module-_codecs_jp",
800    defaults: ["py2-interp-defaults"],
801    srcs: ["Modules/cjkcodecs/_codecs_jp.c"],
802}
803
804cc_library_static {
805    name: "py2-c-module-_codecs_cn",
806    defaults: ["py2-interp-defaults"],
807    srcs: ["Modules/cjkcodecs/_codecs_cn.c"],
808}
809
810cc_library_static {
811    name: "py2-c-module-_codecs_tw",
812    defaults: ["py2-interp-defaults"],
813    srcs: ["Modules/cjkcodecs/_codecs_tw.c"],
814}
815
816cc_library_static {
817    name: "py2-c-module-_codecs_hk",
818    defaults: ["py2-interp-defaults"],
819    srcs: ["Modules/cjkcodecs/_codecs_hk.c"],
820}
821
822cc_library_static {
823    name: "py2-c-module-_codecs_iso2022",
824    defaults: ["py2-interp-defaults"],
825    srcs: ["Modules/cjkcodecs/_codecs_iso2022.c"],
826}
827
828cc_library_static {
829    name: "py2-c-module-_multiprocessing",
830    defaults: ["py2-interp-defaults"],
831    srcs: [
832        "Modules/_multiprocessing/multiprocessing.c",
833        "Modules/_multiprocessing/semaphore.c",
834        "Modules/_multiprocessing/socket_connection.c",
835    ],
836}
837
838cc_library_static {
839    name: "py2-c-module-zlib",
840    defaults: [
841        "py2-interp-defaults",
842    ],
843    cflags: [
844        "-DUSE_ZLIB_CRC32",
845    ],
846    srcs: [
847        "Modules/zlibmodule.c",
848    ],
849    static_libs: [
850        "libz",
851    ],
852}
853
854cc_library_static {
855    name: "py2-c-module-pyexpat",
856    defaults: [
857        "py2-interp-defaults",
858    ],
859    cflags: [
860        "-DUSE_PYEXPAT_CAPI",
861    ],
862    srcs: [
863        "Modules/pyexpat.c",
864    ],
865    static_libs: [
866        "libexpat",
867    ],
868}
869
870cc_library_static {
871    name: "py2-c-module-_sqlite3",
872    defaults: [
873        "py2-interp-defaults",
874    ],
875    cflags: [
876        "-DMODULE_NAME=\"sqlite3\"",
877        "-DSQLITE_OMIT_LOAD_EXTENSION",
878        "-Wno-format-security",
879        "-Wno-type-limits",
880        "-Wno-char-subscripts",
881    ],
882    local_include_dirs: [
883        "Modules/_sqlite",
884    ],
885    srcs: [
886        "Modules/_sqlite/cache.c",
887        "Modules/_sqlite/connection.c",
888        "Modules/_sqlite/cursor.c",
889        "Modules/_sqlite/microprotocols.c",
890        "Modules/_sqlite/module.c",
891        "Modules/_sqlite/prepare_protocol.c",
892        "Modules/_sqlite/row.c",
893        "Modules/_sqlite/statement.c",
894        "Modules/_sqlite/util.c",
895    ],
896    target: {
897        host: {
898            static_libs: [
899                "libsqlite",
900            ],
901        },
902        android: {
903            shared_libs: [
904                "libsqlite",
905            ],
906        },
907    },
908}
909
910cc_library_static {
911    name: "py2-c-module-_ctypes_test",
912    defaults: ["py2-interp-defaults"],
913    srcs: ["Modules/_ctypes/_ctypes_test.c"],
914}
915
916cc_library_static {
917    name: "py2-c-module-_ctypes",
918    defaults: [
919        "py2-interp-defaults",
920    ],
921    local_include_dirs: [
922        "Modules/_ctypes/libffi/include",
923    ],
924    srcs: [
925        "Modules/_ctypes/_ctypes.c",
926        "Modules/_ctypes/callbacks.c",
927        "Modules/_ctypes/callproc.c",
928        "Modules/_ctypes/stgdict.c",
929        "Modules/_ctypes/cfield.c",
930        "Modules/_ctypes/libffi/src/prep_cif.c",
931        "Modules/_ctypes/libffi/src/closures.c",
932    ],
933    arch: {
934        x86_64: {
935            local_include_dirs: [
936                "Modules/_ctypes/libffi/src/x86",
937            ],
938            srcs: [
939                "Modules/_ctypes/libffi/src/x86/ffi64.c",
940                "Modules/_ctypes/libffi/src/x86/ffi.c",
941                "Modules/_ctypes/libffi/src/x86/sysv.S",
942            ],
943        },
944        x86: {
945            local_include_dirs: [
946                "Modules/_ctypes/libffi/src/x86",
947            ],
948            srcs: [
949                "Modules/_ctypes/libffi/src/x86/ffi.c",
950                "Modules/_ctypes/libffi/src/x86/sysv.S",
951            ],
952        },
953        arm: {
954            local_include_dirs: [
955                "android_arm/libffi",
956                "Modules/_ctypes/libffi/src/arm",
957            ],
958            srcs: [
959                "Modules/_ctypes/libffi/src/arm/ffi.c",
960                "Modules/_ctypes/libffi/src/arm/sysv.S",
961                "Modules/_ctypes/libffi/src/arm/trampoline.S",
962            ],
963        },
964        arm64: {
965            // arithmetic on a pointer in _ctypes/libffi/src/aarch64/ffi.c
966            cflags: ["-Wno-pointer-arith"],
967            local_include_dirs: [
968                "android_arm64/libffi",
969                "Modules/_ctypes/libffi/src/aarch64",
970            ],
971            srcs: [
972                "Modules/_ctypes/libffi/src/aarch64/ffi.c",
973                "Modules/_ctypes/libffi/src/aarch64/sysv.S",
974            ],
975        },
976    },
977    target: {
978        // Regenerate include dirs with android_regen.sh
979        darwin_x86_64: {
980            local_include_dirs: ["darwin_x86_64/libffi"],
981            srcs: [
982                "Modules/_ctypes/libffi/src/x86/darwin.S",
983                "Modules/_ctypes/libffi/src/x86/darwin64.S",
984            ],
985        },
986        host_linux: {
987            local_include_dirs: ["linux_x86_64/libffi"],
988            srcs: [
989                "Modules/_ctypes/libffi/src/x86/unix64.S",
990            ],
991        },
992        android_x86: {
993            local_include_dirs: ["android_x86/libffi"],
994            srcs: [
995                "Modules/_ctypes/libffi/src/x86/win32.S",
996            ],
997        },
998        android_x86_64: {
999            local_include_dirs: ["android_x86_64/libffi"],
1000            srcs: [
1001                "Modules/_ctypes/libffi/src/x86/unix64.S",
1002            ],
1003        },
1004    },
1005}
1006
1007cc_library_host_static {
1008    name: "py2-c-module-_scproxy",
1009    defaults: ["py2-interp-defaults"],
1010    srcs: ["Mac/Modules/_scproxy.c"],
1011    target: {
1012        linux: {
1013            enabled: false,
1014        },
1015    },
1016}
1017