Guidelines and HOWTOs/Build from source/Mac: Difference between revisions

From KDE Community Wiki
No edit summary
Line 34: Line 34:
  port notes kf5-kate            # show any notes
  port notes kf5-kate            # show any notes


== Installation using stock version of Qt and Craft ==
== Installation using Craft ==


Install [https://developer.apple.com/xcode/ XCode], first.
# Install [https://developer.apple.com/xcode/ XCode]
# Install [https://www.python.org/downloads/ Python 3.6]


==== Homebrew (plus official Qt installer) ====
=== Install Craft ===
# Install [https://www.python.org/downloads/ python 3.6]
 
== Install Craft ==
   curl https://raw.githubusercontent.com/KDE/craft/master/setup/CraftBootstrap.py -O setup.py && python3.6 setup.py --prefix ~/CraftRoot
   curl https://raw.githubusercontent.com/KDE/craft/master/setup/CraftBootstrap.py -O setup.py && python3.6 setup.py --prefix ~/CraftRoot



Revision as of 12:12, 26 April 2018

Overview

Several methods of building KDE / KF5 on Mac are available, and it is not firmly established, yet, which one is "best". The two main approaches are using either a "stock" version of Qt, or a "patched" Qt. The latter has several patches meant to make KF5-applications work better on Mac. It also follows the file system layout of KDE on Linux, which should mean that KDE applications will be more likely to work correctly, without adjustments.

There is some hope that the required patches will eventually become available in official Qt packages, but this is not the case as of this writing. The main drawback with this is that Qt has to be compiled on your computer, adding hours to your setup time. The main advantage is that most things can be expected to work out of the box.

Installation using patched version of Qt and MacPorts

  • Install Macports
    • Note: If you have an existing installation of MacPorts and installed ports that depend on Qt, see this mail.
  • Install git, if you don't have it yet:
sudo port install git 
  • Get the ports tree for patched qt and frameworks:
# We assume you're doing this in your home directory
cd ~
git clone https://github.com/mkae/macstrop.git
# create index
cd macstrop
portindex
  • Register the new ports with Macports. To do so, edit ${prefix}/etc/macports/sources.conf, where prefix is the root path of your MacPorts installation (/opt/local by default). Add the following line above any other path specifications (thus making sure it will take precedence):
file:///Users/YourUserName/macstrop

It is recommended that you build the patched Qt before any frameworks, in order to make extra sure all dependencies are resolved, correctly:

sudo port install qt5-kde

You can now start building frameworks or applications (if already packaged), using e.g.

sudo port install kf5-parts
sudo port install kf5-kate
sudo port install kf5-frameworkintegration     # will get the most common frameworks in one go

Many ports have additional variants, such as "+docs" for handbooks / API documentation:

sudo port install kf5-kate +docs
port variants kf5-kate       # list available variants
port notes kf5-kate            # show any notes

Installation using Craft

  1. Install XCode
  2. Install Python 3.6

Install Craft

 curl https://raw.githubusercontent.com/KDE/craft/master/setup/CraftBootstrap.py -O setup.py && python3.6 setup.py --prefix ~/CraftRoot

Using craft

  • Every time you want to use craft in a new shell, you need to set up the craft environment, first:
source craft/craftenv.sh
  • In this shell, now craft is usable, e.g. to build Kate with all dependencies:
craft kate