Blame autobuild/fedora-crosscompile-win.sh

e2752b
#!/bin/bash
b62a37
1765a1
set -e
1765a1
620837
export SCRIPTPATH=$(cd `dirname "$0"`; pwd)
b62a37
620837
if [ -z $ARCH ]; then
2a3fd4
	export ARCH="64"
620837
fi
620837
833812
if [ -z $THREADS ]; then
833812
	export THREADS=4
833812
fi
833812
620837
export TOOLCHAIN="mingw$ARCH" # mingw32 | mingw64
620837
620837
if [[ $TOOLCHAIN == "mingw32" ]]; then
620837
    export TOOLCHAIN_HOST="i686-w64-mingw32"
bbd9fe
    export EXT_ARCH=i386
620837
elif [[ $TOOLCHAIN == "mingw64" ]]; then
620837
    export TOOLCHAIN_HOST="x86_64-w64-mingw32"
bbd9fe
    export EXT_ARCH=x86_64
620837
else
620837
    echo "Error: Unknown toolchain"
620837
    exit 1
620837
fi
620837
c82d0f
export WORKSPACE=${SCRIPTPATH}/../../../build
5ab0bb
export PREFIX=$WORKSPACE/win$ARCH/build
5ab0bb
export DISTPREFIX=$WORKSPACE/win$ARCH/dist
5ab0bb
export SRCPREFIX=$WORKSPACE/win$ARCH/source
5ab0bb
export CACHEDIR=$WORKSPACE/cache
5ab0bb
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:/usr/${TOOLCHAIN_HOST}/sys-root/mingw/lib/pkgconfig/
beb111
export PKG_CONFIG_LIBDIR=${PREFIX}/lib/pkgconfig
65a33d
export PATH=/usr/${TOOLCHAIN_HOST}/bin:/usr/${TOOLCHAIN_HOST}/sys-root/mingw/bin:${PREFIX}/bin:$PATH
65a33d
export LD_LIBRARY_PATH=${PREFIX}/lib:/usr/${TOOLCHAIN_HOST}/sys-root/mingw/lib
5ab0bb
77b8a6
export CC=/usr/bin/${TOOLCHAIN_HOST}-gcc
77b8a6
export CXX=/usr/bin/${TOOLCHAIN_HOST}-g++
beb111
export CPPFLAGS=" -I/usr/${TOOLCHAIN_HOST}/sys-root/mingw/include -I${PREFIX}/include"
beb111
export LDFLAGS=" -L/usr/${TOOLCHAIN_HOST}/sys-root/mingw/lib -L${PREFIX}/lib "
beb111
5ab0bb
620837
if [ -z $DEBUG ]; then
620837
	export DEBUG=0
620837
fi
620837
620837
if [[ $DEBUG == 1 ]]; then
620837
	echo
620837
	echo "Debug mode: enabled"
620837
	echo
620837
	DEBUG='--enable-debug --enable-optimization=0'
620837
else
620837
	DEBUG=''
620837
fi
620837
5ab0bb
[ -e $SRCPREFIX ] || mkdir -p $SRCPREFIX
526198
[ -e $CACHEDIR ] || mkdir -p $CACHEDIR
5ab0bb
833812
export VERSION=`cat ${SCRIPTPATH}/../synfig-core/configure.ac |egrep "AC_INIT\(\[Synfig Core\],"| sed "s|.*Core\],\[||" | sed "s|\],\[.*||"`
508260
pushd "${SCRIPTPATH}" > /dev/null
508260
export REVISION=`git show --pretty=format:%ci HEAD |  head -c 10 | tr -d '-'`
508260
popd > /dev/null
508260
526198
#mkdir -p ${WORKSPACE}/win$ARCH/bin || true
526198
#cat > ${WORKSPACE}/win$ARCH/bin/synfig <
526198
##!/bin/sh
526198
#
526198
#wine ${PREFIX}/bin/synfig.exe \$@
526198
#EOF
526198
#chmod +x ${WORKSPACE}/win$ARCH/bin/synfig
526198
#export PATH=${WORKSPACE}/win$ARCH/bin:$PATH
526198
058f98
mkprep()
058f98
{
058f98
fe1dd9
if [ ! -z $DEPS ]; then
526198
	DNF_BINARY=yum
526198
	if [ -f /usr/bin/dnf ]; then
526198
		DNF_BINARY=dnf
526198
	fi
526198
	sudo $DNF_BINARY install -y \
526198
		wget xz make which unzip \
526198
		libXdmcp  \
729136
		intltool \
729136
		gcc-c++ \
729136
		autoconf \
729136
		automake \
729136
		libtool \
729136
		libtool-ltdl-devel \
62d93b
		${TOOLCHAIN}-adwaita-icon-theme \
62d93b
		${TOOLCHAIN}-hicolor-icon-theme \
620837
		${TOOLCHAIN}-gcc-c++ \
ddbebe
		${TOOLCHAIN}-cpp \
620837
		${TOOLCHAIN}-libxml++ \
620837
		${TOOLCHAIN}-cairo \
620837
		${TOOLCHAIN}-pango \
620837
		${TOOLCHAIN}-boost \
620837
		${TOOLCHAIN}-libjpeg-turbo \
aaf4e9
		${TOOLCHAIN}-gtkmm30 \
5ab0bb
		${TOOLCHAIN}-glibmm24 \
8b0614
		${TOOLCHAIN}-libltdl \
bbd9fe
		${TOOLCHAIN}-SDL \
ee3232
		${TOOLCHAIN}-fftw \
706c45
		mingw32-nsis \
1765a1
		p7zip \
1765a1
		ImageMagick \
526198
		
526198
	#which synfig || sudo $DNF_BINARY install -y synfig
526198
		
da1e52
da1e52
# Mesa deps (not used)
da1e52
#		scons \
da1e52
#		python-mako \
da1e52
1765a1
fi
b62a37
1765a1
# copy libs
1765a1
[ -d ${PREFIX}/bin ] || mkdir -p ${PREFIX}/bin
1765a1
for file in \
bbd9fe
   av*.dll \
bbd9fe
   ffmpeg.exe \
1765a1
   iconv.dll \
1765a1
   libatk-\*.dll \
1765a1
   libatkmm-1.6-1.dll \
0a6135
   libboost_chrono\*.dll \
0a6135
   libboost_filesystem\*.dll \
1765a1
   libboost_program_options\*.dll \
0a6135
   libboost_system\*.dll \
1765a1
   libbz2\*.dll \
1765a1
   libcairo\*.dll \
bbd9fe
   libdl.dll \
31d1d8
   libepoxy\*.dll \
1765a1
   libexpat\*.dll \
1765a1
   libffi\*.dll \
e024eb
   libfftw\*.dll \
1765a1
   libfontconfig\*.dll \
1765a1
   libfreetype\*.dll \
89bee1
   libgcc_s_\*.dll \
1765a1
   libgdk\*.dll \
1765a1
   libgettext\*.dll \
1765a1
   libgio\*.dll \
1765a1
   libglib\*.dll \
1765a1
   libgmodule\*.dll \
1765a1
   libgobject\*.dll \
8b0614
   libgomp*.dll \
1765a1
   libgthread\*.dll \
1765a1
   libgtk\*.dll \
058f98
   libharfbuzz\*.dll \
89bee1
   libiconv\*.dll \
1765a1
   libintl\*.dll \
89bee1
   libjasper\*.dll \
1765a1
   libjpeg\*.dll \
8b0614
   libltdl*.dll \
89bee1
   liblzma\*.dll \
8b0614
   libMagick*.dll \
bbd9fe
   libmlt*.dll \
bbd9fe
   libogg*.dll \
1765a1
   libpango\*.dll \
385b04
   libpcre\*.dll \
1765a1
   libpixman\*.dll \
1765a1
   libpng\*.dll \
bbd9fe
   libsamplerate*.dll \
1765a1
   libsigc\*.dll \
bbd9fe
   libsox*.dll \
1765a1
   libstdc++\*.dll \
89bee1
   libsynfig\*.dll \
89bee1
   libtiff\*.dll \
1765a1
   libturbojpeg.dll \
bbd9fe
   libvorbis*.dll \
8b0614
   libwinpthread*.dll \
1765a1
   libxml2\*.dll \
1765a1
   libxml++\*.dll \
89bee1
   libz\*.dll \
bbd9fe
   postproc*.dll \
89bee1
   pthread\*.dll \
bbd9fe
   SDL.dll \
bbd9fe
   swscale*.dll \
bbd9fe
   swresample*.dll \
1765a1
   zlib\*.dll \
8b0614
   convert.exe \
1765a1
   pango-querymodules.exe \
89bee1
   synfig.exe \
89bee1
   synfigstudio.exe \
1765a1
# this extra line is required!
1765a1
do
620837
	cp /usr/${TOOLCHAIN_HOST}/sys-root/mingw/bin/$file ${PREFIX}/bin || true
1765a1
done
1765a1
1765a1
[ -d ${PREFIX}/etc ] || mkdir -p ${PREFIX}/etc
1765a1
for file in \
1765a1
   fonts \
e85add
   gtk-3.0 \
1765a1
   pango \
1765a1
# this extra line is required!
1765a1
do
526198
	cp -rf /usr/${TOOLCHAIN_HOST}/sys-root/mingw/etc/$file ${PREFIX}/etc  || true
1765a1
done
1765a1
1765a1
[ -d ${PREFIX}/lib ] || mkdir -p ${PREFIX}/lib
1765a1
for file in \
e85add
   gtk-3.0 \
1765a1
   gdk-pixbuf-2.0 \
1765a1
   pango \
beb111
   pkgconfig \
1765a1
# this extra line is required!
1765a1
do
526198
	cp -rf /usr/${TOOLCHAIN_HOST}/sys-root/mingw/lib/$file ${PREFIX}/lib  || true
1765a1
done
1765a1
058f98
[ -d ${PREFIX}/share ] || mkdir -p ${PREFIX}/share
058f98
for file in \
058f98
   fontconfig \
ddbebe
   glib-2.0 \
ddbebe
   gtk-3.0 \
62d93b
   icons \
058f98
   themes \
058f98
   xml \
058f98
# this extra line is required!
058f98
do
bda85a
	cp -rf /usr/${TOOLCHAIN_HOST}/sys-root/mingw/share/$file ${PREFIX}/share || true
058f98
done
ac1cc9
ac1cc9
# cleaning source tree
ac1cc9
for dir in ETL synfig-core synfig-studio; do
ac1cc9
	pushd $SCRIPTPATH/../$dir > /dev/null
ac1cc9
	make clean || true
ac1cc9
	popd > /dev/null
ac1cc9
done
ac1cc9
8b0614
}
8b0614
8b0614
#ImageMagick
8b0614
mkimagemagick()
8b0614
{
8b0614
PKG_NAME=ImageMagick
5ab0bb
#PKG_VERSION=6.8.6-10
5ab0bb
PKG_VERSION=6.8.7-10
5ab0bb
#PKG_VERSION=6.8.8-7
526198
TAREXT=xz
8b0614
bbd9fe
if ! pkg-config ${PKG_NAME} --exact-version=${PKG_VERSION%-*}  --print-errors; then
bbd9fe
	cd $CACHEDIR
526198
	[ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://www.imagemagick.org/download/releases/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
	cd $SRCPREFIX
bbd9fe
	if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
526198
		tar -xf $CACHEDIR/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
	fi
bbd9fe
	cd ${PKG_NAME}-${PKG_VERSION}
bbd9fe
	[ ! -e config.cache ] || rm config.cache
bbd9fe
	${TOOLCHAIN}-configure \
bbd9fe
	--prefix=${PREFIX} \
bbd9fe
	--exec-prefix=${PREFIX} \
bbd9fe
	--bindir=${PREFIX}/bin \
bbd9fe
	--sbindir=${PREFIX}/sbin \
bbd9fe
	--libexecdir=${PREFIX}/lib \
bbd9fe
	--datadir=${PREFIX}/share \
bbd9fe
	--localstatedir=${PREFIX}/var \
bbd9fe
	--sysconfdir=${PREFIX}/etc \
bbd9fe
	--datarootdir=${PREFIX}/share \
bbd9fe
	--datadir=${PREFIX}/share \
bbd9fe
	--includedir=${PREFIX}/include \
bbd9fe
	--libdir=${PREFIX}/lib \
bbd9fe
	--mandir=${PREFIX}/share/man \
bbd9fe
	--program-prefix="" \
bbd9fe
	--disable-static --enable-shared \
bbd9fe
	--without-modules \
bbd9fe
	--without-perl \
bbd9fe
	--without-x \
bbd9fe
	--without-wmf \
bbd9fe
	--with-threads \
bbd9fe
	--with-magick_plus_plus
bbd9fe
bbd9fe
	make install -j$THREADS
bbd9fe
fi
bbd9fe
}
bbd9fe
bbd9fe
mklibogg()
bbd9fe
{
bbd9fe
bbd9fe
PKG_NAME=libogg
bbd9fe
PKG_VERSION=1.3.1
bbd9fe
TAREXT=gz
bbd9fe
beb111
if ! pkg-config ogg --exact-version=${PKG_VERSION}  --print-errors; then
bbd9fe
    cd $CACHEDIR
bbd9fe
    [ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://downloads.xiph.org/releases/ogg/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    cd $SRCPREFIX
bbd9fe
    if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
bbd9fe
        tar -xzf $CACHEDIR/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    fi
8b0614
    cd ${PKG_NAME}-${PKG_VERSION}
bbd9fe
    [ ! -e config.cache ] || rm config.cache
bbd9fe
    ${TOOLCHAIN}-configure \
bbd9fe
        --prefix=${PREFIX} \
bbd9fe
        --exec-prefix=${PREFIX} \
bbd9fe
        --bindir=${PREFIX}/bin \
bbd9fe
        --sbindir=${PREFIX}/sbin \
bbd9fe
        --libexecdir=${PREFIX}/lib \
beb111
        --libdir=${PREFIX}/lib \
beb111
        --includedir=${PREFIX}/include \
bbd9fe
        --datadir=${PREFIX}/share \
bbd9fe
        --localstatedir=${PREFIX}/var \
bbd9fe
        --sysconfdir=${PREFIX}/etc \
bbd9fe
        --datarootdir=${PREFIX}/share
bbd9fe
bbd9fe
    make all -j$THREADS
bbd9fe
    make install -j$THREADS
bbd9fe
bbd9fe
fi
bbd9fe
}
bbd9fe
bbd9fe
mklibvorbis()
bbd9fe
{
bbd9fe
mklibogg
bbd9fe
bbd9fe
PKG_NAME=libvorbis
bbd9fe
PKG_VERSION=1.3.4
bbd9fe
TAREXT=gz
bbd9fe
beb111
if ! pkg-config vorbis --exact-version=${PKG_VERSION}  --print-errors; then
bbd9fe
    cd $CACHEDIR
bbd9fe
    [ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://downloads.xiph.org/releases/vorbis/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    cd $SRCPREFIX
bbd9fe
    if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
bbd9fe
        tar -xzf $CACHEDIR/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    fi
8b0614
    cd ${PKG_NAME}-${PKG_VERSION}
bbd9fe
    [ ! -e config.cache ] || rm config.cache
bbd9fe
    ${TOOLCHAIN}-configure \
bbd9fe
        --prefix=${PREFIX} \
bbd9fe
        --exec-prefix=${PREFIX} \
bbd9fe
        --bindir=${PREFIX}/bin \
bbd9fe
        --sbindir=${PREFIX}/sbin \
bbd9fe
        --libexecdir=${PREFIX}/lib \
beb111
        --libdir=${PREFIX}/lib \
beb111
        --includedir=${PREFIX}/include \
bbd9fe
        --datadir=${PREFIX}/share \
bbd9fe
        --localstatedir=${PREFIX}/var \
bbd9fe
        --sysconfdir=${PREFIX}/etc \
bbd9fe
        --datarootdir=${PREFIX}/share
bbd9fe
bbd9fe
    make all -j$THREADS
bbd9fe
    make install -j$THREADS
bbd9fe
8b0614
fi
bbd9fe
}
8b0614
bbd9fe
mklibsamplerate()
bbd9fe
{
bbd9fe
PKG_NAME=libsamplerate
bbd9fe
PKG_VERSION=0.1.8
bbd9fe
TAREXT=gz
bbd9fe
beb111
if ! pkg-config samplerate --exact-version=${PKG_VERSION}  --print-errors; then
bbd9fe
    cd $CACHEDIR
bbd9fe
    [ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://www.mega-nerd.com/SRC/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    cd $SRCPREFIX
bbd9fe
    if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
bbd9fe
        tar -xzf $CACHEDIR/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    fi
bbd9fe
    cd ${PKG_NAME}-${PKG_VERSION}
bbd9fe
    [ ! -e config.cache ] || rm config.cache
bbd9fe
    ${TOOLCHAIN}-configure \
bbd9fe
        --prefix=${PREFIX} \
bbd9fe
        --exec-prefix=${PREFIX} \
bbd9fe
        --bindir=${PREFIX}/bin \
bbd9fe
        --sbindir=${PREFIX}/sbin \
bbd9fe
        --libexecdir=${PREFIX}/lib \
beb111
        --libdir=${PREFIX}/lib \
beb111
        --includedir=${PREFIX}/include \
bbd9fe
        --datadir=${PREFIX}/share \
bbd9fe
        --localstatedir=${PREFIX}/var \
bbd9fe
        --sysconfdir=${PREFIX}/etc \
bbd9fe
        --datarootdir=${PREFIX}/share
bbd9fe
bbd9fe
    make all -j$THREADS
bbd9fe
    make install -j$THREADS
bbd9fe
bbd9fe
fi
bbd9fe
}
bbd9fe
bbd9fe
mksox()
bbd9fe
{
bbd9fe
PKG_NAME=sox
bbd9fe
PKG_VERSION=14.4.1
bbd9fe
TAREXT=gz
bbd9fe
bbd9fe
if ! pkg-config ${PKG_NAME} --exact-version=${PKG_VERSION}  --print-errors; then
bbd9fe
    cd $CACHEDIR
bbd9fe
    [ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://download.tuxfamily.org/synfig/packages/sources/base/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    cd $SRCPREFIX
bbd9fe
    if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
bbd9fe
        tar -xzf $CACHEDIR/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    fi
bbd9fe
    cd ${PKG_NAME}-${PKG_VERSION}
bbd9fe
    [ ! -e config.cache ] || rm config.cache
bbd9fe
    ${TOOLCHAIN}-configure \
bbd9fe
        --prefix=${PREFIX} \
bbd9fe
        --exec-prefix=${PREFIX} \
bbd9fe
        --bindir=${PREFIX}/bin \
bbd9fe
        --sbindir=${PREFIX}/sbin \
bbd9fe
        --libexecdir=${PREFIX}/lib \
beb111
        --libdir=${PREFIX}/lib \
beb111
        --includedir=${PREFIX}/include \
beb111
        --mandir=${PREFIX}/man \
bbd9fe
        --datadir=${PREFIX}/share \
bbd9fe
        --localstatedir=${PREFIX}/var \
bbd9fe
        --sysconfdir=${PREFIX}/etc \
bbd9fe
        --datarootdir=${PREFIX}/share 
bbd9fe
bbd9fe
    make all -j$THREADS
bbd9fe
    make install -j$THREADS
bbd9fe
bbd9fe
fi
bbd9fe
}
bbd9fe
bbd9fe
mkffmpeg()
bbd9fe
{
2a3fd4
    export FFMPEG_VERSION=3.4.2
beb111
    if ! pkg-config libswscale --exact-version=${FFMPEG_VERSION}  --print-errors; then
bbd9fe
        cd $CACHEDIR
2a3fd4
        [ -e ffmpeg-${FFMPEG_VERSION}-win${ARCH}-dev.zip ] || wget http://ffmpeg.zeranoe.com/builds/win${ARCH}/dev/ffmpeg-${FFMPEG_VERSION}-win${ARCH}-dev.zip
2a3fd4
        [ -e ffmpeg-${FFMPEG_VERSION}-win${ARCH}-shared.zip ] || wget http://ffmpeg.zeranoe.com/builds/win${ARCH}/shared/ffmpeg-${FFMPEG_VERSION}-win${ARCH}-shared.zip
bbd9fe
        [ ! -d ffmpeg ] || rm -rf ffmpeg
bbd9fe
        cd $SRCPREFIX
bbd9fe
        mkdir -p ffmpeg
bbd9fe
        cd ffmpeg
526198
	
526198
	
526198
	if [ -e /usr/bin/7z ]; then
526198
		SZIP_BINARY=7z
526198
	else
526198
		SZIP_BINARY=7za
526198
	fi
526198
		
526198
	
2a3fd4
        $SZIP_BINARY x -y $CACHEDIR/ffmpeg-${FFMPEG_VERSION}-win${ARCH}-dev.zip
bbd9fe
        cp -rf ffmpeg-${FFMPEG_VERSION}-win${ARCH}-dev/include/* ${PREFIX}/include/
bbd9fe
        cp -rf ffmpeg-${FFMPEG_VERSION}-win${ARCH}-dev/lib/* ${PREFIX}/lib/
2a3fd4
        $SZIP_BINARY x -y $CACHEDIR/ffmpeg-${FFMPEG_VERSION}-win${ARCH}-shared.zip
bbd9fe
        cp -rf ffmpeg-${FFMPEG_VERSION}-win${ARCH}-shared/bin/ffmpeg.exe ${PREFIX}/bin
bbd9fe
        cp -rf ffmpeg-${FFMPEG_VERSION}-win${ARCH}-shared/bin/*.dll ${PREFIX}/bin
bbd9fe
        mkdir -p ${PREFIX}/share/ffmpeg/presets/ || true
bbd9fe
        cp -rf ffmpeg-${FFMPEG_VERSION}-win${ARCH}-shared/presets/* /${PREFIX}/share/ffmpeg/presets/
bbd9fe
d1ca06
		for PKG in avcodec avutil avformat swscale avdevice; do
d1ca06
			cat > ${PREFIX}/lib/pkgconfig/lib${PKG}.pc <
bbd9fe
prefix=${PREFIX}
bbd9fe
exec_prefix=${PREFIX}
bbd9fe
libdir=${PREFIX}/lib
bbd9fe
includedir=${PREFIX}/include
bbd9fe
d1ca06
Name: lib${PKG}
bbd9fe
Description: Dynamic module loader for GLib
bbd9fe
Version: ${FFMPEG_VERSION}
bbd9fe
d1ca06
Libs: -l${PKG}
d1ca06
bbd9fe
EOF
bbd9fe
		done
bbd9fe
    fi
bbd9fe
}
bbd9fe
bbd9fe
mkmlt()
bbd9fe
{
bbd9fe
mkffmpeg
bbd9fe
mklibsamplerate
bbd9fe
mklibvorbis
bbd9fe
mksox
bbd9fe
	
bbd9fe
PKG_NAME=mlt
2a3fd4
PKG_VERSION=6.4.0
bbd9fe
TAREXT=gz
2a3fd4
# version 6.6.0 build failed, TODO
bbd9fe
bbd9fe
if ! pkg-config ${PKG_NAME}\+\+ --exact-version=${PKG_VERSION}  --print-errors; then
beb111
beb111
    export CPPFLAGS=" -I/usr/${TOOLCHAIN_HOST}/sys-root/mingw/include/SDL $CPPFLAGS"
beb111
    export LDFLAGS=" $LDFLAGS -lmingw32 -lSDLmain -lSDL -mwindows"
beb111
	
bbd9fe
    #[ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget http://download.tuxfamily.org/synfig/packages/sources/base/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    #if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
bbd9fe
    #    tar -xzf ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    #fi
bbd9fe
    #cd ${PKG_NAME}-${PKG_VERSION}
2a3fd4
2a3fd4
    [ -e ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} ] || wget https://github.com/mltframework/mlt/releases/download/v${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
2a3fd4
    if [ ! -d ${PKG_NAME}-${PKG_VERSION} ]; then
2a3fd4
        tar -xzf ${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
bbd9fe
    fi
2a3fd4
    cd ${PKG_NAME}-${PKG_VERSION}
2a3fd4
2a3fd4
    
2a3fd4
    #https://github.com/mltframework/mlt/releases/download/v6.8.0/mlt-6.8.0.tar.gz
2a3fd4
    
2a3fd4
    #cd $SRCPREFIX
2a3fd4
    #if [ ! -d ${PKG_NAME} ]; then
2a3fd4
    #    git clone https://github.com/morevnaproject/mlt
2a3fd4
    #fi
2a3fd4
    #cd mlt
2a3fd4
    #git reset --hard
2a3fd4
    #git checkout master
2a3fd4
    #git reset --hard
2a3fd4
    #git pull
2a3fd4
    #git clean -f -d
bbd9fe
    [ ! -e config.cache ] || rm config.cache
bbd9fe
    rm -rf ${PREFIX}/lib/libmlt* || true
bbd9fe
    rm -rf ${PREFIX}/bin/libmlt* || true
beb111
bbd9fe
    ${TOOLCHAIN}-configure \
bbd9fe
        --prefix=${PREFIX} \
bbd9fe
        --exec-prefix=${PREFIX} \
bbd9fe
        --bindir=${PREFIX}/bin \
bbd9fe
        --sbindir=${PREFIX}/sbin \
bbd9fe
        --libexecdir=${PREFIX}/lib \
beb111
        --libdir=${PREFIX}/lib \
bbd9fe
        --datadir=${PREFIX}/share \
beb111
        --mandir=${PREFIX}/man \
bbd9fe
        --localstatedir=${PREFIX}/var \
bbd9fe
        --sysconfdir=${PREFIX}/etc \
bbd9fe
        --datarootdir=${PREFIX}/share \
bbd9fe
        --avformat-shared=${PREFIX}/ \
bbd9fe
        --enable-gpl --disable-decklink \
bbd9fe
        --target-os=MinGW --target-arch=$EXT_ARCH \
bbd9fe
        $DEBUG
77b8a6
    
77b8a6
    if [ $ARCH == "64" ]; then
77b8a6
        touch src/modules/disable-motion_est
77b8a6
        touch src/modules/disable-xine
77b8a6
    fi
526198
    
526198
    touch src/modules/disable-gtk2
bbd9fe
beb111
    make all -j$THREADS
beb111
    make install -j$THREADS
bbd9fe
beb111
    mv ${PREFIX}/melt ${PREFIX}/bin/melt.exe
bbd9fe
    mv ${PREFIX}/libmlt*.dll ${PREFIX}/bin
bbd9fe
bbd9fe
    mkdir -p ${PREFIX}/bin/lib || true
bbd9fe
    mkdir -p ${PREFIX}/bin/share || true
bbd9fe
    cp -rf ${PREFIX}/lib/mlt ${PREFIX}/bin/lib/
bbd9fe
    cp -rf ${PREFIX}/share/mlt ${PREFIX}/bin/share/
bbd9fe
bbd9fe
fi
058f98
}
058f98
da1e52
# not used
65a33d
mkmesa()
65a33d
{
65a33d
PKG_NAME=mesa
65a33d
PKG_VERSION=11.0.5
65a33d
TAREXT=gz
65a33d
if ! pkg-config ${PKG_NAME} --exact-version=${PKG_VERSION}  --print-errors; then
65a33d
	#( cd ${WORKSPACE}/cache/ && wget -c --no-check-certificate ftp://ftp.freedesktop.org/pub/mesa/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT} )
65a33d
	pushd ${SRCPREFIX}
65a33d
	[ ! -d ${PKG_NAME}-${PKG_VERSION} ] && tar -xzf ${WORKSPACE}/cache/${PKG_NAME}-${PKG_VERSION}.tar.${TAREXT}
65a33d
	cd ${PKG_NAME}-${PKG_VERSION}
65a33d
	# TODO: change machine! (64bit)
65a33d
	#LDFLAGS="-static -s"
65a33d
	scons build=release platform=windows toolchain=crossmingw machine=x86 libgl-gdi
65a33d
#	./configure --host=${HOST} --prefix=${DEPSPREFIX} --includedir=${DEPSPREFIX}/include \
65a33d
#		--with-gallium-drivers="swrast" \
65a33d
#		--with-dri-drivers="swrast" \
65a33d
#		--disable-static --enable-shared
65a33d
		
65a33d
#		 \
65a33d
#		--disable-egl \
65a33d
65a33d
	#make -j${THREADS}
65a33d
	#make install
65a33d
	cd ..
65a33d
	popd
65a33d
	
65a33d
fi
65a33d
}
65a33d
b62a37
#ETL
1765a1
mketl()
1765a1
{
b62a37
cd $SCRIPTPATH/../ETL
1765a1
make clean || true
b62a37
autoreconf --install --force
620837
${TOOLCHAIN}-configure --prefix=${PREFIX} --includedir=${PREFIX}/include --libdir=${PREFIX}/lib --bindir=${PREFIX}/bin $DEBUG
b62a37
make install
1765a1
}
b62a37
1765a1
#synfig-core
1765a1
mksynfig()
1765a1
{
1765a1
cd $SCRIPTPATH/../synfig-core/
1765a1
make clean || true
9d86c8
[ ! -e config.cache ] || rm config.cache
c70f84
/bin/sh ./bootstrap.sh
b63555
cp ./configure ./configure.real
2a3fd4
echo -e "#!/bin/sh \n export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:/usr/${TOOLCHAIN_HOST}/sys-root/mingw/lib/pkgconfig/:$PKG_CONFIG_PATH \n ./configure.real \$@  \n " > ./configure
b62a37
chmod +x ./configure
2a3fd4
#this need for debug version for now
2a3fd4
#export CXXFLAGS="-mbig-obj"
410987
${TOOLCHAIN}-configure \
410987
--prefix=${PREFIX} \
410987
--exec-prefix=${PREFIX} \
410987
--bindir=${PREFIX}/bin \
410987
--sbindir=${PREFIX}/sbin \
410987
--includedir=${PREFIX}/include \
410987
--libexecdir=${PREFIX}/lib \
410987
--libdir=${PREFIX}/lib \
410987
--datadir=${PREFIX}/share \
410987
--localstatedir=${PREFIX}/var \
410987
--sysconfdir=${PREFIX}/etc \
410987
--datarootdir=${PREFIX}/share \
1f2d6b
--enable-optimization=3 \
410987
--disable-static --enable-shared --with-magickpp --without-libavcodec --with-boost=/usr/${TOOLCHAIN_HOST}/sys-root/mingw/ --enable-warnings=minimum $DEBUG
833812
make install -j$THREADS
1765a1
}
84a5ba
b62a37
#synfig-studio
1765a1
mksynfigstudio()
1765a1
{
1765a1
cd $SCRIPTPATH/../synfig-studio/
1765a1
make clean || true
9d86c8
[ ! -e config.cache ] || rm config.cache
84a5ba
/bin/sh ./bootstrap.sh
b63555
cp ./configure ./configure.real
616ed6
echo -e "#/bin/sh \n export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:/usr/${TOOLCHAIN_HOST}/sys-root/mingw/lib/pkgconfig/:$PKG_CONFIG_PATH \n ./configure.real \$@  \n " > ./configure
84a5ba
chmod +x ./configure
2a3fd4
#export CPPFLAGS="$CPPFLAGS -std=c++11"
410987
${TOOLCHAIN}-configure \
410987
--prefix=${PREFIX} \
410987
--exec-prefix=${PREFIX} \
410987
--bindir=${PREFIX}/bin \
410987
--sbindir=${PREFIX}/sbin \
410987
--includedir=${PREFIX}/include \
410987
--libexecdir=${PREFIX}/lib \
410987
--libdir=${PREFIX}/lib \
410987
--datadir=${PREFIX}/share \
410987
--localstatedir=${PREFIX}/var \
410987
--sysconfdir=${PREFIX}/etc \
410987
--datarootdir=${PREFIX}/share \
1f2d6b
--enable-optimization=3 \
410987
--disable-static --enable-shared $DEBUG
833812
make install -j$THREADS
1765a1
cp -rf ${PREFIX}/share/pixmaps/synfigstudio/* ${PREFIX}/share/pixmaps/ && rm -rf ${PREFIX}/share/pixmaps/synfigstudio
0d5e72
0d5e72
[ -e ${PREFIX}/etc/gtk-2.0 ] || mkdir -p ${PREFIX}/etc/gtk-2.0
0d5e72
cat > ${PREFIX}/etc/gtk-2.0/gtkrc <
0d5e72
0d5e72
# Enable native look
0d5e72
gtk-theme-name = "MS-Windows"
0d5e72
0d5e72
# Use small toolbar buttons
0d5e72
gtk-toolbar-style = 0
0d5e72
0d5e72
EOF
1765a1
}
1765a1
1765a1
mkpackage()
1765a1
{
1765a1
#[ ! -d DISTPREFIX ] || rm -rf $DISTPREFIX
1765a1
#mkdir -p $DISTPREFIX/bin
1765a1
#cp  ${PREFIX}/bin/*.exe $DISTPREFIX/bin
1765a1
#cp  ${PREFIX}/bin/*.dll $DISTPREFIX/bin
1765a1
#cp -rf ${PREFIX}/etc $DISTPREFIX/etc
1765a1
#mkdir -p $DISTPREFIX/lib
1765a1
#cp -rf ${PREFIX}/lib/synfig $DISTPREFIX/lib
1765a1
#mkdir -p $DISTPREFIX/share
1765a1
#cp -rf ${PREFIX}/share/pixmaps $DISTPREFIX/share
1765a1
#cp -rf ${PREFIX}/share/synfig $DISTPREFIX/share
1765a1
cp -rf $SCRIPTPATH/../synfig-core/examples $PREFIX/
97463c
cp -rf $SCRIPTPATH/gtk-3.0/settings.ini $PREFIX/share/gtk-3.0
1765a1
mkdir -p $PREFIX/licenses
1765a1
cp -rf $SCRIPTPATH/../synfig-studio/COPYING $PREFIX/licenses/synfigstudio.txt
1765a1
cp -rf $SCRIPTPATH/../synfig-studio/images/installer_logo.bmp $PREFIX/
1765a1
1765a1
[ -d $CACHEDIR ] || mkdir -p $CACHEDIR
1765a1
cd $CACHEDIR
1765a1
1765a1
[ -e portable-python-3.2.5.1.zip ] || wget http://download.tuxfamily.org/synfig/packages/sources/portable-python-3.2.5.1.zip
058f98
[ ! -d python ] || rm -rf python
1765a1
unzip portable-python-3.2.5.1.zip
058f98
[ ! -d $PREFIX/python ] || rm -rf $PREFIX/python
1765a1
mv python $PREFIX
1765a1
4e58f8
gen_list_nsh()
4e58f8
{
4e58f8
[ ! -e $2.nsh ] || rm $2.nsh
4e58f8
[ ! -e $2-uninst.nsh ] || rm $2-uninst.nsh
526198
touch $2.nsh
526198
touch $2-uninst.nsh
4e58f8
for line in `find $1 -print`; do
4e58f8
	directory=`dirname $line`
4e58f8
	line1=`echo $directory | sed "s|\./||g" | sed "s|/|\\\\\|g"`
4e58f8
	line2=`echo $line | sed "s|\./||g" | sed "s|/|\\\\\|g"`
4e58f8
	if [ -d $line ]; then
4e58f8
		echo "RMDir \"\$INSTDIR\\$line2\"" >> $2-uninst.nsh
fbf895
	elif [ ! -L $line ]; then
4e58f8
		echo "SetOutPath \"\$INSTDIR\\$line1\""  >> $2.nsh
4e58f8
		echo "File \"$line2\"" >> $2.nsh
4e58f8
		echo "Delete \"\$INSTDIR\\$line2\"" >> $2-uninst.nsh
4e58f8
	fi
4e58f8
done
4e58f8
# reverse order of uninstall commands
4e58f8
cp $2-uninst.nsh $2-uninst.nsh.tmp
4e58f8
tac $2-uninst.nsh.tmp > $2-uninst.nsh
4e58f8
rm $2-uninst.nsh.tmp
4e58f8
}
4e58f8
1765a1
cd $PREFIX
4e58f8
4e58f8
#generate file lists
4e58f8
4e58f8
gen_list_nsh bin bin
4e58f8
sed -i '/ffmpeg\.exe/d' bin.nsh		# exclude ffmpeg from he list of binaries - it will go into separate group
4e58f8
gen_list_nsh etc etc
4e58f8
gen_list_nsh examples examples
ddbebe
gen_list_nsh lib/gdk-pixbuf-2.0 lib-gdk-pixbuf
ddbebe
gen_list_nsh lib/gtk-3.0 lib-gtk
e7dbcc
gen_list_nsh lib/pango lib-pango
4e58f8
gen_list_nsh lib/synfig lib-synfig
4e58f8
gen_list_nsh licenses licenses
4e58f8
#gen_list_nsh python python # -- takes too long
ddbebe
gen_list_nsh share share
4e58f8
2391cc
cp -f $SCRIPTPATH/synfigstudio.nsi $PREFIX/synfigstudio.nsi
833812
sed -i "s/@VERSION@/$VERSION/g" $PREFIX/synfigstudio.nsi
4e58f8
cp -f $SCRIPTPATH/win${ARCH}-specific.nsh $PREFIX/arch-specific.nsh
1765a1
makensis synfigstudio.nsi
508260
cb500d
mv synfigstudio-${VERSION}.exe ${WORKSPACE}/synfigstudio-${VERSION}-${REVISION}-${ARCH}bit.exe
1765a1
}
1765a1
1765a1
mkall()
1765a1
{
058f98
	mkprep
bbd9fe
	mkimagemagick
bbd9fe
	mkmlt
1765a1
	mketl
1765a1
	mksynfig
1765a1
	mksynfigstudio
1765a1
	mkpackage
1765a1
}
1765a1
1765a1
if [ -z $1 ]; then
1765a1
	mkall
1765a1
else
1765a1
	echo "Executing custom user command..."
1765a1
	$@
1765a1
fi
b62a37