CMakeLists.txt 14.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Script to build KF5 Frameworks for digiKam bundle.
#
# Copyright (c) 2015-2020 by Gilles Caulier  <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

set(EXTPREFIX_frameworks "${EXTPREFIX}")

function(InstallKF5Component
         name
         version
         argoptions
         patch)

    if(MINGW)

        # Extract MD5 sums of each KF5 components directly from server.
        execute_process(COMMAND
                        wget -q -O - -o /dev/null http://download.kde.org/stable/frameworks/${version}/${name}-${version}.0.tar.xz.mirrorlist
                        COMMAND
                        grep "MD5 Hash"
                        COMMAND
                        grep -o -P "(?<=<tt>).*(?=</tt>)"
                        RESULT_VARIABLE
                        wgetresult
                        OUTPUT_VARIABLE
                        md5sm
                        OUTPUT_STRIP_TRAILING_WHITESPACE
        )

        if(NOT ${wgetresult} MATCHES 0)
            message(WARNING "Cannot download MD5 sum for ${name}!")
        endif()

        message(STATUS "--------------------------------")
        message(STATUS "KF5 component    : ${name}")
        message(STATUS "Component version: ${version}")
        message(STATUS "Component MD5    : ${md5sm}")
        message(STATUS "Configure options: ${argoptions}")
        message(STATUS "Patch to apply   : ${patch}")

        if(NOT "${patch}" STREQUAL "")
            set(patch "${PATCH_COMMAND};-p1;-i;${CMAKE_CURRENT_SOURCE_DIR}/${patch}")
        endif()

        ExternalProject_Add(ext_${name}
                            DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
                            URL file://${EXTERNALS_DOWNLOAD_DIR}/${name}-${version}.0.tar.xz
                            URL_MD5 ${md5sm}

                            INSTALL_DIR ${EXTPREFIX_frameworks}

                            CMAKE_ARGS -DMXE_TOOLCHAIN=${MXE_TOOLCHAIN}
                                       -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE}
                                       -DCMAKE_COLOR_MAKEFILE=ON
                                       -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks}
                                       -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
                                       -DCMAKE_TOOLCHAIN_FILE=${MXE_TOOLCHAIN}
                                       -DCMAKE_FIND_PREFIX_PATH=${CMAKE_PREFIX_PATH}
                                       -DCMAKE_SYSTEM_INCLUDE_PATH=${CMAKE_PREFIX_PATH}/include
                                       -DCMAKE_INCLUDE_PATH=${CMAKE_PREFIX_PATH}/include
                                       -DCMAKE_LIBRARY_PATH=${CMAKE_PREFIX_PATH}/lib
                                       -DBUILD_TESTING=OFF
                                       -DZLIB_ROOT=${CMAKE_PREFIX_PATH}
                                       -DINSTALL_ROOT=${MXE_INSTALL_PREFIX}
                                       ${GLOBAL_PROFILE}
                                       "${argoptions}"
                                       -Wno-dev

                            PATCH_COMMAND ${patch}
                            UPDATE_COMMAND ""
                            ALWAYS 0
        )

        ExternalProject_Add_step(ext_${name} before_download

            # Note : under MXE, curl is not compiled with https support. We cannot use the tarball as under Linux/MacOS.
            COMMAND wget -N http://download.kde.org/stable/frameworks/${version}/${name}-${version}.0.tar.xz -O ${EXTERNALS_DOWNLOAD_DIR}/${name}-${version}.0.tar.xz
            DEPENDERS download
        )

    elseif(APPLE)

        # Extract MD5 sums of each KF5 components directly from server.
        execute_process(COMMAND
                            wget -q -O - -o /dev/null http://download.kde.org/stable/frameworks/${version}/${name}-${version}.0.tar.xz.mirrorlist
                        COMMAND
                            grep "MD5 Hash"
                        COMMAND
                            grep -o "<tt>.*</tt>"
                        COMMAND
                            cut -c 5-
                        COMMAND
                            rev
                        COMMAND
                            cut -c 6-
                        COMMAND
                            rev
                        RESULT_VARIABLE
                            wgetresult
                        OUTPUT_VARIABLE
                            md5sm
                        OUTPUT_STRIP_TRAILING_WHITESPACE
        )

        if(NOT ${wgetresult} MATCHES 0)
            message(WARNING "Cannot download MD5 sum for ${name}!")
        endif()

        message(STATUS "--------------------------------")
        message(STATUS "KF5 component    : ${name}")
        message(STATUS "Component version: ${version}")
        message(STATUS "Component MD5    : ${md5sm}")
        message(STATUS "Configure options: ${argoptions}")
        message(STATUS "Patch to apply   : ${patch}")

        if(NOT "${patch}" STREQUAL "")
            set(patch "${PATCH_COMMAND};-p1;-i;${CMAKE_CURRENT_SOURCE_DIR}/${patch};&&")
        endif()

        ExternalProject_Add(ext_${name}
                            DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
                            URL http://download.kde.org/stable/frameworks/${version}/${name}-${version}.0.tar.xz
                            URL_MD5 ${md5sm}

                            PATCH_COMMAND ${patch}
                                          cp ${CMAKE_CURRENT_SOURCE_DIR}/../../macports/fixbundledatapath.sh <SOURCE_DIR>/. &&
                                          <SOURCE_DIR>/fixbundledatapath.sh

                            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}"

                            BUILD_COMMAND cd <SOURCE_DIR>/build && $(MAKE)

                            INSTALL_COMMAND cd <SOURCE_DIR>/build && make install/fast

                            BUILD_IN_SOURCE 1

                            UPDATE_COMMAND ""
                            ALWAYS 0
        )

    else() # Linux

        # Extract MD5 sums of each KF5 components directly from server.
        execute_process(COMMAND
                        wget -q -O - -o /dev/null http://download.kde.org/stable/frameworks/${version}/${name}-${version}.0.tar.xz.mirrorlist
                        COMMAND
                        grep "MD5 Hash"
                        COMMAND
                        grep -o -P "(?<=<tt>).*(?=</tt>)"
                        RESULT_VARIABLE
                        wgetresult
                        OUTPUT_VARIABLE
                        md5sm
                        OUTPUT_STRIP_TRAILING_WHITESPACE
        )

        if(NOT ${wgetresult} MATCHES 0)
            message(WARNING "Cannot download MD5 sum for ${name}!")
        endif()

        message(STATUS "--------------------------------")
        message(STATUS "KF5 component    : ${name}")
        message(STATUS "Component version: ${version}")
        message(STATUS "Component MD5    : ${md5sm}")
        message(STATUS "Configure options: ${argoptions}")
        message(STATUS "Patch to apply   : ${patch}")

        if(NOT "${patch}" STREQUAL "")
            set(patch "${PATCH_COMMAND};-p1;-i;${CMAKE_CURRENT_SOURCE_DIR}/${patch}")
        endif()

        ExternalProject_Add(ext_${name}
                            DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
                            URL http://download.kde.org/stable/frameworks/${version}/${name}-${version}.0.tar.xz
                            URL_MD5 ${md5sm}

                            PATCH_COMMAND ${patch}

                            INSTALL_DIR ${EXTPREFIX_frameworks}
                            CMAKE_ARGS ${CMAKE_GLOBAL_PROFILE}
                                       -DBUILD_TESTING=OFF
                                       "${argoptions}"
                                       -Wno-dev
                            UPDATE_COMMAND ""
                            ALWAYS 0
        )

    endif()

endfunction()

if(MINGW)
Julius Künzel's avatar
Julius Künzel committed
198
    set(KF5_VERSION 5.81) # we have Qt 5.14.2 available.
199
elseif(APPLE)
Julius Künzel's avatar
Julius Künzel committed
200
    set(KF5_VERSION 5.81) # we have Qt 5.14.1 available.
201
else()
Julius Künzel's avatar
Julius Künzel committed
202
    set(KF5_VERSION 5.81) # we have Qt 5.14.2 available.
203
204
205
206
207
208
209
210
211
212
endif()

if(APPLE)
    set(MacosThreadWeaverPatch threadweaver-macports.patch)
    set(MacosKauthBackend -DKAUTH_BACKEND_NAME=Apple)
endif()

InstallKF5Component(extra-cmake-modules ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kconfig             ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(breeze-icons        ${KF5_VERSION} "-DBINARY_ICONS_RESOURCE=OFF"                                        "${MacosBreezePatch}")
213
InstallKF5Component(solid               ${KF5_VERSION} ""                                                                   "fix-solid-compile.diff")
214
215
216
217
218
219
220
221
222
223
224
InstallKF5Component(kcoreaddons         ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(threadweaver        ${KF5_VERSION} ""                                                                   "${MacosThreadWeaverPatch}")
InstallKF5Component(kwindowsystem       ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(karchive            ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kdbusaddons         ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(ki18n               ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kcrash              ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kpackage            ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kcodecs             ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kauth               ${KF5_VERSION} "${MacosKauthBackend}"                                               "")
InstallKF5Component(knewstuff           ${KF5_VERSION} ""                                                                   "")
225
InstallKF5Component(kguiaddons          ${KF5_VERSION} "-DWITH_WAYLAND=OFF"                                                                   "")
226
227
228
229
230
231
232
233
234
235
236
237
InstallKF5Component(kwidgetsaddons      ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kdeclarative        ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kitemviews          ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kcompletion         ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kconfigwidgets      ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kiconthemes         ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kservice            ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kglobalaccel        ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kxmlgui             ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kbookmarks          ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kdoctools          ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kimageformats       ${KF5_VERSION} ""                                                                   "")
238
239
InstallKF5Component(knotifyconfig       ${KF5_VERSION} ""                                                                   "knotifyconfig-drop-phonon.diff")
InstallKF5Component(knotifications      ${KF5_VERSION} ""                                                                   "knotifications-drop-phonon.diff")
240
241
242
243
244
245
InstallKF5Component(kjobwidgets         ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(sonnet              ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(ktextwidgets        ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(attica                 ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kio                 ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(frameworkintegration ${KF5_VERSION} ""                                                                   "")
246
247
InstallKF5Component(kirigami2           ${KF5_VERSION} ""                                                                   "")
InstallKF5Component(kactivities         ${KF5_VERSION} ""                                                                   "")
248
InstallKF5Component(qqc2-desktop-style  ${KF5_VERSION} ""                                                                   "")
249
InstallKF5Component(plasma-framework    ${KF5_VERSION} ""                                                                   "")
250
251
252
253

ExternalProject_Add(
  ext_kdecoration
  DOWNLOAD_DIR ${EXT_DOWNLOAD_DIR}
254
255
  URL http://download.kde.org/stable/plasma/5.19.5/kdecoration-5.19.5.tar.xz
  URL_MD5 3cc5be057c571dc20775ac52a6af2908
256
257
258
259
260
261
  CMAKE_ARGS ${CMAKE_GLOBAL_PROFILE}
)

ExternalProject_Add(
  ext_breeze
  DOWNLOAD_DIR ${EXT_DOWNLOAD_DIR}
262
263
  URL http://download.kde.org/stable/plasma/5.19.5/breeze-5.19.5.tar.xz
  URL_MD5 f664f181d10c4cbbe4b385068c75539a
264
  PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/breeze_constexpr.diff
265
266
267
  CMAKE_ARGS ${CMAKE_GLOBAL_PROFILE}
  DEPENDS ext_kdecoration
)
268
269
270
271
272
273
274
275
276

#ExternalProject_Add(
#  ext_plasma-framework
#  DOWNLOAD_DIR ${EXT_DOWNLOAD_DIR}
#  URL http://download.kde.org/stable/frameworks/5.68/plasma-framework-5.68.0.zip
#  URL_MD5 dd2741b632ad0e7589e00ef39a605422
#  CMAKE_ARGS ${CMAKE_GLOBAL_PROFILE}
#  DEPENDS ext_kactivities
#)