--- opengl.eselect.orig 2006-02-27 12:36:17.000000000 +0000 +++ opengl.eselect 2006-03-03 10:50:30.000000000 +0000 @@ -113,14 +113,8 @@ local libdir for libdir in $(list_libdirs); do - # Special case handling of lib32 because it can be a symlink to - # emul libs - # Kill this special case once amd64's 2004.3 crap is gone =) --eradicator - if [[ ${libdir} = "lib32" ]] ; then - [[ -d ${PREFIX}/${libdir}/opengl ]] || continue - else - [[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue - fi + # Don't pass the same directory twice if we're using a profile with the symlink hack + [[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue # Fallback on xorg-x11 if we don't have this implementation for this libdir. local gl_local @@ -169,54 +163,64 @@ popd &> /dev/null fi - # Setup the includes - mkdir -p "${DST_PREFIX}/include/GL" || die "Failed to create ${DST_PREFIX}/include/GL" - pushd "${DST_PREFIX}/include/GL" &> /dev/null - for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do - # IMPORTANT - # It is preferable currently to use the standard glext.h file - # however if an OpenGL provider must use a self produced glext.h - # then it should be installed to ${gl_implem}/include and the user - # can add the --impl-headers option to select it. - - if [[ "${USE_PROFILE_HEADERS}" == "yes" ]] ; then - # Check the profile first. - if [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then - if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then - rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" - fi - - ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" - continue - fi - fi + # Setup the $LDPATH + ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib" - if [[ -e ${PREFIX}/${libdir}/opengl/global/include/${file} ]] ; then + done + + # Determine native/default libdir + local abi=$(portageq envvar DEFAULT_ABI) + local default_libdir + if [ -z ${abi} ] ; then + default_libdir="lib" + else + default_libdir=$(portageq envvar LIBDIR_${abi}) + fi + + # Setup the includes + # Only want to do this once, for the default libdir + mkdir -p "${DST_PREFIX}/include/GL" || die "Failed to create ${DST_PREFIX}/include/GL" + pushd "${DST_PREFIX}/include/GL" &> /dev/null + for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do + # IMPORTANT + # It is preferable currently to use the standard glext.h file + # however if an OpenGL provider must use a self produced glext.h + # then it should be installed to ${gl_implem}/include and the user + # can add the --impl-headers option to select it. + + if [[ "${USE_PROFILE_HEADERS}" == "yes" ]] ; then + # Check the profile first. + if [[ -e ${PREFIX}/${default_libdir}/opengl/${gl_implem}/include/${file} ]] ; then if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" fi - ln -s ${PREFIX}/${libdir}/opengl/global/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" - elif [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then - if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then - rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" - fi + ln -s ${PREFIX}/${default_libdir}/opengl/${gl_implem}/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" + continue + fi + fi - ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" - elif [[ -e ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} ]] ; then - if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then - rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" - fi + if [[ -e ${PREFIX}/${default_libdir}/opengl/global/include/${file} ]] ; then + if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then + rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" + fi - ln -s ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" + ln -s ${PREFIX}/${default_libdir}/opengl/global/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" + elif [[ -e ${PREFIX}/${default_libdir}/opengl/${gl_implem}/include/${file} ]] ; then + if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then + rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" fi - done - popd &> /dev/null - # Setup the $LDPATH - ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib" + ln -s ${PREFIX}/${default_libdir}/opengl/${gl_implem}/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" + elif [[ -e ${PREFIX}/${default_libdir}/opengl/xorg-x11/include/${file} ]] ; then + if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then + rm -f "${file}" || die -q "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")" + fi - done + ln -s ${PREFIX}/${default_libdir}/opengl/xorg-x11/include/${file} || die -q "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")" + fi + done + popd &> /dev/null store_config ${ENV_FILE} LDPATH "${ldpath}" store_config ${ENV_FILE} OPENGL_PROFILE "${gl_implem}"