Ticket #49925: kf5-1.1.tcl

File kf5-1.1.tcl, 20.2 KB (added by RJVB (René Bertin), 8 years ago)

the KF5 PortGroup. It has a 1.1 version out of recognition for Marko's 1.0 version

Line 
1# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id: kf5-1.0.tcl 134210 2015-03-20 06:40:18Z mk@macports.org $
3
4# Copyright (c) 2015 The MacPorts Project
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are
9# met:
10#
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16# 3. Neither the name of Apple Computer, Inc. nor the names of its
17#    contributors may be used to endorse or promote products derived from
18#    this software without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31#
32#
33# Usage:
34# PortGroup     kf5 1.0
35
36PortGroup               cmake 1.0
37# set qt5.prefer_kde      1
38PortGroup               qt5-kde 1.0
39
40########################################################################
41# Projects including the 'kf5' port group can optionally set
42#
43#  - their project name as 'kf5.project'
44#
45# in that case, they should specify whether they are
46#
47#  - a framework by defining 'kf5.framework'
48#
49#  - a porting aid by defining 'kf5.portingAid'
50#
51#  - or a regular KF5 project which requires setting
52#    + a virtual path in 'kf5.virtualPath' (e.g. "applications")
53#    + as well as (optionally) a release in 'kf5.release' (e.g. "15.04.2")
54#    + or (optionally) a plasma version in 'kf5.plasma' (e.g. 5.4.3)
55#
56# otherwise the port will fail to build.
57########################################################################
58
59if { ![ info exists kf5.project ] } {
60    ui_debug "kf5.project is not defined; falling back to \"manual\" configuration"
61} else {
62    name                kf5-${kf5.project}
63}
64
65# KF5 frameworks current version, which is the same for all frameworks
66if {![info exists kf5.version]} {
67    set kf5.version     5.16.0
68}
69
70# KF5 Applications version
71if {![ info exists kf5.release ]} {
72    set kf5.release     15.08.3
73}
74
75# KF5 Plasma version
76if {![ info exists kf5.plasma ]} {
77    set kf5.plasma      5.4.3
78}
79
80platforms               darwin linux
81categories              kde kf5 devel
82license                 GPL-2+
83
84set kf5.branch           [join [lrange [split ${kf5.version} .] 0 1] .]
85
86# Make sure to not use any already installed headers and libraries;
87# these are set in CPATH and LIBRARY_PATH anyway.
88configure.ldflags-delete  -L${prefix}/lib
89configure.cppflags-delete -I${prefix}/include
90
91# setup all KF5 ports to build in a separate directory from the source:
92cmake.out_of_source     yes
93
94set kf5.pyversion       2.7
95set kf5.pybranch        [join [lrange [split ${kf5.pyversion} .] 0 1] ""]
96if {${os.platform} eq "darwin"} {
97    # this should probably become under control of a variant
98    set kf5.pythondep   port:python27
99    set kf5.pylibdir    ${frameworks_dir}/Python.framework/Versions/${kf5.pyversion}/lib/python${kf5.pyversion}
100} elseif {${os.platform} eq "linux"} {
101    # for personal use: don't add a python dependency.
102    set kf5.pythondep   bin:python:python27
103}
104
105# TODO:
106#
107# Phonon added as library dependency here as most, if not all KDE
108# programs current need it.  The phonon port, which includes this
109# PortGroup overrides depends_lib, removing "port:phonon" to prevent a
110# cyclic dependency
111#depends_lib-append      port:phonon
112
113# This is used by all KF5 frameworks
114depends_lib-append      path:share/ECM/cmake/ECMConfig.cmake:kde-extra-cmake-modules
115
116# Use directory set by qt5-kde or qt5-mac
117configure.args-append   -DECM_MKSPECS_INSTALL_DIR=${qt_mkspecs_dir}
118
119# set a best-compromise plugin destination directory, the one from Qt5.
120# this is also what Kubuntu does, and possibly the only way to ensure that Qt5
121# and KF5 find each other's (and their own...) plugins.
122configure.args-append   -DPLUGIN_INSTALL_DIR=${qt_plugins_dir} \
123                        -DKDE_INSTALL_QTPLUGINDIR=${qt_plugins_dir}
124
125# # This is why we need destroo.violate_mtree set to "yes"
126# configure.args-append   -DCONFIG_INSTALL_DIR="/Library/Preferences" \
127#                         -DDATA_INSTALL_DIR="/Library/Application Support"
128#
129# Actually this should be used instead of DATA_INSTALL_DIR, but it doesn't work:
130#                       -DKDE_INSTALL_DATADIR_KF5="/Library/Application Support"
131
132# Q: What about the often used XDG dir?
133#    (Currently it gets installed into /etc/xdg just like on Linux.)
134
135# standard configure args
136configure.args-append   -DBUILD_doc=OFF \
137                        -DBUILD_docs=OFF \
138                        -DBUILD_SHARED_LIBS=ON
139if {${os.platform} eq "darwin"} {
140    set kf5.applications_dir \
141                        ${applications_dir}/KF5
142    set kf5.libexec_dir ${prefix}/libexec/kde5
143    configure.args-append \
144                        -DBUNDLE_INSTALL_DIR=${kf5.applications_dir} \
145                        -DCMAKE_DISABLE_FIND_PACKAGE_X11=ON \
146                        -DAPPLE_SUPPRESS_X11_WARNING=ON \
147                        -DCMAKE_INSTALL_LIBEXECDIR=${prefix}/libexec \
148                        -DKDE_INSTALL_LIBEXECDIR=${kf5.libexec_dir}
149} elseif {${os.platform} eq "linux"} {
150    set kf5.applications_dir \
151                        ${prefix}/bin
152    set kf5.libexec_dir ${prefix}/lib/${os.arch}-linux-gnu/libexec
153    configure.args-delete \
154                        -DCMAKE_INSTALL_RPATH=${prefix}/lib
155    configure.args-append \
156                        -DCMAKE_PREFIX_PATH=${prefix} \
157                        -DCMAKE_INSTALL_RPATH="${prefix}/lib/${os.arch}-linux-gnu\;${prefix}/lib"
158}
159set kf5.docs_dir        ${prefix}/share/doc/kf5
160
161set kf5.allow_docs_generation \
162                        yes
163variant docs description {build and install the documentation, for use with Qt's Assistant and KDevelop} {
164    configure.args-delete \
165                        -DBUILD_doc=OFF \
166                        -DBUILD_docs=OFF
167    if {${subport} ne "kf5-kapidox"} {
168        if {[info exists kf5.allow_docs_generation]} {
169            kf5.depends_build_frameworks \
170                        kapidox
171            post-destroot {
172                ui_msg "--->  Generating documentation for ${subport}"
173                # generate the documentation, working from ${build.dir}
174                system -W ${build.dir} "kgenapidox --qhp --searchengine --api-searchbox \
175                    --qtdoc-dir ${qt_docs_dir} --kdedoc-dir ${kf5.docs_dir} \
176                    --qhelpgenerator ${qt_bins_dir}/qhelpgenerator ${worksrcpath}"
177                xinstall -m 755 -d ${destroot}${kf5.docs_dir}
178                # after creating the destination, copy all generated qch documentation to it
179                foreach doc [glob -nocomplain ${build.dir}/apidocs/qch/*.qch] {
180                    if {${doc} ne "${build.dir}/apidocs/qch/None.qch"} {
181                        xinstall -m 644 ${doc} ${destroot}${kf5.docs_dir}
182                    }
183                }
184                # cleanup
185                file delete -force ${build.dir}/apidocs
186            }
187        }
188    }
189}
190
191if {${os.platform} eq "darwin"} {
192   set kf5.libs_dir    ${prefix}/lib
193   set kf5.libs_ext    dylib
194} elseif {${os.platform} eq "linux"} {
195   set kf5.libs_dir    ${prefix}/lib/${os.arch}-linux-gnu
196   set kf5.libs_ext    so
197}
198
199if {![info exists kf5.framework] && ![info exists kf5.portingAid]} {
200    # explicitly define certain headers and libraries, to avoid
201    # conflicts with those installed into system paths by the user.
202    configure.args-append \
203                        -DDOCBOOKXSL_DIR=${prefix}/share/xsl/docbook-xsl \
204                        -DGETTEXT_INCLUDE_DIR=${prefix}/include \
205                        -DGETTEXT_LIBRARY=${prefix}/lib/libgettextlib.${kf5.libs_ext} \
206                        -DGIF_INCLUDE_DIR=${prefix}/include \
207                        -DGIF_LIBRARY=${prefix}/lib/libgif.${kf5.libs_ext} \
208                        -DJASPER_INCLUDE_DIR=${prefix}/include \
209                        -DJASPER_LIBRARY=${prefix}/lib/libjasper.${kf5.libs_ext} \
210                        -DJPEG_INCLUDE_DIR=${prefix}/include \
211                        -DJPEG_LIBRARY=${prefix}/lib/libjpeg.${kf5.libs_ext} \
212                        -DLBER_LIBRARIES=${prefix}/lib/liblber.${kf5.libs_ext} \
213                        -DLDAP_INCLUDE_DIR=${prefix}/include \
214                        -DLDAP_LIBRARIES=${prefix}/lib/libldap.${kf5.libs_ext} \
215                        -DLIBEXSLT_INCLUDE_DIR=${prefix}/include \
216                        -DLIBEXSLT_LIBRARIES=${prefix}/lib/libexslt.${kf5.libs_ext} \
217                        -DLIBICALSS_LIBRARY=${prefix}/lib/libicalss.${kf5.libs_ext} \
218                        -DLIBICAL_INCLUDE_DIRS=${prefix}/include \
219                        -DLIBICAL_LIBRARY=${prefix}/lib/libical.${kf5.libs_ext} \
220                        -DLIBINTL_INCLUDE_DIR=${prefix}/include \
221                        -DLIBINTL_LIBRARY=${prefix}/lib/libintl.${kf5.libs_ext} \
222                        -DLIBXML2_INCLUDE_DIR=${prefix}/include/libxml2 \
223                        -DLIBXML2_LIBRARIES=${prefix}/lib/libxml2.${kf5.libs_ext} \
224                        -DLIBXML2_XMLLINT_EXECUTABLE=${prefix}/bin/xmllint \
225                        -DLIBXSLT_INCLUDE_DIR=${prefix}/include \
226                        -DLIBXSLT_LIBRARIES=${prefix}/lib/libxslt.${kf5.libs_ext} \
227                        -DOPENAL_INCLUDE_DIR=/System/Library/Frameworks/OpenAL.framework/Headers \
228                        -DOPENAL_LIBRARY=/System/Library/Frameworks/OpenAL.framework \
229                        -DPNG_INCLUDE_DIR=${prefix}/include \
230                        -DPNG_PNG_INCLUDE_DIR=${prefix}/include \
231                        -DPNG_LIBRARY=${prefix}/lib/libpng.${kf5.libs_ext} \
232                        -DTIFF_INCLUDE_DIR=${prefix}/include \
233                        -DTIFF_LIBRARY=${prefix}/lib/libtiff.${kf5.libs_ext}
234}
235
236proc kf5.set_paths {} {
237    upvar #0 kf5.virtualPath vp
238    upvar #0 kf5.folder f
239    global kf5.portingAid
240    global kf5.framework
241    global kf5.branch
242    if { [ info exists kf5.portingAid ] } {
243        set vp          "frameworks"
244        set f           "frameworks/${kf5.branch}/portingAids"
245    }
246
247    if { [ info exists kf5.framework ] } {
248        set vp          "frameworks"
249        set f           "frameworks/${kf5.branch}"
250    }
251}
252kf5.set_paths
253
254proc kf5.is_framework {} {
255    upvar #0 kf5.portingAid pa
256    upvar #0 kf5.framework f
257    unset pa
258    set f yes
259    kf5.set_paths
260}
261
262proc kf5.is_portingAid {} {
263    upvar #0 kf5.portingAid pa
264    upvar #0 kf5.framework f
265    unset f
266    set pa yes
267    kf5.set_paths
268}
269
270proc kf5.set_project {project} {
271    upvar #0 kf5.project p
272    upvar #0 kf5.folder f
273    global kf5.framework
274    global kf5.portingAid
275    global kf5.release
276    global kf5.plasma
277    global kf5.virtualPath
278    global kf5.version
279    set p ${project}
280    if { ![ info exists kf5.framework ] && ![ info exists kf5.portingAid ] } {
281        if { ![ info exists kf5.virtualPath ] } {
282            ui_error "You haven't defined kf5.virtualPath, which is mandatory for any KF5 port that uses kf5.project. \
283            (Or is this project perhaps a framework or porting aid?)"
284            return -code error "incomplete port definition"
285        } else {
286            if { ![info exists kf5.release] && ![info exists kf5.plasma]} {
287                ui_error "You haven't defined kf5.release or kf5.plasma, which is mandatory for any KF5 port that uses kf5.project."
288                return -code error "incomplete port definition"
289            } else {
290                if {${kf5.virtualPath} eq "plasma"} {
291                    set f   "${kf5.virtualPath}/${kf5.plasma}"
292                    distname \
293                            ${project}-${kf5.plasma}
294                    version \
295                            ${kf5.plasma}
296                } else {
297                    set f   "${kf5.virtualPath}/${kf5.release}/src"
298                    distname \
299                            ${project}-${kf5.release}
300                    version \
301                            ${kf5.release}
302                }
303            }
304        }
305    } else {
306        distname            ${project}-${kf5.version}
307    }
308    homepage                http://projects.kde.org/projects/${kf5.virtualPath}/${project}
309    master_sites            http://download.kde.org/stable/${f}
310    use_xz                  yes
311}
312if {[info exists kf5.project]} {
313    kf5.set_project     ${kf5.project}
314}
315# maintainers             gmail.com:rjvbertin mk openmaintainer
316
317post-fetch {
318    if {[file exists ${worksrcpath}/examples] && [file isdirectory ${worksrcpath}/examples] && ![variant_exists examples]} {
319        ui_msg "This port could provide a +examples variant"
320    }
321}
322
323post-build {
324    if {[file exists ${prefix}/bin/afsctool]} {
325        ui_msg "--->  Compressing build directory ..."
326        if {[catch {system "${prefix}/bin/afsctool -cfvv -8 -J${build.jobs} ${build.dir} 2>&1"} result context]} {
327            ui_msg "Compression failed: ${result}, ${context}; port:afsctool is probably installed without support for parallel compression"
328        } else {
329            ui_debug "Compressing ${build.dir}: ${result}"
330        }
331    }
332}
333
334post-activate {
335    if {[file exists ${prefix}/bin/kbuildsycoca5]} {
336        ui_msg "--->  Updating KDE's global desktop file system configuration cache ..."
337        system "${prefix}/bin/kbuildsycoca5 --global"
338    }
339}
340
341proc kf5.add_test_library_path {path} {
342    global os.platform
343    if {${os.platform} eq "darwin"} {
344        test.env    DYLD_LIBRARY_PATH=${path}
345    } else {
346        test.env    LD_LIBRARY_PATH=${path}
347    }
348}
349
350# variables to facilitate setting up dependencies to KF5 frameworks that may (or not)
351# also exist as port:kf5-foo-devel .
352# This may be extended to provide path-style *runtime* dependencies on framework executables;
353# kf5.framework_runtime_dependency{name {executable 0}} and kf5.depends_run_frameworks
354# (which would have to add a library dependency if no executable dependency is defined).
355proc kf5.framework_dependency {name {library 0}} {
356    upvar #0 kf5.${name}_dep dep
357    if {${library} ne 0} {
358        global os.platform os.arch
359        if {${os.platform} eq "darwin"} {
360            set kf5.lib_path    lib
361            set kf5.lib_ext     5.dylib
362        } elseif {${os.platform} eq "linux"} {
363            set kf5.lib_path    lib/${os.arch}-linux-gnu
364            set kf5.lib_ext     so.5
365        }
366        set dep                 path:${kf5.lib_path}/${library}.${kf5.lib_ext}:kf5-${name}
367        ui_debug "Dependency expression for KF5ramework ${name}: ${dep}"
368    } else {
369        if {[info exists dep]} {
370            return ${dep}
371        } else {
372            set allknown [info global "kf5.*_dep"]
373            ui_error "No KF5 framework is known corresponding to \"${name}\""
374            ui_msg "Known framework ports: ${allknown}"
375            return -code error "Unknown KF5 framework ${name}"
376        }
377    }
378}
379
380# kf5.depends_frameworks appends the ports corresponding to the KF5 Frameworks
381# short names to depends_lib
382proc kf5.depends_frameworks {first args} {
383    depends_lib-append  [kf5.framework_dependency ${first}]
384    foreach f ${args} {
385        depends_lib-append \
386                        [kf5.framework_dependency ${f}]
387    }
388}
389proc kf5.depends_build_frameworks {first args} {
390    depends_build-append \
391                        [kf5.framework_dependency ${first}]
392    foreach f ${args} {
393        depends_build-append \
394                        [kf5.framework_dependency ${f}]
395    }
396}
397
398kf5.framework_dependency    attica libKF5Attica
399kf5.framework_dependency    karchive libKF5Archive
400kf5.framework_dependency    kcoreaddons libKF5CoreAddons
401kf5.framework_dependency    kauth libKF5Auth
402kf5.framework_dependency    kconfig libKF5ConfigCore
403kf5.framework_dependency    kcodecs libKF5Codecs
404kf5.framework_dependency    ki18n libKF5I18n
405# kf5-kdoctools does install a static library but I don't know if it has dependents
406set kf5.kdoctools_dep       path:bin/meinproc5:kf5-kdoctools
407kf5.framework_dependency    kguiaddons libKF5GuiAddons
408kf5.framework_dependency    kwidgetsaddons libKF5WidgetsAddons
409kf5.framework_dependency    kconfigwidgets libKF5ConfigWidgets
410kf5.framework_dependency    kitemviews libKF5ItemViews
411kf5.framework_dependency    kiconthemes libKF5IconThemes
412kf5.framework_dependency    kwindowsystem libKF5WindowSystem
413kf5.framework_dependency    kcrash libKF5Crash
414set kf5.kapidox_dep         path:bin/kgenapidox:kf5-kapidox
415kf5.framework_dependency    kdbusaddons libKF5DBusAddons
416kf5.framework_dependency    kdnssd libKF5DNSSD
417kf5.framework_dependency    kidletime libKF5IdleTime
418set kf5.kimageformats_dep   port:kf5-kimageformats
419kf5.framework_dependency    kitemmodels libKF5ItemModels
420kf5.framework_dependency    kplotting libKF5Plotting
421set kf5.oxygen-icons_dep    path:share/icons/oxygen/index.theme:kf5-oxygen-icons
422kf5.framework_dependency    solid libKF5Solid
423kf5.framework_dependency    sonnet libKF5SonnetCore
424kf5.framework_dependency    threadweaver libKF5ThreadWeaver
425kf5.framework_dependency    kcompletion libKF5Completion
426kf5.framework_dependency    kfilemetadata libKF5FileMetaData
427kf5.framework_dependency    kjobwidgets libKF5JobWidgets
428kf5.framework_dependency    knotifications libKF5Notifications
429kf5.framework_dependency    kunitconversion libKF5UnitConversion
430kf5.framework_dependency    kpackage libKF5Package
431kf5.framework_dependency    kservice libKF5Service
432kf5.framework_dependency    ktextwidgets libKF5TextWidgets
433kf5.framework_dependency    kglobalaccel libKF5GlobalAccel
434kf5.framework_dependency    kxmlgui libKF5XmlGui
435kf5.framework_dependency    kbookmarks libKF5Bookmarks
436kf5.framework_dependency    kwallet libKF5Wallet
437kf5.framework_dependency    kio libKF5KIOCore
438kf5.framework_dependency    baloo libKF5Baloo
439kf5.framework_dependency    kdeclarative libKF5Declarative
440kf5.framework_dependency    kcmutils libKF5KCMUtils
441kf5.framework_dependency    kemoticons libKF5Emoticons
442# this is really a framework...
443kf5.framework_dependency    gpgmepp libKF5Gpgmepp
444# kf5-kinit does install a library but it may not be the best choice as a dependency:
445# hard to tell at this moment how many dependents actually use that rather than
446# depending on one of the framework's executables.
447kf5.framework_dependency    kinit libkdeinit5_klauncher
448kf5.framework_dependency    kded libkdeinit5_kded5
449kf5.framework_dependency    kparts libKF5Parts
450kf5.framework_dependency    kdewebkit libKF5WebKit
451set kf5.kdesignerplugin_dep path:bin/kgendesignerplugin:kf5-kdesignerplugin
452kf5.framework_dependency    kpty libKF5Pty
453kf5.framework_dependency    kdelibs4support libKF5KDELibs4Support
454kf5.framework_dependency    frameworkintegration libKF5Style
455kf5.framework_dependency    kpeople libKF5People
456kf5.framework_dependency    ktexteditor libKF5TextEditor
457kf5.framework_dependency    kxmlrpcclient libKF5XmlRpcClient
458kf5.framework_dependency    kactivities libKF5Activities
459kf5.framework_dependency    kdesu libKF5Su
460kf5.framework_dependency    knewstuff libKF5NewStuff
461kf5.framework_dependency    knotifyconfig libKF5NotifyConfig
462kf5.framework_dependency    plasma-framework libKF5Plasma
463
464# see also http://api.kde.org/frameworks-api/frameworks5-apidocs/attica/html/index.html
465
466notes "
467Don't forget that dbus needs to be started as the local\
468user (not with sudo) before any KDE programs will launch.
469To start it run the following command:
470 launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
471"
472
473# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;