delete old
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@2782 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
parent
e863d996c6
commit
f541fc1877
222
eclass/fortran.eclass
Normal file
222
eclass/fortran.eclass
Normal file
@ -0,0 +1,222 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/fortran.eclass,v 1.21 2009/03/07 10:02:33 maekke Exp $
|
||||
#
|
||||
# Author: Danny van Dyk <kugelfang@gentoo.org>
|
||||
#
|
||||
|
||||
inherit eutils autotools
|
||||
|
||||
DESCRIPTION="Based on the ${ECLASS} eclass"
|
||||
|
||||
IUSE="debug"
|
||||
|
||||
#DEPEND="virtual/fortran" # Let's aim for this...
|
||||
|
||||
# Which Fortran Compiler has been selected ?
|
||||
export FORTRANC
|
||||
|
||||
# These are the options to ./configure / econf that enable the usage
|
||||
# of a specific Fortran Compiler. If your package uses a different
|
||||
# option that the one listed here, overwrite it in your ebuild.
|
||||
g77_CONF="--with-f77"
|
||||
f2c_CONF="--with-f2c"
|
||||
|
||||
# This function prints the necessary options for the currently selected
|
||||
# Fortran Compiler.
|
||||
fortran_conf() {
|
||||
echo $(eval echo \${$(echo -n ${FORTRANC})_CONF})
|
||||
}
|
||||
|
||||
# need_fortran(<profiles>):
|
||||
# profiles = <profile> ... <profile>
|
||||
#
|
||||
# profile:
|
||||
# * gfortran - GCC Fortran 95
|
||||
# * g77 - GCC Fortran 77
|
||||
# * f2c - Fortran 2 C Translator
|
||||
# * ifc - Intel Fortran Compiler
|
||||
# * f95 - Sun Studio Fortran Compiler
|
||||
#
|
||||
# Checks if at least one of <profiles> is installed.
|
||||
# Checks also if F77 (the fortran compiler to use) is available
|
||||
# on the System.
|
||||
need_fortran() {
|
||||
if [ -z "$*" ]; then
|
||||
eerror "Call need_fortran with at least one argument !"
|
||||
fi
|
||||
local AVAILABLE
|
||||
local PROFILE
|
||||
for PROFILE in $@; do
|
||||
case ${PROFILE} in
|
||||
gfortran)
|
||||
if [ -x "$(type -P gfortran 2> /dev/null)" ]; then
|
||||
AVAILABLE="${AVAILABLE} gfortran"
|
||||
fi
|
||||
;;
|
||||
g77)
|
||||
if [ -x "$(type -P g77 2> /dev/null)" ]; then
|
||||
AVAILABLE="${AVAILABLE} g77"
|
||||
fi
|
||||
;;
|
||||
f2c)
|
||||
if [ -x "$(type -P f2c 2> /dev/null)" ]; then
|
||||
AVAILABLE="${AVAILABLE} f2c"
|
||||
fi
|
||||
;;
|
||||
ifc)
|
||||
case ${ARCH} in
|
||||
x86|ia64|amd64)
|
||||
if [ -x "$(type -P ifort 2> /dev/null)" ]; then
|
||||
AVAILABLE="${AVAILABLE} ifort"
|
||||
elif [ -x "$(type -P ifc 2> /dev/null)" ]; then
|
||||
AVAILABLE="${AVAILABLE} ifc"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
f95)
|
||||
case ${ARCH} in
|
||||
x86|amd64)
|
||||
if [ -x "$(type -P f95 2> /dev/null)" ]; then
|
||||
AVAILABLE="${AVAILABLE} f95"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# add the ${CHOST} variants so that one may do FC=$(potageq envvar CHOST)-gfortran
|
||||
for A in ${AVAILABLE}; do
|
||||
AVAILABLE="${AVAILABLE} ${CHOST}-${A}"
|
||||
done
|
||||
|
||||
AVAILABLE="${AVAILABLE/^[[:space:]]}"
|
||||
use debug && echo ${AVAILABLE}
|
||||
if [ -z "${AVAILABLE}" ]; then
|
||||
eerror "None of the needed Fortran Compilers ($@) is installed."
|
||||
eerror "To install one of these, choose one of the following steps:"
|
||||
i=1
|
||||
for PROFILE in $@; do
|
||||
case ${PROFILE} in
|
||||
gfortran)
|
||||
eerror "[${i}] USE=\"fortran\" emerge =sys-devel/gcc-4*"
|
||||
;;
|
||||
g77)
|
||||
eerror "[${i}] USE=\"fortran\" emerge =sys-devel/gcc-3*"
|
||||
;;
|
||||
f2c)
|
||||
eerror "[${i}] emerge dev-lang/f2c"
|
||||
;;
|
||||
ifc)
|
||||
case ${ARCH} in
|
||||
x86|ia64)
|
||||
eerror "[${i}] emerge dev-lang/ifc"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
f95)
|
||||
case ${ARCH} in
|
||||
x86|amd64)
|
||||
eerror "[${i}] emerge dev-lang/sunstudio"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
i=$((i + 1))
|
||||
done
|
||||
die "Install a Fortran Compiler !"
|
||||
else
|
||||
einfo "You need one of these Fortran Compilers: $@"
|
||||
einfo "Installed are: ${AVAILABLE}"
|
||||
if [ -n "${F77}" -o -n "${FC}" -o -n "${F2C}" ]; then
|
||||
if [ -n "${F77}" ]; then
|
||||
FC="${F77}" # F77 overwrites FC
|
||||
fi
|
||||
if [ -n "${FC}" -a -n "${F2C}" ]; then
|
||||
ewarn "Using ${FC} and f2c is impossible. Disabling F2C !"
|
||||
F2C="" # Disabling f2c
|
||||
MY_FORTRAN="$(basename ${FC})" # set MY_FORTRAN to filename of
|
||||
# the Fortran Compiler
|
||||
else
|
||||
if [ -n "${F2C}" ]; then
|
||||
MY_FORTRAN="$(basename ${F2C})"
|
||||
elif [ -n "${FC}" ]; then
|
||||
MY_FORTRAN="$(basename ${FC})"
|
||||
else
|
||||
MY_FORTRAN="$(basename ${F77})"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# default to gfortran if available, g77 if not
|
||||
use debug && echo "MY_FORTRAN: \"${MY_FORTRAN}\""
|
||||
if hasq gfortran ${AVAILABLE}; then
|
||||
MY_FORTRAN=${MY_FORTRAN:=gfortran}
|
||||
elif hasq g77 ${AVAILABLE}; then
|
||||
MY_FORTRAN=${MY_FORTRAN:=g77}
|
||||
else
|
||||
# Default to the first valid Fortran compiler
|
||||
for i in ${AVAILABLE}; do
|
||||
MY_FORTRAN=$i
|
||||
break
|
||||
done
|
||||
fi
|
||||
use debug && echo "MY_FORTRAN: \"${MY_FORTRAN}\""
|
||||
|
||||
if ! hasq ${MY_FORTRAN} ${AVAILABLE}; then
|
||||
eerror "Current Fortran Compiler is set to ${MY_FORTRAN}, which is not usable with this package !"
|
||||
die "Wrong Fortran Compiler !"
|
||||
fi
|
||||
|
||||
case ${MY_FORTRAN/${CHOST}-} in
|
||||
gfortran|g77|ifc|ifort|f2c|f95)
|
||||
FORTRANC="${MY_FORTRAN}"
|
||||
esac
|
||||
fi
|
||||
use debug && echo "FORTRANC: \"${FORTRANC}\""
|
||||
}
|
||||
|
||||
# patch_fortran():
|
||||
# Apply necessary patches for ${FORTRANC}
|
||||
patch_fortran() {
|
||||
if [[ -z "${FORTRANC}" || ! -d "${FILESDIR}" ]]; then
|
||||
return
|
||||
fi
|
||||
local PATCHES=$(find ${FILESDIR} -name "${P}-${FORTRANC/${CHOST}-}-*")
|
||||
einfo "Applying patches for selected FORTRAN compiler: ${FORTRANC} (${FORTRANC/${CHOST}-})"
|
||||
local PATCH
|
||||
if [ -n "${PATCHES}" ]; then
|
||||
for PATCH in ${PATCHES}; do
|
||||
epatch ${PATCH}
|
||||
done
|
||||
eautoreconf
|
||||
fi
|
||||
}
|
||||
|
||||
# fortran_pkg_setup():
|
||||
# Set FORTRAN to indicate the list of Fortran Compiler that
|
||||
# can be used for the ebuild.
|
||||
# If not set in ebuild, FORTRAN will default to f77
|
||||
fortran_pkg_setup() {
|
||||
need_fortran ${FORTRAN:="gfortran g77"}
|
||||
}
|
||||
|
||||
# fortran_src_unpack():
|
||||
# Run patch_fortran if no new src_unpack() is defined.
|
||||
fortran_src_unpack() {
|
||||
unpack ${A}
|
||||
cd "${S}"
|
||||
patch_fortran
|
||||
}
|
||||
|
||||
EXPORT_FUNCTIONS pkg_setup src_unpack
|
@ -1,717 +0,0 @@
|
||||
# Copyright 1999-2008 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
#
|
||||
# @ECLASS: multilib-native.eclass
|
||||
# @MAINTAINER:
|
||||
# Steven Newbury <steve@snewbury.org.uk>
|
||||
# @BLURB: Provide infrastructure for native multilib ebuilds
|
||||
|
||||
IUSE="${IUSE} lib32"
|
||||
|
||||
DEPEND="${DEPEND} sys-apps/abi-wrapper"
|
||||
RDEPEND="${RDEPEND} sys-apps/abi-wrapper"
|
||||
|
||||
if use lib32; then
|
||||
EMULTILIB_PKG="true"
|
||||
fi
|
||||
|
||||
inherit base multilib
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
2|3)
|
||||
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm
|
||||
;;
|
||||
*)
|
||||
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
|
||||
;;
|
||||
esac
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# @VARIABLE: EMULTILIB_SAVE_VARS
|
||||
# @DESCRIPTION: Environment variables to save
|
||||
# EMULTILIB_SAVE_VARS="${EMULTILIB_SAVE_VARS}
|
||||
# AS CC CXX FC LD ASFLAGS CFLAGS CXXFLAGS FCFLAGS FFLAGS LDFLAGS
|
||||
# CHOST CBUILD CDEFINE LIBDIR S CCACHE_DIR myconf PYTHON PERLBIN
|
||||
# QMAKE QMAKESPEC QTBINDIR QTBASEDIR QTLIBDIR QTPCDIR
|
||||
# QTPLUGINDIR CMAKE_BUILD_DIR mycmakeargs KDE_S POPPLER_MODULE_S
|
||||
# ECONF_SOURCE MY_LIBDIR MOZLIBDIR SDKDIR G2CONF PKG_CONFIG_PATH
|
||||
# DESTTREE SRC_PREP USE_64"
|
||||
EMULTILIB_SAVE_VARS="${EMULTILIB_SAVE_VARS}
|
||||
AS CC CXX FC LD ASFLAGS CFLAGS CXXFLAGS FCFLAGS FFLAGS LDFLAGS
|
||||
CHOST CBUILD CDEFINE LIBDIR S CCACHE_DIR myconf PYTHON PERLBIN
|
||||
QMAKE QMAKESPEC QTBINDIR QTBASEDIR QTLIBDIR QTPCDIR
|
||||
QTPLUGINDIR CMAKE_BUILD_DIR mycmakeargs KDE_S POPPLER_MODULE_S
|
||||
ECONF_SOURCE MY_LIBDIR MOZLIBDIR SDKDIR G2CONF PKG_CONFIG_PATH
|
||||
DESTTREE SRC_PREP USE_64 osname mythreading myarch PRIV_LIB
|
||||
SITE_LIB SITE_ARCH VENDOR_LIB VENDOR_ARCH ARCH_LIB"
|
||||
|
||||
# @VARIABLE: EMULTILIB_SOURCE_DIRNAME
|
||||
# @DESCRIPTION: Holds the name of the source directory
|
||||
# EMULTILIB_SOURCE_DIRNAME=""
|
||||
EMULTILIB_SOURCE_DIRNAME=""
|
||||
|
||||
# @VARIABLE: EMULTILIB_SOURCE
|
||||
# @DESCRIPTION:
|
||||
# PATH to the top-level source directory. This may be used in multilib-ised
|
||||
# ebuilds choosing to make use of external build directories for installing
|
||||
# files from the top of the source tree although for builds with external
|
||||
# build directories it's sometimes more appropriate to use ${ECONF_SOURCE}.
|
||||
# EMULTILIB_SOURCE=""
|
||||
EMULTILIB_SOURCE=""
|
||||
|
||||
# @VARIABLE: EMULTILIB_RELATIVE_BUILD_DIR
|
||||
# @DESCRIPTION:
|
||||
# EMULTILIB_RELATIVE_BUILD_DIR=""
|
||||
EMULTILIB_RELATIVE_BUILD_DIR=""
|
||||
|
||||
# @VARIABLE: CMAKE_BUILD_DIR
|
||||
# @DESCRIPTION:
|
||||
# Despite the name, this is used for all build systems within this eclass.
|
||||
# Usually this is the same as ${S}, except when using an external build
|
||||
# directory. (This is per ABI and so is saved/restored for each phase.)
|
||||
# CMAKE_BUILD_DIR=""
|
||||
CMAKE_BUILD_DIR=""
|
||||
|
||||
# @VARIABLE: EMULTILIB_INHERITED
|
||||
# @DESCRIPTION:
|
||||
# Holds a list of inherited eclasses
|
||||
# is this var is onlky used in multilib-native_check_inherited_funcs
|
||||
EMULTILIB_INHERITED=""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_setup
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the pkg_setup phase
|
||||
multilib-native_pkg_setup() {
|
||||
multilib-native_src_generic pkg_setup
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_unpack
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the src_unpack phase
|
||||
multilib-native_src_unpack() {
|
||||
multilib-native_src_generic src_unpack
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_prepare
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the src_prepare phase
|
||||
multilib-native_src_prepare() {
|
||||
multilib-native_src_generic src_prepare
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_configure
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the src_configure phase
|
||||
multilib-native_src_configure() {
|
||||
multilib-native_src_generic src_configure
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_compile
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the src_compile phase
|
||||
multilib-native_src_compile() {
|
||||
multilib-native_src_generic src_compile
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_install
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the src_install phase
|
||||
multilib-native_src_install() {
|
||||
multilib-native_src_generic src_install
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_preinst
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the pkg_preinst phase
|
||||
multilib-native_pkg_preinst() {
|
||||
multilib-native_src_generic pkg_preinst
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_postinst
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the pkg_postinst phase
|
||||
multilib-native_pkg_postinst() {
|
||||
multilib-native_src_generic pkg_postinst
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_postrm
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: This is a multilib wrapper for the pkg_postrm phase
|
||||
multilib-native_pkg_postrm() {
|
||||
multilib-native_src_generic pkg_postrm
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib_debug
|
||||
# @USAGE: <name_of_variable> <content_of_variable>
|
||||
# @DESCRIPTION: print debug output if MULTILIB_DEBUG is set
|
||||
multilib_debug() {
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && einfo "MULTILIB_DEBUG: ${1}=\"${2}\""
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_src_generic
|
||||
# @USAGE: <phase>
|
||||
# @DESCRIPTION: Run each phase for each "install ABI"
|
||||
multilib-native_src_generic() {
|
||||
# Recurse this function for each ABI from get_install_abis()
|
||||
if [[ -n ${EMULTILIB_PKG} ]] && [[ -z ${OABI} ]] ; then
|
||||
local abilist=""
|
||||
if has_multilib_profile ; then
|
||||
abilist=$(get_install_abis)
|
||||
einfo "${1/src_/} multilib ${PN} for ABIs: ${abilist}"
|
||||
elif is_crosscompile || tc-is-cross-compiler ; then
|
||||
abilist=${DEFAULT_ABI}
|
||||
fi
|
||||
if [[ -n ${abilist} ]] ; then
|
||||
OABI=${ABI}
|
||||
for ABI in ${abilist} ; do
|
||||
export ABI
|
||||
multilib-native_src_generic ${1}
|
||||
done
|
||||
ABI=${OABI}
|
||||
unset OABI
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# If this is the first time through, initialise the source path variables early
|
||||
# and unconditionally, whether building for multilib or not. (This allows
|
||||
# multilib-native ebuilds to always make use of them.) Then save the initial
|
||||
# environment.
|
||||
#
|
||||
# Sometimes, packages assume a directory structure ABOVE "S". ("S" is set to a
|
||||
# subdirectory of the tree they unpack into ${WORKDIR}.) We need to deal with
|
||||
# this by finding the top-level of the source tree and keeping track of ${S}
|
||||
# relative to it.
|
||||
|
||||
if [[ -z ${EMULTILIB_INITIALISED[$(multilib-native_abi_to_index_key "INIT")]} ]]; then
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: Determining EMULTILIB_SOURCE from S and WORKDIR"
|
||||
EMULTILIB_RELATIVE_BUILD_DIR="${S#*${WORKDIR}\/}"
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: EMULTILIB_RELATIVE_BUILD_DIR=\"${EMULTILIB_RELATIVE_BUILD_DIR}\""
|
||||
EMULTILIB_SOURCE_DIRNAME="${EMULTILIB_RELATIVE_BUILD_DIR%%/*}"
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: EMULTILIB_SOURCE_DIRNAME=\"${EMULTILIB_SOURCE_DIRNAME}\""
|
||||
EMULTILIB_SOURCE="${WORKDIR}/${EMULTILIB_SOURCE_DIRNAME}"
|
||||
CMAKE_BUILD_DIR="${S}"
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: EMULTILIB_SOURCE=\"${EMULTILIB_SOURCE}\""
|
||||
multilib-native_save_abi_env "INIT"
|
||||
EMULTILIB_INITIALISED[$(multilib-native_abi_to_index_key "INIT")]=1
|
||||
fi
|
||||
|
||||
if [[ -n ${EMULTILIB_PKG} ]] && has_multilib_profile; then
|
||||
multilib-native_src_generic_sub ${1}
|
||||
|
||||
# Save the environment for this ABI
|
||||
multilib-native_save_abi_env "${ABI}"
|
||||
|
||||
# If this is the default ABI and we have a build tree, update the INIT
|
||||
# environment
|
||||
[[ "${ABI}" == "${DEFAULT_ABI}" ]] && \
|
||||
[[ -d "${WORKDIR}/${PN}_build_${ABI}" ]] && \
|
||||
multilib-native_save_abi_env "INIT"
|
||||
|
||||
# This assures the environment is correctly configured for non-multilib phases
|
||||
# such as a src_unpack override in ebuilds.
|
||||
multilib-native_restore_abi_env "INIT"
|
||||
else
|
||||
multilib-native_${1}_internal
|
||||
fi
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_src_generic_sub
|
||||
# @USAGE: <phase>
|
||||
# @DESCRIPTION: This function gets used for each ABI pass of each phase
|
||||
multilib-native_src_generic_sub() {
|
||||
# We support two kinds of build: By default we copy/move the source dir for
|
||||
# each ABI. Where supported with the underlying package, we can just create an
|
||||
# external build dir. This requires a modified ebuild which makes use of the
|
||||
# EMULTILIB_SOURCE variable (which points the the top of the original
|
||||
# source dir) to install doc files etc. This latter behaviour is enabled with
|
||||
# MULTILIB_EXT_SOURCE_BUILD. For CMake based packages default is reversed and
|
||||
# the CMAKE_IN_SOURCE_BUILD environment variable is used to specify the former
|
||||
# behaviour.
|
||||
#
|
||||
|
||||
if [[ -z ${EMULTILIB_INITIALISED[$(multilib-native_abi_to_index_key ${ABI})]} ]]; then
|
||||
multilib-native_restore_abi_env "INIT"
|
||||
multilib-native_setup_abi_env "${ABI}"
|
||||
else
|
||||
multilib-native_restore_abi_env "${ABI}"
|
||||
fi
|
||||
|
||||
# If this is the unpack or prepare phase we only need to run for the
|
||||
# DEFAULT_ABI when we are building out of the source tree since it is shared
|
||||
# between each ABI.
|
||||
#
|
||||
# After the unpack phase, some eclasses change into the unpacked source tree
|
||||
# (gnome2.eclass for example), we need to change back to the WORKDIR otherwise
|
||||
# the next ABI tree will get unpacked into a subdir of previous tree.
|
||||
|
||||
|
||||
case ${1/*_} in
|
||||
setup)
|
||||
;;
|
||||
unpack)
|
||||
[[ -d "${WORKDIR}" ]] && cd "${WORKDIR}"
|
||||
if multilib-native_is_EBD && \
|
||||
[[ ! "${ABI}" == "${DEFAULT_ABI}" ]]; then
|
||||
einfo "Skipping ${1} for ${ABI}"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
prepare)
|
||||
if multilib-native_is_EBD; then
|
||||
if [[ ! "${ABI}" == "${DEFAULT_ABI}" ]]; then
|
||||
einfo "Skipping ${1} for ${ABI}"
|
||||
return
|
||||
fi
|
||||
else
|
||||
[[ ! -d "${WORKDIR}/${PN}_build_${ABI}" ]] && multilib-native_setup_build_directory
|
||||
fi
|
||||
if [[ -d "${S}" ]]; then
|
||||
einfo "Working in ${S}"
|
||||
cd "${S}"
|
||||
else
|
||||
ewarn "Not changing to non-existant source directory"
|
||||
fi
|
||||
;;
|
||||
configure|compile|install)
|
||||
[[ ! -d "${WORKDIR}/${PN}_build_${ABI}" ]] && multilib-native_setup_build_directory
|
||||
[[ -d "${S}" ]] && cd "${S}"
|
||||
;;
|
||||
*)
|
||||
[[ -d "${S}" ]] && cd "${S}"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# FIXME: There is a failure case when there is no source directory
|
||||
# at ${EMULTILIB_SOURCE}, creating a directory there is the *wrong*
|
||||
# thing to do, certianly not unconditionally!
|
||||
# mkdir -p "${EMULTILIB_SOURCE}"
|
||||
|
||||
# Call the "real" phase function
|
||||
multilib-native_${1}_internal
|
||||
|
||||
# If we've just unpacked the source, move it into place.
|
||||
if [[ ! "${1/unpack}" == "${1}" ]] && \
|
||||
( [[ -d "${EMULTILIB_SOURCE}" ]] && \
|
||||
[[ ! -d "${WORKDIR}/${PN}_build_${ABI}" ]] ) && ! (multilib-native_is_EBD); then
|
||||
einfo "Moving source tree from ${EMULTILIB_SOURCE} to ${WORKDIR}/${PN}_build_${ABI}"
|
||||
mv "${EMULTILIB_SOURCE}" "${WORKDIR}/${PN}_build_${ABI}"
|
||||
S="${CMAKE_BUILD_DIR}"
|
||||
[[ -n ${KDE_S} ]] && KDE_S="${S}"
|
||||
[[ -n ${POPPLER_MODULE_S} ]] && \
|
||||
POPPLER_MODULE_S=${S}/${POPPLER_MODULE}
|
||||
fi
|
||||
}
|
||||
|
||||
multilib-native_setup_build_directory() {
|
||||
if multilib-native_is_EBD; then
|
||||
einfo "Preparing external build directory for ABI: ${ABI} ..."
|
||||
einfo "Creating build directory: ${WORKDIR}/${PN}_build_${ABI}"
|
||||
mkdir -p "${CMAKE_BUILD_DIR}"
|
||||
ECONF_SOURCE="${S}"
|
||||
else
|
||||
if [[ -d ${EMULTILIB_SOURCE} ]]; then
|
||||
if ! is_final_abi; then
|
||||
einfo "Copying source tree from ${EMULTILIB_SOURCE} to ${WORKDIR}/${PN}_build_${ABI}"
|
||||
cp -al "${EMULTILIB_SOURCE}" "${WORKDIR}/${PN}_build_${ABI}"
|
||||
else
|
||||
einfo "Moving source tree from ${EMULTILIB_SOURCE} to ${WORKDIR}/${PN}_build_${ABI}"
|
||||
mv "${EMULTILIB_SOURCE}" "${WORKDIR}/${PN}_build_${ABI}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if ([[ -n "${CMAKE_BUILD_TYPE}" ]] && \
|
||||
[[ -n "${CMAKE_IN_SOURCE_BUILD}" ]]) || \
|
||||
[[ -z "${CMAKE_BUILD_TYPE}" ]]; then
|
||||
S="${CMAKE_BUILD_DIR}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_is_EBD
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Returns true if we're building with an "External Build Directory"
|
||||
multilib-native_is_EBD() {
|
||||
! ( [[ -n "${CMAKE_IN_SOURCE_BUILD}" ]] || \
|
||||
( [[ -z "${CMAKE_BUILD_TYPE}" ]] && \
|
||||
[[ -z "${MULTILIB_EXT_SOURCE_BUILD}" ]] ) )
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_setup_abi_env
|
||||
# @USAGE: <ABI>
|
||||
# @DESCRIPTION: Setup initial environment for ABI, flags, workarounds etc.
|
||||
multilib-native_setup_abi_env() {
|
||||
local pyver="" libsuffix=""
|
||||
[[ -z $(multilib-native_abi_to_index_key ${1}) ]] && \
|
||||
die "Unknown ABI (${1})"
|
||||
|
||||
# Set the CHOST native first so that we pick up the native #202811.
|
||||
export CHOST=$(get_abi_CHOST ${DEFAULT_ABI})
|
||||
export AS="$(tc-getAS)"
|
||||
export CC="$(tc-getCC)"
|
||||
export CXX="$(tc-getCXX)"
|
||||
export FC="$(tc-getFC)"
|
||||
export LD="$(tc-getLD) $(get_abi_LDFLAGS)"
|
||||
export ASFLAGS="${ASFLAGS} $(get_abi_ASFLAGS)"
|
||||
export CFLAGS="${CFLAGS} $(get_abi_CFLAGS)"
|
||||
export CXXFLAGS="${CXXFLAGS} $(get_abi_CFLAGS)"
|
||||
export FCFLAGS="${FCFLAGS} ${CFLAGS}"
|
||||
export FFLAGS="${FFLAGS} ${CFLAGS}"
|
||||
export CHOST=$(get_abi_CHOST $1)
|
||||
export CBUILD=$(get_abi_CHOST $1)
|
||||
export CDEFINE="${CDEFINE} $(get_abi_CDEFINE $1)"
|
||||
export LDFLAGS="${LDFLAGS} -L/$(get_abi_LIBDIR $1) -L/usr/$(get_abi_LIBDIR $1)"
|
||||
|
||||
if [[ -z PKG_CONFIG_PATH ]]; then
|
||||
export PKG_CONFIG_PATH="/usr/$(get_libdir)/pkgconfig"
|
||||
else
|
||||
PKG_CONFIG_PATH="${PKG_CONFIG_PATH/lib*\//$(get_libdir)/}:/usr/$(get_libdir)/pkgconfig"
|
||||
fi
|
||||
|
||||
# if ! [[ "${ABI}" == "${DEFAULT_ABI}" ]]; then
|
||||
# built_with_use dev-lang/perl lib32 && [[ "$(readlink /usr/bin/perl)" == "/usr/bin/abi-wrapper" ]] || eerror multilib-native.eclass: please rebuild dev-lang/perl to avoid problems
|
||||
# pyver=$(python --version 2>&1)
|
||||
# pyver=${pyver/Python /python}
|
||||
# pyver=${pyver%.*}
|
||||
# built_with_use dev-lang/python lib32 && [[ "$(readlink /usr/bin/${pyver})" == "/usr/bin/abi-wrapper" ]] || eerror multilib-native.eclass: please rebuild dev-lang/python to avoid problems
|
||||
# fi
|
||||
|
||||
# ccache is ABI dependent
|
||||
if [[ -z ${CCACHE_DIR} ]] ; then
|
||||
CCACHE_DIR="/var/tmp/ccache-${1}"
|
||||
else
|
||||
CCACHE_DIR="${CCACHE_DIR}-${1}"
|
||||
fi
|
||||
|
||||
CMAKE_BUILD_DIR="${WORKDIR}/${PN}_build_${ABI}/${EMULTILIB_RELATIVE_BUILD_DIR/${EMULTILIB_SOURCE_DIRNAME}}"
|
||||
|
||||
# Strip any trailing slash (fixes build failure with python.eclass)
|
||||
CMAKE_BUILD_DIR="${CMAKE_BUILD_DIR%/}"
|
||||
|
||||
EMULTILIB_INITIALISED[$(multilib-native_abi_to_index_key ${1})]=1
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_abi_to_index_key
|
||||
# @USAGE: <ABI>
|
||||
# @RETURN: <index key>
|
||||
# @DESCRIPTION: Return an array index key for a given ABI
|
||||
multilib-native_abi_to_index_key() {
|
||||
# Until we can count on bash version > 4, we can't use associative arrays.
|
||||
local index=0 element=""
|
||||
if [[ -z "${EMULTILIB_ARRAY_INDEX}" ]]; then
|
||||
local abilist=""
|
||||
abilist=$(get_install_abis)
|
||||
EMULTILIB_ARRAY_INDEX=(INIT ${abilist})
|
||||
fi
|
||||
for element in ${EMULTILIB_ARRAY_INDEX[@]}; do
|
||||
[[ "${element}" == "${1}" ]] && echo "${index}"
|
||||
let index++
|
||||
done
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_save_abi_env
|
||||
# @USAGE: <ABI>
|
||||
# @DESCRIPTION: Save environment for ABI
|
||||
multilib-native_save_abi_env() {
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: Saving Environment:" "${1}"
|
||||
local _var _array
|
||||
for _var in ${EMULTILIB_SAVE_VARS}; do
|
||||
_array="EMULTILIB_${_var}"
|
||||
declare -p ${_var} &>/dev/null || continue
|
||||
multilib_debug ${_array}[$(multilib-native_abi_to_index_key ${1})] "${!_var}"
|
||||
eval "${_array}[$(multilib-native_abi_to_index_key ${1})]"=\"${!_var}\"
|
||||
done
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION: multilib-native_restore_abi_env
|
||||
# @USAGE: <ABI>
|
||||
# @DESCRIPTION: Restore environment for ABI
|
||||
multilib-native_restore_abi_env() {
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: Restoring Environment:" "${1}"
|
||||
local _var _array
|
||||
for _var in ${EMULTILIB_SAVE_VARS}; do
|
||||
_array="EMULTILIB_${_var}[$(multilib-native_abi_to_index_key ${1})]"
|
||||
if ! (declare -p EMULTILIB_${_var} &>/dev/null) || \
|
||||
[[ -z ${!_array} ]]; then
|
||||
if (declare -p ${_var} &>/dev/null); then
|
||||
[[ -n ${MULTILIB_DEBUG} ]] && \
|
||||
einfo "MULTILIB_DEBUG: unsetting ${_var}"
|
||||
unset ${_var}
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
multilib_debug "${_var}" "${!_array}"
|
||||
export ${_var}="${!_array}"
|
||||
done
|
||||
}
|
||||
|
||||
# Internal function
|
||||
# @FUNCTION multilib-native_check_inherited_funcs
|
||||
# @USAGE: <phase>
|
||||
# @DESCRIPTION: Checks all inherited eclasses for requested phase function
|
||||
multilib-native_check_inherited_funcs() {
|
||||
# Check all eclasses for given function, in order of inheritance.
|
||||
# If none provides it, the var stays empty. If more have it, the last one wins.
|
||||
# Ignore the ones we inherit ourselves, base doesn't matter, as we default on
|
||||
# it.
|
||||
local declared_func=""
|
||||
if [[ -f "${T}"/eclass-debug.log ]]; then
|
||||
EMULTILIB_INHERITED="$(grep ${1} "${T}"/eclass-debug.log | cut -d ' ' -f 4 | cut -d '_' -f 1)"
|
||||
else
|
||||
if [[ "$1" != pkg_postrm ]]; then
|
||||
ewarn "You are using a package manager that does not provide "${T}"/eclass-debug.log."
|
||||
ewarn "Join #gentoo-multilib-overlay on freenode to help finding another way for you."
|
||||
ewarn "Falling back to old behaviour ..."
|
||||
fi
|
||||
EMULTILIB_INHERITED="${INHERITED}"
|
||||
fi
|
||||
|
||||
EMULTILIB_INHERITED="${EMULTILIB_INHERITED//base/}"
|
||||
EMULTILIB_INHERITED="${EMULTILIB_INHERITED//multilib-native/}"
|
||||
|
||||
multilib_debug EMULTILIB_INHERITED ${EMULTILIB_INHERITED}
|
||||
|
||||
for func in ${EMULTILIB_INHERITED}; do
|
||||
if [[ -n $(declare -f ${func}_${1}) ]]; then
|
||||
multilib_debug declared_func "${declared_func}"
|
||||
declared_func="${func}_${1}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$declared_func" == "distutils_src_unpack" ]]; then
|
||||
if ! has "${EAPI:-0}" 0 1; then
|
||||
unset declared_func
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now if $declared_func is still empty, none of the inherited eclasses provides
|
||||
# it, so default on base.eclass. Do nothing for "phase != src_*".
|
||||
if [[ -z "${declared_func}" ]]; then
|
||||
if [[ "${1/_*}" != "src" ]]; then
|
||||
declared_func="return"
|
||||
else
|
||||
declared_func="base_${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z ${SRC_URI} && ( "${declared_func}" == "base_src_prepare" || "${declared_func}" == "base_src_install" ) ]]; then
|
||||
# those functions do not work if we do not have sources
|
||||
declared_func="return"
|
||||
fi
|
||||
|
||||
einfo "Using ${declared_func} for ABI ${ABI} ..."
|
||||
${declared_func}
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_prepare_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom src_configure.
|
||||
multilib-native_src_prepare_internal() {
|
||||
multilib-native_check_inherited_funcs src_prepare
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_configure_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom src_configure.
|
||||
multilib-native_src_configure_internal() {
|
||||
multilib-native_check_inherited_funcs src_configure
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_compile_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom src_compile.
|
||||
multilib-native_src_compile_internal() {
|
||||
multilib-native_check_inherited_funcs src_compile
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_install_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom src_install
|
||||
multilib-native_src_install_internal() {
|
||||
multilib-native_check_inherited_funcs src_install
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_setup_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom pkg_setup
|
||||
multilib-native_pkg_setup_internal() {
|
||||
multilib-native_check_inherited_funcs pkg_setup
|
||||
}
|
||||
|
||||
# @FUNCTION: multilib-native_src_unpack_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom src_unpack
|
||||
multilib-native_src_unpack_internal() {
|
||||
multilib-native_check_inherited_funcs src_unpack
|
||||
}
|
||||
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_preinst_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom pkg_preinst
|
||||
multilib-native_pkg_preinst_internal() {
|
||||
multilib-native_check_inherited_funcs pkg_preinst
|
||||
}
|
||||
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_postinst_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom pkg_postinst
|
||||
multilib-native_pkg_postinst_internal() {
|
||||
multilib-native_check_inherited_funcs pkg_postinst
|
||||
}
|
||||
|
||||
|
||||
# @FUNCTION: multilib-native_pkg_postrm_internal
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Override this function if you want a custom pkg_postrm
|
||||
multilib-native_pkg_postrm_internal() {
|
||||
multilib-native_check_inherited_funcs pkg_postrm
|
||||
}
|
||||
|
||||
# @FUNCTION: is_crosscompile
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# True if we are cross-compiling.
|
||||
# This is identical to the version in
|
||||
# toolchain.eclass, but inheriting that eclass from here breaks many packages
|
||||
# so just define locally.
|
||||
is_crosscompile() {
|
||||
[[ ${CHOST} != ${CTARGET} ]]
|
||||
}
|
||||
|
||||
# @FUNCTION: _check_build_dir
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# This function overrides the function of the same name
|
||||
# in cmake-utils.eclass. We handle the build dir ourselves.
|
||||
# Determine using IN or OUT source build
|
||||
_check_build_dir() {
|
||||
# @ECLASS-VARIABLE: CMAKE_USE_DIR
|
||||
# @DESCRIPTION:
|
||||
# Sets the directory where we are working with cmake.
|
||||
# For example when application uses autotools and only one
|
||||
# plugin needs to be done by cmake. By default it uses ${S}.
|
||||
: ${CMAKE_USE_DIR:=${S}}
|
||||
|
||||
# in/out source build
|
||||
echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\""
|
||||
}
|
||||
|
||||
# @FUNCTION prep_ml_binaries
|
||||
# @USAGE:
|
||||
# @DESCRIPTION: Use wrapper to support non-default binaries
|
||||
prep_ml_binaries() {
|
||||
if [[ -n $EMULTILIB_PKG ]] ; then
|
||||
for binary in "$@"; do
|
||||
if [[ -a ${D}/${binary} ]]; then
|
||||
mv ${D}/${binary} ${D}/${binary}-${ABI} || \
|
||||
die "${D}/${binary} not found!"
|
||||
einfo "mv ${D}/${binary} ${D}/${binary}-${ABI}"
|
||||
if is_final_abi; then
|
||||
ln -s /usr/bin/abi-wrapper ${D}/${binary} || \
|
||||
die "could link abi-wrapper to ${D}/${binary}!"
|
||||
einfo "ln -s /usr/bin/abi-wrapper ${D}/${binary}"
|
||||
fi
|
||||
else
|
||||
ewarn "${D}/${binary} does not exist, please inform the people in #gentoo-multilib-overlay on freenode"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: prep_ml_includes
|
||||
# @DESCRIPTION:
|
||||
# Some includes (include/asm, glibc, etc) are ABI dependent. In this case,
|
||||
# We can install them in different locations for each ABI and create a common
|
||||
# header which includes the right one based on CDEFINE_${ABI}. If your
|
||||
# package installs ABI-specific headers, just add 'prep_ml_includes' to the
|
||||
# end of your src_install(). It takes a list of directories that include
|
||||
# files are installed in (default is /usr/include if none are passed).
|
||||
#
|
||||
# Example:
|
||||
# src_install() {
|
||||
# ...
|
||||
# prep_ml_includes /usr/qt/3/include
|
||||
# }
|
||||
prep_ml_includes() {
|
||||
if [[ $(number_abis) -gt 1 ]] ; then
|
||||
local dir
|
||||
local dirs
|
||||
local base
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
dirs=/usr/include
|
||||
else
|
||||
dirs="$@"
|
||||
fi
|
||||
|
||||
for dir in ${dirs} ; do
|
||||
base=${T}/gentoo-multilib/${dir}/gentoo-multilib
|
||||
mkdir -p "${base}"
|
||||
[[ -d ${base}/${ABI} ]] && rm -rf "${base}/${ABI}"
|
||||
mv "${D}/${dir}" "${base}/${ABI}"
|
||||
done
|
||||
|
||||
if is_final_abi; then
|
||||
base=${T}/gentoo-multilib
|
||||
|
||||
local files_differ=
|
||||
local install_abis=$(get_install_abis)
|
||||
local alternate_abis=${install_abis% *}
|
||||
for dir in ${dirs}; do
|
||||
pushd "${base}${dir}/gentoo-multilib/${ABI}"
|
||||
for i in $(find . -type f); do
|
||||
for diffabi in ${alternate_abis}; do
|
||||
diff -q "${i}" ../${diffabi}/"${i}" >/dev/null || files_differ=1
|
||||
done
|
||||
if [ -z "${files_differ}" ]; then
|
||||
[ -d "${D}${dir}/${i%/*}" ] || mkdir -p "${D}${dir}/${i%/*}"
|
||||
mv ${base}${dir}/gentoo-multilib/${ABI}/"${i}" "${D}${dir}/${i}"
|
||||
einfo rm -rf ${base}${dir}/gentoo-multilib/*/"${i}"
|
||||
rm -rf ${base}${dir}/gentoo-multilib/*/"${i}"
|
||||
fi
|
||||
files_differ=
|
||||
done
|
||||
popd
|
||||
done
|
||||
|
||||
|
||||
pushd "${base}"
|
||||
find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C "${D}"
|
||||
popd
|
||||
|
||||
# This 'set' stuff is required by mips profiles to properly pass
|
||||
# CDEFINE's (which have spaces) to sub-functions
|
||||
set --
|
||||
for dir in ${dirs} ; do
|
||||
set -- "$@" "${dir}"
|
||||
local abi
|
||||
for abi in $(get_install_abis); do
|
||||
set -- "$@" "$(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"
|
||||
done
|
||||
create_ml_includes "$@"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
810
eclass/qt4-build.eclass
Normal file
810
eclass/qt4-build.eclass
Normal file
@ -0,0 +1,810 @@
|
||||
# Copyright 1999-2009 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.87 2010/11/13 20:50:57 wired Exp $
|
||||
|
||||
# @ECLASS: qt4-build.eclass
|
||||
# @MAINTAINER:
|
||||
# Ben de Groot <yngwin@gentoo.org>,
|
||||
# Markos Chandras <hwoarang@gentoo.org>,
|
||||
# Caleb Tennis <caleb@gentoo.org>
|
||||
# Alex Alexander <wired@gentoo.org>
|
||||
# @BLURB: Eclass for Qt4 split ebuilds.
|
||||
# @DESCRIPTION:
|
||||
# This eclass contains various functions that are used when building Qt4
|
||||
|
||||
inherit base eutils multilib toolchain-funcs flag-o-matic versionator
|
||||
|
||||
MY_PV=${PV/_/-}
|
||||
if version_is_at_least 4.5.99999999; then
|
||||
MY_P=qt-everywhere-opensource-src-${MY_PV}
|
||||
[[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] &&
|
||||
[[ ${CATEGORY}/${PN} != x11-themes/qgtkstyle ]] &&
|
||||
IUSE="+exceptions"
|
||||
else
|
||||
MY_P=qt-x11-opensource-src-${MY_PV}
|
||||
fi
|
||||
|
||||
HOMEPAGE="http://qt.nokia.com/"
|
||||
SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz"
|
||||
|
||||
LICENSE="|| ( LGPL-2.1 GPL-3 )"
|
||||
IUSE+=" debug pch aqua"
|
||||
|
||||
RDEPEND="
|
||||
!<x11-libs/qt-assistant-${PV}
|
||||
!>x11-libs/qt-assistant-${PV}-r9999
|
||||
!<x11-libs/qt-core-${PV}
|
||||
!>x11-libs/qt-core-${PV}-r9999
|
||||
!<x11-libs/qt-dbus-${PV}
|
||||
!>x11-libs/qt-dbus-${PV}-r9999
|
||||
!<x11-libs/qt-demo-${PV}
|
||||
!>x11-libs/qt-demo-${PV}-r9999
|
||||
!<x11-libs/qt-gui-${PV}
|
||||
!>x11-libs/qt-gui-${PV}-r9999
|
||||
!<x11-libs/qt-multimedia-${PV}
|
||||
!>x11-libs/qt-multimedia-${PV}-r9999
|
||||
!<x11-libs/qt-opengl-${PV}
|
||||
!>x11-libs/qt-opengl-${PV}-r9999
|
||||
!<x11-libs/qt-phonon-${PV}
|
||||
!>x11-libs/qt-phonon-${PV}-r9999
|
||||
!<x11-libs/qt-qt3support-${PV}
|
||||
!>x11-libs/qt-qt3support-${PV}-r9999
|
||||
!<x11-libs/qt-script-${PV}
|
||||
!>x11-libs/qt-script-${PV}-r9999
|
||||
!<x11-libs/qt-sql-${PV}
|
||||
!>x11-libs/qt-sql-${PV}-r9999
|
||||
!<x11-libs/qt-svg-${PV}
|
||||
!>x11-libs/qt-svg-${PV}-r9999
|
||||
!<x11-libs/qt-test-${PV}
|
||||
!>x11-libs/qt-test-${PV}-r9999
|
||||
!<x11-libs/qt-webkit-${PV}
|
||||
!>x11-libs/qt-webkit-${PV}-r9999
|
||||
!<x11-libs/qt-xmlpatterns-${PV}
|
||||
!>x11-libs/qt-xmlpatterns-${PV}-r9999
|
||||
"
|
||||
|
||||
S=${WORKDIR}/${MY_P}
|
||||
|
||||
# @FUNCTION: qt4-build_pkg_setup
|
||||
# @DESCRIPTION:
|
||||
# Sets up S, MY_P, PATH, and LD_LIBRARY_PATH
|
||||
qt4-build_pkg_setup() {
|
||||
[[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
|
||||
|
||||
# Protect users by not allowing downgrades between releases
|
||||
# Downgrading revisions within the same release should be allowed
|
||||
if has_version '>'${CATEGORY}/${P}-r9999 ; then
|
||||
if [[ -z $I_KNOW_WHAT_I_AM_DOING ]] ; then
|
||||
eerror "Sanity check to keep you from breaking your system:"
|
||||
eerror " Downgrading Qt is completely unsupported and will break your system!"
|
||||
die "aborting to save your system"
|
||||
else
|
||||
ewarn "Downgrading Qt is completely unsupported and will break your system!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${PN}" == "qt-webkit" ]]; then
|
||||
eshopts_push -s extglob
|
||||
if is-flagq '-g?(gdb)?([1-9])'; then
|
||||
echo
|
||||
ewarn "You have enabled debug info (probably have -g or -ggdb in your \$C{,XX}FLAGS)."
|
||||
ewarn "You may experience really long compilation times and/or increased memory usage."
|
||||
ewarn "If compilation fails, please try removing -g{,gdb} before reporting a bug."
|
||||
ewarn "For more info check out bug #307861"
|
||||
echo
|
||||
fi
|
||||
eshopts_pop
|
||||
fi
|
||||
|
||||
PATH="${S}/bin${PATH:+:}${PATH}"
|
||||
if [[ ${CHOST} != *-darwin* ]]; then
|
||||
LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
|
||||
else
|
||||
DYLD_LIBRARY_PATH="${S}/lib${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
|
||||
# On MacOS we *need* at least src/gui/kernel/qapplication_mac.mm for
|
||||
# platform detection. Note: needs to come before any directories to
|
||||
# avoid extract failure.
|
||||
[[ ${CHOST} == *-apple-darwin* ]] && \
|
||||
QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm
|
||||
${QT4_EXTRACT_DIRECTORIES}"
|
||||
fi
|
||||
|
||||
# Make sure ebuilds use the required EAPI
|
||||
if [[ ${EAPI} != [23] ]]; then
|
||||
eerror "The qt4-build eclass requires EAPI=2 or EAPI=3, but this ebuild is using"
|
||||
eerror "EAPI=${EAPI:-0}. The ebuild author or editor failed. This ebuild needs to be"
|
||||
eerror "fixed. Using qt4-build eclass without EAPI=2 or EAPI=3 will fail."
|
||||
die "qt4-build eclass requires EAPI=2 or EAPI=3"
|
||||
fi
|
||||
|
||||
if ! version_is_at_least 4.1 $(gcc-version); then
|
||||
ewarn "Using a GCC version lower than 4.1 is not supported!"
|
||||
fi
|
||||
}
|
||||
|
||||
# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
|
||||
# @DESCRIPTION:
|
||||
# Arguments for build_target_directories. Takes the directories, in which the
|
||||
# code should be compiled. This is a space-separated list
|
||||
|
||||
# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
|
||||
# @DESCRIPTION:
|
||||
# Space separated list including the directories that will be extracted from Qt
|
||||
# tarball
|
||||
|
||||
# @FUNCTION: qt4-build_src_unpack
|
||||
# @DESCRIPTION:
|
||||
# Unpacks the sources
|
||||
qt4-build_src_unpack() {
|
||||
setqtenv
|
||||
local target targets=
|
||||
for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \
|
||||
src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
|
||||
${QT4_EXTRACT_DIRECTORIES}; do
|
||||
targets+=" ${MY_P}/${target}"
|
||||
done
|
||||
|
||||
echo tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets}
|
||||
tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die
|
||||
}
|
||||
|
||||
# @ECLASS-VARIABLE: PATCHES
|
||||
# @DESCRIPTION:
|
||||
# In case you have patches to apply, specify them in PATCHES variable. Make sure
|
||||
# to specify the full path. This variable is necessary for src_prepare phase.
|
||||
# example:
|
||||
# PATCHES="${FILESDIR}"/mypatch.patch
|
||||
# ${FILESDIR}"/mypatch2.patch"
|
||||
#
|
||||
|
||||
# @FUNCTION: qt4-build_src_prepare
|
||||
# @DESCRIPTION:
|
||||
# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
|
||||
# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf.
|
||||
qt4-build_src_prepare() {
|
||||
setqtenv
|
||||
cd "${S}"
|
||||
|
||||
# fix qt 4.7 regression that skips -fvisibility=hidden
|
||||
if version_is_at_least "4.7.0_beta1"; then
|
||||
sed -e "s/^gcc|g++)/*gcc|*g++)/" \
|
||||
-i config.tests/unix/fvisibility.test ||
|
||||
die "visibility fixing sed failed"
|
||||
fi
|
||||
# fix libx11 dependency on non X packages
|
||||
if version_is_at_least "4.7.0_beta2"; then
|
||||
local NOLIBX11PKG="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns"
|
||||
hasq ${PN} ${NOLIBX11PKG} && qt_nolibx11
|
||||
[[ ${PN} == "qt-assistant" ]] && qt_assistant_cleanup
|
||||
fi
|
||||
|
||||
if use aqua; then
|
||||
# provide a proper macx-g++-64
|
||||
use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
|
||||
|
||||
sed -e '/^CONFIG/s:app_bundle::' \
|
||||
-e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \
|
||||
-i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed"
|
||||
fi
|
||||
|
||||
if [[ ${PN} != qt-core ]]; then
|
||||
skip_qmake_build_patch
|
||||
skip_project_generation_patch
|
||||
symlink_binaries_to_buildtree
|
||||
fi
|
||||
|
||||
if [[ ${CHOST} == *86*-apple-darwin* ]] ; then
|
||||
# qmake bus errors with -O2 but -O3 works
|
||||
replace-flags -O2 -O3
|
||||
fi
|
||||
|
||||
# Bug 178652
|
||||
if [[ $(gcc-major-version) == 3 ]] && use amd64; then
|
||||
ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
|
||||
append-flags -fno-gcse
|
||||
fi
|
||||
|
||||
# Unsupported old gcc versions - hardened needs this :(
|
||||
if [[ $(gcc-major-version) -lt 4 ]] ; then
|
||||
ewarn "Appending -fno-stack-protector to CXXFLAGS"
|
||||
append-cxxflags -fno-stack-protector
|
||||
# Bug 253127
|
||||
sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
|
||||
-i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
|
||||
fi
|
||||
|
||||
# Bug 261632
|
||||
if use ppc64; then
|
||||
ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS"
|
||||
append-flags -mminimal-toc
|
||||
fi
|
||||
|
||||
# Bug 282984 && Bug 295530
|
||||
sed -e "s:\(^SYSTEM_VARIABLES\):CC="$(tc-getCC)"\nCXX="$(tc-getCXX)"\nCFLAGS=\"${CFLAGS}\"\nCXXFLAGS=\"${CXXFLAGS}\"\nLDFLAGS=\"${LDFLAGS}\"\n\1:" \
|
||||
-i configure || die "sed qmake compilers failed"
|
||||
# bug 321335
|
||||
if version_is_at_least 4.6; then
|
||||
find ./config.tests/unix -name "*.test" -type f -exec grep -lZ \$MAKE '{}' \; | \
|
||||
xargs -0 \
|
||||
sed -e "s:\(\$MAKE\):\1 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getCXX)" LINK="$(tc-getCXX)":g" \
|
||||
-i || die "sed test compilers failed"
|
||||
fi
|
||||
|
||||
# Bug 172219
|
||||
sed -e "s:X11R6/::" \
|
||||
-i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
|
||||
|
||||
if [[ ${CHOST} == *-darwin* ]]; then
|
||||
# Set FLAGS *and* remove -arch, since our gcc-apple is multilib
|
||||
# crippled (by design) :/
|
||||
sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
|
||||
-e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
|
||||
-e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=-headerpad_max_install_names ${LDFLAGS}:" \
|
||||
-e "s:-arch\s\w*::g" \
|
||||
-i mkspecs/common/mac-g++.conf || die "sed mkspecs/common/mac-g++.conf failed"
|
||||
|
||||
# Fix configure's -arch settings that appear in qmake/Makefile and also
|
||||
# fix arch handling (automagically duplicates our -arch arg and breaks
|
||||
# pch). Additionally disable Xarch support.
|
||||
sed \
|
||||
-e "s:-arch i386::" \
|
||||
-e "s:-arch ppc::" \
|
||||
-e "s:-arch x86_64::" \
|
||||
-e "s:-arch ppc64::" \
|
||||
-e "s:-arch \$i::" \
|
||||
-e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \
|
||||
-e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \
|
||||
-e "s:-Xarch_x86_64::g" \
|
||||
-e "s:-Xarch_ppc64::g" \
|
||||
-i configure mkspecs/common/mac-g++.conf || die "sed configure failed"
|
||||
|
||||
# On Snow Leopard don't fall back to 10.5 deployment target.
|
||||
if [[ ${CHOST} == *-apple-darwin10 ]] ; then
|
||||
sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \
|
||||
-e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \
|
||||
-i configure mkspecs/common/mac-g++.conf || die "sed configure failed"
|
||||
fi
|
||||
fi
|
||||
|
||||
# this one is needed for all systems with a separate -liconv, apart from
|
||||
# Darwin, for which the sources already cater for -liconv
|
||||
if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] ; then
|
||||
sed \
|
||||
-e "s|mac:LIBS += -liconv|LIBS += -liconv|g" \
|
||||
-i config.tests/unix/iconv/iconv.pro \
|
||||
|| die "sed on iconv.pro failed"
|
||||
fi
|
||||
|
||||
# we need some patches for Solaris
|
||||
sed -i \
|
||||
-e '/^QMAKE_LFLAGS_THREAD/a\QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,' \
|
||||
mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
|
||||
# use GCC over SunStudio
|
||||
sed -i -e '/PLATFORM=solaris-cc/s/cc/g++/' configure || die
|
||||
# don't flirt with non-Prefix stuff, we're quite possessive
|
||||
sed -i -e '/^QMAKE_\(LIB\|INC\)DIR\(_X11\|_OPENGL\|\)\t/s/=.*$/=/' \
|
||||
mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
|
||||
# strip predefined CFLAGS from qmake ( bug #312689 )
|
||||
sed -i '/^QMAKE_CFLAGS_RELEASE/s:+=.*:+=:' mkspecs/common/g++.conf
|
||||
|
||||
base_src_prepare
|
||||
}
|
||||
|
||||
# @FUNCTION: qt4-build_src_configure
|
||||
# @DESCRIPTION:
|
||||
# Default configure phase
|
||||
qt4-build_src_configure() {
|
||||
setqtenv
|
||||
myconf="$(standard_configure_options) ${myconf}"
|
||||
|
||||
# this one is needed for all systems with a separate -liconv, apart from
|
||||
# Darwin, for which the sources already cater for -liconv
|
||||
use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] && \
|
||||
myconf+=" -liconv"
|
||||
|
||||
if has glib ${IUSE//+} && use glib; then
|
||||
# use -I, -L and -l from configure
|
||||
local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)"
|
||||
# avoid the -pthread argument
|
||||
myconf+=" ${glibflags//-pthread}"
|
||||
unset glibflags
|
||||
fi
|
||||
|
||||
if use aqua ; then
|
||||
# On (snow) leopard use the new (frameworked) cocoa code.
|
||||
if [[ ${CHOST##*-darwin} -ge 9 ]] ; then
|
||||
myconf+=" -cocoa -framework"
|
||||
|
||||
# We are crazy and build cocoa + qt3support :-)
|
||||
if use qt3support; then
|
||||
sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \
|
||||
-i configure
|
||||
fi
|
||||
|
||||
# We need the source's headers, not the installed ones.
|
||||
myconf+=" -I${S}/include"
|
||||
|
||||
# Add hint for the framework location.
|
||||
myconf+=" -F${QTLIBDIR}"
|
||||
fi
|
||||
else
|
||||
# freetype2 include dir is non-standard, thus include it on configure
|
||||
# use -I from configure
|
||||
myconf+=" $(pkg-config --cflags freetype2)"
|
||||
fi
|
||||
|
||||
# Disable SSE4.x, since auto-detection is currently broken
|
||||
# Upstream bug http://bugreports.qt.nokia.com/browse/QTBUG-13623
|
||||
if version_is_at_least 4.7.1; then
|
||||
myconf+=" -no-sse4.1 -no-sse4.2"
|
||||
fi
|
||||
|
||||
echo ./configure ${myconf}
|
||||
./configure ${myconf} || die "./configure failed"
|
||||
myconf=""
|
||||
}
|
||||
|
||||
# @FUNCTION: qt4-build_src_compile
|
||||
# @DESCRIPTION: Actual compile phase
|
||||
qt4-build_src_compile() {
|
||||
setqtenv
|
||||
|
||||
build_directories ${QT4_TARGET_DIRECTORIES}
|
||||
}
|
||||
|
||||
# @FUNCTION: qt4-build_src_test
|
||||
# @DESCRIPTION:
|
||||
# Runs tests only in target directories.
|
||||
qt4-build_src_test() {
|
||||
for dir in ${QT4_TARGET_DIRECTORIES}; do
|
||||
emake -j1 check -C ${dir}
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: fix_includes
|
||||
# @DESCRIPTION:
|
||||
# For MacOSX we need to add some symlinks when frameworks are
|
||||
# being used, to avoid complications with some more or less stupid packages.
|
||||
fix_includes() {
|
||||
if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then
|
||||
# Some packages tend to include <Qt/...>
|
||||
dodir "${QTHEADERDIR#${EPREFIX}}"/Qt
|
||||
|
||||
# Fake normal headers when frameworks are installed... eases life later on
|
||||
local dest f
|
||||
for frw in "${D}${QTLIBDIR}"/*.framework; do
|
||||
[[ -e "${frw}"/Headers ]] || continue
|
||||
f=$(basename ${frw})
|
||||
dest="${QTHEADERDIR#${EPREFIX}}"/${f%.framework}
|
||||
dosym "${QTLIBDIR#${EPREFIX}}"/${f}/Headers "${dest}"
|
||||
|
||||
# Link normal headers as well.
|
||||
for hdr in "${D}/${QTLIBDIR}/${f}"/Headers/*; do
|
||||
h=$(basename ${hdr})
|
||||
dosym "${QTLIBDIR#${EPREFIX}}"/${f}/Headers/${h} "${QTHEADERDIR#${EPREFIX}}"/Qt/${h}
|
||||
done
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: qt4-build_src_install
|
||||
# @DESCRIPTION:
|
||||
# Perform the actual installation including some library fixes.
|
||||
qt4-build_src_install() {
|
||||
[[ ${EAPI} == 2 ]] && use !prefix && ED=${D}
|
||||
setqtenv
|
||||
install_directories ${QT4_TARGET_DIRECTORIES}
|
||||
install_qconfigs
|
||||
fix_library_files
|
||||
fix_includes
|
||||
# remove .la files since we are building only shared Qt libraries
|
||||
find "${D}"${QTLIBDIR} -name "*.la" -print0 | xargs -0 rm
|
||||
}
|
||||
|
||||
# @FUNCTION: setqtenv
|
||||
setqtenv() {
|
||||
# Set up installation directories
|
||||
QTBASEDIR=${EPREFIX}/usr/$(get_libdir)/qt4
|
||||
QTPREFIXDIR=${EPREFIX}/usr
|
||||
QTBINDIR=${EPREFIX}/usr/bin
|
||||
QTLIBDIR=${EPREFIX}/usr/$(get_libdir)/qt4
|
||||
QMAKE_LIBDIR_QT=${QTLIBDIR}
|
||||
QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig
|
||||
QTDATADIR=${EPREFIX}/usr/share/qt4
|
||||
QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV}
|
||||
QTHEADERDIR=${EPREFIX}/usr/include/qt4
|
||||
QTPLUGINDIR=${QTLIBDIR}/plugins
|
||||
QTSYSCONFDIR=${EPREFIX}/etc/qt4
|
||||
QTTRANSDIR=${QTDATADIR}/translations
|
||||
QTEXAMPLESDIR=${QTDATADIR}/examples
|
||||
QTDEMOSDIR=${QTDATADIR}/demos
|
||||
QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
|
||||
PLATFORM=$(qt_mkspecs_dir)
|
||||
|
||||
unset QMAKESPEC
|
||||
}
|
||||
|
||||
# @FUNCTION: standard_configure_options
|
||||
# @DESCRIPTION:
|
||||
# Sets up some standard configure options, like libdir (if necessary), whether
|
||||
# debug info is wanted or not.
|
||||
standard_configure_options() {
|
||||
local myconf=
|
||||
|
||||
[[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)"
|
||||
|
||||
# Disable visibility explicitly if gcc version isn't 4
|
||||
if [[ $(gcc-major-version) -lt 4 ]]; then
|
||||
myconf+=" -no-reduce-exports"
|
||||
fi
|
||||
|
||||
# precompiled headers doesn't work on hardened, where the flag is masked.
|
||||
myconf+=" $(qt_use pch)"
|
||||
|
||||
if use debug; then
|
||||
myconf+=" -debug"
|
||||
else
|
||||
myconf+=" -release"
|
||||
fi
|
||||
myconf+=" -no-separate-debug-info"
|
||||
|
||||
use aqua && myconf+=" -no-framework"
|
||||
|
||||
# ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
|
||||
# $(tc-arch). Therefore we convert it to supported values.
|
||||
case "$(tc-arch)" in
|
||||
amd64|x64-*) myconf+=" -arch x86_64" ;;
|
||||
ppc-macos) myconf+=" -arch ppc" ;;
|
||||
ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;;
|
||||
sparc|sparc-*) myconf+=" -arch sparc" ;;
|
||||
x86-macos) myconf+=" -arch x86" ;;
|
||||
x86|x86-*) myconf+=" -arch i386" ;;
|
||||
alpha|arm|ia64|mips|s390|sparc) myconf+=" -arch $(tc-arch)" ;;
|
||||
hppa|sh) myconf+=" -arch generic" ;;
|
||||
*) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
|
||||
esac
|
||||
|
||||
# 4.5: build everything but qt-xmlpatterns w/o exceptions
|
||||
# 4.6: exceptions USE flag
|
||||
local exceptions="-exceptions"
|
||||
case "${PV}" in
|
||||
4.5.*)
|
||||
[[ ${PN} == "qt-xmlpatterns" ]] || exceptions="-no-exceptions"
|
||||
;;
|
||||
*)
|
||||
has exceptions "${IUSE//+}" && exceptions="$(qt_use exceptions)"
|
||||
;;
|
||||
esac
|
||||
|
||||
# note about -reduce-relocations:
|
||||
# That flag seems to introduce major breakage to applications,
|
||||
# mostly to be seen as a core dump with the message "QPixmap: Must
|
||||
# construct a QApplication before a QPaintDevice" on Solaris
|
||||
# -- Daniel Vergien
|
||||
[[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations"
|
||||
|
||||
myconf+=" -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license
|
||||
-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
|
||||
-datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
|
||||
-plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
|
||||
-translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
|
||||
-demosdir ${QTDEMOSDIR} -silent -fast -opensource
|
||||
${exceptions}
|
||||
-nomake examples -nomake demos"
|
||||
|
||||
echo "${myconf}"
|
||||
}
|
||||
|
||||
# @FUNCTION: build_directories
|
||||
# @USAGE: < directories >
|
||||
# @DESCRIPTION:
|
||||
# Compiles the code in $QT4_TARGET_DIRECTORIES
|
||||
build_directories() {
|
||||
for x in "$@"; do
|
||||
pushd "${S}"/${x} >/dev/null
|
||||
# avoid running over the maximum argument number, bug #299810
|
||||
{
|
||||
echo "${S}"/mkspecs/common/*.conf
|
||||
find "${S}" -name '*.pr[io]'
|
||||
} | xargs sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:${EPREFIX}/usr/$(get_libdir)/qt4:g" || die
|
||||
"${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
|
||||
emake CC="$(tc-getCC)" \
|
||||
CXX="$(tc-getCXX)" \
|
||||
LINK="$(tc-getCXX)" || die "emake failed"
|
||||
popd >/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: install_directories
|
||||
# @USAGE: < directories >
|
||||
# @DESCRIPTION:
|
||||
# run emake install in the given directories, which are separated by spaces
|
||||
install_directories() {
|
||||
for x in "$@"; do
|
||||
pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}"
|
||||
emake INSTALL_ROOT="${D}" install || die "emake install failed"
|
||||
popd >/dev/null || die "Can't popd from ${S}/${x}"
|
||||
done
|
||||
}
|
||||
|
||||
# @ECLASS-VARIABLE: QCONFIG_ADD
|
||||
# @DESCRIPTION:
|
||||
# List options that need to be added to QT_CONFIG in qconfig.pri
|
||||
: ${QCONFIG_ADD:=}
|
||||
|
||||
# @ECLASS-VARIABLE: QCONFIG_REMOVE
|
||||
# @DESCRIPTION:
|
||||
# List options that need to be removed from QT_CONFIG in qconfig.pri
|
||||
: ${QCONFIG_REMOVE:=}
|
||||
|
||||
# @ECLASS-VARIABLE: QCONFIG_DEFINE
|
||||
# @DESCRIPTION:
|
||||
# List variables that should be defined at the top of QtCore/qconfig.h
|
||||
: ${QCONFIG_DEFINE:=}
|
||||
|
||||
# @FUNCTION: install_qconfigs
|
||||
# @DESCRIPTION: Install gentoo-specific mkspecs configurations
|
||||
install_qconfigs() {
|
||||
local x
|
||||
if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
|
||||
for x in QCONFIG_ADD QCONFIG_REMOVE; do
|
||||
[[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
|
||||
done
|
||||
insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo
|
||||
doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed"
|
||||
fi
|
||||
|
||||
if [[ -n ${QCONFIG_DEFINE} ]]; then
|
||||
for x in ${QCONFIG_DEFINE}; do
|
||||
echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
|
||||
done
|
||||
insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo
|
||||
doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: generate_qconfigs
|
||||
# @DESCRIPTION: Generates gentoo-specific configurations
|
||||
generate_qconfigs() {
|
||||
if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
|
||||
local x qconfig_add qconfig_remove qconfig_new
|
||||
for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
|
||||
[[ -f ${x} ]] || continue
|
||||
qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
|
||||
qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
|
||||
done
|
||||
|
||||
# these error checks do not use die because dying in pkg_post{inst,rm}
|
||||
# just makes things worse.
|
||||
if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
|
||||
# start with the qconfig.pri that qt-core installed
|
||||
if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \
|
||||
"${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
|
||||
eerror "cp qconfig failed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# generate list of QT_CONFIG entries from the existing list
|
||||
# including qconfig_add and excluding qconfig_remove
|
||||
for x in $(sed -n 's/^QT_CONFIG +=//p' \
|
||||
"${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
|
||||
hasq ${x} ${qconfig_remove} || qconfig_new+=" ${x}"
|
||||
done
|
||||
|
||||
# replace the existing QT_CONFIG list with qconfig_new
|
||||
if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
|
||||
"${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
|
||||
eerror "Sed for QT_CONFIG failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# create Gentoo/qconfig.h
|
||||
if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then
|
||||
if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then
|
||||
eerror "mkdir ${QTHEADERDIR}/Gentoo failed"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
: > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
|
||||
for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do
|
||||
[[ -f ${x} ]] || continue
|
||||
cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
|
||||
done
|
||||
else
|
||||
rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri
|
||||
rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
|
||||
rmdir "${ROOT}${QTDATADIR}"/mkspecs \
|
||||
"${ROOT}${QTDATADIR}" \
|
||||
"${ROOT}${QTHEADERDIR}"/Gentoo \
|
||||
"${ROOT}${QTHEADERDIR}" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: qt4-build_pkg_postrm
|
||||
# @DESCRIPTION: Generate configurations when the package is completely removed
|
||||
qt4-build_pkg_postrm() {
|
||||
generate_qconfigs
|
||||
}
|
||||
|
||||
# @FUNCTION: qt4-build_pkg_postinst
|
||||
# @DESCRIPTION: Generate configuration, plus throws a message about possible
|
||||
# breakages and proposed solutions.
|
||||
qt4-build_pkg_postinst() {
|
||||
generate_qconfigs
|
||||
}
|
||||
|
||||
# @FUNCTION: skip_qmake_build_patch
|
||||
# @DESCRIPTION:
|
||||
# Don't need to build qmake, as it's already installed from qt-core
|
||||
skip_qmake_build_patch() {
|
||||
# Don't need to build qmake, as it's already installed from qt-core
|
||||
sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed"
|
||||
}
|
||||
|
||||
# @FUNCTION: skip_project_generation_patch
|
||||
# @DESCRIPTION:
|
||||
# Exit the script early by throwing in an exit before all of the .pro files are scanned
|
||||
skip_project_generation_patch() {
|
||||
# Exit the script early by throwing in an exit before all of the .pro files are scanned
|
||||
sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \
|
||||
-i "${S}"/configure || die "Sed failed"
|
||||
}
|
||||
|
||||
# @FUNCTION: symlink_binaries_to_buildtree
|
||||
# @DESCRIPTION:
|
||||
# Symlink generated binaries to buildtree so they can be used during compilation
|
||||
# time
|
||||
symlink_binaries_to_buildtree() {
|
||||
for bin in qmake moc uic rcc; do
|
||||
ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "Symlinking ${bin} to ${S}/bin failed."
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: fix_library_files
|
||||
# @DESCRIPTION:
|
||||
# Fixes the pathes in *.la, *.prl, *.pc, as they are wrong due to sandbox and
|
||||
# moves the *.pc-files into the pkgconfig directory
|
||||
fix_library_files() {
|
||||
for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do
|
||||
if [[ -e ${libfile} ]]; then
|
||||
sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "Sed on ${libfile} failed."
|
||||
fi
|
||||
done
|
||||
|
||||
# pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
|
||||
for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do
|
||||
if [[ -e ${libfile} ]]; then
|
||||
sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "Sed failed"
|
||||
|
||||
# Move .pc files into the pkgconfig directory
|
||||
dodir ${QTPCDIR#${EPREFIX}}
|
||||
mv ${libfile} "${D}"/${QTPCDIR}/ \
|
||||
|| die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed."
|
||||
fi
|
||||
done
|
||||
|
||||
# Don't install an empty directory
|
||||
rmdir "${D}"/${QTLIBDIR}/pkgconfig
|
||||
}
|
||||
|
||||
# @FUNCTION: qt_use
|
||||
# @USAGE: < flag > [ feature ] [ enableval ]
|
||||
# @DESCRIPTION:
|
||||
# This will echo "${enableval}-${feature}" if <flag> is enabled, or
|
||||
# "-no-${feature} if the flag is disabled. If [feature] is not specified <flag>
|
||||
# will be used for that. If [enableval] is not specified, it omits the
|
||||
# assignment-part
|
||||
qt_use() {
|
||||
local flag=$1
|
||||
local feature=$1
|
||||
local enableval=
|
||||
|
||||
[[ -n $2 ]] && feature=$2
|
||||
[[ -n $3 ]] && enableval=-$3
|
||||
|
||||
if use ${flag}; then
|
||||
echo "${enableval}-${feature}"
|
||||
else
|
||||
echo "-no-${feature}"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: qt_mkspecs_dir
|
||||
# @RETURN: the specs-directory w/o path
|
||||
# @DESCRIPTION:
|
||||
# Allows us to define which mkspecs dir we want to use.
|
||||
qt_mkspecs_dir() {
|
||||
# Allows us to define which mkspecs dir we want to use.
|
||||
local spec
|
||||
|
||||
case ${CHOST} in
|
||||
*-freebsd*|*-dragonfly*)
|
||||
spec=freebsd ;;
|
||||
*-openbsd*)
|
||||
spec=openbsd ;;
|
||||
*-netbsd*)
|
||||
spec=netbsd ;;
|
||||
*-darwin*)
|
||||
if use aqua; then
|
||||
# mac with carbon/cocoa
|
||||
spec=macx
|
||||
else
|
||||
# darwin/mac with x11
|
||||
spec=darwin
|
||||
fi
|
||||
;;
|
||||
*-solaris*)
|
||||
spec=solaris ;;
|
||||
*-linux-*|*-linux)
|
||||
spec=linux ;;
|
||||
*)
|
||||
die "Unknown CHOST, no platform choosen."
|
||||
esac
|
||||
|
||||
CXX=$(tc-getCXX)
|
||||
if [[ ${CXX} == *g++* ]]; then
|
||||
spec+=-g++
|
||||
elif [[ ${CXX} == *icpc* ]]; then
|
||||
spec+=-icc
|
||||
else
|
||||
die "Unknown compiler ${CXX}."
|
||||
fi
|
||||
if [[ -n ${LIBDIR/lib} ]]; then
|
||||
spec+=-${LIBDIR/lib}
|
||||
fi
|
||||
|
||||
# Add -64 for 64bit profiles
|
||||
if use x64-freebsd ||
|
||||
use amd64-linux ||
|
||||
use x64-macos ||
|
||||
use x64-solaris ||
|
||||
use sparc64-solaris
|
||||
then
|
||||
spec+=-64
|
||||
fi
|
||||
|
||||
if [[ "$ABI" == "x86" ]]; then
|
||||
spec+=-32
|
||||
else
|
||||
ewarn "Unknown Arch $ABI."
|
||||
fi
|
||||
|
||||
|
||||
echo "${spec}"
|
||||
}
|
||||
|
||||
# @FUNCTION: qt_assistant_cleanup
|
||||
# @RETURN: nothing
|
||||
# @DESCRIPTION:
|
||||
# Tries to clean up tools.pro for qt-assistant ebuilds
|
||||
# Meant to be called in src_prepare
|
||||
qt_assistant_cleanup() {
|
||||
# different versions (and branches...) may need different handling,
|
||||
# add a case if you need special handling
|
||||
case "${MY_PV_EXTRA}" in
|
||||
*kde-qt*)
|
||||
sed -e "/^[ \t]*porting/,/^[ \t]*win32.*activeqt$/d" \
|
||||
-e "/mac/,/^embedded.*makeqpf$/d" \
|
||||
-i tools/tools.pro || die "patching tools.pro failed"
|
||||
;;
|
||||
*)
|
||||
sed -e "/^[ \t]*porting/,/^[ \t]*win32.*activeqt$/d" \
|
||||
-e "/mac/,/^embedded.*makeqpf$/d" \
|
||||
-e "s/^\([ \t]*pixeltool\) /\1 qdoc3 /" \
|
||||
-i tools/tools.pro || die "patching tools.pro failed"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# @FUNCTION: qt_nolibx11
|
||||
# @RETURN: nothing
|
||||
# @DESCRIPTION:
|
||||
# Ignore X11 tests for packages that don't need X libraries installed
|
||||
qt_nolibx11() {
|
||||
einfo "removing X11 check to allow X-less compilation"
|
||||
sed -i "/unixtests\/compile.test.*config.tests\/x11\/xlib/,/fi$/d" "${S}"/configure ||
|
||||
die "x11 check sed failed"
|
||||
}
|
||||
|
||||
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst
|
@ -6,6 +6,6 @@ AUX qt-4.6.2-alpha.patch 2913 RMD160 52ca59388d88c8e0ea2a40fd8d9d6721d324664e SH
|
||||
AUX rcc.pro 3440 RMD160 42e65efa8dc027f8a2b6c933243a91c1cac96092 SHA1 017ea0aea74a27012608f8be8f301d3cda3dd2b7 SHA256 b09c74046a97ec87b19a05abfe08d959040b737430e498269fb0d0c00bf0a38d
|
||||
AUX uic.pro 3671 RMD160 b6d3c392a67b66f6996134975e99db03a9987baf SHA1 f87fff37256b5c966e4d21b0fb6cb64b717f3d07 SHA256 904084b6d936fb9bab33d3592ec69dc9872708a74834f0cb498e8153f784c7fc
|
||||
DIST qt-everywhere-opensource-src-4.7.1.tar.gz 211768512 RMD160 de6998948eb9f51a9193b9020ba80cfd52d50899 SHA1 fcf764d39d982c7f84703821582bd10c3192e341 SHA256 8cb5277c41f824cfc6dcee0e95e0bf23a9ad2c8d18d245105137481d092b124a
|
||||
EBUILD qt-core-4.7.1-r1.ebuild 5180 RMD160 0edd1ca4915cc697098c9adaac8cb31733c1bc49 SHA1 a8d9a358cf0c66040a53b7f7e195665297f1acb8 SHA256 fc101e3a1b6bc9ad684b0d67b25e81e63857ee5fb8449368eae6ddfeeeb7162d
|
||||
EBUILD qt-core-4.7.1-r1.ebuild 5175 RMD160 5b7c3b231ebf316202715e0d2e1586f912dd1f7e SHA1 8f262eeb47049c72f836e93e8455559113de035e SHA256 aac3eb99cc4f8819140ea43dedfd9da0411aa29009a87b748ab880a0d8fea57a
|
||||
MISC ChangeLog 15622 RMD160 88b29517686f501f38ee39186a036c84faba9b4b SHA1 bb733e98605a6fabd9c2cfe52e5f6d9e67db5fab SHA256 65b9b9946728be7c11c7da5a7857b9ffb71bf112f9da7d901d0e12b94dd9d896
|
||||
MISC metadata.xml 802 RMD160 0341afae262322299759a5a33bae9a42e5b7801c SHA1 b564551c1b4a7902e09200255c6c0a6ede646a23 SHA256 a84f88402ece782e8ac52ad0b90eea94e5bd563ca0a7956e1d89f1263d7f2925
|
||||
|
@ -74,8 +74,6 @@ src_prepare() {
|
||||
"${S}/qmake/Makefile.unix" || die "sed qmake/Makefile.unix CXXFLAGS failed"
|
||||
sed -i -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" \
|
||||
"${S}/qmake/Makefile.unix" || die "sed qmake/Makefile.unix LDFLAGS failed"
|
||||
sed -i -e "s:-m32::" \
|
||||
"${S}/config.tests/.qmake.cache" || die "sed qmake/Makefile.unix LDFLAGS failed"
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
@ -96,6 +94,11 @@ src_configure() {
|
||||
-no-freetype -no-libtiff -no-accessibility -no-fontconfig -no-opengl
|
||||
-no-svg -no-gtkstyle -no-phonon-backend -no-script -no-scripttools
|
||||
-no-cups -no-xsync -no-xinput -no-multimedia"
|
||||
|
||||
if [ "$ABI" = "x86" ] ; then
|
||||
myconf="${myconf} -little-endian -host-little-endian -continue"
|
||||
fi
|
||||
|
||||
qt4-build_src_configure
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user