/[gentoo-x86]/eclass/qt4-build.eclass
Gentoo

Contents of /eclass/qt4-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Fri Dec 21 21:10:34 2007 UTC (7 years ago) by caleb
Branch: MAIN
Changes since 1.1: +2 -2 lines
Use the local qmake and not the one on the file system, because if we're building qt-core there may not be one on the filesystem yet

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

  ViewVC Help
Powered by ViewVC 1.1.20