Skip to content

Recipe updates and small fixes to build process #1034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pythonforandroid/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def build_recipes(build_order, python_modules, ctx):
bs = ctx.bootstrap
info_notify("Recipe build order is {}".format(build_order))
if python_modules:
python_modules = sorted(set(python_modules))
info_notify(
('The requirements ({}) were not found as recipes, they will be '
'installed with pip.').format(', '.join(python_modules)))
Expand Down
14 changes: 14 additions & 0 deletions pythonforandroid/recipes/dateutil/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from pythonforandroid.recipe import PythonRecipe


class DateutilRecipe(PythonRecipe):
name = 'dateutil'
version = '2.6.0'
url = 'https://pypi.python.org/packages/3e/f5/aad82824b369332a676a90a8c0d1e608b17e740bbb6aeeebca726f17b902/python-dateutil-{version}.tar.gz'

depends = ['python2', "setuptools"]
call_hostpython_via_targetpython = False
install_in_hostpython = True


recipe = DateutilRecipe()
78 changes: 38 additions & 40 deletions pythonforandroid/recipes/icu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ICURecipe(NDKRecipe):
version = '57.1'
url = 'http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz'

depends = [('python2', 'python3crystax')] # installs in python
depends = [('python2', 'python3crystax'), 'hostpython2'] # installs in python
generated_libraries = [
'libicui18n.so', 'libicuuc.so', 'libicudata.so', 'libicule.so']

Expand Down Expand Up @@ -68,50 +68,48 @@ def make_build_dest(dest):
shprint(sh.make, "install", _env=host_env)

build_android, exists = make_build_dest("build_icu_android")
if exists:
return

configure = sh.Command(join(build_root, "source", "configure"))

include = (
" -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/include/"
" -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/"
"{arch}/include")
include = include.format(ndk=self.ctx.ndk_dir,
version=env["TOOLCHAIN_VERSION"],
arch=arch.arch)
env["CPPFLAGS"] = env["CXXFLAGS"] + " "
env["CPPFLAGS"] += host_env["CPPFLAGS"]
env["CPPFLAGS"] += include
if not exists:

lib = "{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/{arch}"
lib = lib.format(ndk=self.ctx.ndk_dir,
version=env["TOOLCHAIN_VERSION"],
arch=arch.arch)
env["LDFLAGS"] += " -lgnustl_shared -L"+lib

env.pop("CFLAGS", None)
env.pop("CXXFLAGS", None)

with current_directory(build_android):
shprint(
configure,
"--with-cross-build="+build_linux,
"--enable-extras=no",
"--enable-strict=no",
"--enable-static",
"--enable-tests=no",
"--enable-samples=no",
"--host="+env["TOOLCHAIN_PREFIX"],
"--prefix="+icu_build,
_env=env)
shprint(sh.make, "-j5", _env=env)
shprint(sh.make, "install", _env=env)
configure = sh.Command(join(build_root, "source", "configure"))

include = (
" -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/include/"
" -I{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/"
"{arch}/include")
include = include.format(ndk=self.ctx.ndk_dir,
version=env["TOOLCHAIN_VERSION"],
arch=arch.arch)
env["CPPFLAGS"] = env["CXXFLAGS"] + " "
env["CPPFLAGS"] += host_env["CPPFLAGS"]
env["CPPFLAGS"] += include

lib = "{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/{arch}"
lib = lib.format(ndk=self.ctx.ndk_dir,
version=env["TOOLCHAIN_VERSION"],
arch=arch.arch)
env["LDFLAGS"] += " -lgnustl_shared -L"+lib

env.pop("CFLAGS", None)
env.pop("CXXFLAGS", None)

with current_directory(build_android):
shprint(
configure,
"--with-cross-build="+build_linux,
"--enable-extras=no",
"--enable-strict=no",
"--enable-static",
"--enable-tests=no",
"--enable-samples=no",
"--host="+env["TOOLCHAIN_PREFIX"],
"--prefix="+icu_build,
_env=env)
shprint(sh.make, "-j5", _env=env)
shprint(sh.make, "install", _env=env)

self.copy_files(arch)

def copy_files(self, arch):
ndk = self.ctx.ndk_dir
env = self.get_recipe_env(arch)

lib = "{ndk}/sources/cxx-stl/gnu-libstdc++/{version}/libs/{arch}"
Expand Down
16 changes: 9 additions & 7 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,18 +871,20 @@ def _adb(self, commands):


def build_status(self, args):

print('{Style.BRIGHT}Bootstraps whose core components are probably '
'already built:{Style.RESET_ALL}'.format(Style=Out_Style))
for filen in os.listdir(join(self.ctx.build_dir, 'bootstrap_builds')):
print(' {Fore.GREEN}{Style.BRIGHT}{filen}{Style.RESET_ALL}'
.format(filen=filen, Fore=Out_Fore, Style=Out_Style))

bootstrap_dir = join(self.ctx.build_dir, 'bootstrap_builds')
if exists(bootstrap_dir):
for filen in os.listdir(bootstrap_dir):
print(' {Fore.GREEN}{Style.BRIGHT}{filen}{Style.RESET_ALL}'
.format(filen=filen, Fore=Out_Fore, Style=Out_Style))

print('{Style.BRIGHT}Recipes that are probably already built:'
'{Style.RESET_ALL}'.format(Style=Out_Style))
if exists(join(self.ctx.build_dir, 'other_builds')):
for filen in sorted(
os.listdir(join(self.ctx.build_dir, 'other_builds'))):
other_builds_dir = join(self.ctx.build_dir, 'other_builds')
if exists(other_builds_dir):
for filen in sorted(os.listdir(other_builds_dir)):
name = filen.split('-')[0]
dependencies = filen.split('-')[1:]
recipe_str = (' {Style.BRIGHT}{Fore.GREEN}{name}'
Expand Down