Skip to content

chromaprint recipe #2970

Closed as not planned
Closed as not planned
@magowiz

Description

@magowiz

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions