Difference between revisions of "Calligra/Building Calligra on OSX"

Jump to: navigation, search
(Run & Debug)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[../Building|« Back to general building instructions]]
 +
 +
NOTE: don't use this to build Krita on OSX. Use http://quickgit.kde.org/?p=scratch%2Frempt%2Fkritadeposx.git and contact boud on #krita on irc.freenode.net for more information.
  
 
== Install Dependencies ==
 
== Install Dependencies ==
Line 8: Line 11:
 
# Install all the dependencies to the calligra formula.
 
# Install all the dependencies to the calligra formula.
 
# Install <code>ninja</code> through Homebrew, which is a build tool faster than GNU make.
 
# Install <code>ninja</code> through Homebrew, which is a build tool faster than GNU make.
 +
# Make a directory for build and a directory for install, here we call them ${BUILD_DIR} and ${INSTALL_DIR} as references.
 +
# Eigen2 is not included in Homebrew, you need to install it manually to ${INSTALL_DIR}
  
 
== Setup Calligra Source Code==
 
== Setup Calligra Source Code==
Line 14: Line 19:
 
#: <pre>git clone git://anongit.kde.org/calligra</pre>
 
#: <pre>git clone git://anongit.kde.org/calligra</pre>
 
# Checkout the branch you want to build, master branch usually works best on OSX
 
# Checkout the branch you want to build, master branch usually works best on OSX
# Make a directory for build and a directory for install, here we call them ${BUILD_DIR} and ${INSTALL_DIR} as references.
 
  
 
== Build & Install ==
 
== Build & Install ==
Line 23: Line 27:
 
white-space: -pre-wrap;  
 
white-space: -pre-wrap;  
 
white-space: -o-pre-wrap;  
 
white-space: -o-pre-wrap;  
word-wrap: break-word;">cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DKDE_DEFAULT_HOME=${CMAKE_INSTALL_PREFIX}/.kde -DCMAKE_PREFIX_PATH=/usr/local/opt/gettext:/usr/local/opt/sqlite/:/usr/local/kde4 -DBUILD_doc=FALSE -DBUNDLE_INSTALL_DIR=${CMAKE_INSTALL_PREFIX}/bin -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DPRODUCTSET=osx ${PATH_TO_SOURCE_DIR} -GNinja -Wno-dev -DCMAKE_CXX_FLAGS=-w</pre>
+
word-wrap: break-word;">cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DKDE_DEFAULT_HOME=${INSTALL_DIR}/.kde -DCMAKE_PREFIX_PATH=/usr/local/opt/gettext:/usr/local/opt/sqlite/:/usr/local/kde4 -DBUILD_doc=FALSE -DKDE4_BUILD_TESTS=off -DBUNDLE_INSTALL_DIR=${INSTALL_DIR}/bin -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DPRODUCTSET=osx ${PATH_TO_SOURCE_DIR} -GNinja -Wno-dev -DCMAKE_CXX_FLAGS=-w</pre>
 
# Build and install through command
 
# Build and install through command
 
#: <pre>ninja install</pre>
 
#: <pre>ninja install</pre>
Line 31: Line 35:
  
 
# If you set environment variables in ~/.profile and ran kbuildsycoca4 and update-mime-database, you can run Calligra application by .app container under ${INSTALL_DIR}/bin
 
# If you set environment variables in ~/.profile and ran kbuildsycoca4 and update-mime-database, you can run Calligra application by .app container under ${INSTALL_DIR}/bin
# Here is a example script which included environment variable setup and debugger support [WIP]
+
# Here is a example script which included environment variable setup and debugger support
 +
 
 
<pre>
 
<pre>
 
#! /bin/bash
 
#! /bin/bash
 +
 +
APP=
 +
DEBUG=0
 +
 +
while getopts "a:D" opt; do
 +
    case $opt in
 +
        a)
 +
            APP=$OPTARG
 +
            ;;
 +
        D)
 +
            DEBUG=1
 +
            ;;
 +
        \?)
 +
            echo "Invalid option: -$OPTARG"
 +
            exit 1
 +
            ;;
 +
    esac
 +
done
  
 
INSTALL_DIR=/Users/yue/Dev/calligra/install
 
INSTALL_DIR=/Users/yue/Dev/calligra/install
Line 39: Line 62:
 
BREW_KDE_DIR=/usr/local/kde4
 
BREW_KDE_DIR=/usr/local/kde4
  
export XDG_DATA_HOME=${INSTALL_DIR}/share:$XDG_DATA_HOME
+
export KDEHOME=${INSTALL_DIR}/.kde
export KDEDIRS=${INSTALL_DIR}/install:$KDEDIRS
+
export XDG_DATA_HOME=${INSTALL_DIR}/.local/share
 +
export XDG_CONFIG_HOME=${INSTALL_DIR}/.config
 +
export XDG_DATA_DIRS=${INSTALL_DIR}/share:${BREW_KDE_DIR}/share:${BREW_DIR}/share
 +
export KDEDIRS=${INSTALL_DIR}:$KDEDIRS
 
export DYLD_LIBRARY_PATH=${INSTALL_DIR}/lib:$DYLD_LIBRARY_PATH
 
export DYLD_LIBRARY_PATH=${INSTALL_DIR}/lib:$DYLD_LIBRARY_PATH
 
export PATH=${INSTALL_DIR}/bin:$PATH
 
export PATH=${INSTALL_DIR}/bin:$PATH
Line 49: Line 75:
 
update-mime-database ${INSTALL_DIR}/share/mime
 
update-mime-database ${INSTALL_DIR}/share/mime
  
/Applications/KDE4/${1}.app/Contents/MacOS/$1
+
if [ $DEBUG -eq 1 ]
 +
then
 +
    lldb ${INSTALL_DIR}/bin/${APP}.app/
 +
else
 +
    ${INSTALL_DIR}/bin/${APP}.app/Contents/MacOS/${APP}
 +
fi
 
</pre>
 
</pre>

Latest revision as of 09:41, 5 February 2015

« Back to general building instructions

NOTE: don't use this to build Krita on OSX. Use http://quickgit.kde.org/?p=scratch%2Frempt%2Fkritadeposx.git and contact boud on #krita on irc.freenode.net for more information.

Install Dependencies

First you need to install Calligra dependencies, you can do it manually, through Macports or Homebrew, here shows how to do it in Homebrew.

  1. Install Homebrew following this guide.
  2. Setup adymo/homebrew-kde tap following this guide.
  3. Install all the dependencies to the calligra formula.
  4. Install ninja through Homebrew, which is a build tool faster than GNU make.
  5. Make a directory for build and a directory for install, here we call them ${BUILD_DIR} and ${INSTALL_DIR} as references.
  6. Eigen2 is not included in Homebrew, you need to install it manually to ${INSTALL_DIR}

Setup Calligra Source Code

  1. Clone Calligra git repo.
    git clone git://anongit.kde.org/calligra
  2. Checkout the branch you want to build, master branch usually works best on OSX

Build & Install

  1. Go to ${BUILD_DIR}, run cmake, ${PATH_TO_SOURCE_DIR} is the relative path from ${BUILD_DIR} to the source code directory:
    cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DKDE_DEFAULT_HOME=${INSTALL_DIR}/.kde -DCMAKE_PREFIX_PATH=/usr/local/opt/gettext:/usr/local/opt/sqlite/:/usr/local/kde4 -DBUILD_doc=FALSE -DKDE4_BUILD_TESTS=off -DBUNDLE_INSTALL_DIR=${INSTALL_DIR}/bin -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DPRODUCTSET=osx ${PATH_TO_SOURCE_DIR} -GNinja -Wno-dev -DCMAKE_CXX_FLAGS=-w
  2. Build and install through command
    ninja install
  3. Setup environment variables similar to the homebrew-kde guide or put them in a script so you can fire up a debugger easily

Run & Debug

  1. If you set environment variables in ~/.profile and ran kbuildsycoca4 and update-mime-database, you can run Calligra application by .app container under ${INSTALL_DIR}/bin
  2. Here is a example script which included environment variable setup and debugger support
#! /bin/bash

APP=
DEBUG=0

while getopts "a:D" opt; do
    case $opt in
        a)
            APP=$OPTARG
            ;;
        D)
            DEBUG=1
            ;;
        \?)
            echo "Invalid option: -$OPTARG"
            exit 1
            ;;
    esac
done

INSTALL_DIR=/Users/yue/Dev/calligra/install
BREW_DIR=/usr/local
BREW_KDE_DIR=/usr/local/kde4

export KDEHOME=${INSTALL_DIR}/.kde
export XDG_DATA_HOME=${INSTALL_DIR}/.local/share
export XDG_CONFIG_HOME=${INSTALL_DIR}/.config
export XDG_DATA_DIRS=${INSTALL_DIR}/share:${BREW_KDE_DIR}/share:${BREW_DIR}/share
export KDEDIRS=${INSTALL_DIR}:$KDEDIRS
export DYLD_LIBRARY_PATH=${INSTALL_DIR}/lib:$DYLD_LIBRARY_PATH
export PATH=${INSTALL_DIR}/bin:$PATH

kbuildsycoca4 --noincremental
update-mime-database ${BREW_DIR}/share/mime
update-mime-database ${BREW_KDE_DIR}/share/mime
update-mime-database ${INSTALL_DIR}/share/mime

if [ $DEBUG -eq 1 ]
then
    lldb ${INSTALL_DIR}/bin/${APP}.app/
else
    ${INSTALL_DIR}/bin/${APP}.app/Contents/MacOS/${APP}
fi

This page was last edited on 5 February 2015, at 09:41. Content is available under Creative Commons License SA 4.0 unless otherwise noted.