Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/blank2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
libavcodec-dev libswscale-dev python3-dev cython3 g++ nasm yasm git \
libavfilter-dev libxmu-dev libxcb1-dev libdbus-1-dev libx11-dev \
libxinerama-dev libxrandr-dev intltool libtool libwayland-dev libarchive-dev \
wayland-protocols devscripts libass-dev libx264-dev libxss-dev \
wayland-protocols devscripts libass-dev libx264-dev libxss-dev libdav1d-dev \
libglib2.0-dev libpango1.0-dev binutils libxdg-basedir-dev libnotify-dev \
libc++-dev libplacebo-dev libx265-dev ninja-build meson autotools-dev \
autoconf automake make build-essential pkg-config desktop-file-utils zsync
Expand Down
48 changes: 20 additions & 28 deletions mpv-AppImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,55 @@ export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1
REPO="https://github.com/mpv-player/mpv-build.git"
URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-$ARCH"
UPINFO="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|mpv-AppImage|latest|*$ARCH.AppImage.zsync"
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
mkdir -p ./mpv/AppDir
cd ./mpv/AppDir

# Build mpv
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
git clone "$REPO" ./mpv-build
cd ./mpv-build
sed -i "s#meson setup build#meson setup build -Dprefix=$CURRENTDIR/shared#g" \
./scripts/mpv-config
./rebuild -j$(nproc)
./install
cd ..
git clone "$REPO" ./mpv-build && (
cd ./mpv-build
printf "%s\n" "--enable-libdav1d" >> ffmpeg_options
./rebuild -j$(nproc)
sudo ./install
)
rm -rf ./mpv-build
ln -s ./shared ./usr

# bundle libs
mkdir -p ./AppDir
cd ./AppDir

wget "$LIB4BN" -O ./lib4bin
chmod +x ./lib4bin
./lib4bin -p -w -v -s ./shared/bin/mpv
VERSION=$(./bin/mpv --version 2>/dev/null | awk 'FNR==1 {print $2; exit}')
./lib4bin -p -v -s -k "$(command -v mpv)"

VERSION=$(./bin/mpv --version | awk 'FNR==1 {print $2; exit}')
if [ -z "$VERSION" ]; then
echo "ERROR: Could not get version from mpv"
exit 1
fi
export VERSION
echo "$VERSION" > ~/version

# HACK
sed -i 's|/usr|/KEK|g' ./shared/lib/ld-linux-x86-64.so.2

# prepare AppDir
cp ./usr/share/applications/*.desktop ./
cp ./usr/share/icons/hicolor/128x128/apps/mpv.png ./
cp /usr/local/share/applications/mpv.desktop ./
cp /usr/local/share/icons/hicolor/128x128/apps/mpv.png ./
ln -s ./mpv.png ./.DirIcon

cat >> ./AppRun << 'EOF'
#!/bin/sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
export XDG_DATA_DIRS="$CURRENTDIR/usr/share:$XDG_DATA_DIRS"
export PATH="$CURRENTDIR/bin:$PATH"
CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"
export PATH="$PATH:$CACHEDIR/mpv-appimage_yt-dlp"
export XDG_DATA_DIRS="$CURRENTDIR/usr/share:$XDG_DATA_DIRS"

# Download yt-dlp if needed
if echo "$@" | grep -q "http" && ! command -v yt-dlp >/dev/null 2>&1; then
echo "Video link detected but yt-dlp is not installed, installing..."
mkdir -p "$CACHEDIR"/mpv-appimage_yt-dlp
YT="https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux"
if command -v wget >/dev/null 2>&1; then
YT="$(wget -q https://api.github.com/repos/yt-dlp/yt-dlp/releases -O - \
| sed 's/[()",{} ]/\n/g' | grep -oi -m1 'https.*yt.*linux$')"
wget -q "$YT" -O "$CACHEDIR"/mpv-appimage_yt-dlp/yt-dlp
elif command -v curl >/dev/null 2>&1; then
YT="$(curl -Ls https://api.github.com/repos/yt-dlp/yt-dlp/releases \
| sed 's/[()",{} ]/\n/g' | grep -oi -m1 'https.*yt.*linux$')"
curl -Ls "$YT" -o "$CACHEDIR"/mpv-appimage_yt-dlp/yt-dlp
else
echo "ERROR: You need wget or curl in order to download yt-dlp"
Expand Down Expand Up @@ -97,8 +91,9 @@ echo "Generating AppImage..."
--header uruntime \
-i ./AppDir -o ./mpv-"$VERSION"-anylinux-"$ARCH".AppImage

wget -qO ./pelf "https://github.com/xplshn/pelf/releases/latest/download/pelf_$ARCH"
wget -qO ./pelf "https://github.com/xplshn/pelf/releases/latest/download/pelf_$ARCH"
chmod +x ./pelf

echo "Generating [dwfs]AppBundle...(Go runtime)"
./pelf --add-appdir ./AppDir \
--appbundle-id="mpv-$VERSION" \
Expand All @@ -109,7 +104,4 @@ echo "Generating zsync file..."
zsyncmake *.AppImage -u *.AppImage
zsyncmake *.AppBundle -u *.AppBundle

mv ./*.AppImage* ../
mv ./*.AppBundle* ../
cd ..
echo "All done!"