Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Windows Makefile: Add FFmpeg cross-compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Oct 30, 2017
1 parent ab5082d commit 7e337b7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
dist: trusty
sudo: false
sudo: required
language: python
cache:
pip: true
directories:
- $HOME/FFmpeg
- $HOME/FFmpeg-win32
- $HOME/FFmpeg-win64
- $HOME/.cache/r128gain-test
- $HOME/.cache/pypy
python:
Expand Down Expand Up @@ -35,24 +37,25 @@ matrix:
- python: "3.7-dev"
- python: "pypy3"
fast_finish: true
addons:
apt:
packages:
- yasm
- pandoc
- sox
before_install:
- "if [ $TRAVIS_PYTHON_VERSION = '3.4' -a $FFMPEG_VERSION = '3.4' ]; then WINDOWS=1; fi"
- "if [ $WINDOWS -eq 1 ]; then curl https://dl.winehq.org/wine-builds/Release.key | sudo apt-key add - && sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/; fi"
- "sudo apt-get -q update"
- "./ci/install-ffmpeg $FFMPEG_VERSION"
- "if [ $TRAVIS_PYTHON_VERSION != 'pypy3' ]; then pip install -U pip; fi"
- "if [ $TRAVIS_PYTHON_VERSION = 'pypy3' ]; then mkdir -p ~/.cache/pypy && echo $PYPY3_SHA256 ~/.cache/pypy/pypy$PYPY3_PYTHON_VERSION-$PYPY3_VERSION-linux_x86_64-portable.tar.bz2 | sha256sum --status -c || curl -f -L https://bitbucket.org/squeaky/portable-pypy/downloads/pypy$PYPY3_PYTHON_VERSION-$PYPY3_VERSION-linux_x86_64-portable.tar.bz2 > ~/.cache/pypy/pypy$PYPY3_PYTHON_VERSION-$PYPY3_VERSION-linux_x86_64-portable.tar.bz2; fi"
- "if [ $TRAVIS_PYTHON_VERSION = 'pypy3' ]; then echo $PYPY3_SHA256 ~/.cache/pypy/pypy$PYPY3_PYTHON_VERSION-$PYPY3_VERSION-linux_x86_64-portable.tar.bz2 | sha256sum --status -c && tar -xjf ~/.cache/pypy/pypy$PYPY3_PYTHON_VERSION-$PYPY3_VERSION-linux_x86_64-portable.tar.bz2 -C ~ && deactivate && ~/pypy$PYPY3_PYTHON_VERSION-$PYPY3_VERSION-linux_x86_64-portable/bin/virtualenv-pypy ~/pypy3-venv && . ~/pypy3-venv/bin/activate; fi"
install:
- "sudo apt-get -V install yasm pandoc sox"
- "pip install -r test-requirements.txt"
- "pip install coveralls"
- "if [ $WINDOWS -eq 1 ]; then sudo apt-get -V install winehq-stable p7zip-full mingw-w64; fi"
script:
- "export PATH=$HOME/.local/bin:$PATH"
- "export TEST_DL_CACHE_DIR=$HOME/.cache/r128gain-test"
- "coverage run --source=r128gain setup.py test"
- "if [ $WINDOWS -eq 1 ]; then pushd win && FFMPEG_VERSION=$FFMPEG_VERSION FFMPEG_CACHE_DIR=$HOME/FFmpeg-win32 WINEARCH=win32 make test && popd; fi"
- "if [ $WINDOWS -eq 1 ]; then pushd win && FFMPEG_VERSION=$FFMPEG_VERSION FFMPEG_CACHE_DIR=$HOME/FFmpeg-win64 WINEARCH=win64 make test && popd; fi"
after_success:
- "coveralls"
before_deploy:
Expand Down
11 changes: 8 additions & 3 deletions win/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
WINEARCH ?= win32
WINEARCH ?= win32
FFMPEG_VERSION ?= 3.4
FFMPEG_CACHE_DIR ?= ${HOME}/FFmpeg-${WINEARCH}

# versions
PYTHON_VERSION := 3.4.4
Expand Down Expand Up @@ -46,10 +48,10 @@ print-%:
# End targets
#

r128gain_${WINEARCH}.7z: ${OUTPUT_DIR}/r128gain.exe ${OUTPUT_DIR}/LICENSE ${OUTPUT_DIR}/readme.txt ${OUTPUT_DIR}/python${PYTHON_VERSION_SHORT}.dll
r128gain_${WINEARCH}.7z: ${OUTPUT_DIR}/r128gain.exe ${OUTPUT_DIR}/LICENSE ${OUTPUT_DIR}/readme.txt ${OUTPUT_DIR}/python${PYTHON_VERSION_SHORT}.dll ${OUTPUT_DIR}/ffmpeg.exe
7z a -t7z -mx9 $@ ${OUTPUT_DIR} > /dev/null

r128gain_${WINEARCH}.zip: ${OUTPUT_DIR}/r128gain.exe ${OUTPUT_DIR}/LICENSE ${OUTPUT_DIR}/readme.txt ${OUTPUT_DIR}/python${PYTHON_VERSION_SHORT}.dll
r128gain_${WINEARCH}.zip: ${OUTPUT_DIR}/r128gain.exe ${OUTPUT_DIR}/LICENSE ${OUTPUT_DIR}/readme.txt ${OUTPUT_DIR}/python${PYTHON_VERSION_SHORT}.dll ${OUTPUT_DIR}/ffmpeg.exe
7z a -tzip -mx9 $@ ${OUTPUT_DIR} > /dev/null

r128gain_${WINEARCH}.exe: ${7ZIP_INSTALLED} r128gain_${WINEARCH}.7z
Expand Down Expand Up @@ -77,6 +79,9 @@ ${OUTPUT_DIR}/readme.txt:
mkdir -p $(dir $@)
echo 'Get source, help and latest version at: https://github.com/desbma/r128gain' > $@

${OUTPUT_DIR}/ffmpeg.exe:
mkdir -p $(dir $@)
./build-minimal-ffpmeg ${FFMPEG_VERSION} ${FFMPEG_CACHE_DIR} ${WINEARCH} $@

#
# Tests
Expand Down
3 changes: 1 addition & 2 deletions win/build-minimal-ffpmeg
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ then
then
# update
git pull
fi

# cleanup
make clean || true
make distclean || true

# (re)configure
configure

fi
else
# clone & set branch
git clone https://git.ffmpeg.org/ffmpeg.git $repo_dir
Expand Down

0 comments on commit 7e337b7

Please sign in to comment.