Bump version to 0.36.9
[cygport.git] / cygclass / kde4.cygclass
blobbc7664114719ea8d99c6c9f24d620eac10d623d2
1 ################################################################################
3 # kde4.cygclass - functions for building KDE 4.x packages
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport.  If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****h* Cygclasses/kde4.cygclass
25 #  SYNOPSIS
26 #  inherit kde4
27 #  DESCRIPTION
28 #  The KDE project provides a full-featured X desktop with a wide variety
29 #  of applications, built on a library stack all based on the Qt C++ libraries.
30 #  Most packages are written in C++ and are built with CMake.
32 #  This cygclass manages the building of most KDE4-based packages.
33 #  INHERITS
34 #  cmake.cygclass, kde.org.cygclass, qt4.cygclass
35 #****
37 inherit cmake qt4 kde.org
39 #****v* kde4.cygclass/KDE4_EXTRAGEAR_VERSION
40 #  DESCRIPTION
41 #  KDE Extragear is a collection of software which is part of the KDE project
42 #  but which is not included in the main KDE Software Compilation modules.
43 #  Some of these applications are released in tandem with a KDE SC release but
44 #  use their own versioning system.  Such packages should use their own version
45 #  number as PV and define KDE4_EXTRAGEAR_VERSION to indicate with which
46 #  version of KDE SC they were released.
47 #  NOTE
48 #  If needed, this must be defined before inherit()ing kde4.cygclass.
49 #****
50 if defined KDE4_EXTRAGEAR_VERSION
51 then
52         HOMEPAGE="https://apps.kde.org/${PN}/"
53         SRC_URI="mirror://kde/stable/${KDE4_EXTRAGEAR_VERSION}/src/extragear/${P}-kde${KDE4_EXTRAGEAR_VERSION}.tar.bz2"
54         SRC_DIR="${P}-kde${KDE4_EXTRAGEAR_VERSION}"
57 case ${PN} in
58 calligra-l10n-*)
59 CYGPORT_USE_UNSTABLE_API=1
60 src_unpack_hook() {
61   rm -fv messages/calligra/{braindump,kexi,krita}*
62   if [ -e docs/calligra/CMakeLists.txt ]; then
63     sed -i -e 's/add_subdirectory( *kexi *)/#add_subdirectory(kexi)/g' docs/calligra/CMakeLists.txt
64   fi
66 ;; # calligra-l10n-*
67 kde-l10n-*)
68 CYGPORT_USE_UNSTABLE_API=1
69 src_unpack_hook() {
70   local i=${PN#kde-l10n-}
71   # ca@valencia: setup cannot handle '@' in PN
72   i=${i/-/@}
73   local j jj;
74   for jj in 4/. 4/${i}/${i}@* ; do
75     j=$(basename ${jj})
76     if [ -d 4/${i}/${j} ] ; then
77       # drop: kmouth, keep: jovie
78       if [ -e 4/$i/$j/docs/kdeaccessibility/CMakeLists.txt ] ; then
79         sed -i -e 's/add_subdirectory( *kmouth *)/#add_subdirectory(kmouth)/g' 4/$i/$j/docs/kdeaccessibility/CMakeLists.txt
80       fi
81       # drop: kimagemapeditor, keep: kfilereplace, klinkstatus
82       if [ -e 4/$i/$j/docs/kdewebdev/CMakeLists.txt ] ; then
83         sed -i -e 's/add_subdirectory( *kimagemapeditor *)/#add_subdirectory(kimagemapeditor)/g' 4/$i/$j/docs/kdeaccessibility/CMakeLists.txt
84       fi
85       # drop: all of kdegames, kdegraphics, kdemultimedia, kdenetwork, kdesdk, kdeutils
86       sed -i \
87           -e 's/add_subdirectory( *kdegames *)/#add_subdirectory(kdegames)/g' \
88           -e 's/add_subdirectory( *kdegraphics *)/#add_subdirectory(kdegraphics)/g' \
89           -e 's/add_subdirectory( *kdemultimedia *)/#add_subdirectory(kdemultimedia)/g' \
90           -e 's/add_subdirectory( *kdenetwork *)/#add_subdirectory(kdenetwork)/g' \
91           -e 's/add_subdirectory( *kdepim *)/#add_subdirectory(kdepim)/g' \
92           -e 's/add_subdirectory( *kdesdk *)/#add_subdirectory(kdesdk)/g' \
93           -e 's/add_subdirectory( *kdeutils *)/#add_subdirectory(kdeutils)/g' \
94           4/$i/$j/docs/CMakeLists.txt
95       rm -fv 4/$i/$j/messages/kdeaccessibility/kmouth*.po
96       rm -fv 4/$i/$j/messages/kdewebdev/kimagemapeditor*.po
97       rm -fv 4/$i/$j/messages/kde{games,graphics,multimedia,network,pim,sdk,utils}/*.po
99       # Remove translations shipped by Plasma 5 and KDE Frameworks 5
100       # Each Plasma 5 and KF5 app/library ship their own translations in their tarballs, so they
101       # often conflict with kde-l10n, since most of the catalogs still have the same name
103       # Provided by plasma-workspace and plasma-desktop
104       rm -fv 4/$i/$j/messages/kde-runtime/{attica_kde,knetattach,drkonqi,phonon_kde,soliduiserver}.po
105       rm -fv 4/$i/$j/messages/kde-runtime/kcm{_device_automounter,_emoticons,_phonon,componentchooser,icons,kded,notify}.po
106       rm -fv 4/$i/$j/messages/kde-runtime/kio_{applications,remote}.po
107       rm -fv 4/$i/$j/messages/kdelibs/{kcm_baloofile,plasma_runner_baloosearchrunner}.po
108       rm -fv 4/$i/$j/messages/applications/useraccount.po
109       if [ -e 4/$i/$j/docs/kde-runtime/CMakeLists.txt ]; then
110         sed -i -e 's/add_subdirectory( *documentationnotfound *)/#add_subdirectory(documentationnotfound)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
111         sed -i -e 's/add_subdirectory( *fundamentals *)/#add_subdirectory(fundamentals)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
112         sed -i -e 's/add_subdirectory( *glossary *)/#add_subdirectory(glossary)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
113         sed -i -e 's/add_subdirectory( *kcontrol *)/#add_subdirectory(kcontrol)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
114         sed -i -e 's/add_subdirectory( *kdesu *)/#add_subdirectory(kdesu)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
115         sed -i -e 's/add_subdirectory( *khelpcenter *)/#add_subdirectory(khelpcenter)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
116         sed -i -e 's/add_subdirectory( *knetattach *)/#add_subdirectory(knetattach)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
117         sed -i -e 's/add_subdirectory( *nepomuk *)/#add_subdirectory(nepomuk)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
118         sed -i -e 's/add_subdirectory( *onlinehelp *)/#add_subdirectory(onlinehelp)/g' 4/$i/$j/docs/kde-runtime/CMakeLists.txt
119       fi
120       # Provided by kdeplasma-addons
121       sed -i -e 's/add_subdirectory( *kdeplasma-addons *)/#add_subdirectory(kdeplasma-addons)/g' 4/$i/$j/messages/CMakeLists.txt
122       # Provided by kde-cli-tools
123       rm -fv 4/$i/$j/messages/kde-runtime/{filetypes,kcmshell,kdesu,kioclient,kmimetypefinder,kstart,ktraderclient}.po
124       # Provided by khelpcenter
125       rm -fv 4/$i/$j/messages/kde-runtime/{htmlsearch,kcmhtmlsearch,khelpcenter}.po
127       # Programs which we do not build on Cygwin
128       rm -fv 4/$i/$j/messages/kdelibs/nepomuk*
129       rm -fv 4/$i/$j/messages/kdegraphics/ksaneplugin.po
130       rm -fv 4/$i/$j/messages/kdemultimedia/kscd.po
131       rm -fv 4/$i/$j/messages/kdenetwork/kppp*.po
132       if [ -e 4/$i/$j/docs/kdenetwork/CMakeLists.txt ] ; then
133         sed -e 's/add_subdirectory( *kppp *)/#add_subdirectory(kppp)/g' \
134             -i 4/$i/$j/docs/kdenetwork/CMakeLists.txt
135       fi
136     fi
137   done
140 esac # kde-l10n-*
142 export QTDIR=${QT4_QTDIR}
143 export QT_PLUGIN_PATH=${QT4_PLUGINSDIR}
145 #****C* kde4.cygclass/kde4_cmake
146 #  SYNOPSIS
147 #  kde4_cmake [OPTIONS]
148 #  DESCRIPTION
149 #  Runs cygcmake to configure the package with several Cygwin- and KDE-specific
150 #  options.  Options, in the form of -DVARIABLE=VALUE,
151 #  are passed on to cygcmake.
152 #  NOTE
153 #  Source subdirectories which are declared with macro_optional_add_subdirectory()
154 #  in CMakeLists.txt can be disabled with '-DBUILD_foo=OFF' arguments.
155 #  REQUIRES
156 #  automoc4, cmake, libQtCore4-devel, libQtGui4-devel
157 #****
158 kde4_cmake() {
159         local skip skipargs
161         # for backwards compatibility with KDE3
162         for skip in ${DO_NOT_COMPILE}
163         do
164                 skipargs+=" -DBUILD_${skip}=OFF"
165         done
167         cygcmake \
168                 -DKDE4_BUILD_TESTS=OFF \
169                 -DKDE4_ENABLE_FINAL=OFF \
170                 -DKDE4_ENABLE_FPIE=OFF \
171                 -DKDE4_INCLUDE_DIR=${CROSS_INCLUDEDIR-/usr/include}/kde4 \
172                 -DKDE4_USE_ALWAYS_FULL_RPATH=OFF \
173                 -DKDE_DISTRIBUTION_TEXT=Cygwin \
174                 -DQT_QMAKE_EXECUTABLE=${QT4_QMAKE} \
175                 -DQT_MOC_EXECUTABLE=${QT4_MOC} \
176                 -DQT_INCLUDE_DIR=${QT4_INCLUDEDIR} \
177                 -DQT_LIBRARY_DIR=${QT4_LIBDIR} \
178                 -DQT_MKSPECS_DIR=${QT4_MKSPECSDIR} \
179                 -DQT_UIC_EXECUTABLE=${QT4_UIC} \
180                 -DQT_UIC3_EXECUTABLE=${QT4_UIC3} \
181                 -DQT_RCC_EXECUTABLE=${QT4_RCC} \
182                 -DQT_DBUSCPP2XML_EXECUTABLE=${QT4_BINDIR}/qdbuscpp2xml \
183                 -DQT_DBUSXML2CPP_EXECUTABLE=${QT4_BINDIR}/qdbusxml2cpp \
184                 -DQT_LRELEASE_EXECUTABLE=${QT4_LRELEASE} \
185                 -DQT_LUPDATE_EXECUTABLE=${QT4_BINDIR}/lupdate \
186                 -D__KDE_HAVE_GCC_VISIBILITY=NO \
187                 ${skipargs} \
188                 "${@}"
191 #****C* kde4.cygclass/kde4_compile
192 #  SYNOPSIS
193 #  kde4_compile [OPTIONS]
194 #  DESCRIPTION
195 #  Runs kde4_cmake, followed by cygmake to compile.  Options, in the form of
196 #  -DVARIABLE=VALUE, are passed on to kde4_cmake.
197 #****
198 kde4_compile() {
199         : ${CYGCMAKE_GENERATOR=Ninja}
200         kde4_cmake "${@}"
201         if [ -f build.ninja ]
202         then
203                 cygninja
204         else
205                 cygmake
206         fi
209 #****I* kde4.cygclass/kde4_install
210 #  SYNOPSIS
211 #  kde4_install [OPTIONS]
212 #  DESCRIPTION
213 #  Installs a KDE4 package with cyginstall into $D with some additional steps:
214 #  * Import libraries for libkdeinit4_* libraries are removed, as they are never used.
215 #  * README docs for subpackages in PKG_NAMES are installed into their own
216 #    subdirectories of /usr/share/doc/ under $D.
217 #  Options, if any, are passed on to cyginstall.
218 #****
219 kde4_install() {
220         local kdepkg
222         if [ -f build.ninja ]
223         then
224                 ninja_install
225         else
226                 cyginstall "${@}"
227         fi
229         rm -f ${D}/usr/lib/libkdeinit4_* ${D}/usr/lib/kde4/lib/libkdeinit4_*
231         for kdepkg in ${PKG_NAMES:-${PN}}
232         do
233                 if [ -d ${S}/${kdepkg} ]
234                 then
235                         docinto /${kdepkg}
236                         dodoc ${S}/${kdepkg}/{AUTHORS,BUGS,ChangeLog,NEWS,README,TODO}
237                 elif [ -d ${S}/${kdepkg#${PN}-} ]
238                 then
239                         docinto /${kdepkg}
240                         dodoc ${S}/${kdepkg#${PN}-}/{AUTHORS,BUGS,ChangeLog,NEWS,README,TODO}
241                 fi
242         done
245 #****o* kde4.cygclass/src_compile (kde4)
246 #  DEFINITION
247 src_compile() {
248         cd ${B}
249         : ${CYGCMAKE_GENERATOR=Ninja}
250         kde4_cmake
251         if [ -f build.ninja ]
252         then
253                 cygninja
254         else
255                 cygmake
256         fi
258 #****
260 #****o* kde4.cygclass/src_install (kde4)
261 #  DEFINITION
262 src_install() {
263         cd ${B}
264         kde4_install
266 #****
268 readonly -f kde4_cmake kde4_compile kde4_install