From: Jim Ramsay Date: Fri, 9 Feb 2007 17:27:39 +0000 (+0000) Subject: Changed .desktop and /usr/bin/wrapper names to avoid collisions X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=454d26ea10d004b9896d6feec6a1baa0a3902903;p=gentoo.git Changed .desktop and /usr/bin/wrapper names to avoid collisions --- diff --git a/eclass/rox.eclass b/eclass/rox.eclass index 96375bb81136..bd636998fe00 100644 --- a/eclass/rox.eclass +++ b/eclass/rox.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/rox.eclass,v 1.19 2007/01/30 22:07:49 lack Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/rox.eclass,v 1.20 2007/02/09 17:27:39 lack Exp $ # ROX eclass Version 2 @@ -20,15 +20,21 @@ # the ebuild: # # APPNAME - the actual name of the application as the app folder is named +# WRAPPERNAME - the name of the wrapper installed into /usr/bin +# Defaults to 'rox-${PN}', or just ${PN} if it already starts with 'rox'. +# This does not normally need to be overridden. +# APPNAME_COLLISION - If not set, the old naming convention for wrappers of +# /usr/bin/${APPNAME} will still be around. Needs only be set in packages +# with known collisions (such as Pager, which collides with afterstep) # APPCATEGORY - the .desktop categories this application should be placed in. # If unset, no .desktop file will be created. For a list of acceptable # category names, see # http://standards.freedesktop.org/menu-spec/latest/apa.html # KEEP_SRC - this flag, if set, will not remove the source directory # but will do a make clean in it. This is useful if users wish to -# preserve the source code for anything +# preserve the source code for some reason -# For examples refer to ebuilds in rox-extra/ +# For examples refer to ebuilds in rox-extra/ or rox-base/ # need python to byte compile modules, if any # need autotools to run autoreconf, if required @@ -52,11 +58,65 @@ if [[ -n "${ROX_CLIB_VER}" ]]; then >=dev-util/pkgconfig-0.20" fi -# Utility functions +# This is the new wrapper name (for /usr/bin/) +# It is also used for the icon name in /usr/share/pixmaps +# +# Use rox-${PN} unless ${PN} already starts with 'rox' +a="rox-${PN}" +b=${a/rox-rox*} +WRAPPERNAME=${b:-${PN}} + +# This is the location where all applications are installed +APPDIR="/usr/lib/rox" +LIBDIR="/usr/lib" + +# Utility Functions + +# Creates a .desktop file for this rox application +# (Adapted from eutils::make_desktop_entry) +# +# rox_desktop_entry [ ...] +# exec - The executable to run +# name - The name to display +# icon - The icon file to display +# Any other arguments will be appended verbatim to the desktop file. +# +# The name of the desktop file will be ${exec}.desktop +# rox_desktop_entry() { - # make_desktop_entry(, [name], [icon], [type], [path]) - make_desktop_entry ${APPNAME} ${APPNAME} \ - "${APPICON}" "${APPCATEGORY};ROX" + # Coppied from etuils:make_desktop_entry + local exec=${1}; shift + local name=${1}; shift + local icon=${1}; shift + local type=${1}; shift + + local desktop="${exec}.desktop" + + cat <<-EOF > "${desktop}" + [Desktop Entry] + Encoding=UTF-8 + Version=1.0 + Name=${name} + Type=Application + Comment=${DESCRIPTION} + Exec=${exec} + TryExec=${exec%% *} + Icon=${icon} + Categories=ROX;Application;${type}; + EOF + + local extra=${1}; shift + while [[ "${extra}" ]]; do + echo "${extra}" >> "${desktop}" + extra=${1}; shift + done + + ( + # wrap the env here so that the 'insinto' call + # doesn't corrupt the env of the caller + insinto /usr/share/applications + doins "${desktop}" + ) } # Exported functions @@ -77,7 +137,7 @@ rox_src_compile() { eautoconf cd .. fi - export LIBDIRPATH="/usr/lib/" + export LIBDIRPATH="${LIBDIR}" # Most rox self-compiles have a 'read' call to wait for the user to # press return if the compile fails. @@ -108,62 +168,85 @@ rox_src_install() { done fi - insinto /usr/lib/rox + insinto ${APPDIR} # Use 'cp -pPR' and not 'doins -r' here so we don't have to do a flurry of # 'chmod' calls on the executables in the appdir - Just be sure that all the # files in the original appdir prior to this step are correct, as they will # all be preserved. - cp -pPR ${APPNAME} ${D}/usr/lib/rox/${APPNAME} + cp -pPR ${APPNAME} ${D}${APPDIR}/${APPNAME} #create a script in bin to run the application from command line dodir /usr/bin/ - cat >"${D}/usr/bin/${APPNAME}" <"${D}/usr/bin/${WRAPPERNAME}" </dev/null 2>&1 - # Create a .desktop file if the proper category is supplied if [[ -n "${APPCATEGORY}" ]]; then - rox_desktop_entry + # Copy the .DirIcon into /usr/share/pixmaps with the proper extension + if [[ -f "${APPNAME}/.DirIcon" ]]; then + local APPDIRICON=${APPNAME}/.DirIcon + case "$(file -b ${APPDIRICON})" in + "PNG image data"*) + export APPICON=${WRAPPERNAME}.png + ;; + "XML 1.0 document text"*) + export APPICON=${WRAPPERNAME}.svg + ;; + "X pixmap image text"*) + export APPICON=${WRAPPERNAME}.xpm + ;; + "symbolic link"*) + APPDIRICON=$(dirname ${APPDIRICON})/$(readlink ${APPDIRICON}) + export APPICON=${WRAPPERNAME}.${APPDIRICON##*.} + ;; + *) + # Unknown... Remark on it, and just copy without an extension + ewarn "Could not detect the file type of the application icon," + ewarn "copying without an extension." + export APPICON=${WRAPPERNAME} + ;; + esac + insinto /usr/share/pixmaps + newins "${APPDIRICON}" "${APPICON}" + fi + + rox_desktop_entry "${WRAPPERNAME}" "${APPNAME}" "${APPICON}" "${APPCATEGORY}" fi + + #now compile any and all python files + python_mod_optimize "${D}${APPDIR}/${APPNAME}" >/dev/null 2>&1 } rox_pkg_postinst() { - einfo "${APPNAME} has been installed into /usr/lib/rox" - einfo "You can run it by typing ${APPNAME} at the command line." + einfo "${APPNAME} has been installed into ${APPDIR}" + einfo "You can run it by typing ${WRAPPERNAME} at the command line." einfo "Or, you can run it by pointing the ROX file manager to the" - einfo "install location -- /usr/lib/rox/${APPNAME} -- and click" + einfo "install location -- ${APPDIR} -- and click" einfo "on ${APPNAME}'s icon, drag it to a panel, desktop, etc." }