@@ -11,61 +11,55 @@ export ARCH="$(uname -m)"
11
11
export APPIMAGE_EXTRACT_AND_RUN=1
12
12
REPO=" https://github.com/mpv-player/mpv-build.git"
13
13
URUNTIME=" https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-$ARCH "
14
- UPINFO=" gh-releases-zsync|$GITHUB_REPOSITORY_OWNER |mpv-AppImage |latest|*$ARCH .AppImage.zsync"
14
+ UPINFO=" gh-releases-zsync|$( echo " $GITHUB_REPOSITORY " | tr ' / ' ' | ' ) |latest|*$ARCH .AppImage.zsync"
15
15
LIB4BN=" https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
16
- mkdir -p ./mpv/AppDir
17
- cd ./mpv/AppDir
18
16
19
17
# Build mpv
20
- CURRENTDIR=" $( readlink -f " $( dirname " $0 " ) " ) "
21
- git clone " $REPO " ./mpv-build
22
- cd ./mpv-build
23
- sed -i " s#meson setup build#meson setup build -Dprefix=$CURRENTDIR /shared#g" \
24
- ./scripts/mpv-config
25
- ./rebuild -j$( nproc)
26
- ./install
27
- cd ..
18
+ git clone " $REPO " ./mpv-build && (
19
+ cd ./mpv-build
20
+ printf " %s\n" " --enable-libdav1d" >> ffmpeg_options
21
+ ./rebuild -j$( nproc)
22
+ sudo ./install
23
+ )
28
24
rm -rf ./mpv-build
29
- ln -s ./shared ./usr
30
25
31
26
# bundle libs
27
+ mkdir -p ./AppDir
28
+ cd ./AppDir
29
+
32
30
wget " $LIB4BN " -O ./lib4bin
33
31
chmod +x ./lib4bin
34
- ./lib4bin -p -w -v -s ./shared/bin/mpv
35
- VERSION=$( ./bin/mpv --version 2> /dev/null | awk ' FNR==1 {print $2; exit}' )
32
+ ./lib4bin -p -v -s -k " $( command -v mpv) "
33
+
34
+ VERSION=$( ./bin/mpv --version | awk ' FNR==1 {print $2; exit}' )
36
35
if [ -z " $VERSION " ]; then
37
36
echo " ERROR: Could not get version from mpv"
38
37
exit 1
39
38
fi
40
- export VERSION
41
39
echo " $VERSION " > ~ /version
40
+
42
41
# HACK
43
42
sed -i ' s|/usr|/KEK|g' ./shared/lib/ld-linux-x86-64.so.2
44
43
45
44
# prepare AppDir
46
- cp . /usr/share/applications/* .desktop ./
47
- cp . /usr/share/icons/hicolor/128x128/apps/mpv.png ./
45
+ cp /usr/local/ share/applications/mpv .desktop ./
46
+ cp /usr/local /share/icons/hicolor/128x128/apps/mpv.png ./
48
47
ln -s ./mpv.png ./.DirIcon
48
+
49
49
cat >> ./AppRun << 'EOF '
50
50
#!/bin/sh
51
51
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
52
- export XDG_DATA_DIRS="$CURRENTDIR/usr/share:$XDG_DATA_DIRS"
53
- export PATH="$CURRENTDIR/bin:$PATH"
54
52
CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"
55
53
export PATH="$PATH:$CACHEDIR/mpv-appimage_yt-dlp"
56
- export XDG_DATA_DIRS="$CURRENTDIR/usr/share:$XDG_DATA_DIRS"
57
54
58
55
# Download yt-dlp if needed
59
56
if echo "$@" | grep -q "http" && ! command -v yt-dlp >/dev/null 2>&1; then
60
57
echo "Video link detected but yt-dlp is not installed, installing..."
61
58
mkdir -p "$CACHEDIR"/mpv-appimage_yt-dlp
59
+ YT="https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux"
62
60
if command -v wget >/dev/null 2>&1; then
63
- YT="$(wget -q https://api.github.com/repos/yt-dlp/yt-dlp/releases -O - \
64
- | sed 's/[()",{} ]/\n/g' | grep -oi -m1 'https.*yt.*linux$')"
65
61
wget -q "$YT" -O "$CACHEDIR"/mpv-appimage_yt-dlp/yt-dlp
66
62
elif command -v curl >/dev/null 2>&1; then
67
- YT="$(curl -Ls https://api.github.com/repos/yt-dlp/yt-dlp/releases \
68
- | sed 's/[()",{} ]/\n/g' | grep -oi -m1 'https.*yt.*linux$')"
69
63
curl -Ls "$YT" -o "$CACHEDIR"/mpv-appimage_yt-dlp/yt-dlp
70
64
else
71
65
echo "ERROR: You need wget or curl in order to download yt-dlp"
@@ -97,8 +91,9 @@ echo "Generating AppImage..."
97
91
--header uruntime \
98
92
-i ./AppDir -o ./mpv-" $VERSION " -anylinux-" $ARCH " .AppImage
99
93
100
- wget -qO ./pelf " https://github.com/xplshn/pelf/releases/latest/download/pelf_$ARCH "
94
+ wget -qO ./pelf " https://github.com/xplshn/pelf/releases/latest/download/pelf_$ARCH "
101
95
chmod +x ./pelf
96
+
102
97
echo " Generating [dwfs]AppBundle...(Go runtime)"
103
98
./pelf --add-appdir ./AppDir \
104
99
--appbundle-id=" mpv-$VERSION " \
@@ -109,7 +104,4 @@ echo "Generating zsync file..."
109
104
zsyncmake * .AppImage -u * .AppImage
110
105
zsyncmake * .AppBundle -u * .AppBundle
111
106
112
- mv ./* .AppImage* ../
113
- mv ./* .AppBundle* ../
114
- cd ..
115
107
echo " All done!"
0 commit comments