KDEConnect/Build MacOS: Difference between revisions

From KDE Community Wiki
No edit summary
No edit summary
Line 30: Line 30:
[[File:MacOS_KDEConnect_Craft_Source.png]]
[[File:MacOS_KDEConnect_Craft_Source.png]]


As a dependency of <code>phono-vlc</code>, <code>libvlc</code> is provided on Windows in Craft. But on macOS, there is no Craft Blueprint of <code>libvlc</code>. This will be fixed.
For new version, <code>QtMultimedia</code> library is used for playing sound rather than <code>phonon</code> and <code>phonon-vlc</code>.


Now, as it's a runtime dependency of KDE Connect, we can modify the blueprint of KDE Connect in Craft to pass the building:
Run <code>craft extragear/kdeconnect-kde</code> to build KDE Connect on macOS.
 
# Open the blueprint file of KDE Connect with your preferred text editor<pre>/Users/<username>/CraftRoot/etc/blueprints/locations/craft-blueprints-kde/extragear/kdeconnect-kde/kdeconnect-kde.py</pre>
# Find this line<pre>self.runtimeDependencies["qt-libs/phonon-vlc"] = None</pre>
# Delete or comment this line like: [[File:MacOS_KDEConnect_Craft_Remove_phonon-vlc.png]]
 
Then, run <code>craft extragear/kdeconnect-kde</code> to build KDE Connect on macOS.


If all is well, the last output could be <pre>*** Craft all succeeded: extragear/kdeconnect-kde after 1 minute 51 seconds ***</pre>.
If all is well, the last output could be <pre>*** Craft all succeeded: extragear/kdeconnect-kde after 1 minute 51 seconds ***</pre>.
Line 65: Line 59:


The build is passed on macOS 10.14.2 with Xcode 10.1. Feel easy to test it on other version.
The build is passed on macOS 10.14.2 with Xcode 10.1. Feel easy to test it on other version.
== Quick fix ==
For an old version of KDE Connect, as a dependency of <code>phono-vlc</code>, <code>libvlc</code> is provided on Windows in Craft. But on macOS, there is no Craft Blueprint of <code>libvlc</code>. But as it's a runtime dependency of KDE Connect, we can modify the blueprint of KDE Connect in Craft to pass the building:
# Open the blueprint file of KDE Connect with your preferred text editor<pre>/Users/<username>/CraftRoot/etc/blueprints/locations/craft-blueprints-kde/extragear/kdeconnect-kde/kdeconnect-kde.py</pre>
# Find this line<pre>self.runtimeDependencies["qt-libs/phonon-vlc"] = None</pre>
# Delete or comment this line like: [[File:MacOS_KDEConnect_Craft_Remove_phonon-vlc.png]]

Revision as of 13:52, 7 May 2019

[Note] Building on macOS is still an experimental feature, it's not stable and could not be launched as other applications on macOS. Please do not use it in your production environment !

Prerequisite

  1. Install Xcode from App Store
  2. Install Xcode command line tools with xcode-select --install
  3. Install Python 3 from Python Homepage, Homebrew or MacPorts. Validate your python install with following command:which python3

Setting up Craft environment

Once all prerequisites are satisfied, install Craft

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

With this command, Craft will be installed in ~/CraftRoot. You can change the directory after --prefix to install Craft to another directory.

After a long installation, the final output should be this:

Craft               : /Users/<username>/CraftRoot
Version             : master
ABI                 : macos-64-clang
Download directory  : /Users/<username>/CraftRoot/download

Setup complete

Please run the following command to get started:
  source /Users/<username>/CraftRoot/craft/craftenv.sh

Then, you can execute source /Users/<username>/CraftRoot/craft/craftenv.sh to enter the Craft environment.

Fetching source code and building

Be sure you are in the Craft environment. There could be aCRAFT: prefix in front of your prompt, like this:

For new version, QtMultimedia library is used for playing sound rather than phonon and phonon-vlc.

Run craft extragear/kdeconnect-kde to build KDE Connect on macOS.

If all is well, the last output could be

*** Craft all succeeded: extragear/kdeconnect-kde after 1 minute 51 seconds ***

.

Then you'll get your own build of KDE Connect on macOS in /Users/<username>/CraftRoot/build/extragear/kdeconnect-kde/image-RelWithDebInfo-master/

Launch on macOS

Up to now, KDE Connect could not run normally without some explicit configuration. The build on macOS is still an experimental feature.

Before the launch, you should get your dbus daemon run on macOS. Although dbus is compiled during the building, it's not configured for macOS launchd daemon. Here, we provide an easier way, installing dbus with Homebrew or MacPorts.

For example,

brew install d-bus
brew services start dbus

The dbus daemon could be dynamically lauched and managed by macOS launchd daemon.

To launch KDE Connect, be sure that you're still in Craft environment. Change your directory to the root of build.

  1. Launch kdeconnectd
    craft --run lib/libexec/kdeconnectd
  2. Launch kdeconnect-indicator in another terminal
    craft --run Applications/KDE/kdeconnect-indicator.app/Contents/MacOS/kdeconnect-indicator

There could be a tray icon of KDE Connect in the status bar. Click it and open the KDE Connect setting window, it should be like this:

The build is passed on macOS 10.14.2 with Xcode 10.1. Feel easy to test it on other version.

Quick fix

For an old version of KDE Connect, as a dependency of phono-vlc, libvlc is provided on Windows in Craft. But on macOS, there is no Craft Blueprint of libvlc. But as it's a runtime dependency of KDE Connect, we can modify the blueprint of KDE Connect in Craft to pass the building:

  1. Open the blueprint file of KDE Connect with your preferred text editor
    /Users/<username>/CraftRoot/etc/blueprints/locations/craft-blueprints-kde/extragear/kdeconnect-kde/kdeconnect-kde.py
  2. Find this line
    self.runtimeDependencies["qt-libs/phonon-vlc"] = None
  3. Delete or comment this line like: