Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

build-ffmpeg-msvc.sh 1.5 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. set -e
  3. echo "Discovering environment..."
  4. INSTALL_DIR="$(printenv 'ProgramFiles(x86)')/Microsoft Visual Studio/Installer"
  5. DEVENV_DIR="$("$INSTALL_DIR/vswhere" | sed -ne 's/^productPath: //p' | sed 's/.devenv.exe//' | head -n 1)"
  6. CL64_PATH="$(find "$DEVENV_DIR/../.." -name cl.exe | grep 'x64.*/x64/' | sed 's/.cl.exe//')"
  7. CL32_PATH="$(find "$DEVENV_DIR/../.." -name cl.exe | grep 'x86.*/x86/' | sed 's/.cl.exe//')"
  8. T="$HOME/lol/external/ffmpeg-`date +%Y%m%d`"
  9. SAVED_PATH="$PATH"
  10. echo " vswhere dir: $INSTALL_DIR"
  11. echo " devenv dir: $DEVENV_DIR"
  12. echo " 64-bit cl dir: $CL64_PATH"
  13. echo " 32-bit cl dir: $CL32_PATH"
  14. set_vs_var() {
  15. export $2="$(cmd.exe //c "$DEVENV_DIR/../../VC/Auxiliary/Build/vcvars64.bat" $1 '&' set | sed -ne 's/^'$2'=//p')"
  16. }
  17. echo "Setting environment variables for x64..."
  18. set_vs_var x64 INCLUDE
  19. set_vs_var x64 LIB
  20. set_vs_var x64 LIBPATH
  21. echo "Building for x64..."
  22. export PATH="$CL64_PATH:$SAVED_PATH"
  23. make distclean || true
  24. ./configure --target-os=win64 --arch=x86_64 --toolchain=msvc
  25. make -j8
  26. make install DESTDIR="$T" LIBDIR="$T/lib/x86_64-msvc" INCDIR="$T/include"
  27. echo "Setting environment variables for x86..."
  28. set_vs_var x86 INCLUDE
  29. set_vs_var x86 LIB
  30. set_vs_var x86 LIBPATH
  31. echo "Building for x86..."
  32. export PATH="$CL32_PATH:$SAVED_PATH"
  33. make distclean || true
  34. ./configure --target-os=win64 --arch=i686 --toolchain=msvc
  35. make -j8
  36. make install DESTDIR="$T" LIBDIR="$T/lib/i686-msvc"
  37. rm -rf "$T/usr"
  38. find "$T" -name 'lib*.a' | grep msvc | sed -e 's/\(.*\)lib\(.*\).a/& \1\2.lib/' | while read a b; do mv "$a" "$b"; done
  39. exit 0