diff options
| author | Alexey Shvetsov <alexxy@gentoo.org> | 2009-01-18 00:43:11 +0300 |
|---|---|---|
| committer | Alexey Shvetsov <alexxy@gentoo.org> | 2009-01-18 00:43:11 +0300 |
| commit | f1e3e1e9a522282bc989ff9baa16a423770ad10b (patch) | |
| tree | 56532c88ceed9164d402138cd4f327d411735fa0 /eclass | |
| parent | 448b095a89c921a8b2054ae26ee353c8e286547d (diff) | |
| download | kde-f1e3e1e9a522282bc989ff9baa16a423770ad10b.tar.gz kde-f1e3e1e9a522282bc989ff9baa16a423770ad10b.tar.bz2 kde-f1e3e1e9a522282bc989ff9baa16a423770ad10b.zip | |
Add kde-crazy files to kde-testing
Diffstat (limited to 'eclass')
| -rw-r--r-- | eclass/gitsvn.eclass | 467 | ||||
| -rw-r--r-- | eclass/qt4-build-new.eclass | 547 | ||||
| -rw-r--r-- | eclass/qt4-build.eclass | 495 |
3 files changed, 1509 insertions, 0 deletions
diff --git a/eclass/gitsvn.eclass b/eclass/gitsvn.eclass new file mode 100644 index 00000000000..61b3474de5d --- /dev/null +++ b/eclass/gitsvn.eclass @@ -0,0 +1,467 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.60 2008/05/27 09:49:09 zlin Exp $ + +# @ECLASS: subversion.eclass +# @MAINTAINER: +# kde-herd +# +# @BLURB: The gitsvn eclass is used to access svn repositories via git. +# @DESCRIPTION: +# Same eclass as subversion eclass but use git svn instead of subversion +# directly. +# Requires EAPI="2" + +case ${EAPI} in + 2) : ;; + *) die "No way! EAPI older than 2 is not supported." ;; +esac + +inherit eutils + +ESVN="${ECLASS}" + +EXPORT_FUNCTIONS src_unpack pkg_preinst + +DESCRIPTION="Based on the ${ECLASS} eclass" + + +DEPEND=">=dev-util/git-1.6.0[subversion]" + +# @ECLASS-VARIABLE: ESVN_STORE_DIR +# @DESCRIPTION: +# subversion sources store directory. Users may override this in /etc/make.conf +[[ -z ${ESVN_STORE_DIR} ]] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/git-src" + +# @ECLASS-VARIABLE: ESVN_FETCH_CMD +# @DESCRIPTION: +# subversion checkout command +ESVN_FETCH_CMD="git svn clone" + +# @ECLASS-VARIABLE: ESVN_UPDATE_CMD +# @DESCRIPTION: +# subversion update command +ESVN_UPDATE_CMD="git svn rebase" + +# @ECLASS-VARIABLE: ESVN_SWITCH_CMD +# @DESCRIPTION: +# subversion switch command +ESVN_SWITCH_CMD="svn switch" + +# @ECLASS-VARIABLE: ESVN_OPTIONS +# @DESCRIPTION: +# here we differ against subversion eclass, dont forget you are passing +# variables to git not svn +ESVN_OPTIONS="${ESVN_OPTIONS:-}" + +# @ECLASS-VARIABLE: ESVN_REPO_URI +# @DESCRIPTION: +# repository uri +# +# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234 +# +# supported protocols: +# http:// +# https:// +# svn:// +# svn+ssh:// +# +# to peg to a specific revision, append @REV to the repo's uri +ESVN_REPO_URI="${ESVN_REPO_URI:-}" + +# @ECLASS-VARIABLE: ESVN_REVISION +# @DESCRIPTION: +# User configurable revision checkout or update to from the repository +# +# Useful for live svn or trunk svn ebuilds allowing the user to peg +# to a specific revision +# +# WARNING: git tracking, so git version numbering is used +# +# Note: This should never be set in an ebuild! +ESVN_REVISION="${ESVN_REVISION:-}" + +# @ECLASS-VARIABLE: ESVN_PROJECT +# @DESCRIPTION: +# project name of your ebuild (= name space) +# +# subversion eclass will check out the subversion repository like: +# +# ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/} +# +# so if you define ESVN_REPO_URI as http://svn.collab.net/repo/svn/trunk or +# http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn. +# it will check out like: +# +# ${ESVN_STORE_DIR}/subversion/trunk +# +# this is not used in order to declare the name of the upstream project. +# so that you can declare this like: +# +# # jakarta commons-loggin +# ESVN_PROJECT=commons/logging +# +# default: ${PN/-svn}. +ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}" + +# @ECLASS-VARIABLE: ESVN_BOOTSTRAP +# @DESCRIPTION: +# bootstrap script or command like autogen.sh or etc.. +ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}" + +# @ECLASS-VARIABLE: ESVN_PATCHES +# @DESCRIPTION: +# subversion eclass can apply patches in subversion_bootstrap(). +# you can use regexp in this variable like *.diff or *.patch or etc. +# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed. +# +# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either +# location, the installation dies. +ESVN_PATCHES="${ESVN_PATCHES:-}" + +# @ECLASS-VARIABLE: ESVN_RESTRICT +# @DESCRIPTION: +# this should be a space delimited list of subversion eclass features to +# restrict. +# export) +# don't export the working copy to S. +ESVN_RESTRICT="${ESVN_RESTRICT:-}" + +# @ECLASS-VARIABLE: ESVN_OFFLINE +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic updating of +# an svn source tree. This is intended to be set outside the subversion source +# tree by users. +ESVN_OFFLINE="${ESVN_OFFLINE:-${ESCM_OFFLINE}}" + +# @ECLASS-VARIABLE: ESVN_UP_FREQ +# @DESCRIPTION: +# Set the minimum number of hours between svn up'ing in any given svn module. This is particularly +# useful for split KDE ebuilds where we want to ensure that all submodules are compiled for the same +# revision. It should also be kept user overrideable. +ESVN_UP_FREQ="${ESVN_UP_FREQ:=}" + +# @ECLASS-VARIABLE: ESCM_LOGDIR +# @DESCRIPTION: +# User configuration variable. If set to a path such as e.g. /var/log/scm any +# package inheriting from subversion.eclass will record svn revision to +# ${CATEGORY}/${PN}.log in that path in pkg_preinst. This is not supposed to be +# set by ebuilds/eclasses. It defaults to empty so users need to opt in. +ESCM_LOGDIR="${ESCM_LOGDIR:=}" + +# @FUNCTION: subversion_fetch +# @USAGE: [repo_uri] [destination] +# @DESCRIPTION: +# Wrapper function to fetch sources from subversion via svn checkout or svn update, +# depending on whether there is an existing working copy in ${ESVN_STORE_DIR}. +# +# Can take two optional parameters: +# repo_uri - a repository URI. default is ESVN_REPO_URI. +# destination - a check out path in S. +subversion_fetch() { + local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")" + local revision="$(subversion__get_peg_revision "${1:-${ESVN_REPO_URI}}")" + local S_dest="${2}" + + if [[ -z ${repo_uri} ]]; then + die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." + fi + + [[ -n "${ESVN_REVISION}" ]] && revision="${ESVN_REVISION}" + + # check for the protocol + local protocol="${repo_uri%%:*}" + + case "${protocol}" in + http|https) + if ! built_with_use --missing true -o dev-util/subversion webdav-neon webdav-serf || \ + built_with_use --missing false dev-util/subversion nowebdav ; then + echo + eerror "In order to emerge this package, you need to" + eerror "reinstall Subversion with support for WebDAV." + eerror "Subversion requires either Neon or Serf to support WebDAV." + echo + die "${ESVN}: reinstall Subversion with support for WebDAV." + fi + ;; + svn|svn+ssh) + ;; + *) + die "${ESVN}: fetch from '${protocol}' is not yet implemented." + ;; + esac + + addread "/etc/subversion" + addwrite "${ESVN_STORE_DIR}" + + if [[ ! -d ${ESVN_STORE_DIR} ]]; then + debug-print "${FUNCNAME}: initial checkout. creating subversion directory" + mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." + fi + + cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" + + local wc_path="$(subversion__get_wc_path "${repo_uri}")" + local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" + + [[ -n "${revision}" ]] && options="${options} -r ${revision}" + + if [[ "${ESVN_OPTIONS}" = *-r* ]]; then + ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please" + ewarn "see \${ESVN_REPO_URI}" + fi + + debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" + debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" + debug-print "${FUNCNAME}: options = \"${options}\"" + + if [[ ! -d ${wc_path}/.svn ]]; then + if [[ -n ${ESVN_OFFLINE} ]]; then + ewarn "ESVN_OFFLINE cannot be used when the there is no existing checkout." + fi + # first check out + einfo "subversion check out start -->" + einfo " repository: ${repo_uri}${revision:+@}${revision}" + + debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" + + mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." + cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" + ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." + + elif [[ -n ${ESVN_OFFLINE} ]]; then + subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." + if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then + die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally." + fi + einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}." + else + subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." + + local esvn_up_freq= + if [[ -n ${ESVN_UP_FREQ} ]]; then + if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then + die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up." + elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then + einfo "Fetching disabled since ${ESVN_UP_FREQ} hours has not passed since last update." + einfo "Using existing repository copy at revision ${ESVN_WC_REVISION}." + esvn_up_freq=no_update + fi + fi + + if [[ -z ${esvn_up_freq} ]]; then + if [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}") ]]; then + einfo "subversion switch start -->" + einfo " old repository: ${ESVN_WC_URL}@${ESVN_WC_REVISION}" + einfo " new repository: ${repo_uri}${revision:+@}${revision}" + + debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" + + cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" + ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}" + else + # update working copy + einfo "subversion update start -->" + einfo " repository: ${repo_uri}${revision:+@}${revision}" + + debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" + + cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" + ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." + fi + fi + fi + + einfo " working copy: ${wc_path}" + + if ! has "export" ${ESVN_RESTRICT}; then + cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" + + local S="${S}/${S_dest}" + mkdir -p "${S}" + + # export to the ${WORKDIR} + #* "svn export" has a bug. see http://bugs.gentoo.org/119236 + #* svn export . "${S}" || die "${ESVN}: can't export to ${S}." + rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." + fi + + echo +} + +# @FUNCTION: subversion_bootstrap +# @DESCRIPTION: +# Apply patches in ${ESVN_PATCHES} and run ${ESVN_BOOTSTRAP} if specified. +subversion_bootstrap() { + if has "export" ${ESVN_RESTRICT}; then + return + fi + + cd "${S}" + + if [[ -n ${ESVN_PATCHES} ]]; then + einfo "apply patches -->" + + local patch fpatch + + for patch in ${ESVN_PATCHES}; do + if [[ -f ${patch} ]]; then + epatch "${patch}" + + else + for fpatch in ${FILESDIR}/${patch}; do + if [[ -f ${fpatch} ]]; then + epatch "${fpatch}" + + else + die "${ESVN}: ${patch} not found" + + fi + done + + fi + done + + echo + fi + + if [[ -n ${ESVN_BOOTSTRAP} ]]; then + einfo "begin bootstrap -->" + + if [[ -f ${ESVN_BOOTSTRAP} && -x ${ESVN_BOOTSTRAP} ]]; then + einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" + eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." + + else + einfo " bootstrap with command: ${ESVN_BOOTSTRAP}" + eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP." + + fi + fi +} + +# @FUNCTION: subversion_src_unpack +# @DESCRIPTION: +# default src_unpack. fetch and bootstrap. +subversion_src_unpack() { + subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." + subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." +} + +# @FUNCTION: subversion_wc_info +# @USAGE: [repo_uri] +# @RETURN: ESVN_WC_URL, ESVN_WC_ROOT, ESVN_WC_UUID, ESVN_WC_REVISION and ESVN_WC_PATH +# @DESCRIPTION: +# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI. +# +# The working copy information on the specified repository URI are set to +# ESVN_WC_* variables. +subversion_wc_info() { + local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")" + local wc_path="$(subversion__get_wc_path "${repo_uri}")" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + debug-print "${FUNCNAME}: wc_path = ${wc_path}" + + if [[ ! -d ${wc_path} ]]; then + return 1 + fi + + export ESVN_WC_URL="$(subversion__svn_info "${wc_path}" "URL")" + export ESVN_WC_ROOT="$(subversion__svn_info "${wc_path}" "Repository Root")" + export ESVN_WC_UUID="$(subversion__svn_info "${wc_path}" "Repository UUID")" + export ESVN_WC_REVISION="$(subversion__svn_info "${wc_path}" "Revision")" + export ESVN_WC_PATH="${wc_path}" +} + +## -- Private Functions + +## -- subversion__svn_info() ------------------------------------------------- # +# +# param $1 - a target. +# param $2 - a key name. +# +subversion__svn_info() { + local target="${1}" + local key="${2}" + + env LC_ALL=C svn info "${target}" | grep -i "^${key}" | cut -d" " -f2- +} + +## -- subversion__get_repository_uri() --------------------------------------- # +# +# param $1 - a repository URI. +subversion__get_repository_uri() { + local repo_uri="${1}" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + + if [[ -z ${repo_uri} ]]; then + die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." + fi + + # delete trailing slash + if [[ -z ${repo_uri##*/} ]]; then + repo_uri="${repo_uri%/}" + fi + + repo_uri="${repo_uri%@*}" + + echo "${repo_uri}" +} + +## -- subversion__get_wc_path() ---------------------------------------------- # +# +# param $1 - a repository URI. +subversion__get_wc_path() { + local repo_uri="$(subversion__get_repository_uri "${1}")" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + + echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}" +} + +## -- subversion__get_peg_revision() ----------------------------------------- # +# +# param $1 - a repository URI. +subversion__get_peg_revision() { + local repo_uri="${1}" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + + # repo_uri has peg revision ? + if [[ ${repo_uri} != *@* ]]; then + debug-print "${FUNCNAME}: repo_uri does not have a peg revision." + fi + + local peg_rev= + [[ ${repo_uri} = *@* ]] && peg_rev="${repo_uri##*@}" + + debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" + + echo "${peg_rev}" +} + +# @FUNCTION: subversion_pkg_preinst +# @USAGE: [repo_uri] +# @DESCRIPTION: +# Log the svn revision of source code. Doing this in pkg_preinst because we +# want the logs to stick around if packages are uninstalled without messing with +# config protection. +subversion_pkg_preinst() { + local pkgdate=$(date "+%Y%m%d %H:%M:%S") + subversion_wc_info "${1:-${ESVN_REPO_URI}}" + if [[ -n ${ESCM_LOGDIR} ]]; then + local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}" + if [[ ! -d ${dir} ]]; then + mkdir -p "${dir}" || \ + eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'" + fi + local logmessage="svn: ${pkgdate} - ${PF}:${SLOT} was merged at revision ${ESVN_WC_REVISION}" + if [[ -d ${dir} ]]; then + echo "${logmessage}" >> "${dir}/${PN}.log" + else + eerror "Could not log the message '${logmessage}' to '${dir}/${PN}.log'" + fi + fi +} diff --git a/eclass/qt4-build-new.eclass b/eclass/qt4-build-new.eclass new file mode 100644 index 00000000000..88c4fa10c8f --- /dev/null +++ b/eclass/qt4-build-new.eclass @@ -0,0 +1,547 @@ +# Copyright 2007-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: qt4-build.eclass +# @MAINTAINER: +# Caleb Tennis <caleb@gentoo.org> +# @BLURB: Eclass for Qt4 split ebuilds. +# @DESCRIPTION: +# This eclass contains various functions that are used when building Qt4 +# +# +# draft #2 for qt4-build eclass +# 6/1/2008 +# Markos Chandras (hwoarang) <hwoarang@silverarrow.gr> +# +# NOTES: +# +# *.9999 stands for 4.4.9999 live ebuils from kdesvn repository +# *9999 stands for 9999 live ebuilds from trolltechs git repository +# +# +IUSE="${IUSE} debug pch" + +case "${PV}" in + *.9999) + inherit eutils multilib toolchain-funcs flag-o-matic subversion + ;; + *9999) + inherit eutils multilib toolchain-funcs flag-o-matic git versionator + ;; + *) + inherit eutils multilib toolchain-funcs flag-o-matic + ;; +esac + +case "${PV}" in + 4.*.*_beta*) + SRCTYPE="${SRCTYPE:-opensource-src}" + MY_PV="${PV/_beta/-beta}" + ;; + 4.*.0_rc*) + SRCTYPE="${SRCTYPE:-opensource-src}" + MY_PV="${PV/_rc/-rc}" + ;; + *) + SRCTYPE="${SRCTYPE:-opensource-src}" + MY_PV="${PV}" + ;; +esac +MY_P=qt-x11-${SRCTYPE}-${MY_PV} +S=${WORKDIR}/${MY_P} + +SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2" + +#fix 2 +#removing svn stuff , use git variables instead +case "${PV}" in + *.9999) + ESVN_REPO_URI="svn://anonsvn.kde.org/home/trunk/qt-copy" + ESVN_PROJECT="qt-copy" + SRC_URI= + ;; + *9999) + EGIT_REPO_URI="git://labs.trolltech.com/qt/all" + SRC_URI= + ;; + 4.4.2|4.4.1|4.4.0|4.4.0_rc*) + SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" + ;; + *) + ;; +esac + +# fix 3 +# Removing qt4-build_check_use +# See fix 9 for more informations +# !! AFFECTED EBUILDS !! # +# 4.5 and live fixed but not commited +# + +qt4-build_pkg_setup() { + # Check USE requirements + #qt4-build_check_use + + # Set up installation directories + QTBASEDIR=/usr/$(get_libdir)/qt4 + QTPREFIXDIR=/usr + QTBINDIR=/usr/bin + QTLIBDIR=/usr/$(get_libdir)/qt4 + QTPCDIR=/usr/$(get_libdir)/pkgconfig + QTDATADIR=/usr/share/qt4 + QTDOCDIR=/usr/share/doc/qt-${PV} + QTHEADERDIR=/usr/include/qt4 + QTPLUGINDIR=${QTLIBDIR}/plugins + QTSYSCONFDIR=/etc/qt4 + QTTRANSDIR=${QTDATADIR}/translations + QTEXAMPLESDIR=${QTDATADIR}/examples + QTDEMOSDIR=${QTDATADIR}/demos + + PLATFORM=$(qt_mkspecs_dir) + + PATH="${S}/bin:${PATH}" + LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" +} + +qt4_unpack() { + local target targets + for target in configure LICENSE.{GPL2,GPL3} projects.pro \ + src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ + ${QT4_EXTRACT_DIRECTORIES}; do + targets="${targets} ${MY_P}/${target}" + done + case "${PV}" in + *.9999) + ESVN_REPO_FREQ=${ESVN_UP_FREQ:-1} + subversion_src_unpack + ;; + *9999) + git_src_unpack + ;; + *) + echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} + tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} + ;; + esac + + case "${PV}" in + # this could be moved above while removing ;;, but I'm not sure about consequences of unpacking reorder - yngwin? help :) + 4.4.2|4.4.1|4.4.0|4.4.0_rc*) + echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 + tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 + ;; + esac +} + +qt4-build_src_unpack() { + qt4_unpack + case "${PV}" in + *.9999) + # apply KDE patchset + cd "${S}" + python apply_patches.py || die "Applying KDE patchset failed" + ;; + esac + + if [[ ${PN} != qt-core ]]; then + cd "${S}" + skip_qmake_build_patch + skip_project_generation_patch + symlink_binaries_to_buildtree + fi + + 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=${LDFLAGS}:" \ + -e "s:X11R6/::" \ + -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" + + 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=${LDFLAGS}:" \ + -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" +} + +#fix 6 +#since EAPI 2 is using src_configure and src_compile functions +#we need to split the old src_compile function to src_configure and src_compile +qt4-build_src_configure() { + # Don't let the user go too overboard with flags. If you really want to, uncomment + # out the line below and give 'er a whirl. + strip-flags + replace-flags -O3 -O2 + + if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then + ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" + append-flags -fno-stack-protector + fi + + # Bug 178652 + if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then + ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" + append-flags -fno-gcse + fi + + myconf="$(standard_configure_options) ${myconf}" + + echo ./configure ${myconf} + ./configure ${myconf} || die "./configure failed" +} + +#fix 7 +# src_compile new implementation +qt4-build_src_compile() { + build_directories "${QT4_TARGET_DIRECTORIES}" +} + +qt4-build_src_install() { + install_directories "${QT4_TARGET_DIRECTORIES}" + install_qconfigs + fix_library_files +} + +standard_configure_options() { + local myconf="" + + [[ $(get_libdir) != "lib" ]] && myconf="${myconf} -L/usr/$(get_libdir)" + + # Disable visibility explicitly if gcc version isn't 4 + if [[ "$(gcc-major-version)" -lt "4" ]]; then + myconf="${myconf} -no-reduce-exports" + fi + + # precompiled headers doesn't work on hardened, where the flag is masked. + if use pch; then + myconf="${myconf} -pch" + else + myconf="${myconf} -no-pch" + fi + + if use debug; then + myconf="${myconf} -debug -no-separate-debug-info" + else + myconf="${myconf} -release -no-separate-debug-info" + fi + + # ARCH is set on Gentoo. QT now falls back to generic on an unsupported + # ${ARCH}. Therefore we convert it to supported values. + case "${ARCH}" in + amd64) myconf="${myconf} -arch x86_64" ;; + ppc|ppc64) myconf="${myconf} -arch powerpc" ;; + x86|x86-*) myconf="${myconf} -arch i386" ;; + alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; + hppa|sh) myconf="${myconf} -arch generic" ;; + *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;; + esac + + myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath + -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} + -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} + -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} + -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} + -demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations + -nomake examples -nomake demos" + + echo "${myconf}" +} + +#fix 8 +#removing as obsolete. See fix #6 +#build_directories is now called through qt4-build_src_compile function +#build_target_directories() { +# build_directories "${QT4_TARGET_DIRECTORIES}" +#} + +build_directories() { + local dirs="$@" + for x in ${dirs}; do + cd "${S}"/${x} + "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" + emake || die "emake failed" + done +} + +install_directories() { + local dirs="$@" + for x in ${dirs}; 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="${QCONFIG_ADD:-}" + +# @ECLASS-VARIABLE: QCONFIG_REMOVE +# @DESCRIPTION: +# List options that need to be removed from QT_CONFIG in qconfig.pri +QCONFIG_REMOVE="${QCONFIG_REMOVE:-}" + +# @ECLASS-VARIABLE: QCONFIG_DEFINE +# @DESCRIPTION: +# List variables that should be defined at the top of QtCore/qconfig.h +QCONFIG_DEFINE="${QCONFIG_DEFINE:-}" + +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}/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}/Gentoo + doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" + fi +} + +# Stubs for functions used by the Qt 4.4.0_technical_preview_1. +qconfig_add_option() { : ; } +qconfig_remove_option() { : ; } + +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="${qconfig_add} $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" + qconfig_remove="${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="${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 +} + +qt4-build_pkg_postrm() { + generate_qconfigs +} + +qt4-build_pkg_postinst() { + generate_qconfigs + #since we have two 9999 packages , it is wise to let the user know , which + #live ebuild is the one he installed. Feel free to change the messages. They + # just examples + case "${PN}" in + *.9999) + elog "Qt live version from kdesvn repository";; + *9999) + elog "Qt live version from trolltechs' git repository" ;; + esac +} + +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" +} + +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" +} + +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 +} + +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} + mv ${libfile} "${D}"/${QTPCDIR}/ \ + || die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed." + fi + done + + # Don't install an empty directory + rmdir "${D}"/${QTLIBDIR}/pkgconfig +} + +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 +} + +# Fix 9 +# removing obsolete stuff here +# Using EAPI Use dependencies indead + + +# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK +# @DESCRIPTION: +# The contents of $QT4_BUILT_WITH_USE_CHECK gets fed to built_with_use +# (eutils.eclass), line per line. +# +# Example: +# @CODE +# pkg_setup() { +# use qt3support && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} +# ~x11-libs/qt-gui-${PV} qt3support" +# qt4-build_check_use +# } +# @CODE + +# Run built_with_use on each flag and print appropriate error messages if any +# flags are missing +#_qt_built_with_use() { +# local missing opt pkg flag flags +# +# if [[ ${1} = "--missing" ]]; then +# missing="${1} ${2}" && shift 2 +# fi +# if [[ ${1:0:1} = "-" ]]; then +# opt=${1} && shift +# fi +# +# pkg=${1} && shift +# +# for flag in "${@}"; do +# flags="${flags} ${flag}" +# if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then +# flags="${flags}*" +# else +# [[ ${opt} = "-o" ]] && return 0 +# fi +# done +# if [[ "${flags# }" = "${@}" ]]; then +# return 0 +# fi +# if [[ ${opt} = "-o" ]]; then +# eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'." +# else +# eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'." +# fi +# return 1 +#} +# +## @FUNCTION: qt4-build_check_use +# @DESCRIPTION: +# Check if the listed packages in $QT4_BUILT_WITH_USE_CHECK are built with the +# USE flags listed. +# +# If any of the required USE flags are missing, an eerror will be printed for +# each package with missing USE flags. +#qt4-build_check_use() { +# local line missing +# while read line; do +# [[ -z ${line} ]] && continue +# if ! _qt_built_with_use ${line}; then +# missing=true +# fi +# done <<< "${QT4_BUILT_WITH_USE_CHECK}" +# if [[ -n ${missing} ]]; then +# echo +# eerror "Flags marked with an * are missing." +# die "Missing USE flags found" +# fi +#} + +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*) + spec="darwin" ;; + *-linux-*|*-linux) + spec="linux" ;; + *) + die "Unknown CHOST, no platform choosen." + esac + + CXX=$(tc-getCXX) + if [[ ${CXX/g++/} != ${CXX} ]]; then + spec="${spec}-g++" + elif [[ ${CXX/icpc/} != ${CXX} ]]; then + spec="${spec}-icc" + else + die "Unknown compiler ${CXX}." + fi + + echo "${spec}" +} +#fix 10 +#exporting src_configure function +EXPORT_FUNCTIONS pkg_setup src_unpack src_configure src_compile src_install pkg_postrm pkg_postinst diff --git a/eclass/qt4-build.eclass b/eclass/qt4-build.eclass new file mode 100644 index 00000000000..9fcc46ad4d9 --- /dev/null +++ b/eclass/qt4-build.eclass @@ -0,0 +1,495 @@ +# Copyright 2007-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: qt4-build.eclass +# @MAINTAINER: +# Caleb Tennis <caleb@gentoo.org> +# @BLURB: Eclass for Qt4 split ebuilds. +# @DESCRIPTION: +# This eclass contains various functions that are used when building Qt4 + +IUSE="${IUSE} debug pch" + +case "${PV}" in + *9999) + inherit eutils multilib toolchain-funcs flag-o-matic subversion + ;; + *) + inherit eutils multilib toolchain-funcs flag-o-matic + ;; +esac + +case "${PV}" in + 4.*.*_beta*) + SRCTYPE="${SRCTYPE:-opensource-src}" + MY_PV="${PV/_beta/-beta}" + ;; + 4.*.0_rc*) + SRCTYPE="${SRCTYPE:-opensource-src}" + MY_PV="${PV/_rc/-rc}" + ;; + *) + SRCTYPE="${SRCTYPE:-opensource-src}" + MY_PV="${PV}" + ;; +esac +MY_P=qt-x11-${SRCTYPE}-${MY_PV} +S=${WORKDIR}/${MY_P} + +SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2" + +case "${PV}" in + *9999) + ESVN_REPO_URI="svn://anonsvn.kde.org/home/kde/trunk/qt-copy" + ESVN_PROJECT="qt-copy" + SRC_URI= + ;; + 4.4.2|4.4.1|4.4.0|4.4.0_rc*) + SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" + ;; + *) + ;; +esac + +qt4-build_pkg_setup() { + # Check USE requirements + qt4-build_check_use + + # Set up installation directories + QTBASEDIR=/usr/$(get_libdir)/qt4 + QTPREFIXDIR=/usr + QTBINDIR=/usr/bin + QTLIBDIR=/usr/$(get_libdir)/qt4 + QTPCDIR=/usr/$(get_libdir)/pkgconfig + QTDATADIR=/usr/share/qt4 + QTDOCDIR=/usr/share/doc/qt-${PV} + QTHEADERDIR=/usr/include/qt4 + QTPLUGINDIR=${QTLIBDIR}/plugins + QTSYSCONFDIR=/etc/qt4 + QTTRANSDIR=${QTDATADIR}/translations + QTEXAMPLESDIR=${QTDATADIR}/examples + QTDEMOSDIR=${QTDATADIR}/demos + + PLATFORM=$(qt_mkspecs_dir) + + PATH="${S}/bin:${PATH}" + LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" +} + +qt4_unpack() { + local target targets + for target in configure LICENSE.{GPL2,GPL3} projects.pro \ + src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ + ${QT4_EXTRACT_DIRECTORIES}; do + targets="${targets} ${MY_P}/${target}" < |
