| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.335 2010/02/26 05:17:24 halcy0n Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.336 2010/02/26 05:33:57 abcd Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: eutils.eclass |
5 | # @ECLASS: eutils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
| … | |
… | |
| 959 | irc) type=IRCClient;; |
959 | irc) type=IRCClient;; |
| 960 | mail) type=Email;; |
960 | mail) type=Email;; |
| 961 | news) type=News;; |
961 | news) type=News;; |
| 962 | nntp) type=News;; |
962 | nntp) type=News;; |
| 963 | p2p) type=FileTransfer;; |
963 | p2p) type=FileTransfer;; |
|
|
964 | voip) type=Telephony;; |
| 964 | *) type=;; |
965 | *) type=;; |
| 965 | esac |
966 | esac |
| 966 | type="Network;${type}" |
967 | type="Network;${type}" |
| 967 | ;; |
968 | ;; |
| 968 | |
969 | |
| … | |
… | |
| 977 | math*) type=Math;; |
978 | math*) type=Math;; |
| 978 | physics) type=Physics;; |
979 | physics) type=Physics;; |
| 979 | visual*) type=DataVisualization;; |
980 | visual*) type=DataVisualization;; |
| 980 | *) type=;; |
981 | *) type=;; |
| 981 | esac |
982 | esac |
| 982 | type="Science;${type}" |
983 | type="Education;Science;${type}" |
| 983 | ;; |
984 | ;; |
| 984 | |
985 | |
| 985 | sys) |
986 | sys) |
| 986 | type="System" |
987 | type="System" |
| 987 | ;; |
988 | ;; |
| … | |
… | |
| 989 | www) |
990 | www) |
| 990 | case ${catmin} in |
991 | case ${catmin} in |
| 991 | client) type=WebBrowser;; |
992 | client) type=WebBrowser;; |
| 992 | *) type=;; |
993 | *) type=;; |
| 993 | esac |
994 | esac |
| 994 | type="Network" |
995 | type="Network;${type}" |
| 995 | ;; |
996 | ;; |
| 996 | |
997 | |
| 997 | *) |
998 | *) |
| 998 | type= |
999 | type= |
| 999 | ;; |
1000 | ;; |
| … | |
… | |
| 1004 | else |
1005 | else |
| 1005 | local desktop_name="${PN}-${SLOT}" |
1006 | local desktop_name="${PN}-${SLOT}" |
| 1006 | fi |
1007 | fi |
| 1007 | local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop" |
1008 | local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop" |
| 1008 | #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop |
1009 | #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop |
|
|
1010 | |
|
|
1011 | # Don't append another ";" when a valid category value is provided. |
|
|
1012 | type=${type%;}${type:+;} |
|
|
1013 | |
|
|
1014 | eshopts_push -s extglob |
|
|
1015 | if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then |
|
|
1016 | ewarn "As described in the Icon Theme Specification, icon file extensions are not" |
|
|
1017 | ewarn "allowed in .desktop files if the value is not an absolute path." |
|
|
1018 | icon=${icon%.@(xpm|png|svg)} |
|
|
1019 | fi |
|
|
1020 | eshopts_pop |
| 1009 | |
1021 | |
| 1010 | cat <<-EOF > "${desktop}" |
1022 | cat <<-EOF > "${desktop}" |
| 1011 | [Desktop Entry] |
1023 | [Desktop Entry] |
| 1012 | Name=${name} |
1024 | Name=${name} |
| 1013 | Type=Application |
1025 | Type=Application |
| 1014 | Comment=${DESCRIPTION} |
1026 | Comment=${DESCRIPTION} |
| 1015 | Exec=${exec} |
1027 | Exec=${exec} |
| 1016 | TryExec=${exec%% *} |
1028 | TryExec=${exec%% *} |
| 1017 | Icon=${icon} |
1029 | Icon=${icon} |
| 1018 | Categories=${type}; |
1030 | Categories=${type} |
| 1019 | EOF |
1031 | EOF |
| 1020 | |
1032 | |
| 1021 | [[ ${path} ]] && echo "Path=${path}" >> "${desktop}" |
1033 | [[ ${path} ]] && echo "Path=${path}" >> "${desktop}" |
| 1022 | |
1034 | |
| 1023 | ( |
1035 | ( |