recipes: tde/tqt3: add support for trinity's binaries location
[dragora.git] / recipes / tde / tqt3 / recipe
blobb477806ead2466949285fc8bd3d697f30be4bc90
1 # Build recipe for tqt3 (trinity).
3 # Copyright (c) 2019-2020 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 program=tqt3-trinity
18 pkgname=tqt3
19 version=14.0.7
20 release=1
22 # Set 'outdir' for a nice and well-organized output directory
23 outdir="${outdir}/${arch}/tde"
25 tarname=${program}-${version}.tar.xz
27 # Remote source(s)
28 fetch=http://mirror.ppa.trinitydesktop.org/trinity/releases/R${version}/main/dependencies/$tarname
30 description="
31 Qt is a multiplatform C++ GUI application framework.
33 Qt 3.3 introduces new features and many improvements over the 3.2.x
34 series. See the changes file for details.
36 The Qt version 3.3 series is binary compatible with the 3.2.x series -
37 applications compiled for 3.2 will continue to run with 3.3.
40 homepage=http://www.trinitydesktop.org/
41 license="GPLv2+, GPLv3+ | The Q Public License"
43 # Source documentation
44 docs="FAQ LICENSE* README*"
45 docsdir="${docdir}/${pkgname}-${version}"
47 build()
49     set -e
51     unpack "${tardir}/$tarname"
53     cd "$srcdir"
55     # Remove unneeded specs for targets other than GNU/Linux
56     ( cd mkspecs && find . -maxdepth 1 \( -type d -a ! -name 'linux-g++' \) -exec rm -rf -- '{}' \; )
58     # Do not build the HTML documentation in order to save disk space
59     sed -i '/htmldocs/d' src/qt_install.pri
61     # Set custom compilation flags from Qi
62     sed -i \
63      -e "s:QMAKE_CFLAGS_RELEASE.*=:QMAKE_CFLAGS_RELEASE=${QICXXFLAGS} :" \
64       mkspecs/linux*/qmake.conf
66     # Set sane permissions
67     chmod -R u+w,go-w,a+rX-s .
69     SAVED_QTDIR="$QTDIR"
70     QTDIR="$PWD"
71     LD_LIBRARY_PATH="${PWD}/lib:${LD_LIBRARY_PATH}"
72     SAVED_PATH="$PATH"
73     PATH="${PWD}/bin:${PATH}"
75     echo ""
76     echo "New QTDIR: $QTDIR"
77     echo "New LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
78     echo "New PATH: $PATH"
79     echo ""
81     export QTDIR LD_LIBRARY_PATH PATH
83     echo yes | ./configure -L/usr/lib${libSuffix} \
84      -prefix /opt/trinity/lib${libSuffix}/${pkgname}-${version} \
85      -sysconfdir /opt/etc \
86      -sysshare /usr/share \
87      -docdir $docsdir \
88      -no-exceptions \
89      -stl \
90      -largefile \
91      -qt-gif \
92      -system-zlib \
93      -system-libpng \
94      -system-libjpeg \
95      -system-libmng \
96      -plugin-imgfmt-png \
97      -plugin-imgfmt-jpeg \
98      -plugin-imgfmt-mng \
99      -thread \
100      -xinerama \
101      -xcursor \
102      -xrandr \
103      -xrender \
104      -xft \
105      -tablet \
106      -xkb \
107      -plugin-style-cde \
108      -plugin-style-compact \
109      -plugin-style-motif \
110      -plugin-style-motifplus \
111      -plugin-style-platinum \
112      -plugin-style-sgi \
113      -plugin-style-windows \
114      -release
116     make -i -j${jobs} sub-tools
117     make -j${jobs} INSTALL_ROOT="$destdir" install
119     PATH=$SAVED_PATH
120     QTDIR=$SAVED_QTDIR
121     unset SAVED_QTDIR SAVED_PATH LD_LIBRARY_PATH
122     export PATH QTDIR
124     # Strip remaining binaries and libraries
125     find "$destdir" -type f | xargs file | \
126      awk '/ELF/ && /executable/ || /shared object/' | \
127       cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
129     # Make symlinks in order to have canonical paths
131     cd "${destdir}/opt/trinity" || exit 1
133     if test -n "$libSuffix"
134     then
135         ln -sf lib${libSuffix} lib
136     fi
137     cd lib${libSuffix} && ln -sf ${pkgname}-${version} $pkgname
139     # Link tqt3's pkg-config files at /opt/trinity/lib/pkgconfig
141     mkdir -p "${destdir}/opt/trinity/lib${libSuffix}/pkgconfig"
142     cd "${destdir}/opt/trinity/lib${libSuffix}/${pkgname}-${version}"/lib/pkgconfig/
143     for file in *.pc
144     do
145         ln -sf $file ../../../pkgconfig/${file}
146     done
148     # Link tqt3's programs at /opt/trinity/bin
150     mkdir -p "${destdir}/opt/trinity/bin"
151     cd "${destdir}/opt/trinity/lib${libSuffix}/${pkgname}-${version}"/bin/
152     for file in *
153     do
154         test -x "$file" && ln -sf $file ../../../bin/${file}
155     done
157     cd -- "${TMPDIR}/$srcdir"
159     # Include profile file
160     mkdir -p "${destdir}/etc/profile.d"
161     cp -p "${worktree}/archive/tqt3/etc/profile.d/tqt3.sh" \
162            "${destdir}/etc/profile.d/"
163     chmod 644 "${destdir}/etc/profile.d/tqt3.sh"
165     # To handle config file(s)
166     touch "${destdir}/etc/profile.d/.graft-config"
168     # Compress and link man pages (if needed)
169     if test -d "${destdir}/$mandir"
170     then
171         (
172             cd "${destdir}/$mandir"
173             find . -type f -exec lzip -9 '{}' +
174             find . -type l | while read -r file
175             do
176                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
177                 rm -- "$file"
178             done
179         )
180     fi
182     # Copy documentation
183     mkdir -p "${destdir}${docsdir}"
184     cp -p $docs "${destdir}${docsdir}"