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

chromaprint recipe #2970

Closed
5 tasks done
magowiz opened this issue Feb 10, 2024 · 1 comment
Closed
5 tasks done

chromaprint recipe #2970

magowiz opened this issue Feb 10, 2024 · 1 comment
Labels

Comments

@magowiz
Copy link

magowiz commented Feb 10, 2024

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.10.7
  • OS: Linux
  • Kivy: 2.3.1
  • Cython: 0.29.33
  • OpenJDK: 11

Description

I'm trying to create chromaprint recipe, I reached a successful build with apk which ships libchromaprint.so inside apk lib directory, the issue is that pyacoustid searches for libchromaprint.so.0 or .1 to detect libchromaprint presence (https://github.com/beetbox/pyacoustid/blob/master/chromaprint.py) if it fails it searches for fpcalc which is not available. No matter what I do, in lib there is only .so file.

How can I complete this recipe to make also libchromaprint.so.1 be present in apk? I can see it gets created in src folder like the so without number.

This is the recipe I wrote

from pythonforandroid.toolchain import Recipe, shprint, current_directory
from os.path import exists, join
import sh
import glob
import shutil
import os 


class ChromaPrintRecipe(Recipe):
    # This could also inherit from PythonRecipe etc. if you want to
    # use their pre-written build processes
    version = '1.5.1'
    url = 'https://github.com/acoustid/chromaprint/releases/download/v{version}/chromaprint-{version}.tar.gz'
    # {version} will be replaced with self.version when downloading

    depends = ['ffmpeg', 'cmake']  # A list of any other recipe names
                                    # that must be built before this
                                    # one

    conflicts = []  # A list of any recipe names that cannot be built
                    # alongside this one

    def get_recipe_env(self, arch):
        env = super().get_recipe_env(arch)
        # Manipulate the env here if you want
        return env

    def should_build(self, arch):
        # Add a check for whether the recipe is already built if you
        # want, and return False if it is.
        return True

    def prebuild_arch(self, arch):
        # super().prebuild_arch(self)
        # Do any extra prebuilding you want, e.g.:
        # self.apply_patch('path/to/patch.patch')
        pass 
    def build_arch(self, arch):
        # super().build_arch(self)
        # Build the code. Make sure to use the right build dir, e.g.
        with current_directory(self.get_build_dir(arch.arch)):
            sh.ls('-lathr')  # Or run some commands that actually do
                             # something
            cmake = sh.Command('cmake') 
            shprint(cmake, '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_TOOLS=OFF')
            shprint(sh.make, '-j4')
            shprint(sh.make, 'install')
            sh.cp('-a', sh.glob('src/*.so*'),
                  self.ctx.get_libs_dir(arch.arch))
                  
    def postbuild_arch(self, arch):
        # Do anything you want after the build, e.g. deleting
        # unnecessary files such as documentation
        pass


recipe = ChromaPrintRecipe()
Copy link

👋 @magowiz,
Sorry to hear you are having difficulties with Kivy's python-for-android; Kivy unites a number of different technologies, so building apps can be temperamental.
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to python-for-android.
However, this issue appears to be a support request. Please use our support channels to get help with the project.
If you're having trouble installing python-for-android, please see our quickstart guide.
If you're having trouble using python-for-android, please see our troubleshooting guide and FAQ.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants