Difference between revisions of "Dev:Building on Windows"

From Synfig Studio :: Documentation
Jump to: navigation, search
(synfig bootstrap was removed, change autoreconf flags to -sif :))
(synfigstudio bootstrap killed)
Line 365: Line 365:
  
 
echo "Configuring"
 
echo "Configuring"
./bootstrap
+
autoreconf -sif
 
[ $? -eq 0 ] || exit 1
 
[ $? -eq 0 ] || exit 1
 
mkdir win32build
 
mkdir win32build

Revision as of 03:50, 9 November 2007


Directories

First, if you didn't already start an msys session, do so now. Just double click the MSYS shortcut or run C:\msys\1.0\msys.bat. An msys session will be opened, creating your profile directory at C:\msys\1.0\home\<windows login>. As you can see, MinGW uses your windows login as the user name in its fake UNIX environment. Be careful, I've not checked whether it works with non latin-character account names.

Now, use explorer or your favorite file manager and go to C:\msys\1.0\home\<windows login>. Create a directory there for all Synfig operations. For example, let it be synfig. Go into this directory.

Ok, now you are at C:\msys\1.0\home\<windows login>\synfig. Create four directories here:

  • _filez, for patches (and maybe later, additional files).
  • _src, for program sources.
  • build, for building programs.
  • temp, for local installation programs and libraries, which are required for building synfig. (For example: ETL, synfig (core for studio), OpenEXR, etc...)

Of course, you can choose your own name for all the directories and choose their locations. All you need then is to set a new path in the configuration file. But for now we choose the easy way.

Files

Save this configuration file as C:\msys\1.0\home\<windows login>\synfig\synbuild.conf:

# Synfig for Win32 build configuration script.
#############################################################################
# 1. Files and Directories

# Uncompressed Synfig svn snapshots and another package sources
SYN_SOURCE_DIR=`dirname ~/.`"/synfig/_src"

# Directory additional files (patches f.e.)
SYN_FILEZ_DIR=`dirname ~/.`"/synfig/_filez"

# Temporary installations (ETL headers, synfig binaries for icon and image making)
SYN_TEMP_INSTALL=`dirname ~/.`"/synfig/temp"

# Build directory
SYN_BUILD_DIR=`dirname ~/.`"/synfig/build"

# OpenEXR source package
SYN_OPENEXR_VERSION="1.4.0"
SYN_OPENEXR_SRC="${SYN_SOURCE_DIR}/openexr-${SYN_OPENEXR_VERSION}a.tar.gz"

#############################################################################
# 2. External tools

# Path to ImageMagick directory.
SYN_IMAGEMAGICK_PATH="/C/Program Files/ImageMagick"

# Path to Subversion bin directory.
SYN_SUBVERSION_PATH="/C/Program Files/Subversion/bin"

# Path to NSIS directory with makensis.exe file.
SYN_NSIS_PATH="/C/Program Files/NSIS"

#############################################################################
# 3. Build setup

# Build host
MINGW_HOST="mingw32"

# Make debug build of Synfig Core
SYN_CORE_DEBUG_BUILD="no"

# Make debug build of Synfig Studio
SYN_STUDIO_DEBUG_BUILD="yes"

#############################################################################
# 4. Patches (you can place here any additional patches)

# ETL patches
ETL_PATCHES=$(cat <<:END_ETL:
:END_ETL:)

# Synfig Core patches
SYNCORE_PATCHES=$(cat <<:END_SYNCORE:
:END_SYNCORE:)

# Sunfig Studio patches
SYNSTUDIO_PATCHES=$(cat <<:END_SYNSTUDIO:
:END_SYNSTUDIO:)

# OpenEXR patches
OPENEXR_PATCHES=$(cat <<:END_OPENEXR:
openexr-1.4.0-pkgconfig.patch
openexr-1.4.0-mingw32.patch
:END_OPENEXR:)

#############################################################################
# 5. Autoconfiguration

if [ "$GTK_BASEPATH" ]; then
  CPPFLAGS="-I${GTK_BASEPATH}/include $CPPFLAGS"
fi

if [ "$SYN_IMAGEMAGICK_PATH" ]; then
  PATH="${SYN_IMAGEMAGICK_PATH}:${PATH}"
fi

if [ "$SYN_SUBVERSION_PATH" ]; then
  PATH="${SYN_SUBVERSION_PATH}:${PATH}"
fi

if [ "$SYN_NSIS_PATH" ]; then
  PATH="${SYN_NSIS_PATH}:${PATH}"
fi

if [ -d "${SYN_TEMP_INSTALL}/ETL" ]; then
  PATH="${SYN_TEMP_INSTALL}/ETL/bin:${PATH}"
  PKG_CONFIG_PATH="${SYN_TEMP_INSTALL}/ETL/lib/pkgconfig:${PKG_CONFIG_PATH}"
fi

if [ -d "${SYN_TEMP_INSTALL}/synfig-devel" ]; then
  PATH="${SYN_TEMP_INSTALL}/synfig-devel/bin:${PATH}"
  PKG_CONFIG_PATH="${SYN_TEMP_INSTALL}/synfig-devel/lib/pkgconfig:${PKG_CONFIG_PATH}"
fi

if [ -d "${SYN_TEMP_INSTALL}/openexr" ]; then
  PATH="${SYN_TEMP_INSTALL}/openexr/bin:${PATH}"
  PKG_CONFIG_PATH="${SYN_TEMP_INSTALL}/openexr/lib/pkgconfig:${PKG_CONFIG_PATH}"
fi

export PATH
export PKG_CONFIG_PATH
export CPPFLAGS

Save OpenEXR build script as C:\msys\1.0\home\<windows login>\synfig\make_openexr.sh:

#!/bin/sh

echo "Making OpenEXR..."
# Including configuration
if [ -r "./synbuild.conf" ]; then
  . ./synbuild.conf
else
  echo "No config file for synfig build (./synbuild.conf) found."
  exit 1
fi

CURRENT_DIR=`pwd`

echo "Cleanup directories"
rm -rf ${SYN_BUILD_DIR}/openexr
[ $? -eq 0 ] || exit 1
rm -rf ${SYN_TEMP_INSTALL}/openexr
[ $? -eq 0 ] || exit 1

echo "Preparing sources"
tar -xzf ${SYN_OPENEXR_SRC} -C ${SYN_BUILD_DIR}
[ $? -eq 0 ] || exit 1

echo "Applying patches..."
cd  ${SYN_BUILD_DIR}/openexr-${SYN_OPENEXR_VERSION}
[ $? -eq 0 ] || exit 1
for SFILE in ${OPENEXR_PATCHES[@]}
do
  patch -p1 <${SYN_FILEZ_DIR}/${SFILE}
  [ $? -eq 0 ] || exit 1
done

echo "Configuring"
[ $? -eq 0 ] || exit 1
./configure --host=${MINGW_HOST} --prefix=${SYN_TEMP_INSTALL}/openexr \
  --disable-static --disable-threading --disable-posix-sem
[ $? -eq 0 ] || exit 1

echo "Making"
make
[ $? -eq 0 ] || exit 1
make install
[ $? -eq 0 ] || exit 1
cd ${CURRENT_DIR}
[ $? -eq 0 ] || exit 1
rm -rf ${SYN_BUILD_DIR}/openexr-${SYN_OPENEXR_VERSION}
[ $? -eq 0 ] || exit 1

echo "Done: OpenEXR"

Save ETL build script as C:\msys\1.0\home\<windows login>\synfig\make_etl.sh:

#!/bin/sh

echo "Making ETL..."
# Including configuration
if [ -r "./synbuild.conf" ]; then
  . ./synbuild.conf
else
  echo "No config file for synfig build (./synbuild.conf) found."
  exit 1
fi

CURRENT_DIR=`pwd`

echo "Cleanup directories"
rm -rf ${SYN_BUILD_DIR}/ETL
[ $? -eq 0 ] || exit 1
rm -rf ${SYN_TEMP_INSTALL}/ETL
[ $? -eq 0 ] || exit 1

echo "Preparing sources"
mkdir  ${SYN_BUILD_DIR}/ETL
[ $? -eq 0 ] || exit 1
cp -R ${SYN_SOURCE_DIR}/ETL/*  ${SYN_BUILD_DIR}/ETL/
[ $? -eq 0 ] || exit 1
cp -R ${SYN_SOURCE_DIR}/ETL/.svn  ${SYN_BUILD_DIR}/ETL/
[ $? -eq 0 ] || exit 1

echo "Applying patches..."
cd  ${SYN_BUILD_DIR}/ETL
[ $? -eq 0 ] || exit 1
for SFILE in ${ETL_PATCHES[@]}
do
  patch -p1 <${SYN_FILEZ_DIR}/${SFILE}
  [ $? -eq 0 ] || exit 1
done

echo "Configuring"
autoreconf -sif
[ $? -eq 0 ] || exit 1
./configure --host=${MINGW_HOST} --prefix=${SYN_TEMP_INSTALL}/ETL
[ $? -eq 0 ] || exit 1

echo "Making"
make install
[ $? -eq 0 ] || exit 1
cd ${CURRENT_DIR}
[ $? -eq 0 ] || exit 1
rm -rf ${SYN_BUILD_DIR}/ETL
[ $? -eq 0 ] || exit 1

echo "Done: ETL"

Save Synfig Core build script as C:\msys\1.0\home\<windows login>\synfig\make_core.sh:

#!/bin/sh

echo "Making Synfig-Core..."
# Including configuration
if [ -r "./synbuild.conf" ]; then
  . ./synbuild.conf
else
  echo "No config file for synfig build (./synbuild.conf) found."
  exit 1
fi

CURRENT_DIR=`pwd`

echo "Cleanup directories"
rm -rf ${SYN_BUILD_DIR}/synfig-core
[ $? -eq 0 ] || exit 1
rm -rf ${SYN_TEMP_INSTALL}/synfig-devel
[ $? -eq 0 ] || exit 1

echo "Preparing sources"
mkdir ${SYN_BUILD_DIR}/synfig-core
[ $? -eq 0 ] || exit 1
cp -R ${SYN_SOURCE_DIR}/synfig-core/* ${SYN_BUILD_DIR}/synfig-core/
[ $? -eq 0 ] || exit 1
cp -R ${SYN_SOURCE_DIR}/synfig-core/.svn ${SYN_BUILD_DIR}/synfig-core/
[ $? -eq 0 ] || exit 1

echo "Applying patches..."
cd  ${SYN_BUILD_DIR}/synfig-core
[ $? -eq 0 ] || exit 1
for SFILE in ${SYNCORE_PATCHES[@]}
do
  patch -p1 <${SYN_FILEZ_DIR}/${SFILE}
  [ $? -eq 0 ] || exit 1
done

echo "Configuring"
libtoolize --ltdl -f
autoreconf -sif
[ $? -eq 0 ] || exit 1
mkdir win32build
[ $? -eq 0 ] || exit 1
cd win32build
[ $? -eq 0 ] || exit 1
if [ "$SYN_CORE_DEBUG_BUILD" == "yes" ]; then
  ../configure --host=${MINGW_HOST} --prefix=C:/PROGRA~1/Synfig --disable-optimization --enable-debug
  [ $? -eq 0 ] || exit 1
else
  ../configure --host=${MINGW_HOST} --prefix=C:/PROGRA~1/Synfig --enable-optimization=1 --disable-debug
  [ $? -eq 0 ] || exit 1
fi

echo "Making"
# libtool hack patch [begin]
patch -p2 <${SYN_FILEZ_DIR}/synfig-core-hack-libtool.patch
[ $? -eq 0 ] || exit 1
# libtool hack patch [end]
make package
[ $? -eq 0 ] || exit 1
mv ./synfig-*.exe ${CURRENT_DIR}/
[ $? -eq 0 ] || exit 1

make clean
[ $? -eq 0 ] || exit 1
# auto build hack installation [begin]
make install prefix=${SYN_TEMP_INSTALL}/synfig-devel
[ $? -eq 0 ] || exit 1
# auto build hack installation [end]
cd ${CURRENT_DIR}

# auto build hack patch [begin]
echo "Postprocessing"
SYN_SED_PATH=`echo ${SYN_TEMP_INSTALL}/synfig-devel | sed -e 's/\//\\\\\//g'`
[ $? -eq 0 ] || exit 1
mv ${SYN_TEMP_INSTALL}/synfig-devel/bin/synfig-config ${SYN_TEMP_INSTALL}/synfig-devel/bin/synfig-config.tmp
[ $? -eq 0 ] || exit 1
sed -e "s/C:\/PROGRA~1\\/Synfig/${SYN_SED_PATH}/g" \
  ${SYN_TEMP_INSTALL}/synfig-devel/bin/synfig-config.tmp >${SYN_TEMP_INSTALL}/synfig-devel/bin/synfig-config
[ $? -eq 0 ] || exit 1
rm -f ${SYN_TEMP_INSTALL}/synfig-devel/bin/synfig-config.tmp
[ $? -eq 0 ] || exit 1
mv ${SYN_TEMP_INSTALL}/synfig-devel/lib/pkgconfig/synfig.pc ${SYN_TEMP_INSTALL}/synfig-devel/lib/pkgconfig/synfig.pc.tmp
[ $? -eq 0 ] || exit 1
sed -e "s/C:\/PROGRA~1\\/Synfig/${SYN_SED_PATH}/g" \
  ${SYN_TEMP_INSTALL}/synfig-devel/lib/pkgconfig/synfig.pc.tmp >${SYN_TEMP_INSTALL}/synfig-devel/lib/pkgconfig/synfig.pc
[ $? -eq 0 ] || exit 1
rm -f ${SYN_TEMP_INSTALL}/synfig-devel/lib/pkgconfig/synfig.pc.tmp
[ $? -eq 0 ] || exit 1
# auto build hack patch [end]

rm -rf ${SYN_BUILD_DIR}/synfig-core

echo "Done: synfig-core"

Save Synfig Studio build script as C:\msys\1.0\home\<windows login>\synfig\make_studio.sh:

#!/bin/sh

echo "Making Synfig-Studio..."
# Including configuration
if [ -r "./synbuild.conf" ]; then
  . ./synbuild.conf
else
  echo "No config file for synfig build (./synbuild.conf) found."
  exit 1
fi

CURRENT_DIR=`pwd`

echo "Cleanup directories"
rm -rf ${SYN_BUILD_DIR}/synfig-studio
[ $? -eq 0 ] || exit 1

echo "Preparing sources"
mkdir ${SYN_BUILD_DIR}/synfig-studio
[ $? -eq 0 ] || exit 1
cp -R ${SYN_SOURCE_DIR}/synfig-studio/* ${SYN_BUILD_DIR}/synfig-studio/
[ $? -eq 0 ] || exit 1
cp -R ${SYN_SOURCE_DIR}/synfig-studio/.svn ${SYN_BUILD_DIR}/synfig-studio/
[ $? -eq 0 ] || exit 1

echo "Applying patches..."
cd  ${SYN_BUILD_DIR}/synfig-studio
[ $? -eq 0 ] || exit 1
for SFILE in ${SYNSTUDIO_PATCHES[@]}
do
  patch -p1 <${SYN_FILEZ_DIR}/${SFILE}
  [ $? -eq 0 ] || exit 1
done

echo "Configuring"
autoreconf -sif
[ $? -eq 0 ] || exit 1
mkdir win32build
[ $? -eq 0 ] || exit 1
cd win32build
[ $? -eq 0 ] || exit 1
if [ "$SYN_STUDIO_DEBUG_BUILD" == "yes" ]; then
  ../configure --host=${MINGW_HOST} --prefix=C:/PROGRA~1/Synfig --disable-optimization --enable-debug
  [ $? -eq 0 ] || exit 1
else
  ../configure --host=${MINGW_HOST} --prefix=C:/PROGRA~1/Synfig --enable-optimization=1 --disable-debug
  [ $? -eq 0 ] || exit 1
fi

echo "Making"
make package
[ $? -eq 0 ] || exit 1

mv ./synfigstudio-*.exe ${CURRENT_DIR}/
[ $? -eq 0 ] || exit 1
cd ${CURRENT_DIR}
[ $? -eq 0 ] || exit 1
rm -rf ${SYN_BUILD_DIR}/synfig-studio
[ $? -eq 0 ] || exit 1

echo "Done: synfig-studio"

_src directory

Go to the C:\msys\1.0\home\<windows login>\synfig\_src directory. Get the latest sources of Synfig from its repository.

$ svn co http://svn.voria.com/code/ETL/trunk/ ETL

$ svn co http://svn.voria.com/code/synfig-core/trunk/ synfig-core

$ svn co http://svn.voria.com/code/synfig-studio/trunk/ synfig-studio

Download the current stable OpenEXR version from:

Finally you must have three directories (ETL, synfig-core and synfig-studio) and the openexr-1.4.0a.tar.gz file in your _src directory.

_filez directory

Save the following text as C:\msys\1.0\home\<windows login>\synfig\_filez\synfig-core-hack-libtool.patch:

diff -Nuar synfig-core.orig/win32build/libtool synfig-core/win32build/libtool
--- synfig-core.orig/win32build/libtool	Wed Feb  7 21:52:34 2007
+++ synfig-core/win32build/libtool	Wed Feb  7 21:57:12 2007
@@ -2805,7 +2805,7 @@
 	  fi
 	elif test "$build_libtool_libs" = yes; then
 	  # Not a shared library
-	  if test "$deplibs_check_method" != pass_all; then
+	  if test "$deplibs_check_method" != pass_all && test "$old_library" != "libltdl.a"; then
 	    # We're trying link a shared library against a static one
 	    # but the system doesn't support it.
 

Then save the following as C:\msys\1.0\home\<windows login>\synfig\_filez\openexr-1.4.0-mingw32.patch:

diff -Nuar openexr-1.4.0.orig/IlmThread/Makefile.in openexr-1.4.0/IlmThread/Makefile.in
--- openexr-1.4.0.orig/IlmThread/Makefile.in	Wed Aug  9 05:45:52 2006
+++ openexr-1.4.0/IlmThread/Makefile.in	Wed Apr 18 20:31:58 2007
@@ -62,7 +62,8 @@
 am_libIlmThread_la_OBJECTS = IlmThreadPool.lo IlmThread.lo \
 	IlmThreadSemaphore.lo IlmThreadMutex.lo IlmThreadPosix.lo \
 	IlmThreadSemaphorePosix.lo IlmThreadSemaphorePosixCompat.lo \
-	IlmThreadMutexPosix.lo
+	IlmThreadMutexPosix.lo IlmThreadWin32.lo IlmThreadSemaphoreWin32.lo \
+	IlmThreadMutexWin32.lo
 libIlmThread_la_OBJECTS = $(am_libIlmThread_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/depcomp

Finally save the following as C:\msys\1.0\home\<windows login>\synfig\_filez\openexr-1.4.0-pkgconfig.patch:

diff -Nuar openexr-1.4.0.orig/OpenEXR.pc.in openexr-1.4.0/OpenEXR.pc.in
--- openexr-1.4.0.orig/OpenEXR.pc.in	Wed Aug  9 05:37:50 2006
+++ openexr-1.4.0/OpenEXR.pc.in	Fri Apr 20 20:52:46 2007
@@ -7,5 +7,5 @@
 Name: OpenEXR
 Description: OpenEXR image library
 Version: @OPENEXR_VERSION@
-Libs: -L${libdir} -lIlmImf -lImath -lHalf -lIex -lz @PTHREAD_LIBS@
-Cflags: @PTHREAD_CFLAGS@ -I${OpenEXR_includedir}
+Libs: -L${libdir} -lIlmImf -lImath -lHalf -lIex -lz
+Cflags: -I@includedir@ -I${OpenEXR_includedir}

Configuration

This section describes the parameters of synbuild.conf file.

Files and Directories

As you can see in this section you can define the path and name of the special directories (with sources, patches and temporary directories). If you install the build scripts as written above, there is nothing to change.

Also this section contains the path and version of the OpenEXR source files.

External tools

In this section you need to define the path to the executable files of the three auxiliary packages: ImageMagick, Subversion and NSIS. ImageMagick and Subversion binaries are located using the PATH environment variable, but their paths are added to the end of the path list and so we can get name collisions. For example, the ImageMagick "convert" tool has the same name as the "convert" tool from Borland Delphi Explorer, which may have been installed before ImageMagick.

Build setup

MINGW_HOST - host parameter of "configure" script. Do not change it.

SYN_CORE_DEBUG_BUILD - if "yes", Synfig Core will be made with debug info.

SYN_STUDIO_DEBUG_BUILD - if "yes", Synfig Studio will be made with debug info.

Patches

In this section you can find a number of patch definition blocks, looking like this:

# ETL patches
ETL_PATCHES=$(cat <<:END_ETL:
:END_ETL:)

For example, if you place any filenames of patches between :END_ETL: blocks, it will be applied before the configuration of ETL. Patch files need to be stored in the _filez directory.

This section is useful if you want to test your own patches before sending them to the Synfig developers.

Autoconfiguration

This section contatins code which sets up the required environment variables and (by default) there is no need to change anything.

Build Order

Note: If you want build synfig without slowing down other tasks running on the same machine while the build takes place, open a single msys session, then open "Task Manager", search for the sh.exe process and set its priority to "Below normal".

Note: Running an on-access antivirus scanner can dramatically decrease compilation speed.

OpenEXR

This package needs to be built only once. A rebuild is only required if you get a new version or want to apply a new patch to it or you update the compiler and it is incompatible with the previous binaries.

In your msys console go to the C:\msys\1.0\home\<windows login>\synfig directory by typing:

$ cd ~/synfig

Then type:

$ ./make_openexr.sh

Wait for the "Done: OpenEXR" message.

ETL

Rebuild it when you get a new version of Synfig.

In your msys console go to the C:\msys\1.0\home\<windows login>\synfig directory by typing:

$ cd ~/synfig

Then type:

$ ./make_etl.sh

Wait for the "Done: ETL" message.

Synfig Core

Rebuild it when you get a new version of Synfig.

In your msys console go to the C:\msys\1.0\home\<windows login>\synfig directory by typing:

$ cd ~/synfig

Then type:

$ ./make_core.sh

Wait for the "Done: synfig-core" message. It can take a long time. The Synfig Core installer will be moved into the current directory.

Synfig Studio

Rebuild it when you get a new version of Synfig.

In your msys console go to the C:\msys\1.0\home\<windows login>\synfig directory by typing:

$ cd ~/synfig

Then type:

$ ./make_studio.sh

Wait for the "Done: synfig-studio" message. It can take a long time. The Synfig Studio installer will be moved into the current directory.

Additional tools

These tools are not required to build Synfig, but they can help in the debugging process.

P.S. Post this later. ;-)

(Atrus - keen to hear what you recommend for debug. Also any debug processes you go through to fix the bugs. There's several bugs (mainly preview rendering) that I see under the current builds of Windows that are not under Linux or the old 0.61.05 for Windows - Pxegeek 2/7/07)