| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 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.283 2007/06/16 08:03:28 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.284 2007/06/21 04:44:45 vapier 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 |
| … | |
… | |
| 732 | # name: the name that will show up in the menu |
732 | # name: the name that will show up in the menu |
| 733 | # icon: give your little like a pretty little icon ... |
733 | # icon: give your little like a pretty little icon ... |
| 734 | # this can be relative (to /usr/share/pixmaps) or |
734 | # this can be relative (to /usr/share/pixmaps) or |
| 735 | # a full path to an icon |
735 | # a full path to an icon |
| 736 | # type: what kind of application is this ? for categories: |
736 | # type: what kind of application is this ? for categories: |
| 737 | # http://www.freedesktop.org/Standards/desktop-entry-spec |
737 | # http://standards.freedesktop.org/menu-spec/latest/apa.html |
| 738 | # path: if your app needs to startup in a specific dir |
738 | # path: if your app needs to startup in a specific dir |
| 739 | make_desktop_entry() { |
739 | make_desktop_entry() { |
| 740 | [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1 |
740 | [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1 |
| 741 | |
741 | |
| 742 | local exec=${1} |
742 | local exec=${1} |
| … | |
… | |
| 749 | local catmaj=${CATEGORY%%-*} |
749 | local catmaj=${CATEGORY%%-*} |
| 750 | local catmin=${CATEGORY##*-} |
750 | local catmin=${CATEGORY##*-} |
| 751 | case ${catmaj} in |
751 | case ${catmaj} in |
| 752 | app) |
752 | app) |
| 753 | case ${catmin} in |
753 | case ${catmin} in |
|
|
754 | accessibility) type=Accessibility;; |
| 754 | admin) type=System;; |
755 | admin) type=System;; |
|
|
756 | antivirus) type=System;; |
|
|
757 | arch) type=Archiving;; |
|
|
758 | backup) type=Archiving;; |
| 755 | cdr) type=DiscBurning;; |
759 | cdr) type=DiscBurning;; |
| 756 | dicts) type=Dictionary;; |
760 | dicts) type=Dictionary;; |
|
|
761 | doc) type=Documentation;; |
| 757 | editors) type=TextEditor;; |
762 | editors) type=TextEditor;; |
| 758 | emacs) type=TextEditor;; |
763 | emacs) type=TextEditor;; |
| 759 | emulation) type=Emulator;; |
764 | emulation) type=Emulator;; |
| 760 | laptop) type=HardwareSettings;; |
765 | laptop) type=HardwareSettings;; |
| 761 | office) type=Office;; |
766 | office) type=Office;; |
|
|
767 | pda) type=PDA;; |
| 762 | vim) type=TextEditor;; |
768 | vim) type=TextEditor;; |
| 763 | xemacs) type=TextEditor;; |
769 | xemacs) type=TextEditor;; |
| 764 | *) type=;; |
770 | *) type=;; |
| 765 | esac |
771 | esac |
| 766 | ;; |
772 | ;; |
| … | |
… | |
| 772 | games) |
778 | games) |
| 773 | case ${catmin} in |
779 | case ${catmin} in |
| 774 | action|fps) type=ActionGame;; |
780 | action|fps) type=ActionGame;; |
| 775 | arcade) type=ArcadeGame;; |
781 | arcade) type=ArcadeGame;; |
| 776 | board) type=BoardGame;; |
782 | board) type=BoardGame;; |
|
|
783 | emulation) type=Emulator;; |
| 777 | kids) type=KidsGame;; |
784 | kids) type=KidsGame;; |
| 778 | emulation) type=Emulator;; |
|
|
| 779 | puzzle) type=LogicGame;; |
785 | puzzle) type=LogicGame;; |
|
|
786 | roguelike) type=RolePlaying;; |
| 780 | rpg) type=RolePlaying;; |
787 | rpg) type=RolePlaying;; |
| 781 | roguelike) type=RolePlaying;; |
|
|
| 782 | simulation) type=Simulation;; |
788 | simulation) type=Simulation;; |
| 783 | sports) type=SportsGame;; |
789 | sports) type=SportsGame;; |
| 784 | strategy) type=StrategyGame;; |
790 | strategy) type=StrategyGame;; |
| 785 | *) type=;; |
791 | *) type=;; |
| 786 | esac |
792 | esac |
| 787 | type="Game;${type}" |
793 | type="Game;${type}" |
|
|
794 | ;; |
|
|
795 | |
|
|
796 | gnome) |
|
|
797 | type="Gnome;GTK" |
|
|
798 | ;; |
|
|
799 | |
|
|
800 | kde) |
|
|
801 | type="KDE;Qt" |
| 788 | ;; |
802 | ;; |
| 789 | |
803 | |
| 790 | mail) |
804 | mail) |
| 791 | type="Network;Email" |
805 | type="Network;Email" |
| 792 | ;; |
806 | ;; |
| … | |
… | |
| 818 | type="Network;${type}" |
832 | type="Network;${type}" |
| 819 | ;; |
833 | ;; |
| 820 | |
834 | |
| 821 | sci) |
835 | sci) |
| 822 | case ${catmin} in |
836 | case ${catmin} in |
| 823 | astro*) type=Astronomy;; |
837 | astro*) type=Astronomy;; |
| 824 | bio*) type=Biology;; |
838 | bio*) type=Biology;; |
| 825 | calc*) type=Calculator;; |
839 | calc*) type=Calculator;; |
| 826 | chem*) type=Chemistry;; |
840 | chem*) type=Chemistry;; |
|
|
841 | elec*) type=Electronics;; |
| 827 | geo*) type=Geology;; |
842 | geo*) type=Geology;; |
| 828 | math*) type=Math;; |
843 | math*) type=Math;; |
|
|
844 | physics) type=Physics;; |
|
|
845 | visual*) type=DataVisualization;; |
| 829 | *) type=;; |
846 | *) type=;; |
| 830 | esac |
847 | esac |
| 831 | type="Science;${type}" |
848 | type="Science;${type}" |
|
|
849 | ;; |
|
|
850 | |
|
|
851 | sys) |
|
|
852 | type="System" |
| 832 | ;; |
853 | ;; |
| 833 | |
854 | |
| 834 | www) |
855 | www) |
| 835 | case ${catmin} in |
856 | case ${catmin} in |
| 836 | client) type=WebBrowser;; |
857 | client) type=WebBrowser;; |
| … | |
… | |
| 853 | #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop |
874 | #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop |
| 854 | |
875 | |
| 855 | cat <<-EOF > "${desktop}" |
876 | cat <<-EOF > "${desktop}" |
| 856 | [Desktop Entry] |
877 | [Desktop Entry] |
| 857 | Encoding=UTF-8 |
878 | Encoding=UTF-8 |
| 858 | Version=0.9.2 |
879 | Version=1.0 |
| 859 | Name=${name} |
880 | Name=${name} |
| 860 | Type=Application |
881 | Type=Application |
| 861 | Comment=${DESCRIPTION} |
882 | Comment=${DESCRIPTION} |
| 862 | Exec=${exec} |
883 | Exec=${exec} |
| 863 | TryExec=${exec%% *} |
884 | TryExec=${exec%% *} |
| 864 | Path=${path} |
885 | Path=${path} |
| 865 | Icon=${icon} |
886 | Icon=${icon} |
| 866 | Categories=Application;${type}; |
887 | Categories=${type}; |
| 867 | EOF |
888 | EOF |
| 868 | |
889 | |
| 869 | ( |
890 | ( |
| 870 | # wrap the env here so that the 'insinto' call |
891 | # wrap the env here so that the 'insinto' call |
| 871 | # doesn't corrupt the env of the caller |
892 | # doesn't corrupt the env of the caller |