|
|
(11 intermediate revisions by 7 users not shown) |
Line 1: |
Line 1: |
| {{improve|cross compiling is still unstable}} | | {{Moved To Community|Windows/Imported From TechBase/Build/{{#titleparts:{{PAGENAME}}||4}}}} |
| {{KDE4}}
| |
| | |
| ==Basic tools==
| |
| ===MinGw===
| |
| Install mingw for linux, on debian the packages are called mingw32, mingw32-binutils, mingw32-runtime, you need to install mingw32 with gcc/g++ 3 and not 4 since that doesn't work with kdelibs, debian testing/unstable has gcc 4 so i've installed mingw32 package from ubuntu repository
| |
| ===Qt4 Kdesupport and dependencies===
| |
| You can install these dependencies(aspell, boost, dbus, qca etc..) from windows with the kdewin installer or manually download them from [http://sourceforge.net/project/showfiles.php?group_id=214730 sourceforge mirrors]
| |
| ===Qt4 and KDE4 for linux===
| |
| You also need to have Qt4 and KDE4 already installed on linux, to use moc/uic/kde4automoc etc...
| |
| ===Cmake===
| |
| To cross compile KDE you need CMake >= 2.5, you can get the last version from [http://cmake.org/HTML/Download.html#cvs CVS]
| |
| | |
| * Create two files Toolchain-mingw32.cmake and mingw32-kdelibs.cmake with this contents and place them somewhere i.e. in your home
| |
| ====Toolchain-mingw32.cmake====
| |
| <code scheme>
| |
| # the name of the target operating system
| |
| SET(CMAKE_SYSTEM_NAME Windows)
| |
| | |
| # which compilers to use for C and C++
| |
| SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
| |
| SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
| |
| | |
| # here is the target environment located
| |
| SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc /windows/kde4 )
| |
| | |
| # adjust the default behaviour of the FIND_XXX() commands: | |
| # search headers and libraries in the target environment, search
| |
| # programs in the host environment
| |
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
| |
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
| |
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
| |
| | |
| # FindQt4.cmake querys qmake to get information, this doesn't work when crosscompiling
| |
| set(KDE_PREFIX /windows/kde4)
| |
| set(QT_BINARY_DIR /home/kdeuser/kde/src/qt-copy/bin)
| |
| set(QT_LIBRARY_DIR ${KDE_PREFIX}/lib)
| |
| set(QT_QTCORE_LIBRARY ${KDE_PREFIX}/lib/libQtCore4.a)
| |
| set(QT_QTCORE_INCLUDE_DIR ${KDE_PREFIX}/include/QtCore)
| |
| set(QT_MKSPECS_DIR ${KDE_PREFIX}/mkspecs)
| |
| set(QT_MOC_EXECUTABLE ${QT_BINARY_DIR}/moc)
| |
| set(QT_QMAKE_EXECUTABLE ${QT_BINARY_DIR}/qmake)
| |
| set(QT_UIC_EXECUTABLE ${QT_BINARY_DIR}/uic)
| |
| </code>
| |
| | |
| ====mingw32-kdelibs.cmake====
| |
| <code scheme>
| |
| set(KDE_PREFIX /windows/kde4)
| |
| set(KDE4_BIN_DIR /home/kdeuser/kde/bin)
| |
| | |
| # this one is used by FindKDE4.cmake to load FindKDE4Internal.cmake:
| |
| set(KDE4_DATA_DIR ${KDE_PREFIX}/share/apps CACHE PATH "points to the apps directory of installed kdelibs")
| |
| | |
| # not sure about this one:
| |
| set(KDEWIN_DIR ${KDE_PREFIX} CACHE PATH "what is it ?")
| |
| | |
| # disable some things:
| |
| set(WITH_AVAHI OFF CACHE BOOL "Disabled")
| |
| set(WITH_DNSSD OFF CACHE BOOL "Disabled")
| |
| set(WITH_ENCHANT OFF CACHE BOOL "Disabled")
| |
| set(WITH_FAM OFF CACHE BOOL "Disabled")
| |
| set(WITH_GSSAPI OFF CACHE BOOL "Disabled")
| |
| set(WITH_HSPELL OFF CACHE BOOL "Disabled")
| |
| set(WITH_OpenEXR OFF CACHE BOOL "Disabled")
| |
| | |
| # use the binaries from native KDE4
| |
| set(KDE4_KCFGC_EXECUTABLE ${KDE4_BIN_DIR}/kconfig_compiler CACHE PATH "")
| |
| set(KDE4_AUTOMOC_EXECUTABLE ${KDE4_BIN_DIR}/kde4automoc CACHE PATH "")
| |
| set(KDE4_MEINPROC_EXECUTABLE ${KDE4_BIN_DIR}/meinproc4 CACHE PATH "")
| |
| </code>
| |
| <br/>
| |
| adjust the values according to your setup
| |
| | |
| ==Build kdelibs==
| |
| <code bash>
| |
| svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
| |
| cd kdelibs
| |
| mkdir build
| |
| cd build
| |
| cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw32.cmake ..
| |
| </code>
| |
| * you have to make a link to your kde4automoc and kconfig_compiler for linux in the bin directory
| |
| <code bash>
| |
| ln -s /path/to/kde4automoc bin/
| |
| ln -s /path/to/kconfig_compiler bin/
| |
| </code>
| |
| * since linux is case sensitive you have to make symbolic links for some headers
| |
| <code bash>
| |
| cd /windows/kde4/include
| |
| ln -s soprano Soprano
| |
| </code>
| |
| | |
| * You will get an error in klauncher.moc about slotKDEInitData so go into kinit and do something like this(you need wine)
| |
| <code bash>
| |
| rm *.moc
| |
| ../bin/kde4automoc.exe /home/kdeuser/kde/src/KDE/kdelibs/build/kinit/klauncher_automoc.cpp /home/kdeuser/kde/src/KDE/kdelibs/kinit /home/kdeuser/kde/src/KDE/kdelibs/build/kinit /windows/kde4/bin/moc.exe
| |
| </code>
| |
| and then do make as usual
| |
| | |
| * Another error in kdewidgets because wine doesn't find some dll to run makekdewidgets.exe so either run the linux version manually like this
| |
| makekdewidgets -o /home/kdeuser/kde/src/KDE/kdelibs/build/kdewidgets/kdewidgets.cpp /home/kdeuser/kde/src/KDE/kdelibs/kdewidgets/kde.widgets
| |
| or symlink those missing library in your wine system32 folder(i haven't tested it but it should work)
| |
| | |
| ==Build kdepimlibs==
| |
| This is easy :)
| |
| <code bash>
| |
| svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs
| |
| cd kdepimlibs
| |
| mkdir build
| |
| cd build
| |
| cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw32.cmake -C ~/mingw32-kdelibs.cmake ..
| |
| make
| |
| make install
| |
| </code>
| |
| | |
| ==Build kdebase==
| |
| This is easy :)
| |
| <code bash>
| |
| svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase
| |
| cd kdebase
| |
| mkdir build
| |
| cd build
| |
| cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw32.cmake -C ~/mingw32-kdelibs.cmake ..
| |
| make
| |
| make install
| |
| </code>
| |
| | |
| == Icecream ==
| |
| | |
| One of the joys of cross-compiling is the possibility to use an icecream cluster to speed up compilation.
| |
| | |
| For Debian Etch, you can get an icecream environment from here:
| |
| | |
| ftp://ftp.kdab.net/pub/gpg4win/devtools/debian-etch-mingw32-icecream-env.tar.gz
| |
| | |
| (If you want to create your own environment: icecc-create-env does a good job except that it packages the wrong as. /usr/bin/i586-mingw32msvc-as is needed)
| |
| | |
| The bin/ dir with symlinks from i586-mingw32msvc-* to /usr/bin/icecc:
| |
| | |
| ftp://ftp.kdab.net/pub/gpg4win/devtools/icecc-mingw-bin.tar.bz2
| |
| | |
| Untar icecc-mingw-bin.tar.bz2 to icecc-mingw-bin
| |
| | |
| Then set the following environment variables:
| |
| | |
| <code bash>
| |
| export PATH=/path/to/icecc-mingw-bin/bin:$PATH
| |
| export ICECC_CC=i586-mingw32msvc-gcc
| |
| export ICECC_CXX=i586-mingw32msvc-g++
| |
| export ICECC_VERSION=/path/to/debian-etch-mingw32-icecream-env.tar.gz
| |
| <code>
| |
| | |
| (Re-)run cmake and have fun.
| |