Advertisement
pintcat

MPV build script v1.0

Jun 26th, 2016
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.38 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. TMP_DIR="/media/ramdisk/mpv-build"
  4. BIN_DIR="/home/pintcat/ubin"
  5.  
  6. function CLEAN()
  7. {
  8.     echo -ne "\n\033[0;32mCleaning up... "
  9.     cd $TMP_DIR/..
  10.     rm -rf $TMP_DIR
  11.     echo -e "done.\033[0m\n"
  12. }
  13.  
  14. function FAIL()
  15. {
  16.     echo -e "\n\033[0;31mError - something went wrong :(\033[0m"
  17.     CLEAN
  18.     exit 1
  19. }
  20.  
  21. if [ -d "$TMP_DIR" ]; then
  22.     echo -ne "\n\033[0;32mFolder \""$TMP_DIR"\" already exists and it's content will be deleted. Continue (Y/N)? \033[0m"
  23.     read -n 1 YN
  24.     case $YN in
  25.     y|Y)
  26.         rm -rf $TMP_DIR
  27.         echo
  28.         ;;
  29.     n|N)
  30.         echo -e "\n\033[0;32mDone - nothing changed.\033[0m\n"
  31.         exit
  32.         ;;
  33.     esac
  34. fi
  35. echo -e "\n\033[0;32mDownloading build scripts...\033[0m\n"
  36. if git clone https://github.com/mpv-player/mpv-build.git $TMP_DIR; then
  37.     echo -e "\n\033[0;32mDownloading and building components and linking final binary...\033[0m\n"
  38.     echo "--enable-gpl --enable-nonfree --enable-version3 --enable-static" >> ffmpeg_options
  39.     cd $TMP_DIR
  40.     ./use-ffmpeg-release
  41.     ./use-mpv-release
  42.     if ./rebuild -j5; then
  43.     echo -e "\n\033[0;32mCompressing and installing binary to \""$BIN_DIR"\".\033[0m\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 --ultra-brute mpv/build/mpv -o $BIN_DIR/mpv
  47.     CLEAN
  48.     else
  49.     FAIL
  50.     fi
  51. else
  52.     FAIL
  53. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement