Makefile: add tools targets to download FFmpeg

Four Makefile targets have been added:
- `tools`, which evokes the other three
- `tools-linux`, `tools-darwin`, `tools-windows`, download FFmpeg and put
  the `ffmpeg` executables into `./tools/ffmpeg-{OS}-{ARCH}`.

Downloaded tarball/ZIP files are stored in `tools/download`, and won't be
re-downloaded if they already exist.
This commit is contained in:
Sybren A. Stüvel 2022-07-22 16:36:23 +02:00
parent 0e6d61dd84
commit 59cb21e3b6
2 changed files with 50 additions and 0 deletions

1
.gitignore vendored

@ -33,6 +33,7 @@ web/manager-api/dist/
web/static/
web/flamenco-io-site/public/
/dist/
/tools/
# IDE related stuff
*.DS_Store

@ -24,6 +24,11 @@ WEB_STATIC=web/static
# Prevent any dependency that requires a C compiler, i.e. only work with pure-Go libraries.
export CGO_ENABLED=0
# FFmpeg version to bundle.
FFMPEG_VERSION=5.0.1
TOOLS=./tools
TOOLS_DOWNLOAD=./tools/download
all: application
# Install generators and build the software.
@ -191,6 +196,50 @@ site:
--exclude .htaccess \
--delete-after
# Download & install FFmpeg in the 'tools' directory for supported platforms.
.PHONY: tools
tools:
$(MAKE) -s tools-linux
$(MAKE) -s tools-darwin
$(MAKE) -s tools-windows
FFMPEG_PACKAGE_LINUX=$(TOOLS_DOWNLOAD)/ffmpeg-$(FFMPEG_VERSION)-linux-amd64-static.tar.xz
FFMPEG_PACKAGE_DARWIN=$(TOOLS_DOWNLOAD)/ffmpeg-$(FFMPEG_VERSION)-darwin-amd64.zip
FFMPEG_PACKAGE_WINDOWS=$(TOOLS_DOWNLOAD)/ffmpeg-$(FFMPEG_VERSION)-windows-amd64.zip
.PHONY: tools-linux
tools-linux:
[ -e $(FFMPEG_PACKAGE_LINUX) ] || curl \
--create-dirs -o $(FFMPEG_PACKAGE_LINUX) \
https://johnvansickle.com/ffmpeg/releases/ffmpeg-$(FFMPEG_VERSION)-amd64-static.tar.xz
tar xvf \
$(FFMPEG_PACKAGE_LINUX) \
ffmpeg-$(FFMPEG_VERSION)-amd64-static/ffmpeg \
--strip-components=1
mv ffmpeg $(TOOLS)/ffmpeg-linux-amd64
.PHONY: tools-darwin
tools-darwin:
[ -e $(FFMPEG_PACKAGE_DARWIN) ] || curl \
--create-dirs -o $(FFMPEG_PACKAGE_DARWIN) \
https://evermeet.cx/ffmpeg/ffmpeg-$(FFMPEG_VERSION).zip
unzip $(FFMPEG_PACKAGE_DARWIN)
mv ffmpeg $(TOOLS)/ffmpeg-darwin-amd64
.PHONY: tools-windows
tools-windows:
[ -e $(FFMPEG_PACKAGE_WINDOWS) ] || curl \
--create-dirs -o $(FFMPEG_PACKAGE_WINDOWS) \
https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$(FFMPEG_VERSION)-essentials_build.zip
unzip -j $(FFMPEG_PACKAGE_WINDOWS) ffmpeg-5.0.1-essentials_build/bin/ffmpeg.exe -d .
mv ffmpeg.exe $(TOOLS)/ffmpeg-windows-amd64.exe
# https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$(FFMPEG_VERSION)-essentials_build.zip
#
# cd tools-download;
package: flamenco-manager flamenco-worker addon-packer
rm -rf dist-build
mkdir -p dist-build