--- pygame-1.8.1-r1.ebuild_orig 2009-04-09 12:04:56.000000000 +0200 +++ pygame-1.8.1-r1.ebuild_orig 2009-05-29 13:54:36.000000000 +0200 @@ -13,9 +13,9 @@ LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~sparc ~x86 ~x86-fbsd" -IUSE="doc" +IUSE="doc X" -RDEPEND=">=media-libs/libsdl-1.2.5[X] +RDEPEND=">=media-libs/libsdl-1.2.5 >=media-libs/sdl-ttf-2.0.6 >=media-libs/sdl-image-1.2.2[png,jpeg] >=media-libs/sdl-mixer-1.2.4 @@ -49,3 +49,23 @@ python_version PYTHONPATH="$(ls -d build/lib.*)" "${python}" run_tests.py || die "tests failed" } + +pkg_setup() { + if use X ; then + # if we want X11 (at all), make sure libsdl was also built with X11 support + if ! built_with_use media-libs/libsdl X ; then + eerror "Please re-emerge media-libs/libsdl with the X USE-flag set." + die "Missing USE-flag for media-libs/libsdl" + fi + fi +} + +src_unpack() { + unpack "${A}" + cd "${S}" + if use !X ; then + # if we do not want X11 support, disable it + einfo "Disabling X11 support" + epatch ${FILESDIR}/${P}_disable-X11.diff + fi +}