• 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_arm: {
118            enabled: false,
119        },
120        linux_musl_x86: {
121            enabled: false,
122        },
123        linux_glibc_x86_64: {
124            local_include_dirs: ["linux_x86_64/pyconfig"],
125            cflags: ["-Werror"],
126        },
127        linux_musl_arm64: {
128            local_include_dirs: ["linux_arm64/pyconfig"],
129            cflags: ["-Werror"],
130        },
131        linux_musl_x86_64: {
132            local_include_dirs: ["linux_x86_64/pyconfig"],
133            cflags: ["-Werror"],
134        },
135        windows: {
136            enabled: false,
137        },
138    },
139    host_supported: true,
140    compile_multilib: "both",
141    multilib: {
142        lib32: {
143            suffix: "32",
144        },
145        lib64: {
146            suffix: "64",
147        },
148    },
149}
150
151cc_library_static {
152    name: "py2-interp-parser",
153    defaults: ["py2-interp-defaults"],
154    srcs: [
155        "Parser/acceler.c",
156        "Parser/bitset.c",
157        "Parser/firstsets.c",
158        "Parser/grammar.c",
159        "Parser/grammar1.c",
160        "Parser/listnode.c",
161        "Parser/metagrammar.c",
162        "Parser/myreadline.c",
163        "Parser/node.c",
164        "Parser/parser.c",
165        "Parser/parsetok.c",
166        "Parser/pgen.c",
167        "Parser/tokenizer.c",
168    ],
169}
170
171cc_library_static {
172    name: "py2-interp-object",
173    defaults: ["py2-interp-defaults"],
174    srcs: [
175        "Objects/abstract.c",
176        "Objects/boolobject.c",
177        "Objects/bufferobject.c",
178        "Objects/bytes_methods.c",
179        "Objects/bytearrayobject.c",
180        "Objects/capsule.c",
181        "Objects/cellobject.c",
182        "Objects/classobject.c",
183        "Objects/cobject.c",
184        "Objects/codeobject.c",
185        "Objects/complexobject.c",
186        "Objects/descrobject.c",
187        "Objects/enumobject.c",
188        "Objects/exceptions.c",
189        "Objects/genobject.c",
190        "Objects/fileobject.c",
191        "Objects/floatobject.c",
192        "Objects/frameobject.c",
193        "Objects/funcobject.c",
194        "Objects/intobject.c",
195        "Objects/iterobject.c",
196        "Objects/listobject.c",
197        "Objects/longobject.c",
198        "Objects/dictobject.c",
199        "Objects/memoryobject.c",
200        "Objects/methodobject.c",
201        "Objects/moduleobject.c",
202        "Objects/object.c",
203        "Objects/obmalloc.c",
204        "Objects/rangeobject.c",
205        "Objects/setobject.c",
206        "Objects/sliceobject.c",
207        "Objects/stringobject.c",
208        "Objects/structseq.c",
209        "Objects/tupleobject.c",
210        "Objects/typeobject.c",
211        "Objects/weakrefobject.c",
212        "Objects/unicodeobject.c",
213        "Objects/unicodectype.c",
214    ],
215}
216
217cc_library_static {
218    name: "py2-interp-python",
219    defaults: ["py2-interp-defaults"],
220    target: {
221        linux: {
222            cflags: [
223                "-DPLATFORM=\"linux2\"",
224            ],
225        },
226        darwin_x86_64: {
227            cflags: [
228                "-DPLATFORM=\"darwin\"",
229            ],
230        },
231    },
232    srcs: [
233        "Python/_warnings.c",
234        "Python/Python-ast.c",
235        "Python/asdl.c",
236        "Python/ast.c",
237        "Python/bltinmodule.c",
238        "Python/ceval.c",
239        "Python/compile.c",
240        "Python/codecs.c",
241        "Python/errors.c",
242        "Python/frozen.c",
243        "Python/frozenmain.c",
244        "Python/future.c",
245        "Python/getargs.c",
246        "Python/getcompiler.c",
247        "Python/getcopyright.c",
248        "Python/getplatform.c",
249        "Python/getversion.c",
250        "Python/graminit.c",
251        "Python/import.c",
252        "Python/importdl.c",
253        "Python/marshal.c",
254        "Python/modsupport.c",
255        "Python/mystrtoul.c",
256        "Python/mysnprintf.c",
257        "Python/peephole.c",
258        "Python/pyarena.c",
259        "Python/pyctype.c",
260        "Python/pyfpe.c",
261        "Python/pymath.c",
262        "Python/pystate.c",
263        "Python/pythonrun.c",
264        "Python/random.c",
265        "Python/structmember.c",
266        "Python/symtable.c",
267        "Python/sysmodule.c",
268        "Python/traceback.c",
269        "Python/getopt.c",
270        "Python/pystrcmp.c",
271        "Python/pystrtod.c",
272        "Python/dtoa.c",
273        "Python/formatter_unicode.c",
274        "Python/formatter_string.c",
275        "Python/dynload_shlib.c",
276        "Python/thread.c",
277    ],
278}
279
280cc_defaults {
281    name: "py2-launcher-defaults",
282    defaults: ["py2-interp-defaults"],
283    cflags: [
284        "-DVERSION=\"2.7\"",
285        "-DVPATH=\"\"",
286        "-DPREFIX=\"\"",
287        "-DEXEC_PREFIX=\"\"",
288        "-DPYTHONPATH=\"..:\"",
289        "-DANDROID_SKIP_ZIP_PATH",
290        "-DANDROID_SKIP_EXEC_PREFIX_PATH",
291        "-DANDROID_LIB_PYTHON_PATH=\"internal/stdlib\"",
292        "-DDATE=\"Dec 31 1969\"",
293        "-DTIME=\"23:59:59\"",
294    ],
295    static_libs: [
296        "libbase",
297        "libcrypto_static",
298        "libexpat",
299        "liblog",
300        "libssl",
301        "libz",
302    ],
303    target: {
304        linux_glibc_x86_64: {
305            host_ldlibs: ["-lutil"],
306        },
307        darwin: {
308            host_ldlibs: [
309                "-framework SystemConfiguration",
310                "-framework CoreFoundation",
311            ],
312        },
313        host: {
314            static_libs: ["libsqlite_static_noicu"],
315        },
316        // Use shared libsqlite for device side, otherwise
317        // the executable size will be really huge.
318        android: {
319            shared_libs: ["libsqlite"],
320        },
321    },
322}
323
324cc_library_static {
325    name: "py2-launcher-lib",
326    defaults: ["py2-launcher-defaults"],
327    srcs: [
328        "Modules/gcmodule.c",
329        "Modules/getpath.c",
330        "Modules/config.c",
331        "Modules/getbuildinfo.c",
332        // Default built-in extension py2-c-modules.
333        "Modules/threadmodule.c",
334        "Modules/signalmodule.c",
335        "Modules/posixmodule.c",
336        "Modules/errnomodule.c",
337        "Modules/pwdmodule.c",
338        "Modules/_sre.c",
339        "Modules/_codecsmodule.c",
340        "Modules/_weakref.c",
341        "Modules/zipimport.c",
342        "Modules/symtablemodule.c",
343        "Modules/main.c",
344    ],
345    // NOTE: Please update Modules/config.c if new lib get added in the static_libs.
346    whole_static_libs: [
347        // Be careful the order of these three static libraries below due to
348        // missing symbols issues.
349        "py2-interp-object",
350        "py2-interp-python",
351        "py2-interp-parser",
352        "py2-c-module-array",
353        "py2-c-module-cmath",
354        "py2-c-module-math",
355        "py2-c-module-_struct",
356        "py2-c-module-time",
357        "py2-c-module-operator",
358        "py2-c-module-_testcapi",
359        "py2-c-module-_random",
360        "py2-c-module-_collections",
361        "py2-c-module-_heapq",
362        "py2-c-module-itertools",
363        "py2-c-module-strop",
364        "py2-c-module-_functools",
365        "py2-c-module-datetime",
366        "py2-c-module-_bisect",
367        "py2-c-module-unicodedata",
368        "py2-c-module-_io",
369        "py2-c-module-fcntl",
370        "py2-c-module-select",
371        "py2-c-module-mmap",
372        "py2-c-module-_csv",
373        "py2-c-module-_socket",
374        "py2-c-module-termios",
375        "py2-c-module-_ssl",
376        "py2-c-module-_md5",
377        "py2-c-module-_sha",
378        "py2-c-module-_sha256",
379        "py2-c-module-_sha512",
380        "py2-c-module-binascii",
381        "py2-c-module-parser",
382        "py2-c-module-cStringIO",
383        "py2-c-module-cPickle",
384        "py2-c-module-xxsubtype",
385        "py2-c-module-future_builtins",
386        "py2-c-module-_json",
387        "py2-c-module-_hotshot",
388        "py2-c-module-_lsprof",
389        "py2-c-module-grp",
390        "py2-c-module-syslog",
391        "py2-c-module-audioop",
392        "py2-c-module-resource",
393        "py2-c-module-_multibytecodec",
394        "py2-c-module-_codecs_kr",
395        "py2-c-module-_codecs_jp",
396        "py2-c-module-_codecs_cn",
397        "py2-c-module-_codecs_tw",
398        "py2-c-module-_codecs_hk",
399        "py2-c-module-_codecs_iso2022",
400        "py2-c-module-_multiprocessing",
401        "py2-c-module-zlib",
402        "py2-c-module-pyexpat",
403        "py2-c-module-_sqlite3",
404        "py2-c-module-_ctypes_test",
405        "py2-c-module-_ctypes",
406    ],
407    target: {
408        darwin: {
409            whole_static_libs: ["py2-c-module-_scproxy"],
410        },
411    },
412}
413
414cc_binary {
415    name: "py2-launcher",
416    defaults: ["py2-launcher-defaults"],
417    srcs: ["Launcher/launcher_main.cpp"],
418    static_libs: ["py2-launcher-lib"],
419}
420
421cc_binary {
422    name: "py2-launcher-autorun",
423    defaults: ["py2-launcher-defaults"],
424    srcs: ["Launcher/launcher_main.cpp"],
425    static_libs: ["py2-launcher-lib"],
426    cflags: ["-DANDROID_AUTORUN"],
427}
428
429python_binary_host {
430    name: "py2-cmd",
431    autorun: false,
432    version: {
433        py2: {
434            enabled: true,
435            embedded_launcher: true,
436        },
437        py3: {
438            enabled: false,
439        },
440    },
441}
442
443// Enabled extension py2-c-modules.
444
445cc_library_static {
446    name: "py2-c-module-array",
447    defaults: ["py2-interp-defaults"],
448    srcs: [
449        "Modules/arraymodule.c",
450    ],
451}
452
453cc_library_static {
454    name: "py2-c-module-cmath",
455    defaults: ["py2-interp-defaults"],
456    srcs: [
457        "Modules/cmathmodule.c",
458        "Modules/_math.c",
459    ],
460}
461
462cc_library_static {
463    name: "py2-c-module-math",
464    defaults: ["py2-interp-defaults"],
465    srcs: [
466        "Modules/mathmodule.c",
467        "Modules/_math.c",
468    ],
469}
470
471cc_library_static {
472    name: "py2-c-module-_struct",
473    defaults: ["py2-interp-defaults"],
474    srcs: [
475        "Modules/_struct.c",
476    ],
477}
478
479cc_library_static {
480    name: "py2-c-module-time",
481    defaults: ["py2-interp-defaults"],
482    srcs: [
483        "Modules/timemodule.c",
484    ],
485}
486
487cc_library_static {
488    name: "py2-c-module-operator",
489    defaults: ["py2-interp-defaults"],
490    srcs: [
491        "Modules/operator.c",
492    ],
493}
494
495cc_library_static {
496    name: "py2-c-module-_testcapi",
497    defaults: ["py2-interp-defaults"],
498    srcs: [
499        "Modules/_testcapimodule.c",
500    ],
501}
502
503cc_library_static {
504    name: "py2-c-module-_random",
505    defaults: ["py2-interp-defaults"],
506    srcs: [
507        "Modules/_randommodule.c",
508    ],
509}
510
511cc_library_static {
512    name: "py2-c-module-_collections",
513    defaults: ["py2-interp-defaults"],
514    srcs: [
515        "Modules/_collectionsmodule.c",
516    ],
517}
518
519cc_library_static {
520    name: "py2-c-module-_heapq",
521    defaults: ["py2-interp-defaults"],
522    srcs: [
523        "Modules/_heapqmodule.c",
524    ],
525}
526
527cc_library_static {
528    name: "py2-c-module-itertools",
529    defaults: ["py2-interp-defaults"],
530    srcs: [
531        "Modules/itertoolsmodule.c",
532    ],
533}
534
535cc_library_static {
536    name: "py2-c-module-strop",
537    defaults: ["py2-interp-defaults"],
538    srcs: [
539        "Modules/stropmodule.c",
540    ],
541}
542
543cc_library_static {
544    name: "py2-c-module-_functools",
545    defaults: ["py2-interp-defaults"],
546    srcs: [
547        "Modules/_functoolsmodule.c",
548    ],
549}
550
551cc_library_static {
552    name: "py2-c-module-datetime",
553    defaults: ["py2-interp-defaults"],
554    srcs: [
555        "Modules/datetimemodule.c",
556    ],
557}
558
559cc_library_static {
560    name: "py2-c-module-_bisect",
561    defaults: ["py2-interp-defaults"],
562    srcs: [
563        "Modules/_bisectmodule.c",
564    ],
565}
566
567cc_library_static {
568    name: "py2-c-module-unicodedata",
569    defaults: ["py2-interp-defaults"],
570    srcs: [
571        "Modules/unicodedata.c",
572    ],
573}
574
575cc_library_static {
576    name: "py2-c-module-_io",
577    defaults: ["py2-interp-defaults"],
578    srcs: [
579        "Modules/_io/bufferedio.c",
580        "Modules/_io/bytesio.c",
581        "Modules/_io/fileio.c",
582        "Modules/_io/iobase.c",
583        "Modules/_io/_iomodule.c",
584        "Modules/_io/stringio.c",
585        "Modules/_io/textio.c",
586    ],
587    local_include_dirs: [
588        "Modules/_io",
589    ],
590}
591
592cc_library_static {
593    name: "py2-c-module-fcntl",
594    defaults: ["py2-interp-defaults"],
595    srcs: [
596        "Modules/fcntlmodule.c",
597    ],
598}
599
600cc_library_static {
601    name: "py2-c-module-select",
602    defaults: ["py2-interp-defaults"],
603    srcs: [
604        "Modules/selectmodule.c",
605    ],
606}
607
608cc_library_static {
609    name: "py2-c-module-mmap",
610    defaults: ["py2-interp-defaults"],
611    srcs: [
612        "Modules/mmapmodule.c",
613    ],
614}
615
616cc_library_static {
617    name: "py2-c-module-_csv",
618    defaults: ["py2-interp-defaults"],
619    srcs: [
620        "Modules/_csv.c",
621    ],
622}
623
624cc_library_static {
625    name: "py2-c-module-_socket",
626    defaults: ["py2-interp-defaults"],
627    srcs: [
628        "Modules/socketmodule.c",
629        "Modules/timemodule.c",
630    ],
631}
632
633cc_library_static {
634    name: "py2-c-module-termios",
635    defaults: ["py2-interp-defaults"],
636    srcs: [
637        "Modules/termios.c",
638    ],
639}
640
641cc_library_static {
642    name: "py2-c-module-_ssl",
643    defaults: ["py2-interp-defaults"],
644    srcs: ["Modules/_ssl.c"],
645    cflags: ["-Wno-incompatible-pointer-types-discards-qualifiers"],
646    static_libs: [
647        "libssl",
648        "libcrypto_static",
649    ],
650}
651
652cc_library_static {
653    name: "py2-c-module-_md5",
654    defaults: ["py2-interp-defaults"],
655    srcs: [
656        "Modules/md5module.c",
657        "Modules/md5.c",
658    ],
659}
660
661cc_library_static {
662    name: "py2-c-module-_sha",
663    defaults: ["py2-interp-defaults"],
664    srcs: [
665        "Modules/shamodule.c",
666    ],
667}
668
669cc_library_static {
670    name: "py2-c-module-_sha256",
671    defaults: ["py2-interp-defaults"],
672    srcs: [
673        "Modules/sha256module.c",
674    ],
675}
676
677cc_library_static {
678    name: "py2-c-module-_sha512",
679    defaults: ["py2-interp-defaults"],
680    srcs: [
681        "Modules/sha512module.c",
682    ],
683}
684
685cc_library_static {
686    name: "py2-c-module-binascii",
687    defaults: ["py2-interp-defaults"],
688    srcs: [
689        "Modules/binascii.c",
690    ],
691}
692
693cc_library_static {
694    name: "py2-c-module-parser",
695    defaults: ["py2-interp-defaults"],
696    srcs: [
697        "Modules/parsermodule.c",
698    ],
699}
700
701cc_library_static {
702    name: "py2-c-module-cStringIO",
703    defaults: ["py2-interp-defaults"],
704    srcs: [
705        "Modules/cStringIO.c",
706    ],
707}
708
709cc_library_static {
710    name: "py2-c-module-cPickle",
711    defaults: ["py2-interp-defaults"],
712    srcs: [
713        "Modules/cPickle.c",
714    ],
715}
716
717cc_library_static {
718    name: "py2-c-module-xxsubtype",
719    defaults: ["py2-interp-defaults"],
720    srcs: [
721        "Modules/xxsubtype.c",
722    ],
723}
724
725cc_library_static {
726    name: "py2-c-module-future_builtins",
727    defaults: ["py2-interp-defaults"],
728    srcs: [
729        "Modules/future_builtins.c",
730    ],
731}
732
733cc_library_static {
734    name: "py2-c-module-_json",
735    defaults: ["py2-interp-defaults"],
736    srcs: [
737        "Modules/_json.c",
738    ],
739}
740
741cc_library_static {
742    name: "py2-c-module-_hotshot",
743    defaults: ["py2-interp-defaults"],
744    srcs: [
745        "Modules/_hotshot.c",
746    ],
747}
748
749cc_library_static {
750    name: "py2-c-module-_lsprof",
751    defaults: ["py2-interp-defaults"],
752    srcs: [
753        "Modules/_lsprof.c",
754        "Modules/rotatingtree.c",
755    ],
756}
757
758cc_library_static {
759    name: "py2-c-module-grp",
760    defaults: ["py2-interp-defaults"],
761    srcs: [
762        "Modules/grpmodule.c",
763        "Modules/rotatingtree.c",
764    ],
765}
766
767cc_library_static {
768    name: "py2-c-module-syslog",
769    defaults: ["py2-interp-defaults"],
770    srcs: [
771        "Modules/syslogmodule.c",
772    ],
773}
774
775cc_library_static {
776    name: "py2-c-module-audioop",
777    defaults: ["py2-interp-defaults"],
778    srcs: [
779        "Modules/audioop.c",
780    ],
781}
782
783cc_library_static {
784    name: "py2-c-module-resource",
785    defaults: ["py2-interp-defaults"],
786    srcs: [
787        "Modules/resource.c",
788    ],
789}
790
791cc_library_static {
792    name: "py2-c-module-_multibytecodec",
793    defaults: ["py2-interp-defaults"],
794    srcs: [
795        "Modules/cjkcodecs/multibytecodec.c",
796    ],
797}
798
799cc_library_static {
800    name: "py2-c-module-_codecs_kr",
801    defaults: ["py2-interp-defaults"],
802    srcs: ["Modules/cjkcodecs/_codecs_kr.c"],
803}
804
805cc_library_static {
806    name: "py2-c-module-_codecs_jp",
807    defaults: ["py2-interp-defaults"],
808    srcs: ["Modules/cjkcodecs/_codecs_jp.c"],
809}
810
811cc_library_static {
812    name: "py2-c-module-_codecs_cn",
813    defaults: ["py2-interp-defaults"],
814    srcs: ["Modules/cjkcodecs/_codecs_cn.c"],
815}
816
817cc_library_static {
818    name: "py2-c-module-_codecs_tw",
819    defaults: ["py2-interp-defaults"],
820    srcs: ["Modules/cjkcodecs/_codecs_tw.c"],
821}
822
823cc_library_static {
824    name: "py2-c-module-_codecs_hk",
825    defaults: ["py2-interp-defaults"],
826    srcs: ["Modules/cjkcodecs/_codecs_hk.c"],
827}
828
829cc_library_static {
830    name: "py2-c-module-_codecs_iso2022",
831    defaults: ["py2-interp-defaults"],
832    srcs: ["Modules/cjkcodecs/_codecs_iso2022.c"],
833}
834
835cc_library_static {
836    name: "py2-c-module-_multiprocessing",
837    defaults: ["py2-interp-defaults"],
838    srcs: [
839        "Modules/_multiprocessing/multiprocessing.c",
840        "Modules/_multiprocessing/semaphore.c",
841        "Modules/_multiprocessing/socket_connection.c",
842    ],
843}
844
845cc_library_static {
846    name: "py2-c-module-zlib",
847    defaults: [
848        "py2-interp-defaults",
849    ],
850    cflags: [
851        "-DUSE_ZLIB_CRC32",
852    ],
853    srcs: [
854        "Modules/zlibmodule.c",
855    ],
856    static_libs: [
857        "libz",
858    ],
859}
860
861cc_library_static {
862    name: "py2-c-module-pyexpat",
863    defaults: [
864        "py2-interp-defaults",
865    ],
866    cflags: [
867        "-DUSE_PYEXPAT_CAPI",
868    ],
869    srcs: [
870        "Modules/pyexpat.c",
871    ],
872    static_libs: [
873        "libexpat",
874    ],
875}
876
877cc_library_static {
878    name: "py2-c-module-_sqlite3",
879    defaults: [
880        "py2-interp-defaults",
881    ],
882    cflags: [
883        "-DMODULE_NAME=\"sqlite3\"",
884        "-DSQLITE_OMIT_LOAD_EXTENSION",
885        "-Wno-format-security",
886        "-Wno-type-limits",
887        "-Wno-char-subscripts",
888    ],
889    local_include_dirs: [
890        "Modules/_sqlite",
891    ],
892    srcs: [
893        "Modules/_sqlite/cache.c",
894        "Modules/_sqlite/connection.c",
895        "Modules/_sqlite/cursor.c",
896        "Modules/_sqlite/microprotocols.c",
897        "Modules/_sqlite/module.c",
898        "Modules/_sqlite/prepare_protocol.c",
899        "Modules/_sqlite/row.c",
900        "Modules/_sqlite/statement.c",
901        "Modules/_sqlite/util.c",
902    ],
903    target: {
904        host: {
905            static_libs: [
906                "libsqlite",
907            ],
908        },
909        android: {
910            shared_libs: [
911                "libsqlite",
912            ],
913        },
914    },
915}
916
917cc_library_static {
918    name: "py2-c-module-_ctypes_test",
919    defaults: ["py2-interp-defaults"],
920    srcs: ["Modules/_ctypes/_ctypes_test.c"],
921}
922
923cc_library_static {
924    name: "py2-c-module-_ctypes",
925    defaults: [
926        "py2-interp-defaults",
927    ],
928    local_include_dirs: [
929        "Modules/_ctypes/libffi/include",
930    ],
931    srcs: [
932        "Modules/_ctypes/_ctypes.c",
933        "Modules/_ctypes/callbacks.c",
934        "Modules/_ctypes/callproc.c",
935        "Modules/_ctypes/stgdict.c",
936        "Modules/_ctypes/cfield.c",
937        "Modules/_ctypes/libffi/src/prep_cif.c",
938        "Modules/_ctypes/libffi/src/closures.c",
939    ],
940    arch: {
941        x86_64: {
942            local_include_dirs: [
943                "Modules/_ctypes/libffi/src/x86",
944            ],
945            srcs: [
946                "Modules/_ctypes/libffi/src/x86/ffi64.c",
947                "Modules/_ctypes/libffi/src/x86/ffi.c",
948                "Modules/_ctypes/libffi/src/x86/sysv.S",
949            ],
950        },
951        x86: {
952            local_include_dirs: [
953                "Modules/_ctypes/libffi/src/x86",
954            ],
955            srcs: [
956                "Modules/_ctypes/libffi/src/x86/ffi.c",
957                "Modules/_ctypes/libffi/src/x86/sysv.S",
958            ],
959        },
960        arm: {
961            local_include_dirs: [
962                "android_arm/libffi",
963                "Modules/_ctypes/libffi/src/arm",
964            ],
965            srcs: [
966                "Modules/_ctypes/libffi/src/arm/ffi.c",
967                "Modules/_ctypes/libffi/src/arm/sysv.S",
968                "Modules/_ctypes/libffi/src/arm/trampoline.S",
969            ],
970        },
971        arm64: {
972            // arithmetic on a pointer in _ctypes/libffi/src/aarch64/ffi.c
973            cflags: ["-Wno-pointer-arith"],
974            local_include_dirs: [
975                "android_arm64/libffi",
976                "Modules/_ctypes/libffi/src/aarch64",
977            ],
978            srcs: [
979                "Modules/_ctypes/libffi/src/aarch64/ffi.c",
980                "Modules/_ctypes/libffi/src/aarch64/sysv.S",
981            ],
982        },
983    },
984    target: {
985        // Regenerate include dirs with android_regen.sh
986        darwin_x86_64: {
987            local_include_dirs: ["darwin_x86_64/libffi"],
988            srcs: [
989                "Modules/_ctypes/libffi/src/x86/darwin.S",
990                "Modules/_ctypes/libffi/src/x86/darwin64.S",
991            ],
992        },
993        linux_glibc_x86_64: {
994            local_include_dirs: ["linux_x86_64/libffi"],
995            srcs: [
996                "Modules/_ctypes/libffi/src/x86/unix64.S",
997            ],
998        },
999        linux_musl_arm64: {
1000            local_include_dirs: ["linux_arm64/libffi"],
1001            srcs: [
1002                "Modules/_ctypes/libffi/src/x86/unix64.S",
1003            ],
1004        },
1005        linux_musl_x86_64: {
1006            local_include_dirs: ["linux_x86_64/libffi"],
1007            srcs: [
1008                "Modules/_ctypes/libffi/src/x86/unix64.S",
1009            ],
1010        },
1011        android_x86: {
1012            local_include_dirs: ["android_x86/libffi"],
1013            srcs: [
1014                "Modules/_ctypes/libffi/src/x86/win32.S",
1015            ],
1016        },
1017        android_x86_64: {
1018            local_include_dirs: ["android_x86_64/libffi"],
1019            srcs: [
1020                "Modules/_ctypes/libffi/src/x86/unix64.S",
1021            ],
1022        },
1023    },
1024}
1025
1026cc_library_host_static {
1027    name: "py2-c-module-_scproxy",
1028    defaults: ["py2-interp-defaults"],
1029    srcs: ["Mac/Modules/_scproxy.c"],
1030    target: {
1031        linux: {
1032            enabled: false,
1033        },
1034    },
1035}
1036