Dev:Building on Windows

From Synfig Studio :: Documentation
Revision as of 03:33, 9 May 2007 by Atrus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Directories

First, if you dont start msys session before - do it now. Just make double click MSYS shortcut or run C:\msys\1.0\msys.bat. The msys will open session and create you profile directory at C:\msys\1.0\home\<windows login>. As you can see, MinGW use windows login as user name into it fake unix environment. Be careful, I don't check it functionality with non latin-character accounts.

Now, use explorer or you favorite file manager and go to C:\msys\1.0\home\<windows login>. Make here one directory 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. Make here next four directory:

  • _filez, for patches (and may be later - an additional files).
  • _src, for programs sources.
  • build, for building programs.
  • temp, for local installation programs and libraries, which required for synfig building. (For example: ETL, synfig (core for studio), openexr, etc...)

Of course, you can choose you own name for all directories and choose its locations. All you need then is a set new path in configuration file. But 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"
./bootstrap
[ $? -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"
./bootstrap
[ $? -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"
./bootstrap
[ $? -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 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 current stable OpenEXR version from:

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

_filez directory

Save next 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 next 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 next 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 is described parameters of synbuild.conf file.

Files and Directories

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

Also this section contain path and version of OpenEXR source file.

External tools

In this section you need define path to executable files of three auxiliary packages: ImageMagick, Subversion and NSIS. ImageMagick and Subversion are set it paths to PATH environment variable. But it add its to the end of list and we can get name collision. For example, "convert" tool from ImageMagick name some like "convert" tool from Borland Delphi Explorer, which can be 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 maked with debug info.

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

Patches

In this section you can find a number of patches 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 configuration of ETL. Patch files need to be stored into _filez directory.

This section is useful if you want to test your own patches before send it to Synfig developers.

Autoconfiguration

This section contatin code, which setup required environment variables and (by default) there no need to be changed.

Build Order

Note: If you want build synfig without lags, open a single msys session, then open "Task Manager", search for sh.exe process and set priority "Below normal" to it.

Note: On-access antivirus scanner can dramatically decrease configuration speed.

OpenEXR

This package need to build only once. Rebuild is required if you get new version or want apply new patch to it or you update the compiler and its incompatible with oldest binaries.

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

$ cd ~/synfig

Then type:

$ ./make_openexr.sh

Wait for "Done: OpenEXR" string.

ETL

Rebuild it when you get new version of Synfig.

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

$ cd ~/synfig

Then type:

$ ./make_etl.sh

Wait for "Done: ETL" string.

Synfig Core

Rebuild it when you get new version of Synfig.

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

$ cd ~/synfig

Then type:

$ ./make_core.sh

Wait for "Done: synfig-core" string. It can take along time. Synfig Core installer will be moved into current directory.

Synfig Studio

Rebuild it when you get new version of Synfig.

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

$ cd ~/synfig

Then type:

$ ./make_studio.sh

Wait for "Done: synfig-studio" string. It can take along time. Synfig Studio installer will be moved into current directory.

Additional tools

This tools is not required for Synfig building, but its can help in debugging process.

P.S. Post this later. ;-)