QElectroTech sous MacOSX

Macports arm64 Apple silicon environments MAC Mini M2

git clone https://invent.kde.org/graphics/digikam.git
cd digikam/project/bundles/macports/
diff --git a/project/bundles/3rdparty/ext_kf5/CMakeLists.txt b/project/bundles/3rdparty/ext_kf5/CMakeLists.txt
index 41a75f247f..04307322bd 100755
--- a/project/bundles/3rdparty/ext_kf5/CMakeLists.txt
+++ b/project/bundles/3rdparty/ext_kf5/CMakeLists.txt
@@ -107,7 +107,7 @@ function(InstallKDEComponent
 
                             CONFIGURE_COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/../../../../bootstrap.macports <SOURCE_DIR>/. &&
                                               sed -i '' -e "s/DBUILD_TESTING=ON/DBUILD_TESTING=OFF/g" <SOURCE_DIR>/bootstrap.macports &&
-                                              <SOURCE_DIR>/bootstrap.macports ${EXTPREFIX_frameworks} debug x86_64 "${argoptions}"
+                                              <SOURCE_DIR>/bootstrap.macports ${EXTPREFIX_frameworks} debug arm64 "${argoptions}"
 
                             BUILD_COMMAND cd <SOURCE_DIR>/build && $(MAKE)
 
diff --git a/project/bundles/macports/01-build-macports.sh b/project/bundles/macports/01-build-macports.sh
index 669ec675c1..82ac0ff093 100755
--- a/project/bundles/macports/01-build-macports.sh
+++ b/project/bundles/macports/01-build-macports.sh
@@ -210,7 +210,7 @@ EOF
         # No need to build with both architectures embeded (x86 and ARM) for Apple Silicon target
 
         cat << EOF >> "$INSTALL_PREFIX/etc/macports/variants.conf"
-+universal
+++arm64
 EOF
 
     fi
@@ -275,25 +275,11 @@ port install \
              libpng \
              jpeg \
              tiff \
-             boost \
-             eigen3 \
              gettext \
              libusb \
-             libgphoto2 \
-             jasper \
-             lcms2 \
-             expat \
              libxml2 \
              libxslt \
              libical \
-             lensfun \
-             bison \
-             py38-lxml \
-             x265 \
-             libde265 \
-             libheif \
-             aom \
-             ffmpeg \
              wget +ssl \
              qt5-qtbase \
              qt5-qtdeclarative \
@@ -305,22 +291,11 @@ port install \
              qt5-qttranslations \
              qt5-qtimageformats \
              qt5-qtnetworkauth \
-             qt5-sqlite-plugin \
-             qt5-mysql-plugin $MP_MARIADB_VARIANT
+             qt5-sqlite-plugin
 
-port deactivate boost
+#port deactivate boost
 
-if [[ $DK_QTWEBENGINE = 1 ]] ; then
 
-    port install qt5-qtwebengine
-
-else
-
-    port install qt5-qtwebkit
-
-fi
-
-port activate boost
 
 # port broken since a while. check later
 #             sane-backends \
@@ -360,18 +335,7 @@ cmake $ORIG_WD/../3rdparty \
        -DKA_VERSION=$DK_KA_VERSION \
        -DKP_VERSION=$DK_KP_VERSION \
        -DKDE_VERSION=$DK_KDE_VERSION \
-       -DENABLE_QTVERSION=$DK_QTVERSION \
-       -DENABLE_QTWEBENGINE=$DK_QTWEBENGINE \
-       -Wno-dev
-
-if [[ $DK_QTWEBENGINE = 0 ]] ; then
-    cmake --build . --config RelWithDebInfo --target ext_qtwebkit    -- -j$CPU_CORES
-fi
-
-cmake --build . --config RelWithDebInfo --target ext_opencv      -- -j$CPU_CORES
-cmake --build . --config RelWithDebInfo --target ext_imagemagick -- -j$CPU_CORES
-cmake --build . --config RelWithDebInfo --target ext_libjxl      -- -j$CPU_CORES
-cmake --build . --config RelWithDebInfo --target ext_libavif     -- -j$CPU_CORES
+       -DENABLE_QTVERSION=$DK_QTVERSION
 
 #################################################################################################
 
diff --git a/project/bundles/macports/02-build-extralibs.sh b/project/bundles/macports/02-build-extralibs.sh
index a94632c1a6..ca39301c7f 100755
--- a/project/bundles/macports/02-build-extralibs.sh
+++ b/project/bundles/macports/02-build-extralibs.sh
@@ -68,16 +68,15 @@ cmake $ORIG_WD/../3rdparty \
        -DKA_VERSION=$DK_KA_VERSION \
        -DKP_VERSION=$DK_KP_VERSION \
        -DKDE_VERSION=$DK_KDE_VERSION \
-       -DENABLE_QTVERSION=$DK_QTVERSION \
-       -DENABLE_QTWEBENGINE=$DK_QTWEBENGINE \
-       -Wno-dev
+       -DENABLE_QTVERSION=$DK_QTVERSION
+
 
 # NOTE: The order to compile each component here is very important.
 
 # core KF5 frameworks dependencies
 cmake --build . --config RelWithDebInfo --target ext_extra-cmake-modules -- -j$CPU_CORES
 cmake --build . --config RelWithDebInfo --target ext_kconfig             -- -j$CPU_CORES
-cmake --build . --config RelWithDebInfo --target ext_breeze-icons        -- -j$CPU_CORES
+#cmake --build . --config RelWithDebInfo --target ext_breeze-icons        -- -j$CPU_CORES
 cmake --build . --config RelWithDebInfo --target ext_kcoreaddons         -- -j$CPU_CORES
 cmake --build . --config RelWithDebInfo --target ext_kwindowsystem       -- -j$CPU_CORES
 cmake --build . --config RelWithDebInfo --target ext_solid               -- -j$CPU_CORES
@@ -106,10 +105,10 @@ cmake --build . --config RelWithDebInfo --target ext_kimageformats       -- -j$C
 #cmake --build . --config RelWithDebInfo --target ext_libksane            -- -j$CPU_CORES
 
 # Calendar support
-cmake --build . --config RelWithDebInfo --target ext_kcalendarcore       -- -j$CPU_CORES
+#cmake --build . --config RelWithDebInfo --target ext_kcalendarcore       -- -j$CPU_CORES
 
 # Breeze style support
-cmake --build . --config RelWithDebInfo --target ext_breeze              -- -j$CPU_CORES
+#cmake --build . --config RelWithDebInfo --target ext_breeze              -- -j$CPU_CORES
 
 #################################################################################################
 
diff --git a/project/bundles/macports/config.sh b/project/bundles/macports/config.sh
index 37341eefb0..65c9e37442 100644
--- a/project/bundles/macports/config.sh
+++ b/project/bundles/macports/config.sh
@@ -16,7 +16,7 @@ BUILDING_DIR="`pwd`/temp.build"
 ########################################################################
 
 # Target macOS architecture: "x86_64" for Intel 64 bits, or "arm64" for Apple Silicon 64 bits.
-ARCH_TARGET="x86_64"
+ARCH_TARGET="arm64"
 
 if [[ $ARCH_TARGET = "x86_64" ]] ; then
 
@@ -50,7 +50,7 @@ if [[ $ARCH_TARGET = "x86_64" ]] ; then
 elif [[ $ARCH_TARGET = "arm64" ]] ; then
 
     # Apple Silicon is supported since macOS BigSur
-    OSX_MIN_TARGET="11.0"
+    OSX_MIN_TARGET="12.3"
 
 else
 
@@ -128,7 +128,7 @@ DK_VERSION=master
 DK_DEBUG=0
 
 # Option to use QtWebEngine instead QtWebkit
-DK_QTWEBENGINE=1
+DK_QTWEBENGINE=0
 
 # Sign bundles with GPG. Passphrase must be hosted in ~/.gnupg/dkorg-gpg-pwd.txt
 DK_SIGN=0

Add in your .bash_profile or in zsh profile see

PATH="/opt/digikam.org.arm64/libexec/qt5/bin:${PATH}"
PATH="/opt/digikam.org.arm64/bin:${PATH}"
export PATH=/opt/digikam.org.arm64/libexec:$PATH
export PATH=/opt/digikam.org.arm64/include:$PATH
Copy your libs KF5 *.pri  /opt/digikam.org.arm64/mkspecs/modules/  to /opt/digikam.org.arm64/libexec/qt5/mkspecs/modules/
Edit your libs KF5 *.pri files in /opt/digikam.org.arm64/libexec/qt5/mkspecs/modules/ like this:

QT.KCoreAddons.VERSION = 5.110.0
QT.KCoreAddons.MAJOR_VERSION = 5
QT.KCoreAddons.MINOR_VERSION = 110
QT.KCoreAddons.PATCH_VERSION = 0
QT.KCoreAddons.name = KF5CoreAddons
QT.KCoreAddons.module = KF5CoreAddons
QT.KCoreAddons.defines = 
QT.KCoreAddons.includes =  $$PWD/../../include/KF5/KCoreAddons
QT.KCoreAddons.private_includes =
QT.KCoreAddons.libs = $$PWD/../../lib
QT.KCoreAddons.depends = core
QT.KCoreAddons.module_config = 

To:


QT.KCoreAddons.VERSION = 5.110.0
QT.KCoreAddons.MAJOR_VERSION = 5
QT.KCoreAddons.MINOR_VERSION = 110
QT.KCoreAddons.PATCH_VERSION = 0
QT.KCoreAddons.name = KF5CoreAddons
QT.KCoreAddons.module = KF5CoreAddons
QT.KCoreAddons.defines = 
QT.KCoreAddons.includes =  /opt/digikam.org.arm64/include/KF5/KCoreAddons
QT.KCoreAddons.private_includes =
QT.KCoreAddons.libs = /opt/digikam.org.arm64/lib
QT.KCoreAddons.depends = core
QT.KCoreAddons.module_config = 

MacOS Macports environment (new 2023)

We use now Digikam scripts, for create Qt 5.15.X compile environment with qt5-sqlite-plugin (Sqilte3) for database project exporting.
See: https://invent.kde.org/graphics/digikam/-/tree/master/project/bundles/macports
First read the README file:
https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/macports/README

We only use 01-build-macports.sh and 02-build-extralibs.sh script to build MacOS Macports environment for QET builds.

git clone https://invent.kde.org/graphics/digikam.git
cd digikam/project/bundles/macports/

You can comment some packages which are not useful for QElectroTech
like qt5-qtwebengine, qt5-qtwebkit, etc.

bash ./01-build-macports.sh

If ok then

you can comment some packages which are not useful for QElectroTech,
but keep ext_kcoreaddons and ext_kwidgetsaddons!

bash ./02-build-extralibs.sh 

Add in your .bash_profile or in zsh profile see

# Setting PATH for Qt5.15.x
PATH="/opt/digikam.org.x86_64/libexec/qt5/bin:${PATH}"
PATH="/opt/digikam.org.x86_64/bin:${PATH}"
export PATH=/opt/digikam.org.x86_64/libexec:$PATH
export PATH=/opt/digikam.org.x86_64/include:$PATH

Note : On APPLE M1/2 chips replace in PATH /opt/digikam.org.x86_64 by /opt/digikam.org.arm64
but with Qt 5.15.8 environment can't compil like: Can't build QET with MacPorts and Digikam scripts, I have linking errors: …………building for macOS-arm64 but attempting to link with file config macOS-x86_64….. For KF5 libs…

Get GIT sources

git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror.git

Build bundle: We need to add lang1 in qet_git directory with these unzipped files
And create a MAC_OS_X directory in your home otherwise bundles builds was located in /build-aux/mac-osx/ folder.

bash qet_git/misc/MacQetDeploy.sh 

MacOS Homebrew environment (old)

* Note : we can't use Qt 5 sqlite3 plug-in without compile Qt 5
https://invent.kde.org/packaging/homebrew-kde

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install qt@5

brew untap kde-mac/kde 2> /dev/null
brew tap kde-mac/kde https://invent.kde.org/packaging/homebrew-kde.git --force-auto-update
"$(brew --repo kde-mac/kde)/tools/do-caveats.sh"


brew install kde-mac/kde/kf5-kwidgetsaddons
brew install kde-mac/kde/kf5-kcoreaddons


Copy your libs KF5 *.pri  on /usr/local/opt/qt5/mkspecs/modules/  like :

cp /usr/local/opt/kf5-kwidgetsaddons/mkspecs/modules/qt_KWidgetsAddons.pri  /usr/local/opt/qt5/mkspecs/modules/
cp /usr/local/opt/kf5-kcoreaddons/mkspecs/modules/qt_KCoreAddons.pri /usr/local/opt/qt5/mkspecs/modules/

Edit KF5 .pri file $$PWD/…/ PATH like this

QT.KCoreAddons.VERSION = 5.99.0
QT.KCoreAddons.MAJOR_VERSION = 5
QT.KCoreAddons.MINOR_VERSION = 99
QT.KCoreAddons.PATCH_VERSION = 0
QT.KCoreAddons.name = KF5CoreAddons
QT.KCoreAddons.module = KF5CoreAddons
QT.KCoreAddons.defines = 
QT.KCoreAddons.includes =  $$PWD/../../include/KF5/KCoreAddons
QT.KCoreAddons.private_includes =
QT.KCoreAddons.libs = $$PWD/../../lib
QT.KCoreAddons.depends = core
QT.KCoreAddons.module_config = 

to

QT.KCoreAddons.VERSION = 5.99.0
QT.KCoreAddons.MAJOR_VERSION = 5
QT.KCoreAddons.MINOR_VERSION = 99
QT.KCoreAddons.PATCH_VERSION = 0
QT.KCoreAddons.name = KF5CoreAddons
QT.KCoreAddons.module = KF5CoreAddons
QT.KCoreAddons.defines = 
QT.KCoreAddons.includes =  /usr/local/opt/kf5-kcoreaddons/include/KF5/KCoreAddons
QT.KCoreAddons.private_includes =
QT.KCoreAddons.libs = /usr/local/opt/kf5-kcoreaddons/lib
QT.KCoreAddons.depends = core
QT.KCoreAddons.module_config = 

Same things for qt_KWidgetsAddons.pri

cat .bash_profile 
# Setting PATH for Qt5.15.7
PATH="/usr/local/Cellar/qt@5/5.15.7/bin:${PATH}"
export PATH=/usr/local/lib:$PATH
export PATH
git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror.git
bash qet_git/misc/MacQetDeploy.sh 

Or

cd qet_git/
qmake -spec macx-clang
make -j24

Old Documentation

Cette page regroupe l'ensemble des connaissances de l'équipe sur la compilation et l'exécution de QElectroTech sous MacOS X. Le développeur ne disposant pas d'un ordinateur Apple, nous ne garantissons strictement rien quant au bon fonctionnement de QElectroTech sous MacOS X.

Testé sous El Capitan (10.11).

Préparation de l'environnement

Compiler un programme C++ : XCode

Pour disposer d'un compilateur C++ et de l'outil make, vous devez installer Xcode (lancer l'application au moins une fois pour terminer l'installation).

Vérifications :

# Ouvrir une console ; l'utilitaire make doit être présent :
NomDeLaMachine:~ votre_user$ make
make: *** No targets specified and no makefile found.  Stop.

Compiler un programme C++/Qt : Qt 5.x

Téléchargez et installez Qt pour MacOS :

  • Se rendre sur Qt project
  • Répondre aux questions :
    1. Is your application or device being developed for : Open source distribution under a LGPL or GPL licence
    2. Are you prepared to make your application source code publicly available : Yes
    3. Are you able to comply with the obligations of the LGPL (or GPL) and/or does your corporation allow open source usage ? Yes
    4. Get Started
    5. Download now (Le QT Online installer for OS X)
  • Télécharger et installer le sdk de Qt5.x

PS : Si vous avez ce message d'erreur :

Aller dans /Préférences système /Sécurité et confidentialité/ Général.

Et sélectionner « N’importe où » :

sudo spctl --master-disable

__ Indiquer les variables d’environnement Qt au bash :

  1. Afficher les fichiers cachés
 defaults write com.apple.finder AppleShowAllFiles TRUE
  1. Ouvrir le fichier : /Users/Yoann/.bash_profile
  2. rajouter (en adaptant le numéro de version) :
# Setting PATH for Qt5.5
PATH="/Users/Yoann/Qt/5.5/clang_64/bin:${PATH}"
export PATH

Vérifications dans la console du Terminal :

# les variables d'environnements sont présentes :
NomDeLaMachine:~ votre_user$ echo $PATH

On doit retrouver quelque chose avec : /Users/Yoann/Qt/5.5/clang_64/bin

# L'utilitaire qmake doit être présent :
NomDeLaMachine:~ votre_user$ which qmake
/Users/Yoann/Qt/5.5/clang_64/bin/qmake
# Vérification macdeployqt doit être présent :
NomDeLaMachine:~ votre_user$ which macdeployqt
/Users/Yoann/Qt/5.5/clang_64/bin/macdeployqt

Installer Homebrew + coreutils pour étendre les fonctions de cp <code> /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” brew install coreutils </code>

Télécharger les sources : Subversion

Pour télécharger et mettre à jour les sources de QElectroTech, vous aurez besoin de Subversion qui a été installé en même temps Xcode.

Vérifications :

# Ouvrez une console
NomDeLaMachine:~ votre_user$ which svn
/usr/local/bin/svn
NomDeLaMachine:~ votre_user$ svn --version
svn, version 1.4.4 (r25188)
compiled Jun 23 2007, 08:53:30

Ouvrer le terminal, taper la commande

svn checkout svn://svn.tuxfamily.org/svnroot/qet/qet/trunk/ Qet-svn/ 

Appuyer sur la touche « entrer » de votre clavier et patienter …

Faire un package avec l'application

Ouvrir le terminal, taper la commande, « bash » plus un espace, et glisser le fichier « MacQetDeploy.sh » se trouvant dans le dossier /Qet-svn/misc/. Appuyer sur la touche « entrer » de votre clavier et patienter …

Vérifier qu'il n’y a pas d’erreur :

Si les erreurs suivantes se produisent, ignorer les, elles correspondent aux bibliothèques mysql et PostgreSQL qui ne sont pas utilisées :

ERROR: no file at "/opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib"
ERROR: no file at "/usr/local/lib/libpq.5.dylib"

Le script vient de télécharger la dernière mise à jour des sources, les compiler, et placer l’application dans un fichier .dmg près à être distribué. L’image disque a comme nom, qelectrotech_ suivi du numéro de version puis du numéro de révision. Elle se trouve dans : /packaging/mac-osx/

Un lien vers la documentation, un dossier d'exemples, et un raccourci du dossier Applications sont également inclus dans l’image disque.

Problèmes connus, remarques, doléances

le fichier info.plist est incomplet à ce jour donc : * pas d’icon sur les sauvegardes de projet (fichier.qet), * pas de possibilité de lancer l’application en cliquant sur une sauvegarde (fichier.qet), ni sur un element (fichier.elmt) ou un cartouche (fichier.titleblock) comme sur les autres OS Linux et MS Windows.

Voir → info.plist info.plist

Application Bundles.

Document-Based App Programming Guide for Mac

CFBundleDocumentTypes

Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeIconFile</key>
			<string>elmt</string>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>elmt</string>
			</array>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
		</dict>
		<dict>
			<key>CFBundleTypeIconFile</key>
			<string>titleblock</string>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>titleblock</string>
			</array>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
		</dict>
		<dict>
			<key>CFBundleTypeIconFile</key>
			<string>qet</string>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>qet</string>
			</array>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
		</dict>
	</array>
	<key>CFBundleExecutable</key>
	<string>qelectrotech</string>
	<key>CFBundleIconFile</key>
	<string>qelectrotech.icns</string>
	<key>CFBundleIdentifier</key>
	<string>org.qelectrotech</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>NOTE</key>
	<string>This file was generated by Qt/QMake.</string>
	<key>CFBundleShortVersionString</key>
	<string></string>
	<key>NSHighResolutionCapable</key>
	<string>YES</string>
	<key>NSHighResolutionMagnifyAllowed</key>
	<string>NO</string>
	<key>NSHumanReadableCopyright</key>
	<string>GNU Public License, Version 2, June 1991</string>
	<key>NSPrincipalClass</key>
	<string>NSApplication</string>
</dict>
</plist>
defaults write com.apple.LaunchServices LSHandlers -array-add "<dict><key>LSHandlerContentTag</key> <string>qet</string><key>LSHandlerContentTagClass</key> <string>public.filename-extension</string><key>LSHandlerRoleAll</key> <string>com.qelectrotech</string></dict>"
defaults write com.apple.LaunchServices LSHandlers -array-add "<dict><key>LSHandlerContentTag</key> <string>elmt</string><key>LSHandlerContentTagClass</key> <string>public.filename-extension</string><key>LSHandlerRoleAll</key> <string>com.qelectrotech</string></dict>"
defaults write com.apple.LaunchServices LSHandlers -array-add "<dict><key>LSHandlerContentTag</key> <string>titleblock</string><key>LSHandlerContentTagClass</key> <string>public.filename-extension</string><key>LSHandlerRoleAll</key> <string>com.qelectrotech</string></dict>"
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user
Imprimer/exporter