KDEConnect/Build MacOS: Difference between revisions

From KDE Community Wiki
No edit summary
(→‎Prerequisite: Avoid 'certificate has expired' error on mirror.0xem.ma (https://pastebin.com/p7prnF4x))
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
# Install Xcode command line tools with <code>xcode-select --install</code>
# Install Xcode command line tools with <code>xcode-select --install</code>
# Install Python 3 from [https://www.python.org Python Homepage], [https://brew.sh/ Homebrew] or [https://www.macports.org/ MacPorts]. Validate your python install with following command:<code>which python3</code>
# Install Python 3 from [https://www.python.org Python Homepage], [https://brew.sh/ Homebrew] or [https://www.macports.org/ MacPorts]. Validate your python install with following command:<code>which python3</code>
# As of [https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/ September 30, 2021], to fix 'curl: (60) SSL certificate problem: certificate has expired', depending on MacOS version:
*  MacOS <=10.11: [https://trac.macports.org/wiki/ProblemHotlist#letsencrypt trust the Let’s Encrypt ISRG Root X1 certificate]
*  MacOS 10.13-10.15.5: [https://apple.stackexchange.com/questions/428448/app-curl-still-getting-certificate-expired-error-due-to-expired-lets-encrypt/428453#428453 update the system's OpenSSL trusted roots bundle], [https://stackoverflow.com/questions/69387175/git-for-windows-ssl-certificate-problem-certificate-has-expired/69396425#69396425 delete the expired DST Root CA X3 certificate] from the system's OpenSSL trusted roots bundle, [https://blog.bytesguy.com/resolving-lets-encrypt-issues-with-curl-on-macos use an updated trusted root bundle], or use an updated version of curl from eg. [https://github.com/Homebrew/brew/issues/12161 brew] or [https://trac.macports.org/ticket/63563 MacPorts].


== Setting up Craft environment ==
== Setting up Craft environment ==
Line 27: Line 30:


== Fetching source code and building ==
== Fetching source code and building ==
Be sure you are in the Craft environment. There could be a<code>CRAFT:</code> prefix in front of your prompt, like this:
Make sure you are in the Craft environment. There could be a <code>CRAFT:</code> prefix in front of your prompt, like this:
[[File:MacOS_KDEConnect_Craft_Source.png]]
[[File:MacOS_KDEConnect_Craft_Source.png]]


For new version, <code>QtMultimedia</code> library is used for playing sound rather than <code>phonon</code> and <code>phonon-vlc</code>.
Run <code>craft kde/applications/kdeconnect-kde</code> to build KDE Connect on macOS.


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: kde/applications/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>.
Then you'll get your own build of KDE Connect on macOS in <code>/Users/<username>/CraftRoot/build/kde/applications/kdeconnect-kde/image-RelWithDebInfo-master/</code>. But you don't really need handle with it. Just continue...


Then you'll get your own build of KDE Connect on macOS in <code>/Users/<username>/CraftRoot/build/extragear/kdeconnect-kde/image-RelWithDebInfo-master/</code>
Run <code>craft --package kde/applications/kdeconnect-kde</code> to pack KDE Connect to a single application package.


== Launch on macOS ==
This will be a long process(tested on Mac Mini 2012 fusion driver, 3 minutes 25 seconds).
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.
After that, you will get a DMG image file in <code>/Users/<username>/CraftRoot/tmp/</code>.


For example,
== Launch on macOS ==
<pre>
Double click to mount the DMG image, drag it into Applications folder. Then you can see it on your Dashboard.
brew install d-bus
brew services start dbus
</pre>
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.
 
# Launch <code>kdeconnectd</code><pre>craft --run lib/libexec/kdeconnectd</pre>
# Launch <code>kdeconnect-indicator</code> in another terminal<pre>craft --run Applications/KDE/kdeconnect-indicator.app/Contents/MacOS/kdeconnect-indicator</pre>


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:
[[File:KDE_Connect_in_the_macOS_Dashboard.png]]
[[File:MacOS_KDEConnect_Craft_Run.png]]


The build is passed on macOS 10.14.2 with Xcode 10.1. Feel easy to test it on other version.
Open and enjoy the connection between your Mac and your Android phone!


== Quick fix ==
[[File:KDE_Connect_macOS_Launch.png]]
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>
The build is passed on macOS 10.14.5 with Xcode 10.1. Feel easy to test it on other versions.
# 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]]

Latest revision as of 07:03, 17 October 2021

[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
  4. As of September 30, 2021, to fix 'curl: (60) SSL certificate problem: certificate has expired', depending on MacOS version:

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

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

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

If all is well, the last output could be

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

Then you'll get your own build of KDE Connect on macOS in /Users/<username>/CraftRoot/build/kde/applications/kdeconnect-kde/image-RelWithDebInfo-master/. But you don't really need handle with it. Just continue...

Run craft --package kde/applications/kdeconnect-kde to pack KDE Connect to a single application package.

This will be a long process(tested on Mac Mini 2012 fusion driver, 3 minutes 25 seconds).

After that, you will get a DMG image file in /Users/<username>/CraftRoot/tmp/.

Launch on macOS

Double click to mount the DMG image, drag it into Applications folder. Then you can see it on your Dashboard.

Open and enjoy the connection between your Mac and your Android phone!

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