Advertisement
pintcat

do-mpv.sh - build script for a static mpv binary

Jul 2nd, 2024 (edited)
841
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.29 KB | Software | 0 0
  1. #!/bin/sh
  2.  
  3. # Dependencies: meson ninja-build yasm autoconf autoconf-archive libtool pkgconf pkg-config python3-docutils spirv-cross wayland-protocols debhelper-compat libfreetype-dev libfribidi-dev libharfbuzz-dev libfontconfig-dev libjpeg-dev libx11-dev libarchive-dev libasound2-dev libass-dev libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libbluray-dev libcaca-dev libcdio-dev libcdio-paranoia-dev libdrm-dev libdvdnav-dev libegl-dev libffmpeg-nvenc-dev libgbm-dev libgl-dev libjack-dev liblcms2-dev liblua5.2-dev libmujs-dev libpipewire-0.3-dev libplacebo-dev libpulse-dev librubberband-dev libsdl2-dev libsixel-dev libspirv-cross-c-shared-dev libswscale-dev libuchardet-dev libva-dev libvdpau-dev libvulkan-dev libwayland-dev libxinerama-dev libxkbcommon-dev libxpresent-dev libxrandr-dev libxss-dev libxv-dev libzimg-dev
  4.  
  5. TMP_DIR="/media/ramdisk/mpv-build"
  6. BIN_DIR="/home/pintcat/ubin"
  7.  
  8. CLEAN(){
  9.     printf "\n\033[0;32mCleaning up... "
  10.     cd $TMP_DIR/..
  11.     rm -rf $TMP_DIR
  12.     printf "done.\033[0m\n"
  13. }
  14.  
  15. FAIL(){
  16.     printf "\n\033[0;31mError - $1 :(\033[0m\n"
  17.     CLEAN
  18.     exit 1
  19. }
  20.  
  21. if [ -d "$TMP_DIR" ]; then
  22.     printf "\n\033[0;32mFolder \""$TMP_DIR"\" already exists and it's content will be deleted. Continue (Y/n)? \033[0m"
  23.     read YN
  24.     case $YN in
  25.         n|N)
  26.             printf "\n\033[0;32mDone - nothing changed.\033[0m\n\n"
  27.             exit
  28.             ;;
  29.         *)
  30.             CLEAN
  31.             ;;
  32.     esac
  33. fi
  34. printf "\n\033[0;32mDownloading build scripts...\033[0m\n\n"
  35. if git clone https://github.com/mpv-player/mpv-build.git $TMP_DIR; then
  36.     printf "\n\033[0;32mDownloading and building components and linking final binary...\033[0m\n\n"
  37.     cd $TMP_DIR
  38.     ./use-ffmpeg-release
  39.     printf "--disable-avisynth\n--enable-nonfree\n--enable-version3\n--enable-static\n--enable-runtime-cpudetect" >> ffmpeg_options
  40. #   printf "--Dcdda=enabled\n--Ddvdnav=enabled\n--Dsdl2=enabled" >> mpv_options
  41.     if ./rebuild -j$(grep -m 1 "siblings" /proc/cpuinfo | awk '{print $3}'); then
  42.         printf "\n\033[0;32mCompressing and installing binary to \"$BIN_DIR\".\033[0m\n\n"
  43.         if [ -f "$BIN_DIR/mpv~" ]; then rm -f $BIN_DIR/mpv~; fi
  44.         if [ -f "$BIN_DIR/mpv" ]; then mv $BIN_DIR/mpv $BIN_DIR/mpv~; fi
  45.         upx --lzma -9 mpv/build/mpv -o $BIN_DIR/mpv
  46.         CLEAN
  47.     else
  48.         FAIL "building mpv binary failed."
  49.     fi
  50. else
  51.     FAIL "unable to obtain source."
  52. fi
  53. echo
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement