add multilib eclasses
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/vmware@2303 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
parent
0b4f563b0d
commit
014acb0d23
494
eclass/distutils.eclass
Normal file
494
eclass/distutils.eclass
Normal file
@ -0,0 +1,494 @@
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.76 2010/07/17 23:03:29 arfrever Exp $
|
||||
|
||||
# @ECLASS: distutils.eclass
|
||||
# @MAINTAINER:
|
||||
# Gentoo Python Project <python@gentoo.org>
|
||||
#
|
||||
# Original author: Jon Nelson <jnelson@gentoo.org>
|
||||
# @BLURB: Eclass for packages with build systems using Distutils
|
||||
# @DESCRIPTION:
|
||||
# The distutils eclass defines phase functions for packages with build systems using Distutils.
|
||||
|
||||
inherit multilib python
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
0|1)
|
||||
EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
|
||||
;;
|
||||
*)
|
||||
EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
|
||||
if [[ $(number_abis) -gt 1 ]] ; then
|
||||
DEPEND="dev-lang/python[lib32?]"
|
||||
else
|
||||
DEPEND="dev-lang/python"
|
||||
fi
|
||||
RDEPEND="${DEPEND}"
|
||||
fi
|
||||
|
||||
# 'python' variable is deprecated. Use PYTHON() instead.
|
||||
if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
python="python"
|
||||
else
|
||||
python="die"
|
||||
fi
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
|
||||
# @DESCRIPTION:
|
||||
# Set this to use separate source directories for each enabled version of Python.
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
|
||||
# @DESCRIPTION:
|
||||
# Paths to setup files.
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
|
||||
# @DESCRIPTION:
|
||||
# Global options passed to setup files.
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
|
||||
# @DESCRIPTION:
|
||||
# Type of test command used by distutils_src_test().
|
||||
# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
|
||||
# Valid values:
|
||||
# setup.py
|
||||
# nosetests
|
||||
# py.test
|
||||
# trial [arguments]
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_DISABLE_TEST_DEPENDENCY
|
||||
# @DESCRIPTION:
|
||||
# Disable modification of IUSE and DEPEND caused by setting of DISTUTILS_SRC_TEST.
|
||||
|
||||
if [[ -n "${DISTUTILS_SRC_TEST}" && ! "${DISTUTILS_SRC_TEST}" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]; then
|
||||
die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
|
||||
fi
|
||||
|
||||
if [[ -z "${DISTUTILS_DISABLE_TEST_DEPENDENCY}" ]]; then
|
||||
if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
|
||||
IUSE="test"
|
||||
DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
|
||||
elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
|
||||
IUSE="test"
|
||||
DEPEND+="${DEPEND:+ }test? ( dev-python/py )"
|
||||
# trial requires an argument, which is usually equal to "${PN}".
|
||||
elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
|
||||
IUSE="test"
|
||||
DEPEND+="${DEPEND:+ }test? ( dev-python/twisted )"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "${DISTUTILS_SRC_TEST}" ]]; then
|
||||
EXPORT_FUNCTIONS src_test
|
||||
fi
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS
|
||||
# @DESCRIPTION:
|
||||
# Set this to disable renaming of Python scripts containing versioned shebangs
|
||||
# and generation of wrapper scripts.
|
||||
|
||||
# @ECLASS-VARIABLE: DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS
|
||||
# @DESCRIPTION:
|
||||
# List of paths to Python scripts, relative to ${ED}, which are excluded from
|
||||
# renaming and generation of wrapper scripts.
|
||||
|
||||
# @ECLASS-VARIABLE: DOCS
|
||||
# @DESCRIPTION:
|
||||
# Additional documentation files installed by distutils_src_install().
|
||||
|
||||
_distutils_get_build_dir() {
|
||||
if [[ -n "${SUPPORT_PYTHON_ABIS}" && -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
|
||||
echo "build-${PYTHON_ABI}"
|
||||
else
|
||||
echo "build"
|
||||
fi
|
||||
}
|
||||
|
||||
_distutils_get_PYTHONPATH() {
|
||||
if [[ -n "${SUPPORT_PYTHON_ABIS}" && -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
|
||||
ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
|
||||
else
|
||||
ls -d build/lib* 2> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
_distutils_hook() {
|
||||
if [[ "$#" -ne 1 ]]; then
|
||||
die "${FUNCNAME}() requires 1 argument"
|
||||
fi
|
||||
if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
|
||||
"distutils_src_${EBUILD_PHASE}_$1_hook"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_src_unpack
|
||||
# @DESCRIPTION:
|
||||
# The distutils src_unpack function. This function is exported.
|
||||
distutils_src_unpack() {
|
||||
if ! has "${EAPI:-0}" 0 1; then
|
||||
die "${FUNCNAME}() cannot be used in this EAPI"
|
||||
fi
|
||||
|
||||
if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
|
||||
die "${FUNCNAME}() can be used only in src_unpack() phase"
|
||||
fi
|
||||
|
||||
unpack ${A}
|
||||
cd "${S}"
|
||||
|
||||
distutils_src_prepare
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_src_prepare
|
||||
# @DESCRIPTION:
|
||||
# The distutils src_prepare function. This function is exported.
|
||||
distutils_src_prepare() {
|
||||
if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
|
||||
die "${FUNCNAME}() can be used only in src_prepare() phase"
|
||||
fi
|
||||
|
||||
# Delete ez_setup files to prevent packages from installing Setuptools on their own.
|
||||
local ez_setup_existence="0"
|
||||
[[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
|
||||
rm -fr ez_setup*
|
||||
if [[ "${ez_setup_existence}" == "1" ]]; then
|
||||
echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
|
||||
fi
|
||||
|
||||
# Delete distribute_setup files to prevent packages from installing Distribute on their own.
|
||||
local distribute_setup_existence="0"
|
||||
[[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"
|
||||
rm -fr distribute_setup*
|
||||
if [[ "${distribute_setup_existence}" == "1" ]]; then
|
||||
echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py
|
||||
fi
|
||||
|
||||
if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
|
||||
python_copy_sources
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_src_compile
|
||||
# @DESCRIPTION:
|
||||
# The distutils src_compile function. This function is exported.
|
||||
# In ebuilds of packages supporting installation for multiple versions of Python, this function
|
||||
# calls distutils_src_compile_pre_hook() and distutils_src_compile_post_hook(), if they are defined.
|
||||
distutils_src_compile() {
|
||||
if [[ "${EBUILD_PHASE}" != "compile" ]]; then
|
||||
die "${FUNCNAME}() can be used only in src_compile() phase"
|
||||
fi
|
||||
|
||||
_python_set_color_variables
|
||||
|
||||
if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
distutils_building() {
|
||||
_distutils_hook pre
|
||||
|
||||
local setup_file
|
||||
for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
|
||||
echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
|
||||
"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
|
||||
done
|
||||
|
||||
_distutils_hook post
|
||||
}
|
||||
python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
|
||||
else
|
||||
local setup_file
|
||||
for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
|
||||
echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
|
||||
"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_distutils_src_test_hook() {
|
||||
if [[ "$#" -ne 1 ]]; then
|
||||
die "${FUNCNAME}() requires 1 arguments"
|
||||
fi
|
||||
|
||||
if [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
|
||||
eval "python_execute_$1_pre_hook() {
|
||||
distutils_src_test_pre_hook
|
||||
}"
|
||||
fi
|
||||
|
||||
if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
|
||||
eval "python_execute_$1_post_hook() {
|
||||
distutils_src_test_post_hook
|
||||
}"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_src_test
|
||||
# @DESCRIPTION:
|
||||
# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
|
||||
# In ebuilds of packages supporting installation for multiple versions of Python, this function
|
||||
# calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
|
||||
distutils_src_test() {
|
||||
if [[ "${EBUILD_PHASE}" != "test" ]]; then
|
||||
die "${FUNCNAME}() can be used only in src_test() phase"
|
||||
fi
|
||||
|
||||
_python_set_color_variables
|
||||
|
||||
if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
|
||||
if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
distutils_testing() {
|
||||
_distutils_hook pre
|
||||
|
||||
local setup_file
|
||||
for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
|
||||
echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
|
||||
PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"
|
||||
done
|
||||
|
||||
_distutils_hook post
|
||||
}
|
||||
python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
|
||||
else
|
||||
local setup_file
|
||||
for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
|
||||
echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
|
||||
PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
|
||||
done
|
||||
fi
|
||||
elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
|
||||
_distutils_src_test_hook nosetests
|
||||
|
||||
python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
|
||||
elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
|
||||
_distutils_src_test_hook py.test
|
||||
|
||||
python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
|
||||
# trial requires an argument, which is usually equal to "${PN}".
|
||||
elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
|
||||
local trial_arguments
|
||||
if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
|
||||
trial_arguments="${DISTUTILS_SRC_TEST#trial }"
|
||||
else
|
||||
trial_arguments="${PN}"
|
||||
fi
|
||||
|
||||
_distutils_src_test_hook trial
|
||||
|
||||
python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${trial_arguments} "$@"
|
||||
else
|
||||
die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_src_install
|
||||
# @DESCRIPTION:
|
||||
# The distutils src_install function. This function is exported.
|
||||
# In ebuilds of packages supporting installation for multiple versions of Python, this function
|
||||
# calls distutils_src_install_pre_hook() and distutils_src_install_post_hook(), if they are defined.
|
||||
# It also installs some standard documentation files (AUTHORS, Change*, CHANGELOG, CONTRIBUTORS,
|
||||
# KNOWN_BUGS, MAINTAINERS, MANIFEST*, NEWS, PKG-INFO, README*, TODO).
|
||||
distutils_src_install() {
|
||||
if [[ "${EBUILD_PHASE}" != "install" ]]; then
|
||||
die "${FUNCNAME}() can be used only in src_install() phase"
|
||||
fi
|
||||
|
||||
if is_final_abi || (! has_multilib_profile); then
|
||||
if [ -n "${PYTHON_SLOT_VERSION}" ] ; then
|
||||
python=python${PYTHON_SLOT_VERSION}
|
||||
else
|
||||
python=python
|
||||
fi
|
||||
else
|
||||
[[ -z $(get_abi_var SETARCH_ARCH ${ABI}) ]] && die "SETARCH_ARCH_${ABI} is missing in your portage profile take a look at http://wiki.github.com/sjnewbury/multilib-overlay to get further information"
|
||||
if [ -n "${PYTHON_SLOT_VERSION}" ] ; then
|
||||
python="setarch $(get_abi_var SETARCH_ARCH ${ABI}) python${PYTHON_SLOT_VERSION}-${ABI}"
|
||||
elif [[ -n "${PYTHON}" ]]; then
|
||||
python="setarch $(get_abi_var SETARCH_ARCH ${ABI}) ${PYTHON}"
|
||||
else
|
||||
python="setarch $(get_abi_var SETARCH_ARCH ${ABI}) python"
|
||||
fi
|
||||
fi
|
||||
einfo Using ${python}
|
||||
|
||||
_python_initialize_prefix_variables
|
||||
_python_set_color_variables
|
||||
|
||||
if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||
declare -A wrapper_scripts=()
|
||||
|
||||
rename_scripts_with_versioned_shebangs() {
|
||||
if [[ -d "${ED}usr/bin" ]]; then
|
||||
cd "${ED}usr/bin"
|
||||
|
||||
local nonversioned_file file
|
||||
for file in *; do
|
||||
if [[ -f "${file}" && ! "${file}" =~ [[:digit:]]+\.[[:digit:]](-jython)?+$ && "$(head -n1 "${file}")" =~ ^'#!'.*(python|jython-)[[:digit:]]+\.[[:digit:]]+ ]]; then
|
||||
for nonversioned_file in "${DISTUTILS_NONVERSIONED_PYTHON_SCRIPTS[@]}"; do
|
||||
[[ "${nonversioned_file}" == "/usr/bin/${file}" ]] && continue 2
|
||||
done
|
||||
mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"
|
||||
wrapper_scripts+=(["${ED}usr/bin/${file}"]=)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
distutils_installation() {
|
||||
_distutils_hook pre
|
||||
|
||||
local setup_file
|
||||
for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
|
||||
echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@"${_NORMAL}
|
||||
"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --root="${D}" --no-compile "$@" || return "$?"
|
||||
done
|
||||
|
||||
if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||
rename_scripts_with_versioned_shebangs
|
||||
fi
|
||||
|
||||
_distutils_hook post
|
||||
}
|
||||
python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"
|
||||
|
||||
if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${#wrapper_scripts[@]}" -ne 0 && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
||||
python_generate_wrapper_scripts "${!wrapper_scripts[@]}"
|
||||
fi
|
||||
unset wrapper_scripts
|
||||
else
|
||||
# Mark the package to be rebuilt after a Python upgrade.
|
||||
python_need_rebuild
|
||||
|
||||
local setup_file
|
||||
for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
|
||||
echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
|
||||
"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -e "${ED}usr/local" ]]; then
|
||||
die "Illegal installation into /usr/local"
|
||||
fi
|
||||
|
||||
local default_docs
|
||||
default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO"
|
||||
|
||||
local doc
|
||||
for doc in ${default_docs}; do
|
||||
[[ -s "${doc}" ]] && dodoc "${doc}"
|
||||
done
|
||||
|
||||
if [[ -n "${DOCS}" ]]; then
|
||||
dodoc ${DOCS} || die "dodoc failed"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_pkg_postinst
|
||||
# @DESCRIPTION:
|
||||
# The distutils pkg_postinst function. This function is exported.
|
||||
# When PYTHON_MODNAME variable is set, then this function calls python_mod_optimize() with modules
|
||||
# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_optimize() with module, whose
|
||||
# name is equal to name of current package, if this module exists.
|
||||
distutils_pkg_postinst() {
|
||||
if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
|
||||
die "${FUNCNAME}() can be used only in pkg_postinst() phase"
|
||||
fi
|
||||
|
||||
_python_initialize_prefix_variables
|
||||
|
||||
local pylibdir pymod
|
||||
if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
|
||||
for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"/usr/share/jython-*/Lib; do
|
||||
if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
|
||||
PYTHON_MODNAME="${PN}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if has "${EAPI:-0}" 0 1 2; then
|
||||
if is_final_abi || (! has_multilib_profile); then
|
||||
if [ -n "${PYTHON_SLOT_VERSION}" ] ; then
|
||||
python=python${PYTHON_SLOT_VERSION}
|
||||
else
|
||||
python=python
|
||||
fi
|
||||
else
|
||||
[[ -z $(get_abi_var SETARCH_ARCH ${ABI}) ]] && die "SETARCH_ARCH_${ABI} is missing in your portage profile take a look at http://wiki.github.com/sjnewbury/multilib-overlay to get further information"
|
||||
if [ -n "${PYTHON_SLOT_VERSION}" ] ; then
|
||||
python="setarch $(get_abi_var SETARCH_ARCH ${ABI}) python${PYTHON_SLOT_VERSION}-${ABI}"
|
||||
elif [[ -n "${PYTHON}" ]]; then
|
||||
python="setarch $(get_abi_var SETARCH_ARCH ${ABI}) ${PYTHON}"
|
||||
else
|
||||
python="setarch $(get_abi_var SETARCH_ARCH ${ABI}) python"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
python="die"
|
||||
fi
|
||||
einfo Using ${python}
|
||||
if [[ -n "${PYTHON_MODNAME}" ]]; then
|
||||
if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
python_mod_optimize ${PYTHON_MODNAME}
|
||||
else
|
||||
for pymod in ${PYTHON_MODNAME}; do
|
||||
python_mod_optimize "$(python_get_sitedir)/${pymod}"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: distutils_pkg_postrm
|
||||
# @DESCRIPTION:
|
||||
# The distutils pkg_postrm function. This function is exported.
|
||||
# When PYTHON_MODNAME variable is set, then this function calls python_mod_cleanup() with modules
|
||||
# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_cleanup() with module, whose
|
||||
# name is equal to name of current package, if this module exists.
|
||||
distutils_pkg_postrm() {
|
||||
if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
|
||||
die "${FUNCNAME}() can be used only in pkg_postrm() phase"
|
||||
fi
|
||||
|
||||
_python_initialize_prefix_variables
|
||||
|
||||
local pylibdir pymod
|
||||
if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
|
||||
for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"/usr/share/jython-*/Lib; do
|
||||
if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
|
||||
PYTHON_MODNAME="${PN}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -n "${PYTHON_MODNAME}" ]]; then
|
||||
if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
|
||||
python_mod_cleanup ${PYTHON_MODNAME}
|
||||
else
|
||||
for pymod in ${PYTHON_MODNAME}; do
|
||||
for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
|
||||
if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
|
||||
python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Scheduled for deletion on 2011-01-01.
|
||||
distutils_python_version() {
|
||||
eerror "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables."
|
||||
die "${FUNCNAME}() is banned"
|
||||
}
|
||||
|
||||
# Scheduled for deletion on 2011-01-01.
|
||||
distutils_python_tkinter() {
|
||||
eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."
|
||||
die "${FUNCNAME}() is banned"
|
||||
}
|
137
eclass/gst-plugins-base.eclass
Normal file
137
eclass/gst-plugins-base.eclass
Normal file
@ -0,0 +1,137 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-base.eclass,v 1.16 2010/03/19 01:20:40 leio Exp $
|
||||
|
||||
# Author : foser <foser@gentoo.org>
|
||||
|
||||
# gst-plugins eclass
|
||||
#
|
||||
# eclass to make external gst-plugins emergable on a per-plugin basis
|
||||
# to solve the problem with gst-plugins generating far too much unneeded deps
|
||||
#
|
||||
# 3rd party applications using gstreamer now should depend on a set of plugins as
|
||||
# defined in the source, in case of spider usage obtain recommended plugins to use from
|
||||
# Gentoo developers responsible for gstreamer <gnome@gentoo.org>, the application developer
|
||||
# or the gstreamer team.
|
||||
|
||||
inherit eutils gst-plugins10
|
||||
|
||||
|
||||
###
|
||||
# variable declarations
|
||||
###
|
||||
|
||||
MY_PN=gst-plugins-base
|
||||
MY_P=${MY_PN}-${PV}
|
||||
# All relevant configure options for gst-plugins
|
||||
# need a better way to extract these
|
||||
# gst-plugins-base 0.9
|
||||
my_gst_plugins_base="x xvideo xshm gst_v4l alsa cdparanoia gnome_vfs
|
||||
gio libvisual ogg oggtest theora ivorbis vorbis vorbistest examples
|
||||
freetypetest pango"
|
||||
|
||||
#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2"
|
||||
SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-base/${MY_P}.tar.bz2"
|
||||
|
||||
S=${WORKDIR}/${MY_P}
|
||||
|
||||
# added to remove circular deps
|
||||
# 6/2/2006 - zaheerm
|
||||
if [ "${PN}" != "${MY_PN}" ]; then
|
||||
RDEPEND=">=media-libs/gst-plugins-base-${PV}[lib32?]"
|
||||
DEPEND="${RDEPEND}
|
||||
~media-libs/gst-plugins-base-${PV}[lib32?]
|
||||
>=sys-apps/sed-4
|
||||
dev-util/pkgconfig[lib32?]"
|
||||
RESTRICT=test
|
||||
fi
|
||||
|
||||
###
|
||||
# public functions
|
||||
###
|
||||
|
||||
gst-plugins-base_src_configure() {
|
||||
|
||||
# disable any external plugin besides the plugin we want
|
||||
local plugin gst_conf
|
||||
|
||||
einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
|
||||
|
||||
for plugin in ${GST_PLUGINS_BUILD}; do
|
||||
my_gst_plugins_base=${my_gst_plugins_base/${plugin}/}
|
||||
done
|
||||
for plugin in ${my_gst_plugins_base}; do
|
||||
gst_conf="${gst_conf} --disable-${plugin} "
|
||||
done
|
||||
for plugin in ${GST_PLUGINS_BUILD}; do
|
||||
gst_conf="${gst_conf} --enable-${plugin} "
|
||||
done
|
||||
|
||||
cd ${S}
|
||||
econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure"
|
||||
|
||||
}
|
||||
|
||||
###
|
||||
# public inheritable functions
|
||||
###
|
||||
|
||||
gst-plugins-base_src_unpack() {
|
||||
|
||||
# local makefiles
|
||||
|
||||
unpack ${A}
|
||||
|
||||
# Link with the syswide installed gst-libs if needed
|
||||
gst-plugins10_find_plugin_dir
|
||||
sed -e "s:\$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces:${ROOT}/usr/$(get_libdir)/libgstinterfaces:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/interfaces/libgstinterfaces:${ROOT}/usr/$(get_libdir)/libgstinterfaces:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/audio/libgstaudio:${ROOT}/usr/$(get_libdir)/libgstaudio:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/audio/libgstaudio:${ROOT}/usr/$(get_libdir)/libgstaudio:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/cdda/libgstcdda:${ROOT}/usr/$(get_libdir)/libgstcdda:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/cdda/libgstcdda:${ROOT}/usr/$(get_libdir)/libgstcdda:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/riff/libgstriff:${ROOT}/usr/$(get_libdir)/libgstriff:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/riff/libgstriff:${ROOT}/usr/$(get_libdir)/libgstriff:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/tag/libgsttag:${ROOT}/usr/$(get_libdir)/libgsttag:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/tag/libgsttag:${ROOT}/usr/$(get_libdir)/libgsttag:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/video/libgstvideo:${ROOT}/usr/$(get_libdir)/libgstvideo:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/video/libgstvideo:${ROOT}/usr/$(get_libdir)/libgstvideo:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/netbuffer/libgstnetbuffer:${ROOT}/usr/$(get_libdir)/libgstnetbuffer:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/netbuffer/libgstnetbuffer:${ROOT}/usr/$(get_libdir)/libgstnetbuffer:" \
|
||||
-e "s:\$(top_builddir)/gst-libs/gst/rtp/libgstrtp:${ROOT}/usr/$(get_libdir)/libgstrtp:" \
|
||||
-e "s:\${top_builddir}/gst-libs/gst/rtp/libgstrtp:${ROOT}/usr/$(get_libdir)/libgstrtp:" \
|
||||
-i Makefile.in
|
||||
# cd ${S}
|
||||
|
||||
# Remove generation of any other Makefiles except the plugin's Makefile
|
||||
# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then
|
||||
# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile"
|
||||
# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then
|
||||
# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile"
|
||||
# fi
|
||||
# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \
|
||||
# -i ${S}/configure
|
||||
|
||||
}
|
||||
|
||||
gst-plugins-base_src_compile() {
|
||||
|
||||
if [[ ${EAPI:-0} -lt 2 ]]; then
|
||||
gst-plugins-base_src_configure ${@}
|
||||
fi
|
||||
|
||||
gst-plugins10_find_plugin_dir
|
||||
emake || die "compile failure"
|
||||
|
||||
}
|
||||
|
||||
gst-plugins-base_src_install() {
|
||||
|
||||
gst-plugins10_find_plugin_dir
|
||||
einstall || die
|
||||
|
||||
[[ -e README ]] && dodoc README
|
||||
}
|
||||
|
||||
|
||||
EXPORT_FUNCTIONS src_unpack src_compile src_install
|
182
eclass/java-pkg-2.eclass
Normal file
182
eclass/java-pkg-2.eclass
Normal file
@ -0,0 +1,182 @@
|
||||
# Eclass for Java packages
|
||||
#
|
||||
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
|
||||
# Copyright (c) 2004-2005, Gentoo Foundation
|
||||
#
|
||||
# Licensed under the GNU General Public License, v2
|
||||
#
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.35 2010/02/01 09:38:44 caster Exp $
|
||||
|
||||
inherit java-utils-2
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# @eclass-begin
|
||||
# @eclass-summary Eclass for Java Packages
|
||||
#
|
||||
# This eclass should be inherited for pure Java packages, or by packages which
|
||||
# need to use Java.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @IUSE
|
||||
#
|
||||
# Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that
|
||||
# the eclass can automatically add the needed dependencies for the java-pkg_do*
|
||||
# functions.
|
||||
#
|
||||
# Build Java packages to native libraries
|
||||
# ------------------------------------------------------------------------------
|
||||
IUSE="${JAVA_PKG_IUSE} gcj multislot"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @depend
|
||||
#
|
||||
# Java packages need java-config, and a fairly new release of Portage.
|
||||
#
|
||||
# JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
|
||||
# ------------------------------------------------------------------------------
|
||||
DEPEND="${JAVA_PKG_E_DEPEND}"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @rdepend
|
||||
#
|
||||
# Nothing special for RDEPEND... just the same as DEPEND.
|
||||
# ------------------------------------------------------------------------------
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
# Commons packages follow the same rules so do it here
|
||||
if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then
|
||||
HOMEPAGE="http://commons.apache.org/${PN#commons-}/"
|
||||
SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz"
|
||||
fi
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;;
|
||||
*) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;;
|
||||
esac
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-pkg_setup
|
||||
#
|
||||
# pkg_setup initializes the Java environment
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-2_pkg_setup() {
|
||||
java-pkg_init
|
||||
java-pkg_ensure-test
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-src_prepare
|
||||
#
|
||||
# wrapper for java-utils-2_src_prepare
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-2_src_prepare() {
|
||||
java-utils-2_src_prepare
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-src_compile
|
||||
#
|
||||
# Default src_compile for java packages
|
||||
# variables:
|
||||
# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
|
||||
# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
|
||||
# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
|
||||
# EANT_DOC_TARGET - the target to build extra docs under the doc use flag
|
||||
# (default: javadoc; declare empty to disable completely)
|
||||
# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
|
||||
# EANT_EXTRA_ARGS - extra arguments to pass to eant
|
||||
# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment
|
||||
# param: Parameters are passed to ant verbatim
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-2_src_compile() {
|
||||
if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
|
||||
[[ "${EANT_FILTER_COMPILER}" ]] && \
|
||||
java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
|
||||
local antflags="${EANT_BUILD_TARGET:=jar}"
|
||||
if hasq doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then
|
||||
antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
|
||||
fi
|
||||
local tasks
|
||||
[[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}"
|
||||
ANT_TASKS="${tasks:-${ANT_TASKS}}" \
|
||||
eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}"
|
||||
else
|
||||
echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
|
||||
fi
|
||||
}
|
||||
|
||||
java-pkg-2_supports-test() {
|
||||
python << EOF
|
||||
from xml.dom.minidom import parse
|
||||
import sys
|
||||
dom = parse("${1}")
|
||||
for elem in dom.getElementsByTagName('target'):
|
||||
if elem.getAttribute('name') == 'test':
|
||||
sys.exit(0)
|
||||
sys.exit(1)
|
||||
EOF
|
||||
return $?
|
||||
}
|
||||
|
||||
java-pkg-2_src_test() {
|
||||
[[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
|
||||
|
||||
if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
|
||||
local opts task
|
||||
|
||||
if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
|
||||
java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
|
||||
fi
|
||||
|
||||
ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
|
||||
|
||||
if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
|
||||
|
||||
if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
|
||||
ANT_TASKS="${ANT_TASKS} ant-junit"
|
||||
else
|
||||
ANT_TASKS="ant-junit"
|
||||
fi
|
||||
|
||||
task=true
|
||||
fi
|
||||
|
||||
if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
|
||||
opts="-Djunit.jar=\"$(java-pkg_getjar junit junit.jar)\""
|
||||
if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
|
||||
EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit"
|
||||
elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then
|
||||
EANT_GENTOO_CLASSPATH+=',junit'
|
||||
else
|
||||
EANT_GENTOO_CLASSPATH=junit
|
||||
fi
|
||||
fi
|
||||
|
||||
eant ${opts} -f "${EANT_BUILD_XML}" \
|
||||
${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test}
|
||||
|
||||
else
|
||||
echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-pkg_preinst
|
||||
#
|
||||
# wrapper for java-utils-2_pkg_preinst
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-2_pkg_preinst() {
|
||||
java-utils-2_pkg_preinst
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-pkg_postinst
|
||||
# ------------------------------------------------------------------------------
|
||||
pre_pkg_postinst() {
|
||||
java-pkg_reg-cachejar_
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-end
|
||||
# ------------------------------------------------------------------------------
|
73
eclass/java-pkg-opt-2.eclass
Normal file
73
eclass/java-pkg-opt-2.eclass
Normal file
@ -0,0 +1,73 @@
|
||||
# Eclass for optional Java packages
|
||||
#
|
||||
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
|
||||
# Copyright (c) 2004-2005, Gentoo Foundation
|
||||
#
|
||||
# Licensed under the GNU General Public License, v2
|
||||
#
|
||||
# Major changes:
|
||||
# 20070805:
|
||||
# Removed phase hooks because Portage does proper env saving now.
|
||||
# <betelgeuse@gentoo.org>
|
||||
#
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-opt-2.eclass,v 1.14 2010/02/01 09:38:44 caster Exp $
|
||||
|
||||
inherit java-utils-2
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-begin
|
||||
# @eclass-summary Eclass for packages with optional Java support
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @ebuild-variable JAVA_PKG_OPT_USE
|
||||
#
|
||||
# USE flag to control if optional Java stuff is build. Defaults to 'java'.
|
||||
# ------------------------------------------------------------------------------
|
||||
JAVA_PKG_OPT_USE=${JAVA_PKG_OPT_USE:-java}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_PKG_E_DEPEND} )"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# See java-pkg-2.eclass for JAVA_PKG_IUSE documentation
|
||||
IUSE="${JAVA_PKG_IUSE} ${JAVA_PKG_OPT_USE} gcj multislot"
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
0|1) EXPORT_FUNCTIONS pkg_setup pkg_preinst ;;
|
||||
*) EXPORT_FUNCTIONS pkg_setup src_prepare pkg_preinst ;;
|
||||
esac
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-opt-2_pkg_setup() {
|
||||
use ${JAVA_PKG_OPT_USE} && java-pkg_init
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-src_prepare
|
||||
#
|
||||
# wrapper for java-utils-2_src_prepare
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-opt-2_src_prepare() {
|
||||
use ${JAVA_PKG_OPT_USE} && java-utils-2_src_prepare
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-pkg_preinst
|
||||
#
|
||||
# wrapper for java-utils-2_pkg_preinst
|
||||
# ------------------------------------------------------------------------------
|
||||
java-pkg-opt-2_pkg_preinst() {
|
||||
use ${JAVA_PKG_OPT_USE} && java-utils-2_pkg_preinst
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @eclass-pkg_postinst
|
||||
# ------------------------------------------------------------------------------
|
||||
pre_pkg_postinst() {
|
||||
java-pkg_reg-cachejar_
|
||||
}
|
3489
eclass/java-utils-2.eclass
Normal file
3489
eclass/java-utils-2.eclass
Normal file
File diff suppressed because it is too large
Load Diff
813
eclass/linux-mod.eclass
Normal file
813
eclass/linux-mod.eclass
Normal file
@ -0,0 +1,813 @@
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.99 2010/03/31 19:33:16 robbat2 Exp $
|
||||
|
||||
# Author(s): John Mylchreest <johnm@gentoo.org>,
|
||||
# Stefan Schweizer <genstef@gentoo.org>
|
||||
# Maintainer: kernel-misc@gentoo.org
|
||||
#
|
||||
# Please direct your bugs to the current eclass maintainer :)
|
||||
|
||||
# @ECLASS: linux-mod.eclass
|
||||
# @MAINTAINER:
|
||||
# kernel-misc@gentoo.org
|
||||
# @BLURB: It provides the functionality required to install external modules against a kernel source tree.
|
||||
# @DESCRIPTION:
|
||||
# This eclass is used to interface with linux-info.eclass in such a way
|
||||
# to provide the functionality and initial functions
|
||||
# required to install external modules against a kernel source
|
||||
# tree.
|
||||
|
||||
# A Couple of env vars are available to effect usage of this eclass
|
||||
# These are as follows:
|
||||
|
||||
# @ECLASS-VARIABLE: KERNEL_DIR
|
||||
# @DESCRIPTION:
|
||||
# A string containing the directory of the target kernel sources. The default value is
|
||||
# "/usr/src/linux"
|
||||
|
||||
# @ECLASS-VARIABLE: ECONF_PARAMS
|
||||
# @DESCRIPTION:
|
||||
# It's a string containing the parameters to pass to econf.
|
||||
# If this is not set, then econf isn't run.
|
||||
|
||||
# @ECLASS-VARIABLE: BUILD_PARAMS
|
||||
# @DESCRIPTION:
|
||||
# It's a string with the parameters to pass to emake.
|
||||
|
||||
# @ECLASS-VARIABLE: BUILD_TARGETS
|
||||
# @DESCRIPTION:
|
||||
# It's a string with the build targets to pass to make. The default value is "clean modules"
|
||||
|
||||
# @ECLASS-VARIABLE: MODULE_NAMES
|
||||
# @DESCRIPTION:
|
||||
# It's a string containing the modules to be built automatically using the default
|
||||
# src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory.
|
||||
#
|
||||
# The structure of each MODULE_NAMES entry is as follows:
|
||||
#
|
||||
# modulename(libdir:srcdir:objdir)
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# modulename = name of the module file excluding the .ko
|
||||
# libdir = place in system modules directory where module is installed (by default it's misc)
|
||||
# srcdir = place for ebuild to cd to before running make (by default it's ${S})
|
||||
# objdir = place the .ko and objects are located after make runs (by default it's set to srcdir)
|
||||
#
|
||||
# To get an idea of how these variables are used, here's a few lines
|
||||
# of code from around line 540 in this eclass:
|
||||
#
|
||||
# einfo "Installing ${modulename} module"
|
||||
# cd ${objdir} || die "${objdir} does not exist"
|
||||
# insinto /lib/modules/${KV_FULL}/${libdir}
|
||||
# doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
|
||||
#
|
||||
# For example:
|
||||
# MODULE_NAMES="module_pci(pci:${S}/pci:${S}) module_usb(usb:${S}/usb:${S})"
|
||||
#
|
||||
# what this would do is
|
||||
#
|
||||
# cd "${S}"/pci
|
||||
# make ${BUILD_PARAMS} ${BUILD_TARGETS}
|
||||
# cd "${S}"
|
||||
# insinto /lib/modules/${KV_FULL}/pci
|
||||
# doins module_pci.${KV_OBJ}
|
||||
#
|
||||
# cd "${S}"/usb
|
||||
# make ${BUILD_PARAMS} ${BUILD_TARGETS}
|
||||
# cd "${S}"
|
||||
# insinto /lib/modules/${KV_FULL}/usb
|
||||
# doins module_usb.${KV_OBJ}
|
||||
|
||||
# There is also support for automated modprobe.d/modules.d(2.4) file generation.
|
||||
# This can be explicitly enabled by setting any of the following variables.
|
||||
|
||||
# @ECLASS-VARIABLE: MODULESD_<modulename>_ENABLED
|
||||
# @DESCRIPTION:
|
||||
# This is used to disable the modprobe.d/modules.d file generation otherwise the file will be
|
||||
# always generated (unless no MODULESD_<modulename>_* variable is provided). Set to "no" to disable
|
||||
# the generation of the file and the installation of the documentation.
|
||||
|
||||
# @ECLASS-VARIABLE: MODULESD_<modulename>_EXAMPLES
|
||||
# @DESCRIPTION:
|
||||
# This is a bash array containing a list of examples which should
|
||||
# be used. If you want us to try and take a guess set this to "guess".
|
||||
#
|
||||
# For each array_component it's added an options line in the modprobe.d/modules.d file
|
||||
#
|
||||
# options array_component
|
||||
#
|
||||
# where array_component is "<modulename> options" (see modprobe.conf(5))
|
||||
|
||||
# @ECLASS-VARIABLE: MODULESD_<modulename>_ALIASES
|
||||
# @DESCRIPTION:
|
||||
# This is a bash array containing a list of associated aliases.
|
||||
#
|
||||
# For each array_component it's added an alias line in the modprobe.d/modules.d file
|
||||
#
|
||||
# alias array_component
|
||||
#
|
||||
# where array_component is "wildcard <modulename>" (see modprobe.conf(5))
|
||||
|
||||
# @ECLASS-VARIABLE: MODULESD_<modulename>_ADDITIONS
|
||||
# @DESCRIPTION:
|
||||
# This is a bash array containing a list of additional things to
|
||||
# add to the bottom of the file. This can be absolutely anything.
|
||||
# Each entry is a new line.
|
||||
|
||||
# @ECLASS-VARIABLE: MODULESD_<modulename>_DOCS
|
||||
# @DESCRIPTION:
|
||||
# This is a string list which contains the full path to any associated
|
||||
# documents for <modulename>. These files are installed in the live tree.
|
||||
|
||||
# @ECLASS-VARIABLE: KV_OBJ
|
||||
# @DESCRIPTION:
|
||||
# It's a read-only variable. It contains the extension of the kernel modules.
|
||||
|
||||
# The order of these is important as both of linux-info and eutils contain
|
||||
# set_arch_to_kernel and set_arch_to_portage functions and the ones in eutils
|
||||
# are deprecated in favor of the ones in linux-info.
|
||||
# See http://bugs.gentoo.org/show_bug.cgi?id=127506
|
||||
|
||||
inherit eutils linux-info multilib
|
||||
case "${EAPI:-0}" in
|
||||
2)
|
||||
EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_configure src_compile pkg_postrm
|
||||
;;
|
||||
*)
|
||||
EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm
|
||||
;;
|
||||
esac
|
||||
IUSE="kernel_linux"
|
||||
SLOT="0"
|
||||
DESCRIPTION="Based on the $ECLASS eclass"
|
||||
RDEPEND="kernel_linux? ( virtual/modutils )"
|
||||
DEPEND="${RDEPEND}
|
||||
sys-apps/sed
|
||||
kernel_linux? ( virtual/linux-sources )"
|
||||
|
||||
# eclass utilities
|
||||
# ----------------------------------
|
||||
|
||||
check_vermagic() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local curr_gcc_ver=$(gcc -dumpversion)
|
||||
local tmpfile old_chost old_gcc_ver result=0
|
||||
|
||||
tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit`
|
||||
tmpfile=${tmpfile//*usr/lib}
|
||||
tmpfile=${tmpfile//\/include*}
|
||||
old_chost=${tmpfile//*gcc\/}
|
||||
old_chost=${old_chost//\/*}
|
||||
old_gcc_ver=${tmpfile//*\/}
|
||||
|
||||
if [[ -z ${old_gcc_ver} || -z ${old_chost} ]]; then
|
||||
ewarn ""
|
||||
ewarn "Unable to detect what version of GCC was used to compile"
|
||||
ewarn "the kernel. Build will continue, but you may experience problems."
|
||||
elif [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then
|
||||
ewarn ""
|
||||
ewarn "The version of GCC you are using (${curr_gcc_ver}) does"
|
||||
ewarn "not match the version of GCC used to compile the"
|
||||
ewarn "kernel (${old_gcc_ver})."
|
||||
result=1
|
||||
elif [[ ${CHOST} != ${old_chost} ]]; then
|
||||
ewarn ""
|
||||
ewarn "The current CHOST (${CHOST}) does not match the chost"
|
||||
ewarn "used when compiling the kernel (${old_chost})."
|
||||
result=1
|
||||
fi
|
||||
|
||||
if [[ ${result} -gt 0 ]]; then
|
||||
ewarn ""
|
||||
ewarn "Build will not continue, because you will experience problems."
|
||||
ewarn "To fix this either change the version of GCC you wish to use"
|
||||
ewarn "to match the kernel, or recompile the kernel first."
|
||||
die "GCC Version Mismatch."
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: use_m
|
||||
# @RETURN: true or false
|
||||
# @DESCRIPTION:
|
||||
# It checks if the kernel version is greater than 2.6.5.
|
||||
use_m() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
# if we haven't determined the version yet, we need too.
|
||||
get_version;
|
||||
|
||||
# if the kernel version is greater than 2.6.6 then we should use
|
||||
# M= instead of SUBDIRS=
|
||||
[ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \
|
||||
return 0 || return 1
|
||||
}
|
||||
|
||||
# @FUNCTION: convert_to_m
|
||||
# @USAGE: /path/to/the/file
|
||||
# @DESCRIPTION:
|
||||
# It converts a file (e.g. a makefile) to use M= instead of SUBDIRS=
|
||||
convert_to_m() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
if use_m
|
||||
then
|
||||
[ ! -f "${1}" ] && \
|
||||
die "convert_to_m() requires a filename as an argument"
|
||||
ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS="
|
||||
sed -i 's:SUBDIRS=:M=:g' "${1}"
|
||||
eend $?
|
||||
fi
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION: update_depmod
|
||||
# DESCRIPTION:
|
||||
# It updates the modules.dep file for the current kernel.
|
||||
update_depmod() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
# if we haven't determined the version yet, we need too.
|
||||
get_version;
|
||||
|
||||
ebegin "Updating module dependencies for ${KV_FULL}"
|
||||
if [ -r "${KV_OUT_DIR}"/System.map ]
|
||||
then
|
||||
depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r ${KV_FULL}
|
||||
eend $?
|
||||
else
|
||||
ewarn
|
||||
ewarn "${KV_OUT_DIR}/System.map not found."
|
||||
ewarn "You must manually update the kernel module dependencies using depmod."
|
||||
eend 1
|
||||
ewarn
|
||||
fi
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION: update_modules
|
||||
# DESCRIPTION:
|
||||
# It calls the update-modules utility.
|
||||
update_modules() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
if [ -x /sbin/update-modules ] && \
|
||||
grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then
|
||||
ebegin "Updating modules.conf"
|
||||
/sbin/update-modules
|
||||
eend $?
|
||||
elif [ -x /sbin/update-modules ] && \
|
||||
grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then
|
||||
ebegin "Updating modules.conf"
|
||||
/sbin/update-modules
|
||||
eend $?
|
||||
fi
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION: move_old_moduledb
|
||||
# DESCRIPTION:
|
||||
# It updates the location of the database used by the module-rebuild utility.
|
||||
move_old_moduledb() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local OLDDIR="${ROOT}"/usr/share/module-rebuild/
|
||||
local NEWDIR="${ROOT}"/var/lib/module-rebuild/
|
||||
|
||||
if [[ -f "${OLDDIR}"/moduledb ]]; then
|
||||
[[ ! -d "${NEWDIR}" ]] && mkdir -p "${NEWDIR}"
|
||||
[[ ! -f "${NEWDIR}"/moduledb ]] && \
|
||||
mv "${OLDDIR}"/moduledb "${NEWDIR}"/moduledb
|
||||
rm -f "${OLDDIR}"/*
|
||||
rmdir "${OLDDIR}"
|
||||
fi
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION: update_moduledb
|
||||
# DESCRIPTION:
|
||||
# It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility.
|
||||
update_moduledb() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/
|
||||
move_old_moduledb
|
||||
|
||||
if [[ ! -f "${MODULEDB_DIR}"/moduledb ]]; then
|
||||
[[ ! -d "${MODULEDB_DIR}" ]] && mkdir -p "${MODULEDB_DIR}"
|
||||
touch "${MODULEDB_DIR}"/moduledb
|
||||
fi
|
||||
|
||||
if ! grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then
|
||||
einfo "Adding module to moduledb."
|
||||
echo "a:1:${CATEGORY}/${PN}-${PVR}" >> "${MODULEDB_DIR}"/moduledb
|
||||
fi
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION: remove_moduledb
|
||||
# DESCRIPTION:
|
||||
# It removes the package from the /var/lib/module-rebuild/moduledb database used by
|
||||
# the module-rebuild utility.
|
||||
remove_moduledb() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/
|
||||
move_old_moduledb
|
||||
|
||||
if grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then
|
||||
einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb."
|
||||
sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" "${MODULEDB_DIR}"/moduledb
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: set_kvobj
|
||||
# @DESCRIPTION:
|
||||
# It sets the KV_OBJ variable.
|
||||
set_kvobj() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
if kernel_is 2 6
|
||||
then
|
||||
KV_OBJ="ko"
|
||||
else
|
||||
KV_OBJ="o"
|
||||
fi
|
||||
# Do we really need to know this?
|
||||
# Lets silence it.
|
||||
# einfo "Using KV_OBJ=${KV_OBJ}"
|
||||
}
|
||||
|
||||
get-KERNEL_CC() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
if [[ -n ${KERNEL_CC} ]] ; then
|
||||
echo "${KERNEL_CC}"
|
||||
return
|
||||
fi
|
||||
|
||||
local kernel_cc
|
||||
if [ -n "${KERNEL_ABI}" ]; then
|
||||
# In future, an arch might want to define CC_$ABI
|
||||
#kernel_cc="$(get_abi_CC)"
|
||||
#[ -z "${kernel_cc}" ] &&
|
||||
kernel_cc="$(tc-getCC $(ABI=${KERNEL_ABI} get_abi_CHOST))"
|
||||
else
|
||||
kernel_cc=$(tc-getCC)
|
||||
fi
|
||||
echo "${kernel_cc}"
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION:
|
||||
# USAGE: /path/to/the/modulename_without_extension
|
||||
# RETURN: A file in /etc/modules.d/ (kernel < 2.6) or /etc/modprobe.d/ (kernel >= 2.6)
|
||||
# DESCRIPTION:
|
||||
# This function will generate and install the neccessary modprobe.d/modules.d file from the
|
||||
# information contained in the modules exported parms.
|
||||
# (see the variables MODULESD_<modulename>_ENABLED, MODULESD_<modulename>_EXAMPLES,
|
||||
# MODULESD_<modulename>_ALIASES, MODULESD_<modulename>_ADDITION and MODULESD_<modulename>_DOCS).
|
||||
#
|
||||
# At the end the documentation specified with MODULESD_<modulename>_DOCS is installed.
|
||||
generate_modulesd() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local currm_path currm currm_t t myIFS myVAR
|
||||
local module_docs module_enabled module_aliases \
|
||||
module_additions module_examples module_modinfo module_opts
|
||||
|
||||
for currm_path in ${@}
|
||||
do
|
||||
currm=${currm_path//*\/}
|
||||
currm=$(echo ${currm} | tr '[:lower:]' '[:upper:]')
|
||||
currm_t=${currm}
|
||||
while [[ -z ${currm_t//*-*} ]]; do
|
||||
currm_t=${currm_t/-/_}
|
||||
done
|
||||
|
||||
module_docs="$(eval echo \${MODULESD_${currm_t}_DOCS})"
|
||||
module_enabled="$(eval echo \${MODULESD_${currm_t}_ENABLED})"
|
||||
module_aliases="$(eval echo \${#MODULESD_${currm_t}_ALIASES[*]})"
|
||||
module_additions="$(eval echo \${#MODULESD_${currm_t}_ADDITIONS[*]})"
|
||||
module_examples="$(eval echo \${#MODULESD_${currm_t}_EXAMPLES[*]})"
|
||||
|
||||
[[ ${module_aliases} -eq 0 ]] && unset module_aliases
|
||||
[[ ${module_additions} -eq 0 ]] && unset module_additions
|
||||
[[ ${module_examples} -eq 0 ]] && unset module_examples
|
||||
|
||||
# If we specify we dont want it, then lets exit, otherwise we assume
|
||||
# that if its set, we do want it.
|
||||
[[ ${module_enabled} == no ]] && return 0
|
||||
|
||||
# unset any unwanted variables.
|
||||
for t in ${!module_*}
|
||||
do
|
||||
[[ -z ${!t} ]] && unset ${t}
|
||||
done
|
||||
|
||||
[[ -z ${!module_*} ]] && return 0
|
||||
|
||||
# OK so now if we have got this far, then we know we want to continue
|
||||
# and generate the modules.d file.
|
||||
module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})"
|
||||
module_config="${T}/modulesd-${currm}"
|
||||
|
||||
ebegin "Preparing file for modules.d"
|
||||
#-----------------------------------------------------------------------
|
||||
echo "# modules.d configuration file for ${currm}" >> "${module_config}"
|
||||
#-----------------------------------------------------------------------
|
||||
[[ -n ${module_docs} ]] && \
|
||||
echo "# For more information please read:" >> "${module_config}"
|
||||
for t in ${module_docs}
|
||||
do
|
||||
echo "# ${t//*\/}" >> "${module_config}"
|
||||
done
|
||||
echo >> "${module_config}"
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
if [[ ${module_aliases} -gt 0 ]]
|
||||
then
|
||||
echo "# Internal Aliases - Do not edit" >> "${module_config}"
|
||||
echo "# ------------------------------" >> "${module_config}"
|
||||
|
||||
for((t=0; t<${module_aliases}; t++))
|
||||
do
|
||||
echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \
|
||||
>> "${module_config}"
|
||||
done
|
||||
echo '' >> "${module_config}"
|
||||
fi
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
if [[ -n ${module_modinfo} ]]
|
||||
then
|
||||
echo >> "${module_config}"
|
||||
echo "# Configurable module parameters" >> "${module_config}"
|
||||
echo "# ------------------------------" >> "${module_config}"
|
||||
myIFS="${IFS}"
|
||||
IFS="$(echo -en "\n\b")"
|
||||
|
||||
for t in ${module_modinfo}
|
||||
do
|
||||
myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")"
|
||||
if [[ -n ${myVAR} ]]
|
||||
then
|
||||
module_opts="${module_opts} ${t%%:*}:${myVAR}"
|
||||
fi
|
||||
echo -e "# ${t%%:*}:\t${t#*:}" >> "${module_config}"
|
||||
done
|
||||
IFS="${myIFS}"
|
||||
echo '' >> "${module_config}"
|
||||
fi
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]]
|
||||
then
|
||||
# So lets do some guesswork eh?
|
||||
if [[ -n ${module_opts} ]]
|
||||
then
|
||||
echo "# For Example..." >> "${module_config}"
|
||||
echo "# --------------" >> "${module_config}"
|
||||
for t in ${module_opts}
|
||||
do
|
||||
echo "# options ${currm} ${t//:*}=${t//*:}" >> "${module_config}"
|
||||
done
|
||||
echo '' >> "${module_config}"
|
||||
fi
|
||||
elif [[ ${module_examples} -gt 0 ]]
|
||||
then
|
||||
echo "# For Example..." >> "${module_config}"
|
||||
echo "# --------------" >> "${module_config}"
|
||||
for((t=0; t<${module_examples}; t++))
|
||||
do
|
||||
echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \
|
||||
>> "${module_config}"
|
||||
done
|
||||
echo '' >> "${module_config}"
|
||||
fi
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
if [[ ${module_additions} -gt 0 ]]
|
||||
then
|
||||
for((t=0; t<${module_additions}; t++))
|
||||
do
|
||||
echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \
|
||||
>> "${module_config}"
|
||||
done
|
||||
echo '' >> "${module_config}"
|
||||
fi
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# then we install it
|
||||
if kernel_is ge 2 6; then
|
||||
insinto /etc/modprobe.d
|
||||
else
|
||||
insinto /etc/modules.d
|
||||
fi
|
||||
newins "${module_config}" "${currm_path//*\/}.conf"
|
||||
|
||||
# and install any documentation we might have.
|
||||
[[ -n ${module_docs} ]] && dodoc ${module_docs}
|
||||
done
|
||||
eend 0
|
||||
return 0
|
||||
}
|
||||
|
||||
# internal function
|
||||
#
|
||||
# FUNCTION: find_module_params
|
||||
# USAGE: A string "NAME(LIBDIR:SRCDIR:OBJDIR)"
|
||||
# RETURN: The string "modulename:NAME libdir:LIBDIR srcdir:SRCDIR objdir:OBJDIR"
|
||||
# DESCRIPTION:
|
||||
# Analyze the specification NAME(LIBDIR:SRCDIR:OBJDIR) of one module as described in MODULE_NAMES.
|
||||
find_module_params() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local matched_offset=0 matched_opts=0 test="${@}" temp_var result
|
||||
local i=0 y=0 z=0
|
||||
|
||||
for((i=0; i<=${#test}; i++))
|
||||
do
|
||||
case ${test:${i}:1} in
|
||||
\() matched_offset[0]=${i};;
|
||||
\:) matched_opts=$((${matched_opts} + 1));
|
||||
matched_offset[${matched_opts}]="${i}";;
|
||||
\)) matched_opts=$((${matched_opts} + 1));
|
||||
matched_offset[${matched_opts}]="${i}";;
|
||||
esac
|
||||
done
|
||||
|
||||
for((i=0; i<=${matched_opts}; i++))
|
||||
do
|
||||
# i = offset were working on
|
||||
# y = last offset
|
||||
# z = current offset - last offset
|
||||
# temp_var = temporary name
|
||||
case ${i} in
|
||||
0) tempvar=${test:0:${matched_offset[0]}};;
|
||||
*) y=$((${matched_offset[$((${i} - 1))]} + 1))
|
||||
z=$((${matched_offset[${i}]} - ${matched_offset[$((${i} - 1))]}));
|
||||
z=$((${z} - 1))
|
||||
tempvar=${test:${y}:${z}};;
|
||||
esac
|
||||
|
||||
case ${i} in
|
||||
0) result="${result} modulename:${tempvar}";;
|
||||
1) result="${result} libdir:${tempvar}";;
|
||||
2) result="${result} srcdir:${tempvar}";;
|
||||
3) result="${result} objdir:${tempvar}";;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ${result}
|
||||
}
|
||||
|
||||
# default ebuild functions
|
||||
# --------------------------------
|
||||
|
||||
# @FUNCTION: linux-mod_pkg_setup
|
||||
# @DESCRIPTION:
|
||||
# It checks the CONFIG_CHECK options (see linux-info.eclass(5)), verifies that the kernel is
|
||||
# configured, verifies that the sources are prepared, verifies that the modules support is builtin
|
||||
# in the kernel and sets the object extension KV_OBJ.
|
||||
linux-mod_pkg_setup() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
# If we are installing a binpkg, take a different path.
|
||||
if [[ $EMERGE_FROM == binary ]]; then
|
||||
linux-mod_pkg_setup_binary
|
||||
return
|
||||
fi
|
||||
|
||||
linux-info_pkg_setup;
|
||||
require_configured_kernel
|
||||
check_kernel_built;
|
||||
strip_modulenames;
|
||||
[[ -n ${MODULE_NAMES} ]] && check_modules_supported
|
||||
set_kvobj;
|
||||
# Commented out with permission from johnm until a fixed version for arches
|
||||
# who intentionally use different kernel and userland compilers can be
|
||||
# introduced - Jason Wever <weeve@gentoo.org>, 23 Oct 2005
|
||||
#check_vermagic;
|
||||
}
|
||||
|
||||
# @FUNCTION: linux-mod_pkg_setup_binary
|
||||
# @DESCRIPTION:
|
||||
# Perform all kernel option checks non-fatally, as the .config and
|
||||
# /proc/config.gz might not be present. Do not do anything that requires kernel
|
||||
# sources.
|
||||
linux-mod_pkg_setup_binary() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
local new_CONFIG_CHECK
|
||||
# ~ needs always to be quoted, else bash expands it.
|
||||
for config in $CONFIG_CHECK ; do
|
||||
optional='~'
|
||||
[[ ${config:0:1} == "~" ]] && optional=''
|
||||
new_CONFIG_CHECK="${new_CONFIG_CHECK} ${optional}${config}"
|
||||
done
|
||||
export CONFIG_CHECK="${new_CONFIG_CHECK}"
|
||||
linux-info_pkg_setup;
|
||||
}
|
||||
|
||||
strip_modulenames() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local i
|
||||
for i in ${MODULE_IGNORE}; do
|
||||
MODULE_NAMES=${MODULE_NAMES//${i}(*}
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: linux-mod_src_configure
|
||||
# @DESCRIPTION:
|
||||
# It configures all the modules specified in MODULE_NAMES. For each module the econf command is
|
||||
# executed only if ECONF_PARAMS is defined, the name of the target is specified by BUILD_TARGETS
|
||||
# while the options are in BUILD_PARAMS (all the modules share these variables). The compilation
|
||||
# happens inside ${srcdir}.
|
||||
#
|
||||
# Look at the description of these variables for more details.
|
||||
linux-mod_src_configure() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local modulename libdir srcdir objdir i n myABI="${ABI}"
|
||||
set_arch_to_kernel
|
||||
ABI="${KERNEL_ABI}"
|
||||
|
||||
BUILD_TARGETS=${BUILD_TARGETS:-clean module}
|
||||
strip_modulenames;
|
||||
cd "${S}"
|
||||
touch Module.symvers
|
||||
for i in ${MODULE_NAMES}
|
||||
do
|
||||
unset libdir srcdir objdir
|
||||
for n in $(find_module_params ${i})
|
||||
do
|
||||
eval ${n/:*}=${n/*:/}
|
||||
done
|
||||
libdir=${libdir:-misc}
|
||||
srcdir=${srcdir:-${S}}
|
||||
objdir=${objdir:-${srcdir}}
|
||||
|
||||
if [ ! -f "${srcdir}/.configured" ];
|
||||
then
|
||||
cd ${srcdir}
|
||||
ln -s "${S}"/Module.symvers Module.symvers
|
||||
einfo "Preparing ${modulename} module"
|
||||
if [[ -n ${ECONF_PARAMS} ]]
|
||||
then
|
||||
econf ${ECONF_PARAMS} || \
|
||||
die "Unable to run econf ${ECONF_PARAMS}"
|
||||
fi
|
||||
|
||||
cd ${OLDPWD}
|
||||
touch ${srcdir}/.configured
|
||||
fi
|
||||
done
|
||||
|
||||
set_arch_to_portage
|
||||
ABI="${myABI}"
|
||||
}
|
||||
|
||||
|
||||
# @FUNCTION: linux-mod_src_compile
|
||||
# @DESCRIPTION:
|
||||
# It compiles all the modules specified in MODULE_NAMES. For each module the econf command is
|
||||
# executed only if ECONF_PARAMS is defined, the name of the target is specified by BUILD_TARGETS
|
||||
# while the options are in BUILD_PARAMS (all the modules share these variables). The compilation
|
||||
# happens inside ${srcdir}.
|
||||
#
|
||||
# Look at the description of these variables for more details.
|
||||
linux-mod_src_compile() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local modulename libdir srcdir objdir i n myABI="${ABI}"
|
||||
set_arch_to_kernel
|
||||
ABI="${KERNEL_ABI}"
|
||||
|
||||
BUILD_TARGETS=${BUILD_TARGETS:-clean module}
|
||||
strip_modulenames;
|
||||
cd "${S}"
|
||||
touch Module.symvers
|
||||
for i in ${MODULE_NAMES}
|
||||
do
|
||||
unset libdir srcdir objdir
|
||||
for n in $(find_module_params ${i})
|
||||
do
|
||||
eval ${n/:*}=${n/*:/}
|
||||
done
|
||||
libdir=${libdir:-misc}
|
||||
srcdir=${srcdir:-${S}}
|
||||
objdir=${objdir:-${srcdir}}
|
||||
|
||||
if [ ! -f "${srcdir}/.built" ];
|
||||
then
|
||||
cd "${srcdir}"
|
||||
ln -s "${S}"/Module.symvers Module.symvers
|
||||
einfo "Preparing ${modulename} module"
|
||||
if [[ -n ${ECONF_PARAMS} ]] && [ ! -f "${srcdir}/.configured" ];
|
||||
|
||||
then
|
||||
econf ${ECONF_PARAMS} || \
|
||||
die "Unable to run econf ${ECONF_PARAMS}"
|
||||
fi
|
||||
|
||||
# This looks messy, but it is needed to handle multiple variables
|
||||
# being passed in the BUILD_* stuff where the variables also have
|
||||
# spaces that must be preserved. If don't do this, then the stuff
|
||||
# inside the variables gets used as targets for Make, which then
|
||||
# fails.
|
||||
eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
|
||||
CROSS_COMPILE=${CHOST_default}- \
|
||||
LDFLAGS=\"$(get_abi_LDFLAGS)\" \
|
||||
${BUILD_FIXES} \
|
||||
${BUILD_PARAMS} \
|
||||
${BUILD_TARGETS} " \
|
||||
|| die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST_default}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
|
||||
cd "${OLDPWD}"
|
||||
touch "${srcdir}"/.built
|
||||
fi
|
||||
done
|
||||
|
||||
set_arch_to_portage
|
||||
ABI="${myABI}"
|
||||
}
|
||||
|
||||
# @FUNCTION: linux-mod_src_install
|
||||
# @DESCRIPTION:
|
||||
# It install the modules specified in MODULES_NAME. The modules should be inside the ${objdir}
|
||||
# directory and they are installed inside /lib/modules/${KV_FULL}/${libdir}.
|
||||
#
|
||||
# The modprobe.d/modules.d configuration file is automatically generated if the
|
||||
# MODULESD_<modulename>_* variables are defined. The only way to stop this process is by
|
||||
# setting MODULESD_<modulename>_ENABLED=no. At the end the documentation specified via
|
||||
# MODULESD_<modulename>_DOCS is also installed.
|
||||
#
|
||||
# Look at the description of these variables for more details.
|
||||
linux-mod_src_install() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
local modulename libdir srcdir objdir i n
|
||||
|
||||
strip_modulenames;
|
||||
for i in ${MODULE_NAMES}
|
||||
do
|
||||
unset libdir srcdir objdir
|
||||
for n in $(find_module_params ${i})
|
||||
do
|
||||
eval ${n/:*}=${n/*:/}
|
||||
done
|
||||
libdir=${libdir:-misc}
|
||||
srcdir=${srcdir:-${S}}
|
||||
objdir=${objdir:-${srcdir}}
|
||||
|
||||
einfo "Installing ${modulename} module"
|
||||
cd "${objdir}" || die "${objdir} does not exist"
|
||||
insinto /lib/modules/${KV_FULL}/${libdir}
|
||||
doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
|
||||
cd "${OLDPWD}"
|
||||
|
||||
generate_modulesd "${objdir}/${modulename}"
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: linux-mod_pkg_preinst
|
||||
# @DESCRIPTION:
|
||||
# It checks what to do after having merged the package.
|
||||
linux-mod_pkg_preinst() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
[ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
|
||||
[ -d "${D}etc/modules.d" ] && UPDATE_MODULES=true || UPDATE_MODULES=false
|
||||
[ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
|
||||
}
|
||||
|
||||
# @FUNCTION: linux-mod_pkg_postinst
|
||||
# @DESCRIPTION:
|
||||
# It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb
|
||||
# database (if ${D}/lib/modules is created) and it runs /sbin/update-modules
|
||||
# (if ${D}/etc/modules.d is created).
|
||||
linux-mod_pkg_postinst() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
|
||||
${UPDATE_DEPMOD} && update_depmod;
|
||||
${UPDATE_MODULES} && update_modules;
|
||||
${UPDATE_MODULEDB} && update_moduledb;
|
||||
}
|
||||
|
||||
# @FUNCTION: linux-mod_pkg_postrm
|
||||
# @DESCRIPTION:
|
||||
# It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't
|
||||
# call /sbin/depmod and /sbin/update-modules because the modules are still installed.
|
||||
linux-mod_pkg_postrm() {
|
||||
debug-print-function ${FUNCNAME} $*
|
||||
remove_moduledb;
|
||||
}
|
67
eclass/mozconfig-2.eclass
Normal file
67
eclass/mozconfig-2.eclass
Normal file
@ -0,0 +1,67 @@
|
||||
# Copyright 1999-2007 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/mozconfig-2.eclass,v 1.22 2010/07/23 19:53:30 ssuominen Exp $
|
||||
#
|
||||
# mozconfig.eclass: the new mozilla.eclass
|
||||
|
||||
inherit multilib flag-o-matic mozcoreconf
|
||||
|
||||
IUSE="debug gnome ipv6 xinerama"
|
||||
|
||||
RDEPEND="x11-libs/libXrender[lib32?]
|
||||
x11-libs/libXt[lib32?]
|
||||
x11-libs/libXmu[lib32?]
|
||||
virtual/jpeg[lib32?]
|
||||
>=media-libs/libpng-1.2.1[lib32?]
|
||||
dev-libs/expat[lib32?]
|
||||
app-arch/zip
|
||||
app-arch/unzip
|
||||
>=x11-libs/gtk+-2.8.6[lib32?]
|
||||
>=dev-libs/glib-2.8.2[lib32?]
|
||||
>=x11-libs/pango-1.10.1[lib32?]
|
||||
>=dev-libs/libIDL-0.8.0[lib32?]
|
||||
gnome? ( >=gnome-base/gnome-vfs-2.3.5[lib32?]
|
||||
>=gnome-base/libgnomeui-2.2.0[lib32?] )
|
||||
!<x11-base/xorg-x11-6.7.0-r2
|
||||
>=x11-libs/cairo-1.0.0[lib32?]"
|
||||
#According to bugs #18573, #204520, and couple of others in Mozilla's
|
||||
#bugzilla. libmng and mng support has been removed in 2003.
|
||||
|
||||
|
||||
DEPEND="${RDEPEND}
|
||||
xinerama? ( x11-proto/xineramaproto )"
|
||||
|
||||
mozconfig_config() {
|
||||
mozconfig_use_enable ipv6
|
||||
mozconfig_use_enable xinerama
|
||||
|
||||
# We use --enable-pango to do truetype fonts, and currently pango
|
||||
# is required for it to build
|
||||
mozconfig_annotate gentoo --disable-freetype2
|
||||
|
||||
if use debug; then
|
||||
mozconfig_annotate +debug \
|
||||
--enable-debug \
|
||||
--enable-tests \
|
||||
--disable-reorder \
|
||||
--enable-debugger-info-modules=ALL_MODULES
|
||||
else
|
||||
mozconfig_annotate -debug \
|
||||
--disable-debug \
|
||||
--disable-tests \
|
||||
--enable-reorder \
|
||||
|
||||
# Currently --enable-elf-dynstr-gc only works for x86 and ppc,
|
||||
# thanks to Jason Wever <weeve@gentoo.org> for the fix.
|
||||
# -- This breaks now on ppc, no idea why
|
||||
# if use x86 || use ppc && [[ ${enable_optimize} != -O0 ]]; then
|
||||
if use x86 && [[ ${enable_optimize} != -O0 ]]; then
|
||||
mozconfig_annotate "${ARCH} optimized build" --enable-elf-dynstr-gc
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! use gnome; then
|
||||
mozconfig_annotate -gnome --disable-gnomevfs
|
||||
mozconfig_annotate -gnome --disable-gnomeui
|
||||
fi
|
||||
}
|
64
eclass/mozconfig-3.eclass
Normal file
64
eclass/mozconfig-3.eclass
Normal file
@ -0,0 +1,64 @@
|
||||
# Copyright 1999-2008 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/mozconfig-3.eclass,v 1.10 2010/07/23 19:53:30 ssuominen Exp $
|
||||
#
|
||||
# mozconfig.eclass: the new mozilla.eclass
|
||||
|
||||
inherit multilib flag-o-matic mozcoreconf-2
|
||||
|
||||
IUSE="gnome dbus startup-notification"
|
||||
|
||||
RDEPEND="x11-libs/libXrender[lib32?]
|
||||
x11-libs/libXt[lib32?]
|
||||
x11-libs/libXmu[lib32?]
|
||||
virtual/jpeg[lib32?]
|
||||
dev-libs/expat[lib32?]
|
||||
app-arch/zip
|
||||
app-arch/unzip
|
||||
>=x11-libs/gtk+-2.8.6[lib32?]
|
||||
>=dev-libs/glib-2.8.2[lib32?]
|
||||
>=x11-libs/pango-1.10.1[lib32?]
|
||||
>=dev-libs/libIDL-0.8.0[lib32?]
|
||||
gnome? ( >=gnome-base/gnome-vfs-2.16.3[lib32?]
|
||||
>=gnome-base/libgnomeui-2.16.1[lib32?]
|
||||
>=gnome-base/gconf-2.16.0[lib32?]
|
||||
>=gnome-base/libgnome-2.16.0[lib32?] )
|
||||
dbus? ( >=dev-libs/dbus-glib-0.72[lib32?] )
|
||||
startup-notification? ( >=x11-libs/startup-notification-0.8[lib32?] )
|
||||
!<x11-base/xorg-x11-6.7.0-r2
|
||||
>=x11-libs/cairo-1.6.0[lib32?]"
|
||||
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
mozconfig_config() {
|
||||
if ${MN} || ${XUL} || ${TB}; then
|
||||
mozconfig_annotate thebes --enable-default-toolkit=cairo-gtk2
|
||||
else
|
||||
mozconfig_annotate -thebes --enable-default-toolkit=gtk2
|
||||
fi
|
||||
|
||||
mozconfig_use_enable dbus
|
||||
mozconfig_use_enable startup-notification
|
||||
|
||||
# if use debug; then
|
||||
# mozconfig_annotate +debug \
|
||||
# --enable-debug \
|
||||
# --enable-tests \
|
||||
# --enable-debugger-info-modules=ALL_MODULES
|
||||
# else
|
||||
mozconfig_annotate -debug \
|
||||
--disable-debug \
|
||||
--disable-tests
|
||||
|
||||
# Currently --enable-elf-dynstr-gc only works for x86 and ppc,
|
||||
# thanks to Jason Wever <weeve@gentoo.org> for the fix.
|
||||
# -- This breaks now on ppc, no idea why
|
||||
# if use x86 || use ppc && [[ ${enable_optimize} != -O0 ]]; then
|
||||
if use x86 && [[ ${enable_optimize} != -O0 ]]; then
|
||||
mozconfig_annotate "${ARCH} optimized build" --enable-elf-dynstr-gc
|
||||
fi
|
||||
# fi
|
||||
|
||||
mozconfig_use_enable gnome gnomevfs
|
||||
mozconfig_use_enable gnome gnomeui
|
||||
}
|
717
eclass/multilib-native.eclass
Normal file
717
eclass/multilib-native.eclass
Normal file
@ -0,0 +1,717 @@
|
||||
# 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
|
||||
}
|
2609
eclass/python.eclass
Normal file
2609
eclass/python.eclass
Normal file
File diff suppressed because it is too large
Load Diff
802
eclass/qt4-build.eclass
Normal file
802
eclass/qt4-build.eclass
Normal file
@ -0,0 +1,802 @@
|
||||
# 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.78 2010/07/11 10:32:17 hwoarang Exp $
|
||||
|
||||
export EMULTILIB_SAVE_VARS="QTBASEDIR QTPREFIXDIR QTBINDIR QTLIBDIR \
|
||||
QMAKE_LIBDIR_QT QTPCDIR QTDATADIR QTDOCDIR QTHEADERDIR \
|
||||
QTPLUGINDIR QTSYSCONFDIR QTTRANSDIR QTEXAMPLESDIR \
|
||||
QTDEMOSDIR QT_INSTALL_PREFIX PLATFORM QMAKE_CFLAGS \
|
||||
QMAKE_CXXFLAGS QMAKE_LDFLAGS QT4_EXTRACT_DIRECTORIES"
|
||||
|
||||
# @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 ]] && 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)?([0-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\|DEBUG\)/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
|
||||
|
||||
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
|
||||
prep_ml_includes
|
||||
}
|
||||
|
||||
# @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
|
||||
|
||||
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
|
2494
eclass/toolchain.eclass
Normal file
2494
eclass/toolchain.eclass
Normal file
File diff suppressed because it is too large
Load Diff
619
eclass/x-modular.eclass
Normal file
619
eclass/x-modular.eclass
Normal file
@ -0,0 +1,619 @@
|
||||
# Copyright 1999-2005 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.119 2010/07/04 20:42:22 dirtyepic Exp $
|
||||
#
|
||||
# @ECLASS: x-modular.eclass
|
||||
# @MAINTAINER:
|
||||
# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org
|
||||
# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
|
||||
# @DESCRIPTION:
|
||||
# This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
|
||||
# and more. Many things that would normally be done in various functions
|
||||
# can be accessed by setting variables instead, such as patching,
|
||||
# running eautoreconf, passing options to configure and installing docs.
|
||||
#
|
||||
# All you need to do in a basic ebuild is inherit this eclass and set
|
||||
# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
|
||||
# with the other X packages, you don't need to set SRC_URI. Pretty much
|
||||
# everything else should be automatic.
|
||||
|
||||
if [[ ${PV} = 9999* ]]; then
|
||||
GIT_ECLASS="git"
|
||||
SNAPSHOT="yes"
|
||||
SRC_URI=""
|
||||
fi
|
||||
|
||||
MULTILIB_EXT_SOURCE_BUILD=yes
|
||||
|
||||
# If we're a font package, but not the font.alias one
|
||||
FONT_ECLASS=""
|
||||
if [[ "${PN/#font-}" != "${PN}" ]] \
|
||||
&& [[ "${CATEGORY}" = "media-fonts" ]] \
|
||||
&& [[ "${PN}" != "font-alias" ]] \
|
||||
&& [[ "${PN}" != "font-util" ]]; then
|
||||
# Activate font code in the rest of the eclass
|
||||
FONT="yes"
|
||||
|
||||
# Whether to inherit the font eclass
|
||||
FONT_ECLASS="font"
|
||||
fi
|
||||
|
||||
inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
|
||||
${FONT_ECLASS} ${GIT_ECLASS}
|
||||
|
||||
EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm"
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
0|1)
|
||||
;;
|
||||
2)
|
||||
EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure"
|
||||
;;
|
||||
*)
|
||||
die "Unknown EAPI ${EAPI}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# exports must be ALWAYS after inherit
|
||||
EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
|
||||
|
||||
# @ECLASS-VARIABLE: XDIR
|
||||
# @DESCRIPTION:
|
||||
# Directory prefix to use for everything. If you want to install to a
|
||||
# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been
|
||||
# recently tested. You may need to uncomment the setting of datadir and
|
||||
# mandir in x-modular_src_install() or add it back in if it's no longer
|
||||
# there. You may also want to change the SLOT.
|
||||
XDIR="/usr"
|
||||
|
||||
IUSE=""
|
||||
HOMEPAGE="http://xorg.freedesktop.org/"
|
||||
|
||||
# @ECLASS-VARIABLE: SNAPSHOT
|
||||
# @DESCRIPTION:
|
||||
# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
|
||||
# before inheriting this eclass.
|
||||
: ${SNAPSHOT:=no}
|
||||
|
||||
# Set up SRC_URI for individual modular releases
|
||||
BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
|
||||
# @ECLASS-VARIABLE: MODULE
|
||||
# @DESCRIPTION:
|
||||
# The subdirectory to download source from. Possible settings are app,
|
||||
# doc, data, util, driver, font, lib, proto, xserver. Set above the
|
||||
# inherit to override the default autoconfigured module.
|
||||
if [[ -z ${MODULE} ]]; then
|
||||
case ${CATEGORY} in
|
||||
app-doc) MODULE="doc" ;;
|
||||
media-fonts) MODULE="font" ;;
|
||||
x11-apps|x11-wm) MODULE="app" ;;
|
||||
x11-misc|x11-themes) MODULE="util" ;;
|
||||
x11-drivers) MODULE="driver" ;;
|
||||
x11-base) MODULE="xserver" ;;
|
||||
x11-proto) MODULE="proto" ;;
|
||||
x11-libs) MODULE="lib" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ -n ${GIT_ECLASS} ]]; then
|
||||
EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
|
||||
else
|
||||
SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
|
||||
fi
|
||||
|
||||
SLOT="0"
|
||||
|
||||
# Set the license for the package. This can be overridden by setting
|
||||
# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
|
||||
# are under the MIT license. (This is what Red Hat does in their rpms)
|
||||
LICENSE="MIT"
|
||||
|
||||
# Set up shared dependencies
|
||||
if [[ -n "${SNAPSHOT}" ]]; then
|
||||
# FIXME: What's the minimal libtool version supporting arbitrary versioning?
|
||||
DEPEND="${DEPEND}
|
||||
>=sys-devel/libtool-1.5[lib32?]
|
||||
>=sys-devel/m4-1.4"
|
||||
WANT_AUTOCONF="latest"
|
||||
WANT_AUTOMAKE="latest"
|
||||
fi
|
||||
|
||||
if [[ -n "${FONT}" ]]; then
|
||||
RDEPEND="${RDEPEND}
|
||||
media-fonts/encodings
|
||||
x11-apps/mkfontscale
|
||||
x11-apps/mkfontdir"
|
||||
PDEPEND="${PDEPEND}
|
||||
media-fonts/font-alias"
|
||||
|
||||
# Starting with 7.0RC3, we can specify the font directory
|
||||
# But oddly, we can't do the same for encodings or font-alias
|
||||
|
||||
# @ECLASS-VARIABLE: FONT_DIR
|
||||
# @DESCRIPTION:
|
||||
# If you're creating a font package and the suffix of PN is not equal to
|
||||
# the subdirectory of /usr/share/fonts/ it should install into, set
|
||||
# FONT_DIR to that directory or directories. Set before inheriting this
|
||||
# eclass.
|
||||
: ${FONT_DIR:=${PN##*-}}
|
||||
|
||||
# Fix case of font directories
|
||||
FONT_DIR=${FONT_DIR/ttf/TTF}
|
||||
FONT_DIR=${FONT_DIR/otf/OTF}
|
||||
FONT_DIR=${FONT_DIR/type1/Type1}
|
||||
FONT_DIR=${FONT_DIR/speedo/Speedo}
|
||||
|
||||
# Set up configure options, wrapped so ebuilds can override if need be
|
||||
if [[ -z ${FONT_OPTIONS} ]]; then
|
||||
FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
|
||||
fi
|
||||
|
||||
if [[ -n "${FONT}" ]]; then
|
||||
if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
|
||||
IUSE="${IUSE} nls"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If we're a driver package
|
||||
if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
|
||||
# Enable driver code in the rest of the eclass
|
||||
DRIVER="yes"
|
||||
fi
|
||||
|
||||
# Debugging -- ignore packages that can't be built with debugging
|
||||
if [[ -z "${FONT}" ]] \
|
||||
&& [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \
|
||||
&& [[ "${CATEGORY/x11-proto}" = "${CATEGORY}" ]] \
|
||||
&& [[ "${PN/util-macros}" = "${PN}" ]] \
|
||||
&& [[ "${PN/xbitmaps}" = "${PN}" ]] \
|
||||
&& [[ "${PN/xkbdata}" = "${PN}" ]] \
|
||||
&& [[ "${PN/xorg-cf-files}" = "${PN}" ]] \
|
||||
&& [[ "${PN/xcursor}" = "${PN}" ]] \
|
||||
; then
|
||||
DEBUGGABLE="yes"
|
||||
IUSE="${IUSE} debug"
|
||||
fi
|
||||
|
||||
DEPEND="${DEPEND}
|
||||
>=dev-util/pkgconfig-0.18[lib32?]"
|
||||
|
||||
if [[ "${PN/util-macros}" = "${PN}" ]]; then
|
||||
DEPEND="${DEPEND}
|
||||
>=x11-misc/util-macros-1.3.0
|
||||
sys-devel/binutils"
|
||||
fi
|
||||
|
||||
RDEPEND="${RDEPEND}
|
||||
!<=x11-base/xorg-x11-6.9"
|
||||
# Provides virtual/x11 for temporary use until packages are ported
|
||||
# x11-base/x11-env"
|
||||
|
||||
# @FUNCTION: x-modular_specs_check
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Make any necessary changes related to gcc specs (generally hardened)
|
||||
x-modular_specs_check() {
|
||||
if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then
|
||||
append-ldflags -Wl,-z,lazy
|
||||
# (#116698) breaks loading
|
||||
filter-ldflags -Wl,-z,now
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_dri_check
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Ensures the server supports DRI if building a driver with DRI support
|
||||
x-modular_dri_check() {
|
||||
# (#120057) Enabling DRI in drivers requires that the server was built with
|
||||
# support for it
|
||||
# Starting with xorg-server 1.5.3, DRI support is always enabled unless
|
||||
# USE=minimal is set (see bug #252084)
|
||||
if [[ -n "${DRIVER}" ]]; then
|
||||
if has dri ${IUSE} && use dri; then
|
||||
einfo "Checking for direct rendering capabilities ..."
|
||||
if has_version '>=x11-base/xorg-server-1.5.3'; then
|
||||
if built_with_use x11-base/xorg-server minimal; then
|
||||
die "You must build x11-base/xorg-server with USE=-minimal."
|
||||
fi
|
||||
else
|
||||
if ! built_with_use x11-base/xorg-server dri; then
|
||||
die "You must build x11-base/xorg-server with USE=dri."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_server_supports_drivers_check
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Ensures the server SDK is installed if a driver is being built
|
||||
x-modular_server_supports_drivers_check() {
|
||||
# (#135873) Only certain servers will actually use or be capable of
|
||||
# building external drivers, including binary drivers.
|
||||
if [[ -n "${DRIVER}" ]]; then
|
||||
if has_version '>=x11-base/xorg-server-1.1'; then
|
||||
if ! built_with_use x11-base/xorg-server xorg; then
|
||||
eerror "x11-base/xorg-server is not built with support for external drivers."
|
||||
die "You must build x11-base/xorg-server with USE=xorg."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_unpack_source
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Simply unpack source code. Nothing else.
|
||||
x-modular_unpack_source() {
|
||||
if [[ -n ${GIT_ECLASS} ]]; then
|
||||
git_src_unpack
|
||||
else
|
||||
unpack ${A}
|
||||
fi
|
||||
cd "${S}"
|
||||
|
||||
if [[ -n ${FONT_OPTIONS} ]]; then
|
||||
einfo "Detected font directory: ${FONT_DIR}"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_patch_source
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Apply all patches
|
||||
x-modular_patch_source() {
|
||||
# Use standardized names and locations with bulk patching
|
||||
# Patch directory is ${WORKDIR}/patch
|
||||
# See epatch() in eutils.eclass for more documentation
|
||||
if [[ -z "${EPATCH_SUFFIX}" ]] ; then
|
||||
EPATCH_SUFFIX="patch"
|
||||
fi
|
||||
|
||||
# @VARIABLE: PATCHES
|
||||
# @DESCRIPTION:
|
||||
# If you have any patches to apply, set PATCHES to their locations and epatch
|
||||
# will apply them. It also handles epatch-style bulk patches, if you know how to
|
||||
# use them and set the correct variables. If you don't, read eutils.eclass.
|
||||
if [[ ${#PATCHES[@]} -gt 1 ]]; then
|
||||
for x in "${PATCHES[@]}"; do
|
||||
epatch "${x}"
|
||||
done
|
||||
elif [[ -n "${PATCHES}" ]]; then
|
||||
for x in ${PATCHES}; do
|
||||
epatch "${x}"
|
||||
done
|
||||
# For non-default directory bulk patching
|
||||
elif [[ -n "${PATCH_LOC}" ]] ; then
|
||||
epatch ${PATCH_LOC}
|
||||
# For standard bulk patching
|
||||
elif [[ -d "${EPATCH_SOURCE}" ]] ; then
|
||||
epatch
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_reconf_source
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run eautoreconf if necessary, and run elibtoolize.
|
||||
x-modular_reconf_source() {
|
||||
if [[ "${SNAPSHOT}" = "yes" ]]
|
||||
then
|
||||
# If possible, generate configure if it doesn't exist
|
||||
if [ -f "./configure.ac" ]
|
||||
then
|
||||
eautoreconf
|
||||
fi
|
||||
fi
|
||||
|
||||
# Joshua Baergen - October 23, 2005
|
||||
# Fix shared lib issues on MIPS, FBSD, etc etc
|
||||
elibtoolize
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_src_prepare
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Prepare a package after unpacking, performing all X-related tasks.
|
||||
x-modular_src_prepare() {
|
||||
[[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \
|
||||
&& git_src_prepare
|
||||
x-modular_patch_source
|
||||
x-modular_reconf_source
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_src_unpack
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Unpack a package, performing all X-related tasks.
|
||||
x-modular_src_unpack() {
|
||||
x-modular_specs_check
|
||||
x-modular_server_supports_drivers_check
|
||||
x-modular_dri_check
|
||||
x-modular_unpack_source
|
||||
has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_font_configure
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# If a font package, perform any necessary configuration steps
|
||||
x-modular_font_configure() {
|
||||
if [[ -n "${FONT}" ]]; then
|
||||
# Might be worth adding an option to configure your desired font
|
||||
# and exclude all others. Also, should this USE be nls or minimal?
|
||||
if has nls ${IUSE//+} && ! use nls; then
|
||||
FONT_OPTIONS="${FONT_OPTIONS}
|
||||
--disable-iso8859-2
|
||||
--disable-iso8859-3
|
||||
--disable-iso8859-4
|
||||
--disable-iso8859-5
|
||||
--disable-iso8859-6
|
||||
--disable-iso8859-7
|
||||
--disable-iso8859-8
|
||||
--disable-iso8859-9
|
||||
--disable-iso8859-10
|
||||
--disable-iso8859-11
|
||||
--disable-iso8859-12
|
||||
--disable-iso8859-13
|
||||
--disable-iso8859-14
|
||||
--disable-iso8859-15
|
||||
--disable-iso8859-16
|
||||
--disable-jisx0201
|
||||
--disable-koi8-r"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_debug_setup
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Set up CFLAGS for a debug build
|
||||
x-modular_debug_setup() {
|
||||
if [[ -n "${DEBUGGABLE}" ]]; then
|
||||
if use debug; then
|
||||
strip-flags
|
||||
append-flags -g
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_src_configure
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Perform any necessary pre-configuration steps, then run configure
|
||||
x-modular_src_configure() {
|
||||
x-modular_font_configure
|
||||
x-modular_debug_setup
|
||||
|
||||
# @VARIABLE: CONFIGURE_OPTIONS
|
||||
# @DESCRIPTION:
|
||||
# Any extra options to pass to configure
|
||||
|
||||
# If prefix isn't set here, .pc files cause problems
|
||||
if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
|
||||
econf --prefix=${XDIR} \
|
||||
--datadir=${XDIR}/share \
|
||||
${FONT_OPTIONS} \
|
||||
${DRIVER_OPTIONS} \
|
||||
${CONFIGURE_OPTIONS}
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_src_make
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run make.
|
||||
x-modular_src_make() {
|
||||
emake || die "emake failed"
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_src_compile
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Compile a package, performing all X-related tasks.
|
||||
x-modular_src_compile() {
|
||||
has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
|
||||
x-modular_src_make
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_src_install
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Install a built package to ${D}, performing any necessary steps.
|
||||
# Creates a ChangeLog from git if using live ebuilds.
|
||||
x-modular_src_install() {
|
||||
# Install everything to ${XDIR}
|
||||
if [[ ${CATEGORY} = x11-proto ]]; then
|
||||
make \
|
||||
${PN/proto/}docdir=/usr/share/doc/${PF} \
|
||||
DESTDIR="${D}" \
|
||||
install \
|
||||
|| die
|
||||
else
|
||||
make \
|
||||
docdir=/usr/share/doc/${PF} \
|
||||
DESTDIR="${D}" \
|
||||
install \
|
||||
|| die
|
||||
fi
|
||||
# Shouldn't be necessary in XDIR=/usr
|
||||
# einstall forces datadir, so we need to re-force it
|
||||
# datadir=${XDIR}/share \
|
||||
# mandir=${XDIR}/share/man \
|
||||
|
||||
if [[ -n ${GIT_ECLASS} ]]; then
|
||||
pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}"
|
||||
git log ${GIT_TREE} > "${S}"/ChangeLog
|
||||
popd
|
||||
fi
|
||||
|
||||
if [[ -e ${S}/ChangeLog ]]; then
|
||||
dodoc "${S}"/ChangeLog
|
||||
fi
|
||||
# @VARIABLE: DOCS
|
||||
# @DESCRIPTION:
|
||||
# Any documentation to install via dodoc
|
||||
[[ -n ${DOCS} ]] && dodoc ${DOCS}
|
||||
|
||||
# Don't install libtool archives for server modules
|
||||
if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
|
||||
find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
|
||||
| xargs rm -f
|
||||
fi
|
||||
|
||||
if [[ -n "${FONT}" ]]; then
|
||||
remove_font_metadata
|
||||
fi
|
||||
|
||||
if [[ -n "${DRIVER}" ]]; then
|
||||
install_driver_hwdata
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_pkg_preinst
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# This function doesn't do anything right now, but it may in the future.
|
||||
x-modular_pkg_preinst() {
|
||||
# We no longer do anything here, but we can't remove it from the API
|
||||
:
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_pkg_postinst
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run X-specific post-installation tasks on the live filesystem. The
|
||||
# only task right now is some setup for font packages.
|
||||
x-modular_pkg_postinst() {
|
||||
if [[ -n "${FONT}" ]]; then
|
||||
setup_fonts
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_pkg_postrm
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run X-specific post-removal tasks on the live filesystem. The only
|
||||
# task right now is some cleanup for font packages.
|
||||
x-modular_pkg_postrm() {
|
||||
if [[ -n "${FONT}" ]]; then
|
||||
font_pkg_postrm
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: setup_fonts
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Generates needed files for fonts and fixes font permissions
|
||||
setup_fonts() {
|
||||
if [[ ! -n "${FONT_DIR}" ]]; then
|
||||
msg="FONT_DIR is empty. The ebuild should set it to at least one subdir of /usr/share/fonts."
|
||||
eerror "${msg}"
|
||||
die "${msg}"
|
||||
fi
|
||||
|
||||
create_fonts_scale
|
||||
create_fonts_dir
|
||||
create_font_cache
|
||||
}
|
||||
|
||||
# @FUNCTION: remove_font_metadata
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Don't let the package install generated font files that may overlap
|
||||
# with other packages. Instead, they're generated in pkg_postinst().
|
||||
remove_font_metadata() {
|
||||
local DIR
|
||||
for DIR in ${FONT_DIR}; do
|
||||
if [[ "${DIR}" != "Speedo" ]] && \
|
||||
[[ "${DIR}" != "CID" ]] ; then
|
||||
# Delete font metadata files
|
||||
# fonts.scale, fonts.dir, fonts.cache-1
|
||||
rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: install_driver_hwdata
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Installs device-to-driver mappings for system-config-display and
|
||||
# anything else that uses hwdata.
|
||||
install_driver_hwdata() {
|
||||
insinto /usr/share/hwdata/videoaliases
|
||||
for i in "${FILESDIR}"/*.xinf; do
|
||||
# We need this for the case when none exist,
|
||||
# so *.xinf doesn't expand
|
||||
if [[ -e $i ]]; then
|
||||
doins $i
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: discover_font_dirs
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Deprecated. Sets up the now-unused FONT_DIRS variable.
|
||||
discover_font_dirs() {
|
||||
FONT_DIRS="${FONT_DIR}"
|
||||
}
|
||||
|
||||
# @FUNCTION: create_fonts_scale
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Create fonts.scale file, used by the old server-side fonts subsystem.
|
||||
create_fonts_scale() {
|
||||
ebegin "Creating fonts.scale files"
|
||||
local x
|
||||
for DIR in ${FONT_DIR}; do
|
||||
x=${ROOT}/usr/share/fonts/${DIR}
|
||||
[[ -z "$(ls ${x}/)" ]] && continue
|
||||
[[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
|
||||
|
||||
# Only generate .scale files if truetype, opentype or type1
|
||||
# fonts are present ...
|
||||
|
||||
# NOTE: There is no way to regenerate Speedo/CID fonts.scale
|
||||
# <dberkholz@gentoo.org> 2 August 2004
|
||||
if [[ "${x/encodings}" = "${x}" ]] \
|
||||
&& [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
|
||||
mkfontscale \
|
||||
-a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \
|
||||
-- ${x}
|
||||
fi
|
||||
done
|
||||
eend 0
|
||||
}
|
||||
|
||||
# @FUNCTION: create_fonts_dir
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Create fonts.dir file, used by the old server-side fonts subsystem.
|
||||
create_fonts_dir() {
|
||||
ebegin "Generating fonts.dir files"
|
||||
for DIR in ${FONT_DIR}; do
|
||||
x=${ROOT}/usr/share/fonts/${DIR}
|
||||
[[ -z "$(ls ${x}/)" ]] && continue
|
||||
[[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
|
||||
|
||||
if [[ "${x/encodings}" = "${x}" ]]; then
|
||||
mkfontdir \
|
||||
-e "${ROOT}"/usr/share/fonts/encodings \
|
||||
-e "${ROOT}"/usr/share/fonts/encodings/large \
|
||||
-- ${x}
|
||||
fi
|
||||
done
|
||||
eend 0
|
||||
}
|
||||
|
||||
# @FUNCTION: create_font_cache
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Create fonts.cache-1 files, used by the new client-side fonts
|
||||
# subsystem.
|
||||
create_font_cache() {
|
||||
font_pkg_postinst
|
||||
}
|
413
eclass/xorg-2.eclass
Normal file
413
eclass/xorg-2.eclass
Normal file
@ -0,0 +1,413 @@
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.6 2010/07/14 08:34:27 scarabeus Exp $
|
||||
#
|
||||
# @ECLASS: xorg-2.eclass
|
||||
# @MAINTAINER:
|
||||
# x11@gentoo.org
|
||||
# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
|
||||
# @DESCRIPTION:
|
||||
# This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
|
||||
# and more. Many things that would normally be done in various functions
|
||||
# can be accessed by setting variables instead, such as patching,
|
||||
# running eautoreconf, passing options to configure and installing docs.
|
||||
#
|
||||
# All you need to do in a basic ebuild is inherit this eclass and set
|
||||
# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
|
||||
# with the other X packages, you don't need to set SRC_URI. Pretty much
|
||||
# everything else should be automatic.
|
||||
|
||||
# Author: Tomáš Chvátal <scarabeus@gentoo.org>
|
||||
# Author: Donnie Berkholz <dberkholz@gentoo.org>
|
||||
|
||||
MULTILIB_EXT_SOURCE_BUILD=yes
|
||||
|
||||
GIT_ECLASS=""
|
||||
if [[ ${PV} == *9999* ]]; then
|
||||
GIT_ECLASS="git"
|
||||
XORG_EAUTORECONF="yes"
|
||||
SRC_URI=""
|
||||
fi
|
||||
|
||||
# If we're a font package, but not the font.alias one
|
||||
FONT_ECLASS=""
|
||||
if [[ ${PN} == font* \
|
||||
&& ${CATEGORY} = media-fonts \
|
||||
&& ${PN} != font-alias \
|
||||
&& ${PN} != font-util ]]; then
|
||||
# Activate font code in the rest of the eclass
|
||||
FONT="yes"
|
||||
FONT_ECLASS="font"
|
||||
fi
|
||||
|
||||
inherit eutils base libtool multilib toolchain-funcs flag-o-matic autotools \
|
||||
${FONT_ECLASS} ${GIT_ECLASS}
|
||||
|
||||
EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
|
||||
case "${EAPI:-0}" in
|
||||
3) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
|
||||
*) DEPEND="EAPI-UNSUPPORTED" ;;
|
||||
esac
|
||||
|
||||
# exports must be ALWAYS after inherit
|
||||
EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
|
||||
|
||||
IUSE=""
|
||||
HOMEPAGE="http://xorg.freedesktop.org/"
|
||||
|
||||
# @ECLASS-VARIABLE: XORG_EAUTORECONF
|
||||
# @DESCRIPTION:
|
||||
# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
|
||||
# before inheriting this eclass.
|
||||
: ${XORG_EAUTORECONF:="no"}
|
||||
|
||||
# Set up SRC_URI for individual modular releases
|
||||
BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
|
||||
# @ECLASS-VARIABLE: MODULE
|
||||
# @DESCRIPTION:
|
||||
# The subdirectory to download source from. Possible settings are app,
|
||||
# doc, data, util, driver, font, lib, proto, xserver. Set above the
|
||||
# inherit to override the default autoconfigured module.
|
||||
if [[ -z ${MODULE} ]]; then
|
||||
MODULE=""
|
||||
case ${CATEGORY} in
|
||||
app-doc) MODULE="doc" ;;
|
||||
media-fonts) MODULE="font" ;;
|
||||
x11-apps|x11-wm) MODULE="app" ;;
|
||||
x11-misc|x11-themes) MODULE="util" ;;
|
||||
x11-drivers) MODULE="driver" ;;
|
||||
x11-base) MODULE="xserver" ;;
|
||||
x11-proto) MODULE="proto" ;;
|
||||
x11-libs) MODULE="lib" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ -n ${GIT_ECLASS} ]]; then
|
||||
EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
|
||||
else
|
||||
SRC_URI+=" ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
|
||||
fi
|
||||
|
||||
: ${SLOT:=0}
|
||||
|
||||
# Set the license for the package. This can be overridden by setting
|
||||
# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
|
||||
# are under the MIT license. (This is what Red Hat does in their rpms)
|
||||
: ${LICENSE:=MIT}
|
||||
|
||||
# Set up shared dependencies
|
||||
if [[ ${XORG_EAUTORECONF} != no ]]; then
|
||||
DEPEND+="
|
||||
>=sys-devel/libtool-2.2.6a
|
||||
sys-devel/m4"
|
||||
# This MUST BE STABLE
|
||||
if [[ ${PN} != util-macros ]] ; then
|
||||
DEPEND+=" >=x11-misc/util-macros-1.8.0"
|
||||
# Required even by xorg-server
|
||||
[[ ${PN} == "font-util" ]] || DEPEND+=" >=media-fonts/font-util-1.1.1-r1"
|
||||
fi
|
||||
WANT_AUTOCONF="latest"
|
||||
WANT_AUTOMAKE="latest"
|
||||
fi
|
||||
|
||||
if [[ ${FONT} == yes ]]; then
|
||||
RDEPEND+=" media-fonts/encodings
|
||||
x11-apps/mkfontscale
|
||||
x11-apps/mkfontdir"
|
||||
PDEPEND+=" media-fonts/font-alias"
|
||||
|
||||
# @ECLASS-VARIABLE: FONT_DIR
|
||||
# @DESCRIPTION:
|
||||
# If you're creating a font package and the suffix of PN is not equal to
|
||||
# the subdirectory of /usr/share/fonts/ it should install into, set
|
||||
# FONT_DIR to that directory or directories. Set before inheriting this
|
||||
# eclass.
|
||||
[[ -z ${FONT_DIR} ]] && FONT_DIR=${PN##*-}
|
||||
|
||||
# Fix case of font directories
|
||||
FONT_DIR=${FONT_DIR/ttf/TTF}
|
||||
FONT_DIR=${FONT_DIR/otf/OTF}
|
||||
FONT_DIR=${FONT_DIR/type1/Type1}
|
||||
FONT_DIR=${FONT_DIR/speedo/Speedo}
|
||||
|
||||
# Set up configure options, wrapped so ebuilds can override if need be
|
||||
[[ -z ${FONT_OPTIONS} ]] && FONT_OPTIONS="--with-fontdir=\"${EPREFIX}/usr/share/fonts/${FONT_DIR}\""
|
||||
|
||||
[[ ${PN##*-} = misc || ${PN##*-} = 75dpi || ${PN##*-} = 100dpi || ${PN##*-} = cyrillic ]] && IUSE+=" nls"
|
||||
fi
|
||||
|
||||
# If we're a driver package, then enable DRIVER case
|
||||
[[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes"
|
||||
|
||||
# @ECLASS-VARIABLE: XORG_STATIC
|
||||
# @DESCRIPTION:
|
||||
# Enables static-libs useflag. Set to no, if your package gets:
|
||||
#
|
||||
# QA: configure: WARNING: unrecognized options: --disable-static
|
||||
: ${XORG_STATIC:="yes"}
|
||||
|
||||
# Add static-libs useflag where usefull.
|
||||
if [[ ${XORG_STATIC} == yes \
|
||||
&& ${FONT} != yes \
|
||||
&& ${CATEGORY} != app-doc \
|
||||
&& ${CATEGORY} != x11-proto \
|
||||
&& ${CATEGORY} != x11-drivers \
|
||||
&& ${CATEGORY} != media-fonts \
|
||||
&& ${PN} != util-macros \
|
||||
&& ${PN} != xbitmaps \
|
||||
&& ${PN} != xorg-cf-files \
|
||||
&& ${PN/xcursor} = ${PN} ]]; then
|
||||
IUSE+=" static-libs"
|
||||
fi
|
||||
|
||||
DEPEND+=" >=dev-util/pkgconfig-0.23"
|
||||
|
||||
# Check deps on xorg-server
|
||||
has dri ${IUSE//+} && DEPEND+=" dri? ( >=x11-base/xorg-server-1.6.3.901-r2[-minimal] )"
|
||||
[[ -n "${DRIVER}" ]] && DEPEND+=" x11-base/xorg-server[xorg]"
|
||||
|
||||
# @FUNCTION: xorg-2_pkg_setup
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Setup prefix compat
|
||||
xorg-2_pkg_setup() {
|
||||
[[ ${FONT} == yes ]] && font_pkg_setup
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_src_unpack
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Simply unpack source code.
|
||||
xorg-2_src_unpack() {
|
||||
if [[ -n ${GIT_ECLASS} ]]; then
|
||||
git_src_unpack
|
||||
else
|
||||
unpack ${A}
|
||||
fi
|
||||
|
||||
[[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_patch_source
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Apply all patches
|
||||
xorg-2_patch_source() {
|
||||
# Use standardized names and locations with bulk patching
|
||||
# Patch directory is ${WORKDIR}/patch
|
||||
# See epatch() in eutils.eclass for more documentation
|
||||
EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
|
||||
|
||||
[[ -d "${EPATCH_SOURCE}" ]] && epatch
|
||||
base_src_prepare
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_reconf_source
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run eautoreconf if necessary, and run elibtoolize.
|
||||
xorg-2_reconf_source() {
|
||||
case ${CHOST} in
|
||||
*-interix* | *-aix* | *-winnt*)
|
||||
# some hosts need full eautoreconf
|
||||
[[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail."
|
||||
;;
|
||||
*)
|
||||
# elibtoolize required for BSD
|
||||
[[ ${XORG_EAUTORECONF} != no && -e "./configure.ac" ]] && eautoreconf || elibtoolize
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_src_prepare
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Prepare a package after unpacking, performing all X-related tasks.
|
||||
xorg-2_src_prepare() {
|
||||
[[ -n ${GIT_ECLASS} ]] && git_src_prepare
|
||||
xorg-2_patch_source
|
||||
xorg-2_reconf_source
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_font_configure
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# If a font package, perform any necessary configuration steps
|
||||
xorg-2_font_configure() {
|
||||
if has nls ${IUSE//+} && ! use nls; then
|
||||
FONT_OPTIONS+="
|
||||
--disable-iso8859-2
|
||||
--disable-iso8859-3
|
||||
--disable-iso8859-4
|
||||
--disable-iso8859-5
|
||||
--disable-iso8859-6
|
||||
--disable-iso8859-7
|
||||
--disable-iso8859-8
|
||||
--disable-iso8859-9
|
||||
--disable-iso8859-10
|
||||
--disable-iso8859-11
|
||||
--disable-iso8859-12
|
||||
--disable-iso8859-13
|
||||
--disable-iso8859-14
|
||||
--disable-iso8859-15
|
||||
--disable-iso8859-16
|
||||
--disable-jisx0201
|
||||
--disable-koi8-r"
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: x-modular_flags_setup
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Set up CFLAGS for a debug build
|
||||
xorg-2_flags_setup() {
|
||||
# Win32 require special define
|
||||
[[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
|
||||
# hardened ldflags
|
||||
[[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_src_configure
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Perform any necessary pre-configuration steps, then run configure
|
||||
xorg-2_src_configure() {
|
||||
local myopts=""
|
||||
|
||||
xorg-2_flags_setup
|
||||
[[ -n "${FONT}" ]] && xorg-2_font_configure
|
||||
|
||||
# @VARIABLE: CONFIGURE_OPTIONS
|
||||
# @DESCRIPTION:
|
||||
# Any options to pass to configure
|
||||
CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""}
|
||||
if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
|
||||
if has static-libs ${IUSE//+}; then
|
||||
myopts+=" $(use_enable static-libs static)"
|
||||
fi
|
||||
econf \
|
||||
${FONT_OPTIONS} \
|
||||
${CONFIGURE_OPTIONS} \
|
||||
${myopts}
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_src_compile
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Compile a package, performing all X-related tasks.
|
||||
xorg-2_src_compile() {
|
||||
base_src_compile
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_src_install
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Install a built package to ${D}, performing any necessary steps.
|
||||
# Creates a ChangeLog from git if using live ebuilds.
|
||||
xorg-2_src_install() {
|
||||
if [[ ${CATEGORY} == x11-proto ]]; then
|
||||
emake \
|
||||
${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \
|
||||
DESTDIR="${D}" \
|
||||
install || die "emake install failed"
|
||||
else
|
||||
emake \
|
||||
docdir=${EPREFIX}/usr/share/doc/${PF} \
|
||||
DESTDIR="${D}" \
|
||||
install || die "emake install failed"
|
||||
fi
|
||||
|
||||
if [[ -n ${GIT_ECLASS} ]]; then
|
||||
pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null
|
||||
git log ${GIT_TREE} > "${S}"/ChangeLog
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
if [[ -e "${S}"/ChangeLog ]]; then
|
||||
dodoc "${S}"/ChangeLog
|
||||
fi
|
||||
# @VARIABLE: DOCS
|
||||
# @DESCRIPTION:
|
||||
# Any documentation to install
|
||||
if [[ -n ${DOCS} ]]; then
|
||||
dodoc ${DOCS} || die "dodoc failed"
|
||||
fi
|
||||
|
||||
# Don't install libtool archives for server modules
|
||||
if [[ -e "${D%/}${EPREFIX}/usr/$(get_libdir)/xorg/modules" ]]; then
|
||||
find "${D%/}${EPREFIX}/usr/$(get_libdir)/xorg/modules" -name '*.la' \
|
||||
-exec rm -f {} ';'
|
||||
fi
|
||||
|
||||
[[ -n ${FONT} ]] && remove_font_metadata
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_pkg_postinst
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run X-specific post-installation tasks on the live filesystem. The
|
||||
# only task right now is some setup for font packages.
|
||||
xorg-2_pkg_postinst() {
|
||||
[[ -n ${FONT} ]] && setup_fonts
|
||||
}
|
||||
|
||||
# @FUNCTION: xorg-2_pkg_postrm
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Run X-specific post-removal tasks on the live filesystem. The only
|
||||
# task right now is some cleanup for font packages.
|
||||
xorg-2_pkg_postrm() {
|
||||
if [[ -n ${FONT} ]]; then
|
||||
font_pkg_postrm
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: setup_fonts
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Generates needed files for fonts and fixes font permissions
|
||||
setup_fonts() {
|
||||
create_fonts_scale
|
||||
create_fonts_dir
|
||||
font_pkg_postinst
|
||||
}
|
||||
|
||||
# @FUNCTION: remove_font_metadata
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Don't let the package install generated font files that may overlap
|
||||
# with other packages. Instead, they're generated in pkg_postinst().
|
||||
remove_font_metadata() {
|
||||
if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
|
||||
einfo "Removing font metadata"
|
||||
rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: create_fonts_scale
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Create fonts.scale file, used by the old server-side fonts subsystem.
|
||||
create_fonts_scale() {
|
||||
if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
|
||||
ebegin "Generating font.scale"
|
||||
mkfontscale \
|
||||
-a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
|
||||
-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
|
||||
eend $?
|
||||
fi
|
||||
}
|
||||
|
||||
# @FUNCTION: create_fonts_dir
|
||||
# @USAGE:
|
||||
# @DESCRIPTION:
|
||||
# Create fonts.dir file, used by the old server-side fonts subsystem.
|
||||
create_fonts_dir() {
|
||||
ebegin "Generating fonts.dir"
|
||||
mkfontdir \
|
||||
-e "${EROOT}"/usr/share/fonts/encodings \
|
||||
-e "${EROOT}"/usr/share/fonts/encodings/large \
|
||||
-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
|
||||
eend $?
|
||||
}
|
Loading…
Reference in New Issue
Block a user