1 |
caleb 07/12/21 16:11:18 |
2 |
|
3 |
Added: qt4-build.eclass |
4 |
Log: |
5 |
Add new eclass |
6 |
|
7 |
Revision Changes Path |
8 |
1.1 eclass/qt4-build.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/qt4-build.eclass?rev=1.1&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/qt4-build.eclass?rev=1.1&content-type=text/plain |
12 |
|
13 |
Index: qt4-build.eclass |
14 |
=================================================================== |
15 |
# Copyright 2005 Gentoo Foundation |
16 |
# Distributed under the terms of the GNU General Public License v2 |
17 |
# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.1 2007/12/21 16:11:18 caleb Exp $ |
18 |
|
19 |
# @ECLASS: qt4-build.eclass |
20 |
# @MAINTAINER: |
21 |
# Caleb Tennis <caleb@g.o> |
22 |
# @BLURB: |
23 |
# Eclass for Qt4 |
24 |
# @DESCRIPTION: |
25 |
# This eclass contains various functions that are used when building Qt4 |
26 |
|
27 |
inherit eutils multilib toolchain-funcs flag-o-matic |
28 |
|
29 |
IUSE="${IUSE} debug" |
30 |
|
31 |
qt4-build_pkg_setup() { |
32 |
# Set up installation directories |
33 |
|
34 |
QTBASEDIR=/usr/$(get_libdir)/qt4 |
35 |
QTPREFIXDIR=/usr |
36 |
QTBINDIR=/usr/bin |
37 |
QTLIBDIR=/usr/$(get_libdir)/qt4 |
38 |
QTPCDIR=/usr/$(get_libdir)/pkgconfig |
39 |
QTDATADIR=/usr/share/qt4 |
40 |
QTDOCDIR=/usr/share/doc/${PF} |
41 |
QTHEADERDIR=/usr/include/qt4 |
42 |
QTPLUGINDIR=${QTLIBDIR}/plugins |
43 |
QTSYSCONFDIR=/etc/qt4 |
44 |
QTTRANSDIR=${QTDATADIR}/translations |
45 |
QTEXAMPLESDIR=${QTDATADIR}/examples |
46 |
QTDEMOSDIR=${QTDATADIR}/demos |
47 |
|
48 |
PLATFORM=$(qt_mkspecs_dir) |
49 |
|
50 |
PATH="${S}/bin:${PATH}" |
51 |
LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
52 |
} |
53 |
|
54 |
qt4-build_src_unpack() { |
55 |
unpack ${A} |
56 |
cd "${S}" |
57 |
|
58 |
# Don't let the user go too overboard with flags. If you really want to, uncomment |
59 |
# out the line below and give 'er a whirl. |
60 |
strip-flags |
61 |
replace-flags -O3 -O2 |
62 |
|
63 |
if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then |
64 |
ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" |
65 |
append-flags -fno-stack-protector |
66 |
fi |
67 |
} |
68 |
|
69 |
standard_configure_options() { |
70 |
local myconf="" |
71 |
|
72 |
[ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)" |
73 |
|
74 |
# Disable visibility explicitly if gcc version isn't 4 |
75 |
if [[ "$(gcc-major-version)" != "4" ]]; then |
76 |
myconf="${myconf} -no-reduce-exports" |
77 |
fi |
78 |
|
79 |
use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info" |
80 |
|
81 |
myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath\ |
82 |
-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \ |
83 |
-docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \ |
84 |
-sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \ |
85 |
-examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}" |
86 |
|
87 |
myconf="${myconf} -fast -reduce-relocations -nomake examples -nomake demos" |
88 |
|
89 |
echo "${myconf}" |
90 |
} |
91 |
|
92 |
build_directories() { |
93 |
local dirs="$@" |
94 |
for x in ${dirs}; do |
95 |
cd "${S}"/${x} |
96 |
qmake "LIBS+=-L${QTLIBDIR}" && emake || die |
97 |
done |
98 |
} |
99 |
|
100 |
install_directories() { |
101 |
local dirs="$@" |
102 |
for x in ${dirs}; do |
103 |
cd "${S}"/${x} |
104 |
emake INSTALL_ROOT="${D}" install || die |
105 |
done |
106 |
} |
107 |
|
108 |
qconfig_add_option() { |
109 |
local option=$1 |
110 |
qconfig_remove_option $1 |
111 |
sed -i -e "s:QT_CONFIG +=:QT_CONFIG += ${option}:g" /usr/share/qt4/mkspecs/qconfig.pri |
112 |
} |
113 |
|
114 |
qconfig_remove_option() { |
115 |
local option=$1 |
116 |
sed -i -e "s: ${option}::g" /usr/share/qt4/mkspecs/qconfig.pri |
117 |
} |
118 |
|
119 |
skip_qmake_build_patch() { |
120 |
# Don't need to build qmake, as it's already installed from qmake-core |
121 |
sed -i -e "s:if true:if false:g" "${S}"/configure |
122 |
} |
123 |
|
124 |
skip_project_generation_patch() { |
125 |
# Exit the script early by throwing in an exit before all of the .pro files are scanned |
126 |
sed -i -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" "${S}"/configure |
127 |
} |
128 |
|
129 |
install_binaries_to_buildtree() |
130 |
{ |
131 |
cp ${QTBINDIR}/qmake ${S}/bin |
132 |
cp ${QTBINDIR}/moc ${S}/bin |
133 |
cp ${QTBINDIR}/uic ${S}/bin |
134 |
cp ${QTBINDIR}/rcc ${S}/bin |
135 |
} |
136 |
|
137 |
fix_library_files() { |
138 |
sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la |
139 |
sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl |
140 |
sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc |
141 |
|
142 |
# pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix: |
143 |
sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc |
144 |
|
145 |
# Move .pc files into the pkgconfig directory |
146 |
dodir ${QTPCDIR} |
147 |
mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR} |
148 |
} |
149 |
|
150 |
qt_use() { |
151 |
local flag="$1" |
152 |
local feature="$1" |
153 |
local enableval= |
154 |
|
155 |
[[ -n $2 ]] && feature=$2 |
156 |
[[ -n $3 ]] && enableval="-$3" |
157 |
|
158 |
useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}" |
159 |
return 0 |
160 |
} |
161 |
|
162 |
qt_mkspecs_dir() { |
163 |
# Allows us to define which mkspecs dir we want to use. |
164 |
local spec |
165 |
|
166 |
case ${CHOST} in |
167 |
*-freebsd*|*-dragonfly*) |
168 |
spec="freebsd" ;; |
169 |
*-openbsd*) |
170 |
spec="openbsd" ;; |
171 |
*-netbsd*) |
172 |
spec="netbsd" ;; |
173 |
*-darwin*) |
174 |
spec="darwin" ;; |
175 |
*-linux-*|*-linux) |
176 |
spec="linux" ;; |
177 |
*) |
178 |
die "Unknown CHOST, no platform choosed." |
179 |
esac |
180 |
|
181 |
CXX=$(tc-getCXX) |
182 |
if [[ ${CXX/g++/} != ${CXX} ]]; then |
183 |
spec="${spec}-g++" |
184 |
elif [[ ${CXX/icpc/} != ${CXX} ]]; then |
185 |
spec="${spec}-icc" |
186 |
else |
187 |
die "Unknown compiler ${CXX}." |
188 |
fi |
189 |
|
190 |
echo "${spec}" |
191 |
} |
192 |
|
193 |
EXPORT_FUNCTIONS pkg_setup src-unpack |
194 |
|
195 |
|
196 |
|
197 |
-- |
198 |
gentoo-commits@g.o mailing list |