openCom-Companion/recipes/codec2/__init__.py

51 lines
1.9 KiB
Python
Raw Normal View History

2024-06-04 03:17:45 +02:00
from os.path import join
2024-06-03 12:04:05 +02:00
from pythonforandroid.recipe import Recipe
from pythonforandroid.toolchain import current_directory, shprint
import sh
2024-06-03 12:53:27 +02:00
# For debugging, clean with
# buildozer android p4a -- clean_recipe_build codec2 --local-recipes ~/Information/Source/Sideband/recipes
2024-06-03 12:04:05 +02:00
class Codec2Recipe(Recipe):
url = "https://github.com/markqvist/codec2/archive/00e01c9d72d3b1607e165c71c4c9c942d277dfac.tar.gz"
2024-06-04 03:17:45 +02:00
built_libraries = {'libcodec2.so': 'build_android/src'}
def include_flags(self, arch):
'''Returns a string with the include folders'''
codec2_includes = join(self.get_build_dir(arch.arch), 'build_android')
return (' -I' + codec2_includes)
def link_dirs_flags(self, arch):
'''Returns a string with the appropriate `-L<lib directory>` to link
with the libs. This string is usually added to the environment
variable `LDFLAGS`'''
return ' -L' + self.get_build_dir(arch.arch)
# def link_libs_flags(self):
# '''Returns a string with the appropriate `-l<lib>` flags to link with
# the libs. This string is usually added to the environment
# variable `LIBS`'''
# return ' -lcodec2{version} -lssl{version}'.format(version=self.version)
2024-06-03 12:04:05 +02:00
def build_arch(self, arch):
with current_directory(self.get_build_dir(arch.arch)):
env = self.get_recipe_env(arch)
flags = [
"..",
"--log-level=TRACE",
"--fresh",
"-DCMAKE_BUILD_TYPE=Release",
]
2024-06-04 03:17:45 +02:00
mkdir = sh.mkdir("-p", "build_android")
2024-09-07 02:08:04 +02:00
# cd = sh.cd("build_android")
os.chdir("build_android")
2024-06-04 03:17:45 +02:00
cmake = sh.Command('cmake')
2024-06-03 12:04:05 +02:00
shprint(cmake, *flags, _env=env)
shprint(sh.make, _env=env)
2024-06-04 03:17:45 +02:00
sh.cp("../src/codec2.h", "./codec2/")
2024-06-03 12:04:05 +02:00
recipe = Codec2Recipe()