Skip to content

Commit ab0fdda

Browse files
committed
Migrating recipes...
1 parent cd99583 commit ab0fdda

File tree

13 files changed

+30
-27
lines changed

13 files changed

+30
-27
lines changed

ci/constants.py

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class TargetPython(Enum):
3232
'zope_interface',
3333
# Requires zope_interface, which is broken.
3434
'twisted',
35+
'icu',
36+
'genericndkbuild',
37+
'evdev'
3538
])
3639

3740
BROKEN_RECIPES = {

pythonforandroid/archs.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,10 @@ def get_env(self, with_flags_in_cc=True):
167167
)
168168

169169
# Compiler: `CC` and `CXX` (and make sure that the compiler exists)
170-
environ['PATH'] = '{clang_path}:{path}'.format(
171-
clang_path=self.clang_path, path=environ['PATH']
172-
)
173-
cc = find_executable(self.clang_exe, path=environ['PATH'])
170+
env['PATH'] = self.ctx.env['PATH']
171+
cc = find_executable(self.clang_exe, path=env['PATH'])
174172
if cc is None:
175-
print('Searching path are: {!r}'.format(environ['PATH']))
173+
print('Searching path are: {!r}'.format(env['PATH']))
176174
raise BuildInterruptingException(
177175
'Couldn\'t find executable for CC. This indicates a '
178176
'problem locating the {} executable in the Android '
@@ -221,8 +219,6 @@ def get_env(self, with_flags_in_cc=True):
221219
),
222220
)
223221

224-
env['PATH'] = environ['PATH']
225-
226222
# for reproducible builds
227223
if 'SOURCE_DATE_EPOCH' in environ:
228224
for k in 'LC_ALL TZ SOURCE_DATE_EPOCH PYTHONHASHSEED BUILD_DATE BUILD_TIME'.split():

pythonforandroid/build.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def prepare_build_environment(self,
368368
self.ndk_sysroot, ndk_sysroot_exists = get_ndk_sysroot(self.ndk_dir)
369369
self.ndk_include_dir = join(self.ndk_sysroot, 'usr', 'include')
370370

371-
environ["PATH"] = ":".join(
371+
self.env["PATH"] = ":".join(
372372
[
373373
f"{ndk_dir}/toolchains/llvm/prebuilt/{py_platform}-x86_64/bin",
374374
ndk_dir,

pythonforandroid/recipe.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ def build_arch(self, arch, *extra_args):
818818
env = self.get_recipe_env(arch)
819819
with current_directory(self.get_build_dir(arch.arch)):
820820
shprint(
821-
sh.ndk_build,
821+
sh.Command(f"{self.ctx.ndk_dir}/ndk-build"),
822822
'V=1',
823823
'NDK_DEBUG=' + ("1" if self.ctx.build_as_debuggable else "0"),
824824
'APP_PLATFORM=android-' + str(self.ctx.ndk_api),
@@ -1142,7 +1142,6 @@ def get_recipe_env(self, arch, with_flags_in_cc=True):
11421142
env['LDSHARED'] = env['CC'] + ' -shared'
11431143
# shprint(sh.whereis, env['LDSHARED'], _env=env)
11441144
env['LIBLINK'] = 'NOTNONE'
1145-
env['NDKPLATFORM'] = self.ctx.ndk_sysroot # FIXME?
11461145
if self.ctx.copy_libs:
11471146
env['COPYLIBS'] = '1'
11481147

pythonforandroid/recipes/evdev/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class EvdevRecipe(CompiledComponentsPythonRecipe):
1818

1919
def get_recipe_env(self, arch=None):
2020
env = super().get_recipe_env(arch)
21+
env['SYSROOT'] = self.ctx.ndk_sysroot
2122
return env
2223

2324

pythonforandroid/recipes/evdev/include-dir.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ diff -Naur orig/setup.py v0.4.7/setup.py
66
#-----------------------------------------------------------------------------
77
def create_ecodes():
88
- header = '/usr/include/linux/input.h'
9-
+ header = os.environ['NDKPLATFORM'] + '/usr/include/linux/input.h'
9+
+ header = os.environ['SYSROOT'] + '/usr/include/linux/input.h'
1010

1111
if not os.path.isfile(header):
1212
msg = '''\

pythonforandroid/recipes/fontconfig/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ def build_arch(self, arch):
1313
env = self.get_recipe_env(arch)
1414

1515
with current_directory(self.get_jni_dir()):
16-
shprint(sh.ndk_build, "V=1", 'fontconfig', _env=env)
16+
shprint(
17+
sh.Command(f"{self.ctx.ndk_dir}/ndk-build"),
18+
"V=1",
19+
"APP_ALLOW_MISSING_DEPS=true",
20+
"fontconfig",
21+
_env=env,
22+
)
1723

1824

1925
recipe = FontconfigRecipe()

pythonforandroid/recipes/genericndkbuild/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def build_arch(self, arch):
2525
env = self.get_recipe_env(arch)
2626

2727
with current_directory(self.get_jni_dir()):
28-
shprint(sh.ndk_build, "V=1", _env=env)
28+
shprint(sh.Command(f"{self.ctx.ndk_dir}/ndk-build"), "V=1", _env=env)
2929

3030

3131
recipe = GenericNDKBuildRecipe()

pythonforandroid/recipes/icu/__init__.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sh
22
import os
3+
import platform
34
from os.path import join, isdir, exists
45
from multiprocessing import cpu_count
56
from pythonforandroid.recipe import Recipe
@@ -64,7 +65,7 @@ def make_build_dest(dest):
6465
return build_dest, True
6566

6667
icu_build = join(build_root, "icu_build")
67-
build_linux, exists = make_build_dest("build_icu_linux")
68+
build_host, exists = make_build_dest("build_icu_host")
6869

6970
host_env = os.environ.copy()
7071
# reduce the function set
@@ -75,12 +76,15 @@ def make_build_dest(dest):
7576
"-DUCONFIG_NO_TRANSLITERATION=0 ")
7677

7778
if not exists:
79+
icu4c_host_platform = platform.system()
80+
if icu4c_host_platform == "Darwin":
81+
icu4c_host_platform = "MacOSX"
7882
configure = sh.Command(
7983
join(build_root, "source", "runConfigureICU"))
80-
with current_directory(build_linux):
84+
with current_directory(build_host):
8185
shprint(
8286
configure,
83-
"Linux",
87+
icu4c_host_platform,
8488
"--prefix="+icu_build,
8589
"--enable-extras=no",
8690
"--enable-strict=no",
@@ -93,18 +97,18 @@ def make_build_dest(dest):
9397

9498
build_android, exists = make_build_dest("build_icu_android")
9599
if not exists:
96-
97100
configure = sh.Command(join(build_root, "source", "configure"))
98101

99102
with current_directory(build_android):
100103
shprint(
101104
configure,
102-
"--with-cross-build="+build_linux,
105+
"--with-cross-build="+build_host,
103106
"--enable-extras=no",
104107
"--enable-strict=no",
105108
"--enable-static=no",
106109
"--enable-tests=no",
107110
"--enable-samples=no",
111+
"--host="+arch.command_prefix,
108112
"--prefix="+icu_build,
109113
_env=env)
110114
shprint(sh.make, "-j", str(cpu_count()), _env=env)

pythonforandroid/recipes/libzbar/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def build_arch(self, arch):
3333
shprint(
3434
sh.Command('./configure'),
3535
'--host=' + arch.command_prefix,
36-
'--target=' + arch.toolchain_prefix,
36+
# '--target=' + arch.toolchain_prefix,
3737
'--prefix=' + self.ctx.get_python_install_dir(arch.arch),
3838
# Python bindings are compiled in a separated recipe
3939
'--with-python=no',

pythonforandroid/recipes/openal/__init__.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from pythonforandroid.recipe import NDKRecipe
22
from pythonforandroid.toolchain import current_directory, shprint
33
from os.path import join
4-
import os
54
import sh
65

76

@@ -11,12 +10,6 @@ class OpenALRecipe(NDKRecipe):
1110

1211
generated_libraries = ['libopenal.so']
1312

14-
def prebuild_arch(self, arch):
15-
# we need to build native tools for host system architecture
16-
with current_directory(join(self.get_build_dir(arch.arch), 'native-tools')):
17-
shprint(sh.cmake, '.', _env=os.environ)
18-
shprint(sh.make, _env=os.environ)
19-
2013
def build_arch(self, arch):
2114
with current_directory(self.get_build_dir(arch.arch)):
2215
env = self.get_recipe_env(arch)

pythonforandroid/recipes/sdl2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def build_arch(self, arch):
3030

3131
with current_directory(self.get_jni_dir()):
3232
shprint(
33-
sh.ndk_build,
33+
sh.Command(f"{self.ctx.ndk_dir}/ndk-build"),
3434
"V=1",
3535
"NDK_DEBUG=" + ("1" if self.ctx.build_as_debuggable else "0"),
3636
_env=env

pythonforandroid/recipes/zope/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def get_recipe_env(self, arch):
1717
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{}'.format(
1818
self.ctx.get_libs_dir(arch.arch))
1919
env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink')
20+
return env
2021

2122
def postbuild_arch(self, arch):
2223
super().postbuild_arch(arch)

0 commit comments

Comments
 (0)