# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ ECLASS=x11-prefix INHERITED="${INHERITED} ${ECLASS}" EXPORT_FUNCTIONS pkg_setup # Set the X11_PREFIX variable x11-prefix_pkg_setup() { if [ -d "/usr/X11R6" -a ! -L "/usr/X11R6" ] \ || [ -d "${ROOT}usr/X11R6" -a ! -L "${ROOT}usr/X11R6" ] ; then # safer to use /usr/X11R6 as soon as one of the existing X11 # instances uses this prefix X11_PREFIX="/usr/X11R6" else X11_PREFIX="/usr" fi if [ -n "${NEED_NEW_X11_PREFIX}" ] \ && [ -n "${X11_PREFIX#/usr}" ] ; then eerror "This ebuild needs X11 to be installed in /usr" die "wrong X11 prefix" elif [ -n "${NEED_OLD_X11_PREFIX}" ] \ && [ -n "${X11_PREFIX#/usr/X11R6}" ] ; then eerror "This ebuild needs X11 to be installed in /usr/X11R6" die "wrong X11 prefix" fi return 0 } # Boolean test to check we are on a system where X11 is in /usr new_x11_prefix() { if [ -z "${X11_PREFIX}" ] ; then eerror "X11_PREFIX not defined: you must call x11-prefix_pkg_setup()." fi [ -z "${X11_PREFIX#/usr}" ] } # These are some sed hacks useful to applications built from an Imakefile. # Typical usage: # xmkf || die # fix_Imake_Makefile # make || die fix_Imake_Makefile() { local my_file=${1:-Makefile} [ ! -f "${my_file}" ] \ && eerror "${my_file}: file not found" \ && return 1 # - change *MANSUFFIX from [1-9]x to [1-9] (we'll keep the X category for the # actual X11 stuffs, not for any random app/lib vaguely linked to X) sed -i "/MANSUFFIX *= */s:\([1-8]\)x:\1:" ${my_file} # - set DOCDIR to /usr/share/doc/${PF} (it's /usr/share/doc/xorg-x11-VERSION # otherwise) sed -i "/DOCDIR *= */s:\(/usr/share/doc\)/.*:\1/${PF}:" ${my_file} # - random shots: fix remaining /usr/X11R6 instances if any (BUILDROOT, # stuffs like that), etc. sed -i \ -e "s:/usr/X11R6:${X11_PREFIX}:" \ -e "s:/usr/man:/usr/share/man:" \ -e "s:/usr/local:/usr:" \ -e "s:/usr/bin/X11:/usr/bin:" \ -e "s:/usr/X11/bin:/usr/bin:" \ ${my_file} } # XXX Add a pkg_postinst function to warn about the Ive-built-a-binary-on-a- # XXX new-system-but-Im-installing-it-on-an-old-one case.