Skip to content
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

liblzma: Use p4a_install instead of install, as a file named INSTALL is already present. #2663

Merged
merged 1 commit into from
Sep 2, 2022
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
9 changes: 4 additions & 5 deletions pythonforandroid/recipes/liblzma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
from pythonforandroid.archs import Arch
from pythonforandroid.logger import shprint
from pythonforandroid.recipe import Recipe
from pythonforandroid.util import current_directory, ensure_dir
from pythonforandroid.util import current_directory


class LibLzmaRecipe(Recipe):

version = '5.2.4'
url = 'https://tukaani.org/xz/xz-{version}.tar.gz'
built_libraries = {'liblzma.so': 'install/lib'}
built_libraries = {'liblzma.so': 'p4a_install/lib'}

def build_arch(self, arch: Arch) -> None:
env = self.get_recipe_env(arch)
install_dir = join(self.get_build_dir(arch.arch), 'install')
install_dir = join(self.get_build_dir(arch.arch), 'p4a_install')
with current_directory(self.get_build_dir(arch.arch)):
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
Expand All @@ -42,7 +42,6 @@ def build_arch(self, arch: Arch) -> None:
_env=env
)

ensure_dir('install')
shprint(sh.make, 'install', _env=env)

def get_library_includes(self, arch: Arch) -> str:
Expand All @@ -52,7 +51,7 @@ def get_library_includes(self, arch: Arch) -> str:
variable `CPPFLAGS`.
"""
return " -I" + join(
self.get_build_dir(arch.arch), 'install', 'include',
self.get_build_dir(arch.arch), 'p4a_install', 'include',
)

def get_library_ldflags(self, arch: Arch) -> str:
Expand Down
20 changes: 18 additions & 2 deletions tests/recipes/test_liblzma.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_get_library_includes(self):
recipe_build_dir = self.recipe.get_build_dir(self.arch.arch)
self.assertEqual(
self.recipe.get_library_includes(self.arch),
f" -I{join(recipe_build_dir, 'install/include')}",
f" -I{join(recipe_build_dir, 'p4a_install/include')}",
)

def test_get_library_ldflags(self):
Expand All @@ -25,11 +25,27 @@ def test_get_library_ldflags(self):
recipe_build_dir = self.recipe.get_build_dir(self.arch.arch)
self.assertEqual(
self.recipe.get_library_ldflags(self.arch),
f" -L{join(recipe_build_dir, 'install/lib')}",
f" -L{join(recipe_build_dir, 'p4a_install/lib')}",
)

def test_link_libs_flags(self):
"""
Test :meth:`~pythonforandroid.recipes.liblzma.get_library_libs_flag`.
"""
self.assertEqual(self.recipe.get_library_libs_flag(), " -llzma")

def test_install_dir_not_named_install(self):
"""
Tests that the install directory is not named ``install``.

liblzma already have a file named ``INSTALL`` in its source directory.
On case-insensitive filesystems, using a folder named ``install`` will
cause a conflict. (See issue: #2343).

WARNING: This test is quite flaky, but should be enough to
ensure that someone in the future will not accidentally rename
the install directory without seeing this test to fail.
"""
liblzma_install_dir = self.recipe.built_libraries["liblzma.so"]

self.assertNotIn("install", liblzma_install_dir.split("/"))