Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
cpython/Android/android-env.sh at issue-130160-httpserver · donbarbos/cpython · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
donbarbos
/
cpython
Public
forked from
python/cpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
issue-130160-httpserver
Breadcrumbs
cpython
/
Android
/
android-env.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
99 lines (82 loc) · 3.35 KB
issue-130160-httpserver
Breadcrumbs
cpython
/
Android
/
android-env.sh
Copy path
Top
File metadata and controls
Code
Blame
99 lines (82 loc) · 3.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
This script must be sourced with the following variables already set:
:
"
${ANDROID_HOME
:?
}
"
#
Path to Android SDK
:
"
${HOST
:?
}
"
#
GNU target triplet
#
You may also override the following:
:
"
${api_level
:=
24}
"
#
Minimum Android API level the build will run on
:
"
${PREFIX
:-
}
"
#
Path in which to find required libraries
#
Print all messages on stderr so they're visible when running within build-wheel.
log
() {
echo
"
$1
"
>&2
}
fail
() {
log
"
$1
"
exit
1
}
#
When moving to a new version of the NDK, carefully review the following:
#
#
* https://developer.android.com/ndk/downloads/revision_history
#
#
* https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
#
where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
#
https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
ndk_version=27.1.12297006
ndk=
$ANDROID_HOME
/ndk/
$ndk_version
if
!
[
-e
"
$ndk
"
]
;
then
log
"
Installing NDK - this may take several minutes
"
yes
|
"
$ANDROID_HOME
/cmdline-tools/latest/bin/sdkmanager
"
"
ndk;
$ndk_version
"
fi
if
[
"
$HOST
"
=
"
arm-linux-androideabi
"
]
;
then
clang_triplet=armv7a-linux-androideabi
else
clang_triplet=
"
$HOST
"
fi
#
These variables are based on BuildSystemMaintainers.md above, and
#
$ndk/build/cmake/android.toolchain.cmake.
toolchain=
$(
echo
"
$ndk
"
/toolchains/llvm/prebuilt/
*
)
export
AR=
"
$toolchain
/bin/llvm-ar
"
export
AS=
"
$toolchain
/bin/llvm-as
"
export
CC=
"
$toolchain
/bin/
${clang_triplet}${api_level}
-clang
"
export
CXX=
"
${CC}
++
"
export
LD=
"
$toolchain
/bin/ld
"
export
NM=
"
$toolchain
/bin/llvm-nm
"
export
RANLIB=
"
$toolchain
/bin/llvm-ranlib
"
export
READELF=
"
$toolchain
/bin/llvm-readelf
"
export
STRIP=
"
$toolchain
/bin/llvm-strip
"
#
The quotes make sure the wildcard in the `toolchain` assignment has been expanded.
for
path
in
"
$AR
"
"
$AS
"
"
$CC
"
"
$CXX
"
"
$LD
"
"
$NM
"
"
$RANLIB
"
"
$READELF
"
"
$STRIP
"
;
do
if
!
[
-e
"
$path
"
]
;
then
fail
"
$path
does not exist
"
fi
done
export
CFLAGS=
"
-D__BIONIC_NO_PAGE_SIZE_MACRO
"
export
LDFLAGS=
"
-Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,-z,max-page-size=16384
"
#
Unlike Linux, Android does not implicitly use a dlopened library to resolve
#
relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used
#
(https://github.com/android/ndk/issues/1244). So any library that fails to
#
build with this flag, would also fail to load at runtime.
LDFLAGS=
"
$LDFLAGS
-Wl,--no-undefined
"
#
Many packages get away with omitting -lm on Linux, but Android is stricter.
LDFLAGS=
"
$LDFLAGS
-lm
"
#
-mstackrealign is included where necessary in the clang launcher scripts which are
#
pointed to by $CC, so we don't need to include it here.
if
[
"
$HOST
"
=
"
arm-linux-androideabi
"
]
;
then
CFLAGS=
"
$CFLAGS
-march=armv7-a -mthumb
"
fi
if
[
-n
"
${PREFIX
:-
}
"
]
;
then
abs_prefix=
"
$(
realpath
"
$PREFIX
"
)
"
CFLAGS=
"
$CFLAGS
-I
$abs_prefix
/include
"
LDFLAGS=
"
$LDFLAGS
-L
$abs_prefix
/lib
"
export
PKG_CONFIG=
"
pkg-config --define-prefix
"
export
PKG_CONFIG_LIBDIR=
"
$abs_prefix
/lib/pkgconfig
"
fi
#
When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
#
use CXXFLAGS alone.
export
CXXFLAGS=
"
$CFLAGS
"
#
Use the same variable name as conda-build
if
[
"
$(
uname
)
"
=
"
Darwin
"
]
;
then
CPU_COUNT=
"
$(
sysctl -n hw.ncpu
)
"
export
CPU_COUNT
else
CPU_COUNT=
"
$(
nproc
)
"
export
CPU_COUNT
fi
You can’t perform that action at this time.