Skip to content

Commit 0856e6a

Browse files
authored
Merge pull request #40 from GRRedWings/API30-Build
Api30 build
2 parents 0059dd1 + ad775ce commit 0856e6a

File tree

546 files changed

+24060
-33322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

546 files changed

+24060
-33322
lines changed

Android/bldlibrary.patch

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--- Python-3.12.1-original/configure 2023-11-22 09:33:49
2+
+++ Python-3.12.1/configure 2023-11-22 10:13:05
3+
@@ -7484,6 +7484,7 @@
4+
5+
case $ac_sys_system in
6+
CYGWIN*)
7+
LDLIBRARY='libpython$(LDVERSION).dll.a'
8+
+ BLDLIBRARY='-L. -lpython$(LDVERSION)'
9+
DLLLIBRARY='libpython$(LDVERSION).dll'
10+
;;
11+
SunOS*)
12+
--- Python-3.12.1-original/configure 2023-11-22 09:33:49
13+
+++ Python-3.12.1/configure 2023-11-22 10:13:05
14+
@@ -24378,7 +24378,7 @@
15+
# On Android and Cygwin the shared libraries must be linked with libpython.
16+
17+
if test "$PY_ENABLE_SHARED" = "1" && ( test -n "$ANDROID_API_LEVEL" || test "$MACHDEP" = "cygwin"); then
18+
- LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"
19+
+ LIBPYTHON="$BLDLIBRARY"
20+
else
21+
LIBPYTHON=''
22+
fi
23+
--- Python-3.12.1-original/Modules/makesetup 2023-10-02 12:48:14
24+
+++ Python-3.12.1/Modules/makesetup 2023-11-22 10:11:40
25+
@@ -86,18 +86,6 @@
26+
# Newline for sed i and a commands
27+
NL='\
28+
'
29+
-
30+
-# Setup to link with extra libraries when making shared extensions.
31+
-# Currently, only Cygwin needs this baggage.
32+
-case `uname -s` in
33+
-CYGWIN*) if test $libdir = .
34+
- then
35+
- ExtraLibDir=.
36+
- else
37+
- ExtraLibDir='$(LIBPL)'
38+
- fi
39+
- ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";;
40+
-esac
41+
42+
# Main loop
43+
for i in ${*-Setup}
44+
@@ -286,7 +274,7 @@
45+
;;
46+
esac
47+
rule="$file: $objs"
48+
- rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
49+
+ rule="$rule; \$(BLDSHARED) $objs $libs \$(LIBPYTHON) -o $file"
50+
echo "$rule" >>$rulesf
51+
done
52+
done

Android/build_deps.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
import re
66
import subprocess
77
from typing import List
8+
import subprocess
89

910
from util import ARCHITECTURES, BASE, SYSROOT, env_vars, ndk_unified_toolchain, parse_args
1011

11-
logger = logging.getLogger(__name__)
12+
import patch
1213

1314
class Package:
1415
def __init__(self, target_arch_name: str, android_api_level: int):
@@ -18,7 +19,6 @@ def __init__(self, target_arch_name: str, android_api_level: int):
1819

1920
def run(self, cmd: List[str]):
2021
cwd = BASE / 'deps' / re.sub(r'\.tar\..*', '', os.path.basename(self.source))
21-
logger.debug(f'Running in {cwd}: ' + ' '.join([shlex.quote(str(arg)) for arg in cmd]))
2222
subprocess.check_call(cmd, cwd=cwd)
2323

2424
def build(self):
@@ -34,6 +34,9 @@ def configure(self):
3434
'--host=' + self.target_arch.ANDROID_TARGET,
3535
'--disable-shared',
3636
] + getattr(self, 'configure_args', []))
37+
38+
pset = patch.fromfile('Android/patchTrampc.patch')
39+
pset.apply()
3740

3841
def make(self):
3942
self.run(['make'])
@@ -72,16 +75,16 @@ class LibFFI(Package):
7275
configure_args = ['--disable-builddir']
7376

7477
class LibUUID(Package):
75-
source = 'https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.38/util-linux-2.38.1.tar.xz'
78+
source = 'https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.2.tar.xz'
7679
configure_args = ['--disable-all-programs', '--enable-libuuid']
7780

7881
class NCurses(Package):
79-
source = 'https://ftp.gnu.org/gnu/ncurses/ncurses-6.3.tar.gz'
82+
source = 'https://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gz'
8083
# Not stripping the binaries as there is no easy way to specify the strip program for Android
8184
configure_args = ['--without-ada', '--enable-widec', '--without-debug', '--without-cxx-binding', '--disable-stripping']
8285

8386
class OpenSSL(Package):
84-
source = 'https://www.openssl.org/source/openssl-3.0.7.tar.gz'
87+
source = 'https://www.openssl.org/source/openssl-3.0.12.tar.gz'
8588

8689
def configure(self):
8790
# OpenSSL handles NDK internal paths by itself
@@ -93,8 +96,6 @@ def configure(self):
9396
os.environ['PATH'],
9497
))
9598

96-
logger.debug(f'$PATH for OpenSSL: {path}')
97-
9899
os.environ['PATH'] = path
99100

100101
openssl_target = 'android-' + self.target_arch_name
@@ -115,13 +116,24 @@ class Readline(Package):
115116
configure_args = ['bash_cv_wcwidth_broken=yes']
116117

117118
class SQLite(Package):
118-
source = 'https://sqlite.org/2022/sqlite-autoconf-3390400.tar.gz'
119+
source = 'https://sqlite.org/2024/sqlite-autoconf-3460000.tar.gz'
119120

120121
class XZ(Package):
121-
source = 'https://tukaani.org/xz/xz-5.2.7.tar.xz'
122+
source = 'https://tukaani.org/xz/xz-5.6.2.tar.xz'
123+
124+
def make(self):
125+
print('******************** About to run make')
126+
self.run([
127+
'make',
128+
f'CFLAGS={os.environ["CFLAGS"]} {os.environ["CPPFLAGS"]}',
129+
])
130+
131+
print('******** Finished running make')
132+
133+
122134

123135
class ZLib(Package):
124-
source = 'https://www.zlib.net/zlib-1.2.13.tar.gz'
136+
source = 'https://www.zlib.net/zlib-1.3.1.tar.gz'
125137

126138
def configure(self):
127139
os.environ.update({
@@ -139,7 +151,7 @@ def make(self):
139151
self.run(['make', 'libz.a'])
140152

141153
def build_package(pkg: Package):
142-
subprocess.check_call(['curl', '-fLO', pkg.source], cwd=BASE / 'deps')
154+
subprocess.check_call(['curl', '-kfLO', pkg.source], cwd=BASE / 'deps')
143155
subprocess.check_call(['tar', '--no-same-owner', '-xf', os.path.basename(pkg.source)], cwd=BASE / 'deps')
144156

145157
try:

Android/grph.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- /android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/grp.h 2023-10-05 20:43:06.000000000 -0500
2+
+++ /android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/grp.h 2023-10-11 15:13:45.525034100 -0500
3+
@@ -52,12 +52,12 @@
4+
5+
/* Note: Android has thousands and thousands of ids to iterate through. */
6+
7+
-#if __ANDROID_API__ >= 26
8+
-struct group* _Nullable getgrent(void) __INTRODUCED_IN(26);
9+
+#if __ANDROID_API__ >= 23
10+
+struct group* _Nullable getgrent(void) __INTRODUCED_IN(23);
11+
12+
-void setgrent(void) __INTRODUCED_IN(26);
13+
-void endgrent(void) __INTRODUCED_IN(26);
14+
-#endif /* __ANDROID_API__ >= 26 */
15+
+void setgrent(void) __INTRODUCED_IN(23);
16+
+void endgrent(void) __INTRODUCED_IN(23);
17+
+#endif /* __ANDROID_API__ >= 23 */
18+
19+
20+
#if __ANDROID_API__ >= 24

Android/patchTrampc.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/Android/deps/libffi-3.4.4/src/tramp.c 2022-10-23 10:23:27.000000000 -0500
2+
+++ b/Android/deps/libffi-3.4.4/src/tramp.c 2023-10-10 15:04:02.008920000 -0500
3+
@@ -249,6 +249,8 @@
4+
return 1;
5+
}
6+
7+
+int open_temp_exec_file (void);
8+
+
9+
#endif /* defined (__linux__) || defined (__CYGWIN__) */
10+
11+
#if defined (__linux__) || defined (__CYGWIN__)

Android/trampc.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/Android/deps/libffi-3.4.4/src/tramp.c 2022-10-23 10:23:27.000000000 -0500
2+
+++ b/Android/deps/libffi-3.4.4/src/tramp.c 2023-10-10 15:04:02.008920000 -0500
3+
@@ -249,6 +249,8 @@
4+
return 1;
5+
}
6+
7+
+int open_temp_exec_file (void);
8+
+
9+
#endif /* defined (__linux__) || defined (__CYGWIN__) */
10+
11+
#if defined (__linux__) || defined (__CYGWIN__)

Android/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ def env_vars(target_arch_name: str, android_api_level: int) -> Dict[str, str]:
7676
def parse_args():
7777
parser = argparse.ArgumentParser()
7878
parser.add_argument('--arch', required=True, choices=ARCHITECTURES.keys(), dest='target_arch_name')
79-
parser.add_argument('--api', required=True, type=int, choices=range(21, 30), dest='android_api_level')
79+
parser.add_argument('--api', required=True, type=int, choices=range(30, 40), dest='android_api_level')
8080
return parser.parse_known_args()

AndroidApp/app/build.gradle

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ apply plugin: 'com.android.application'
33
android {
44
defaultConfig {
55
applicationId "com.example.pythontest"
6-
compileSdkVersion 33
7-
minSdkVersion 23
8-
targetSdkVersion 33
6+
compileSdkVersion = 34
7+
minSdkVersion 30
8+
targetSdkVersion 34
99
versionCode 1
1010
versionName "1.0"
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -26,36 +26,34 @@ android {
2626
}
2727

2828
packagingOptions {
29-
pickFirst 'lib/arm64-v8a/libpython3.11.so'
30-
pickFirst 'lib/armeabi-v7a/libpython3.11.so'
31-
pickFirst 'lib/x86_64/libpython3.11.so'
29+
pickFirst 'lib/arm64-v8a/libpython3.12.so'
30+
pickFirst 'lib/x86_64/libpython3.12.so'
3231
}
3332

3433
// Only building ARM currently
3534
// productFlavors allows us to specify exactly which ABIs we support
36-
flavorDimensions "arm8", "arm", "x86_64"
35+
flavorDimensions.add("arm8")
36+
flavorDimensions.add("x86_64")
3737
productFlavors {
3838
arm8 {
3939
dimension "arm8"
4040
ndk {
41+
//noinspection ChromeOsAbiSupport
4142
abiFilters 'arm64-v8a'
4243
}
4344
}
44-
arm {
45-
dimension "arm"
46-
ndk {
47-
abiFilter 'armeabi-v7a'
48-
}
49-
}
5045
x86_64 {
5146
dimension "x86_64"
5247
ndk {
5348
abiFilter 'x86_64'
5449
}
5550
}
5651
}
57-
58-
52+
namespace 'com.example.pythontest'
53+
buildFeatures {
54+
aidl true
55+
buildConfig true
56+
}
5957
}
6058

6159
dependencies {

AndroidApp/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.example.pythontest">
3+
xmlns:tools="http://schemas.android.com/tools">
54

65
<application
76
android:allowBackup="true"
-14.9 MB
Binary file not shown.
-1.39 MB
Binary file not shown.

0 commit comments

Comments
 (0)