mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-12-03 18:30:36 +01:00
Added custom recipes
This commit is contained in:
parent
17c4febc96
commit
0ef5fe2870
1516
recipes/ffpyplayer/__init__.py
Normal file
1516
recipes/ffpyplayer/__init__.py
Normal file
File diff suppressed because it is too large
Load Diff
15
recipes/ffpyplayer/setup.py.patch
Normal file
15
recipes/ffpyplayer/setup.py.patch
Normal file
@ -0,0 +1,15 @@
|
||||
--- ffpyplayer/setup.py 2024-06-02 11:10:49.691183467 +0530
|
||||
+++ ffpyplayer.mod/setup.py 2024-06-02 11:20:16.220966873 +0530
|
||||
@@ -27,12 +27,6 @@
|
||||
# This sets whether or not Cython gets added to setup_requires.
|
||||
declare_cython = False
|
||||
|
||||
-if platform in ('ios', 'android'):
|
||||
- # NEVER use or declare cython on these platforms
|
||||
- print('Not using cython on %s' % platform)
|
||||
- can_use_cython = False
|
||||
-else:
|
||||
- declare_cython = True
|
||||
|
||||
src_path = build_path = dirname(__file__)
|
||||
print(f'Source/build path: {src_path}')
|
22
recipes/libopus/__init__.py
Normal file
22
recipes/libopus/__init__.py
Normal file
@ -0,0 +1,22 @@
|
||||
from pythonforandroid.recipe import Recipe
|
||||
from pythonforandroid.toolchain import current_directory, shprint
|
||||
import sh
|
||||
|
||||
|
||||
class OpusRecipe(Recipe):
|
||||
version = '1.5.2'
|
||||
url = "https://downloads.xiph.org/releases/opus/opus-{version}.tar.gz"
|
||||
built_libraries = {'libopus.so': '.libs'}
|
||||
|
||||
def build_arch(self, arch):
|
||||
with current_directory(self.get_build_dir(arch.arch)):
|
||||
env = self.get_recipe_env(arch)
|
||||
flags = [
|
||||
'--host=' + arch.command_prefix,
|
||||
]
|
||||
configure = sh.Command('./configure')
|
||||
shprint(configure, *flags, _env=env)
|
||||
shprint(sh.make, _env=env)
|
||||
|
||||
|
||||
recipe = OpusRecipe()
|
152
recipes/mffmpeg/__init__.py
Normal file
152
recipes/mffmpeg/__init__.py
Normal file
@ -0,0 +1,152 @@
|
||||
from pythonforandroid.toolchain import Recipe, current_directory, shprint
|
||||
from os.path import exists, join, realpath
|
||||
import sh
|
||||
|
||||
|
||||
class FFMpegRecipe(Recipe):
|
||||
version = 'n4.3.1'
|
||||
# Moved to github.com instead of ffmpeg.org to improve download speed
|
||||
url = 'https://github.com/FFmpeg/FFmpeg/archive/{version}.zip'
|
||||
depends = ['sdl2'] # Need this to build correct recipe order
|
||||
opts_depends = ['openssl', 'ffpyplayer_codecs']
|
||||
patches = ['patches/configure.patch']
|
||||
|
||||
def should_build(self, arch):
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
return not exists(join(build_dir, 'lib', 'libavcodec.so'))
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
self.apply_patches(arch)
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
env = super().get_recipe_env(arch)
|
||||
env['NDK'] = self.ctx.ndk_dir
|
||||
return env
|
||||
|
||||
def build_arch(self, arch):
|
||||
with current_directory(self.get_build_dir(arch.arch)):
|
||||
env = arch.get_env()
|
||||
|
||||
# flags = ['--disable-everything']
|
||||
flags = []
|
||||
cflags = []
|
||||
ldflags = []
|
||||
|
||||
if 'openssl' in self.ctx.recipe_build_order:
|
||||
flags += [
|
||||
'--enable-openssl',
|
||||
'--enable-nonfree',
|
||||
'--enable-protocol=https,tls_openssl',
|
||||
]
|
||||
build_dir = Recipe.get_recipe(
|
||||
'openssl', self.ctx).get_build_dir(arch.arch)
|
||||
cflags += ['-I' + build_dir + '/include/',
|
||||
'-DOPENSSL_API_COMPAT=0x10002000L']
|
||||
ldflags += ['-L' + build_dir]
|
||||
|
||||
if 'ffpyplayer_codecs' in self.ctx.recipe_build_order:
|
||||
# Enable GPL
|
||||
flags += ['--enable-gpl']
|
||||
|
||||
# libx264
|
||||
flags += ['--enable-libx264']
|
||||
build_dir = Recipe.get_recipe(
|
||||
'libx264', self.ctx).get_build_dir(arch.arch)
|
||||
cflags += ['-I' + build_dir + '/include/']
|
||||
ldflags += ['-lx264', '-L' + build_dir + '/lib/']
|
||||
|
||||
# libshine
|
||||
flags += ['--enable-libshine']
|
||||
build_dir = Recipe.get_recipe('libshine', self.ctx).get_build_dir(arch.arch)
|
||||
cflags += ['-I' + build_dir + '/include/']
|
||||
ldflags += ['-lshine', '-L' + build_dir + '/lib/']
|
||||
ldflags += ['-lm']
|
||||
|
||||
# libvpx
|
||||
flags += ['--enable-libvpx']
|
||||
build_dir = Recipe.get_recipe(
|
||||
'libvpx', self.ctx).get_build_dir(arch.arch)
|
||||
cflags += ['-I' + build_dir + '/include/']
|
||||
ldflags += ['-lvpx', '-L' + build_dir + '/lib/']
|
||||
|
||||
# Enable all codecs:
|
||||
flags += [
|
||||
'--enable-parsers',
|
||||
'--enable-decoders',
|
||||
'--enable-encoders',
|
||||
'--enable-muxers',
|
||||
'--enable-demuxers',
|
||||
]
|
||||
else:
|
||||
# Enable codecs only for .mp4:
|
||||
flags += [
|
||||
'--enable-parser=aac,ac3,h261,h264,mpegaudio,mpeg4video,mpegvideo,vc1',
|
||||
'--enable-decoder=aac,h264,mpeg4,mpegvideo',
|
||||
'--enable-muxer=h264,mov,mp4,mpeg2video',
|
||||
'--enable-demuxer=aac,h264,m4v,mov,mpegvideo,vc1,rtsp',
|
||||
]
|
||||
|
||||
# needed to prevent _ffmpeg.so: version node not found for symbol av_init_packet@LIBAVFORMAT_52
|
||||
# /usr/bin/ld: failed to set dynamic section sizes: Bad value
|
||||
flags += [
|
||||
'--disable-symver',
|
||||
]
|
||||
|
||||
# disable binaries / doc
|
||||
flags += [
|
||||
# '--disable-programs',
|
||||
'--disable-doc',
|
||||
]
|
||||
|
||||
# other flags:
|
||||
flags += [
|
||||
'--enable-filter=aresample,resample,crop,adelay,volume,scale',
|
||||
'--enable-protocol=file,http,hls,udp,tcp',
|
||||
'--enable-small',
|
||||
'--enable-hwaccels',
|
||||
'--enable-pic',
|
||||
'--disable-static',
|
||||
'--disable-debug',
|
||||
'--enable-shared',
|
||||
]
|
||||
|
||||
if 'arm64' in arch.arch:
|
||||
arch_flag = 'aarch64'
|
||||
elif 'x86' in arch.arch:
|
||||
arch_flag = 'x86'
|
||||
flags += ['--disable-asm']
|
||||
else:
|
||||
arch_flag = 'arm'
|
||||
|
||||
# android:
|
||||
flags += [
|
||||
'--target-os=android',
|
||||
'--enable-cross-compile',
|
||||
'--cross-prefix={}-'.format(arch.target),
|
||||
'--arch={}'.format(arch_flag),
|
||||
'--strip={}'.format(self.ctx.ndk.llvm_strip),
|
||||
'--sysroot={}'.format(self.ctx.ndk.sysroot),
|
||||
'--enable-neon',
|
||||
'--prefix={}'.format(realpath('.')),
|
||||
]
|
||||
|
||||
if arch_flag == 'arm':
|
||||
cflags += [
|
||||
'-mfpu=vfpv3-d16',
|
||||
'-mfloat-abi=softfp',
|
||||
'-fPIC',
|
||||
]
|
||||
|
||||
env['CFLAGS'] += ' ' + ' '.join(cflags)
|
||||
env['LDFLAGS'] += ' ' + ' '.join(ldflags)
|
||||
|
||||
configure = sh.Command('./configure')
|
||||
shprint(configure, *flags, _env=env)
|
||||
shprint(sh.make, '-j4', _env=env)
|
||||
shprint(sh.make, 'install', _env=env)
|
||||
# copy libs:
|
||||
sh.cp('-a', sh.glob('./lib/lib*.so'),
|
||||
self.ctx.get_libs_dir(arch.arch))
|
||||
|
||||
|
||||
recipe = FFMpegRecipe()
|
11
recipes/mffmpeg/patches/configure.patch
Normal file
11
recipes/mffmpeg/patches/configure.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- ./configure 2020-10-11 19:12:16.759760904 +0200
|
||||
+++ ./configure.patch 2020-10-11 19:15:49.059533563 +0200
|
||||
@@ -6361,7 +6361,7 @@
|
||||
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
|
||||
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
|
||||
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
|
||||
-enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
|
||||
+enabled libshine && require "shine" shine/layer3.h shine_encode_buffer -lshine -lm
|
||||
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
|
||||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
|
||||
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
|
46
recipes/opusfile/__init__.py
Normal file
46
recipes/opusfile/__init__.py
Normal file
@ -0,0 +1,46 @@
|
||||
from pythonforandroid.recipe import Recipe
|
||||
from pythonforandroid.toolchain import current_directory, shprint
|
||||
import sh
|
||||
import os
|
||||
import time
|
||||
|
||||
|
||||
class OpusFileRecipe(Recipe):
|
||||
version = "0.12"
|
||||
url = "https://downloads.xiph.org/releases/opus/opusfile-{version}.tar.gz"
|
||||
depends = ['libogg']
|
||||
built_libraries = {'libopusfile.so': '.libs'}
|
||||
|
||||
def build_arch(self, arch):
|
||||
with current_directory(self.get_build_dir(arch.arch)):
|
||||
env = self.get_recipe_env(arch)
|
||||
flags = [
|
||||
"--host=" + arch.command_prefix,
|
||||
"--disable-http",
|
||||
"--disable-examples",
|
||||
"--disable-doc",
|
||||
"--disable-largefile",
|
||||
]
|
||||
|
||||
cwd = os.getcwd()
|
||||
ogg_include_path = cwd.replace("opusfile", "libogg")
|
||||
env["CPPFLAGS"] += f" -I{ogg_include_path}/include"
|
||||
|
||||
# libogg_recipe = Recipe.get_recipe('libogg', self.ctx)
|
||||
# env['CFLAGS'] += libogg_recipe.include_flags(arch)
|
||||
|
||||
# openssl_recipe = Recipe.get_recipe('openssl', self.ctx)
|
||||
# env['CFLAGS'] += openssl_recipe.include_flags(arch)
|
||||
# env['LDFLAGS'] += openssl_recipe.link_dirs_flags(arch)
|
||||
# env['LIBS'] = openssl_recipe.link_libs_flags()
|
||||
|
||||
from rich.pretty import pprint
|
||||
pprint(env)
|
||||
time.sleep(5)
|
||||
|
||||
configure = sh.Command('./configure')
|
||||
shprint(configure, *flags, _env=env)
|
||||
shprint(sh.make, _env=env)
|
||||
|
||||
|
||||
recipe = OpusFileRecipe()
|
Loading…
Reference in New Issue
Block a user