Advertisement
pintcat

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

Jul 2nd, 2024 (edited)
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.48 KB | Software | 0 0
  1. #!/bin/sh
  2.  
  3. # Use option "D" to install dependencies (command line is copied to clipboard). Note that at least meson version 1.3 is required.
  4. [ -n "$1" ] && [ $1 = D ] && printf "sudo apt-get install 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" | clipboard && exit
  5.  
  6. TMP_DIR="/media/ramdisk/mpv-build"
  7. BIN_DIR="/home/pintcat/ubin"
  8.  
  9. CLEAN(){
  10.     printf "\n\033[0;32mCleaning up... "
  11.     cd $TMP_DIR/..
  12.     rm -rf $TMP_DIR
  13.     printf "done.\033[0m\n"
  14. }
  15.  
  16. FAIL(){
  17.     printf "\n\033[0;31mError - $1 :(\033[0m\n"
  18.     CLEAN
  19.     exit 1
  20. }
  21.  
  22. if [ -d "$TMP_DIR" ]; then
  23.     printf "\n\033[0;32mFolder \""$TMP_DIR"\" already exists and it's content will be deleted. Continue (Y/n)? \033[0m"
  24.     read YN
  25.     case $YN in
  26.         n|N)
  27.             printf "\n\033[0;32mDone - nothing changed.\033[0m\n\n"
  28.             exit
  29.             ;;
  30.         *)
  31.             CLEAN
  32.             ;;
  33.     esac
  34. fi
  35. printf "\n\033[0;32mDownloading build scripts...\033[0m\n\n"
  36. if git clone https://github.com/mpv-player/mpv-build.git $TMP_DIR; then
  37.     printf "\n\033[0;32mDownloading and building components and linking final binary...\033[0m\n\n"
  38.     cd $TMP_DIR
  39.     ./use-ffmpeg-release
  40.     printf "--disable-avisynth\n--enable-nonfree\n--enable-version3\n--enable-static\n--enable-runtime-cpudetect" >> ffmpeg_options
  41. #   printf "--Dcdda=enabled\n--Ddvdnav=enabled\n--Dsdl2=enabled" >> mpv_options
  42.     if ./rebuild -j$(grep -m 1 "siblings" /proc/cpuinfo | awk '{print $3}'); then
  43.         printf "\n\033[0;32mCompressing and installing binary to \"$BIN_DIR\".\033[0m\n\n"
  44.         if [ -f "$BIN_DIR/mpv~" ]; then rm -f $BIN_DIR/mpv~; fi
  45.         if [ -f "$BIN_DIR/mpv" ]; then mv $BIN_DIR/mpv $BIN_DIR/mpv~; fi
  46.         upx --lzma -9 mpv/build/mpv -o $BIN_DIR/mpv
  47.         CLEAN
  48.     else
  49.         FAIL "building mpv binary failed."
  50.     fi
  51. else
  52.     FAIL "unable to obtain source."
  53. fi
  54. echo
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement