Skip to content

Commit

Permalink
[+] Attempt to remove bloat
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas committed Sep 7, 2024
1 parent 48be03e commit 11a8bac
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/x86_64_Linux/bins/mpv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ if [ "$SKIP_BUILD" == "NO" ]; then
##Desktop
find "." -path '*mpv*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./mpv.desktop"'
sed 's/Icon=[^ ]*/Icon=mpv/' -i "./mpv.desktop" 2>/dev/null
##Purge Bloatware
echo -e "\n[+] Purging Bloatware...\n"
O_SIZE="$(du -sh "${APPIMAGE_EXTRACT}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "O_SIZE=${O_SIZE}"
#Headers
find "." -type d -path "*/include*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
#docs & manpages
find "." -type d -path "*doc/share*" ! -name "*mpv*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
find "." -type d -path "*/share/docs*" ! -name "*mpv*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
find "." -type d -path "*/share/man*" ! -name "*mpv*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
#static libs
find "." -type f -name "*.a" -print -exec rm -f {} 2>/dev/null \; 2>/dev/null
#systemd (need .so)
find "." -type d -name "*systemd*" -exec find {} -type f ! -name "*.so*" -delete \;
#Strip (this breaks things)
#find "." -type f -executable -exec file -i '{}' \; | grep "application/.*executable" | cut -d':' -f1 | xargs realpath | xargs sudo strip -R ".comment" -R ".gnu.version" --strip-unneeded 2>/dev/null
P_SIZE="$(du -sh "${APPIMAGE_EXTRACT}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "P_SIZE=${P_SIZE}"
echo -e "\n[+] Shaved off ${O_SIZE} --> ${P_SIZE}\n"
#(Re)Pack
cd "${OWD}"
curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "./appimagetool" && chmod +x "./appimagetool"
Expand Down

0 comments on commit 11a8bac

Please sign in to comment.