Skip to content

Commit

Permalink
Cross compiling: Add build scripts for OSX/WIN/GNU using docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zamaudio committed Feb 24, 2018
1 parent d3f1584 commit 68b2969
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN apt-get install -y \
ladspa-sdk \
libpthread-stubs0-dev

RUN apt-get install -y make
RUN apt-get install -y make zip

RUN wget http://zamaudio.com/mbox2/apple-macports-libsamplerate_0.1.9-1_all.deb
RUN dpkg -i apple-macports-libsamplerate_0.1.9-1_all.deb
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Note:
This is a new repo that contains the full history of the old repo.
Submodules are now required (>= 3.6).
Uses Distrho Plugin Framework.
Please use version 3.9 for a stable package, latest git is experimental.


Build Dependencies:
===================
Expand All @@ -19,23 +19,21 @@ Build Dependencies:
Bleeding edge installation:
===========================

git submodule init
git submodule update
git submodule update --init
make
sudo make install


Cross-compiling with docker:
============================

sudo docker build . -t zam-plugins-build
sudo docker run -v `pwd`:/tmp/build zam-plugins-build /bin/bash -c "cd /tmp/build && ..."

(See .travis.yml file for the required cross build commands)
# Make sure docker is installed and configured
git submodule update --init
./make-all


Package Maintainers:
====================

git checkout 3.9
git checkout 3.10
make dist
92 changes: 92 additions & 0 deletions docker-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash
set -e

CPUS=${CPUS:-4}
TRAVIS_TAG=${TRAVIS_TAG:-}

rm -fr bin linux osx win32 win64

# GNU/Linux
export CC=gcc-4.8
export CXX=g++-4.8
export AR=ar
export CXXFLAGS=
export CFLAGS=
export LDFLAGS=
make clean
rm -fr bin
mkdir bin
make -j${CPUS} LINUX=true
mv bin linux

# OSX
mkdir bin
export CC=i686-apple-darwin10-gcc
export CXX=i686-apple-darwin10-g++
export AR=i686-apple-darwin10-ar
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
export CXXFLAGS="-I/opt/local/include"
export CFLAGS="-I/opt/local/include"
make clean
touch dpf/utils/lv2_ttl_generator
chmod a+x dpf/utils/lv2_ttl_generator
make MACOS=true MACOS_OLD=true -j${CPUS}
mv bin osx

# WIN32
mkdir bin
export PATH=$PATH:/opt/mingw64/bin
export CXXFLAGS="-m32 -I/opt/mingw64/x86_64-w64-mingw32/include -I/opt/mingw64/include"
export CFLAGS="-m32 -I/opt/mingw64/x86_64-w64-mingw32/include -I/opt/mingw64/include"
export LDFLAGS=-m32
export PKG_CONFIG_PATH=/opt/mingw64/lib32/pkgconfig
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export AR=x86_64-w64-mingw32-ar
make clean
touch dpf/utils/lv2_ttl_generator.exe
chmod a+x dpf/utils/lv2_ttl_generator.exe
make WIN32=true -j${CPUS}
mv bin win32

# WIN64
mkdir bin
export CXXFLAGS="-I/opt/mingw64/x86_64-w64-mingw32/include -I/opt/mingw64/include"
export CFLAGS="-I/opt/mingw64/x86_64-w64-mingw32/include -I/opt/mingw64/include"
export LDFLAGS=
export PKG_CONFIG_PATH=/opt/mingw64/lib/pkgconfig
make clean
touch dpf/utils/lv2_ttl_generator.exe
chmod a+x dpf/utils/lv2_ttl_generator.exe
make WIN32=true -j${CPUS}
mv bin win64

# Metadata for LV2
mkdir bin
cd linux
for f in *.lv2; do cd $f; cp *.ttl ../../osx/$f/ ; cd .. ; done
for f in *.lv2; do cd $f; cp *.ttl ../../win32/$f/ ; cd .. ; done
for f in *.lv2; do cd $f; cp *.ttl ../../win64/$f/ ; cd .. ; done
cd ../osx
for f in *.lv2; do cd $f; perl -pi -e 's/\.so/\.dylib/g' manifest.ttl; perl -pi -e 's/X11UI/CocoaUI/g' manifest.ttl; cd .. ; done
cd ../win32
for f in *.lv2; do cd $f; perl -pi -e 's/\.so/\.dll/g' manifest.ttl; perl -pi -e 's/X11UI/WindowsUI/g' manifest.ttl; cd .. ; done
cd ../win64
for f in *.lv2; do cd $f; perl -pi -e 's/\.so/\.dll/g' manifest.ttl; perl -pi -e 's/X11UI/WindowsUI/g' manifest.ttl; cd .. ; done

# Release
cd ../linux
zip -9 -r zam-plugins-$TRAVIS_TAG-linuxlv2.zip *.lv2
mv *.zip ../bin
cd ../osx
zip -9 -r zam-plugins-$TRAVIS_TAG-osxlv2.zip *.lv2
mv *.zip ../bin
cd ../win32
zip -9 -r zam-plugins-$TRAVIS_TAG-win32lv2.zip *.lv2
mv *.zip ../bin
cd ../win64
zip -9 -r zam-plugins-$TRAVIS_TAG-win64lv2.zip *.lv2
mv *.zip ../bin
cd ../bin
ls -l
echo "ALL DONE!!!"
5 changes: 5 additions & 0 deletions make-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

docker build . -t zam-plugins-build:latest
docker run -v `pwd`:/tmp/build --entrypoint "/bin/bash" zam-plugins-build:latest -c "cd /tmp/build; bash docker-script"

0 comments on commit 68b2969

Please sign in to comment.