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

new package: spleeter-proot #1037

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
21 changes: 21 additions & 0 deletions tur-on-device/spleeter-proot/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019-present, Deezer SA.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions tur-on-device/spleeter-proot/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
TERMUX_PKG_HOMEPAGE=https://research.deezer.com/projects/spleeter.html
TERMUX_PKG_DESCRIPTION="Audio source separation based, pacakged in proot"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux-user-repository"
TERMUX_PKG_VERSION=2.4.0
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_DEPENDS="proot-distro"
TERMUX_PKG_BUILD_DEPENDS="wget"
TERMUX_PKG_UNDEF_SYMBOLS_FILES=all

TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686"

termux_step_pre_configure() {
if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then
termux_error_exit "This package doesn't support cross-compiling."
fi
}

termux_step_post_get_source () {
cp "$TERMUX_PKG_BUILDER_DIR"/LICENSE "$TERMUX_PKG_SRCDIR"/
}

proot_run () {
proot-distro login app_spleeter --isolated -- "$@"
}
proot_run_user () {
proot-distro login app_spleeter --user android --isolated -- "$@"
}

termux_step_make_install(){
# install 2stems model
mkdir -p "$PREFIX/etc/spleeter-proot/pretrained_models/2stems"
wget "https://github.com/deezer/spleeter/releases/download/v1.4.0/2stems.tar.gz"
tar -xf 2stems.tar.gz -C "$PREFIX/etc/spleeter-proot/pretrained_models/2stems/"

# install proot rootfs and spleeter
proot-distro install --override-alias app_spleeter ubuntu

proot_run apt update
proot_run apt upgrade -y
proot_run apt install -y libhdf5-dev gcc wget pkg-config
proot_run useradd -U -m -s /bin/bash -p root android
proot_run_user mkdir -p /home/android/miniconda3
proot_run_user wget https://repo.anaconda.com/miniconda/Miniconda3-py310_24.4.0-0-Linux-$TERMUX_ARCH.sh -O /home/android/miniconda3/miniconda.sh
proot_run_user bash /home/android/miniconda3/miniconda.sh -b -u -p /home/android/miniconda3
proot_run_user rm -rf /home/android/miniconda3/miniconda.sh
proot_run_user /home/android/miniconda3/bin/conda config --set auto_activate_base false
proot_run_user /home/android/miniconda3/bin/conda create -n spleeter_py310 -y python=3.10
proot_run_user /home/android/miniconda3/bin/conda run -n spleeter_py310 pip install ffmpeg-python httpx[http2]==0.19.0 norbert typer==0.3.2
proot_run_user /home/android/miniconda3/bin/conda run -n spleeter_py310 pip install pandas==1.5.3 tensorflow==2.10
proot_run_user /home/android/miniconda3/bin/conda run -n spleeter_py310 pip install --no-deps spleeter
proot_run_user /home/android/miniconda3/bin/conda run -n spleeter_py310 pip cache purge
proot_run apt autoremove -y gcc wget pkg-config

install -Dm700 "$TERMUX_PKG_BUILDER_DIR"/spleeter-proot $TERMUX_PREFIX/bin/
ln -sfr $TERMUX_PREFIX/bin/spleeter-proot $TERMUX_PREFIX/bin/spleeter
}
4 changes: 4 additions & 0 deletions tur-on-device/spleeter-proot/spleeter-is-proot.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TERMUX_SUBPKG_DESCRIPTION="Symlinks to bin/spleeter"
TERMUX_SUBPKG_INCLUDE="
bin/spleeter
"
3 changes: 3 additions & 0 deletions tur-on-device/spleeter-proot/spleeter-proot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/data/data/com.termux/files/usr/bin/sh

proot-distro login --user android app_spleeter --shared-tmp --env MODEL_PATH="$PREFIX/etc/spleeter-proot/pretrained_models/2stems" --work-dir "$PWD" -- /home/android/miniconda3/bin/conda run -n spleeter_py310 spleeter "$@"
Loading