/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.157 Revision 1.161
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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.157 2005/03/07 17:45:07 carlo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.161 2005/03/23 04:30:51 vapier Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
109gen_usr_ldscript() { 109gen_usr_ldscript() {
110 local libdir="$(get_libdir)" 110 local libdir="$(get_libdir)"
111 # Just make sure it exists 111 # Just make sure it exists
112 dodir /usr/${libdir} 112 dodir /usr/${libdir}
113 113
114 while [[ $# -gt 0 ]] ; do
114 cat > "${D}/usr/${libdir}/${1}" << END_LDSCRIPT 115 cat > "${D}/usr/${libdir}/$1" <<-END_LDSCRIPT
115/* GNU ld script 116 /* GNU ld script
116 Because Gentoo have critical dynamic libraries 117 Since Gentoo has critical dynamic libraries
117 in /lib, and the static versions in /usr/lib, we 118 in /lib, and the static versions in /usr/lib,
118 need to have a "fake" dynamic lib in /usr/lib, 119 we need to have a "fake" dynamic lib in /usr/lib,
119 otherwise we run into linking problems. 120 otherwise we run into linking problems.
120 See bug #4411 on http://bugs.gentoo.org/ for 121
121 more info. */ 122 See bug http://bugs.gentoo.org/4411 for more info.
123 */
122GROUP ( /${libdir}/${1} ) 124 GROUP ( /${libdir}/$1 )
123END_LDSCRIPT 125 END_LDSCRIPT
124 fperms a+x "/usr/${libdir}/${1}" 126 fperms a+x "/usr/${libdir}/$1"
127 shift
128 done
125} 129}
126 130
127# Simple function to draw a line consisting of '=' the same length as $* 131# Simple function to draw a line consisting of '=' the same length as $*
128# 132#
129# <azarah@gentoo.org> (11 Nov 2002) 133# <azarah@gentoo.org> (11 Nov 2002)
386 fi 390 fi
387 391
388 if [ "${count}" -eq 5 ] 392 if [ "${count}" -eq 5 ]
389 then 393 then
390 echo 394 echo
391 eerror "Failed Patch: ${patchname}!" 395 eerror "Failed Patch: ${patchname} !"
396 eerror " ( ${PATCH_TARGET} )"
392 eerror 397 eerror
393 eerror "Include in your bugreport the contents of:" 398 eerror "Include in your bugreport the contents of:"
394 eerror 399 eerror
395 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}" 400 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
396 echo 401 echo
912# a full path to an icon 917# a full path to an icon
913# type: what kind of application is this ? for categories: 918# type: what kind of application is this ? for categories:
914# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec 919# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
915# path: if your app needs to startup in a specific dir 920# path: if your app needs to startup in a specific dir
916make_desktop_entry() { 921make_desktop_entry() {
917 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 922 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1
918 923
919 local exec="${1}" 924 local exec=${1}
920 local name="${2:-${PN}}" 925 local name=${2:-${PN}}
921 local icon="${3:-${PN}.png}" 926 local icon=${3:-${PN}.png}
922 local type="${4}" 927 local type=${4}
923 local subdir="${6}" 928 local path=${5}
924 local path="${5:-${GAMES_BINDIR}}" 929
925 if [ -z "${type}" ] 930 if [[ -z ${type} ]] ; then
926 then 931 local catmaj=${CATEGORY%%-*}
927 case ${CATEGORY} in 932 local catmin=${CATEGORY##*-}
928 "app-emulation") 933 case ${catmaj} in
929 type=Emulator 934 app)
930 subdir="Emulation" 935 case ${catmin} in
936 admin) type=System;;
937 cdr) type=DiscBurning;;
938 dicts) type=Dictionary;;
939 editors) type=TextEditor;;
940 emacs) type=TextEditor;;
941 emulation) type=Emulator;;
942 laptop) type=HardwareSettings;;
943 office) type=Office;;
944 vim) type=TextEditor;;
945 xemacs) type=TextEditor;;
946 *) type=;;
947 esac
931 ;; 948 ;;
932 "games-"*) 949
933 type=Game 950 dev)
934 subdir="Games" 951 type="Development"
935 ;; 952 ;;
936 "net-"*) 953
937 type=Network 954 games)
938 subdir="${type}" 955 [[ -z ${path} ]] && path=${GAMES_BINDIR}
956
957 case ${catmin} in
958 action) type=ActionGame;;
959 arcade) type=ArcadeGame;;
960 board) type=BoardGame;;
961 kid) type=KidsGame;;
962 emulation) type=Emulator;;
963 puzzle) type=LogicGame;;
964 rpg) type=RolePlaying;;
965 roguelike) type=RolePlaying;;
966 simulation) type=Simulation;;
967 sports) type=SportsGame;;
968 strategy) type=StrategyGame;;
969 *) type=;;
970 esac
971 type="Game;${type}"
939 ;; 972 ;;
973
974 mail)
975 type="Network;Email"
976 ;;
977
978 media)
979 case ${catmin} in
980 gfx) type=Graphics;;
981 radio) type=Tuner;;
982 sound) type=Audio;;
983 tv) type=TV;;
984 video) type=Video;;
985 *) type=;;
986 esac
987 type="AudioVideo;${type}"
988 ;;
989
990 net)
991 case ${catmin} in
992 dialup) type=Dialup;;
993 ftp) type=FileTransfer;;
994 im) type=InstantMessaging;;
995 irc) type=IRCClient;;
996 mail) type=Email;;
997 news) type=News;;
998 nntp) type=News;;
999 p2p) type=FileTransfer;;
1000 *) type=;;
1001 esac
1002 type="Network;${type}"
1003 ;;
1004
1005 sci)
1006 case ${catmin} in
1007 astro*) type=Astronomoy;;
1008 bio*) type=Biology;;
1009 calc*) type=Calculator;;
1010 chem*) type=Chemistry;;
1011 geo*) type=Geology;;
1012 math*) type=Math;;
1013 *) type=;;
1014 esac
1015 type="Science;${type}"
1016 ;;
1017
1018 www)
1019 case ${catmin} in
1020 client) type=WebBrowser;;
1021 *) type=;;
1022 esac
1023 type="Network"
1024 ;;
1025
940 *) 1026 *)
941 type= 1027 type=
942 subdir=
943 ;; 1028 ;;
944 esac 1029 esac
945 fi 1030 fi
1031
946 local desktop="${T}/${exec%% *}-${P}.desktop" 1032 local desktop=${T}/${exec%% *}-${P}.desktop
947 1033
948echo "[Desktop Entry] 1034echo "[Desktop Entry]
949Encoding=UTF-8 1035Encoding=UTF-8
950Version=0.9.2 1036Version=0.9.2
951Name=${name} 1037Name=${name}
1673 insinto /etc/pam.d 1759 insinto /etc/pam.d
1674 # these are the default doins options, but be explicit just in case 1760 # these are the default doins options, but be explicit just in case
1675 insopts -m 0644 -o root -g root 1761 insopts -m 0644 -o root -g root
1676 newins "$1" "$2" || die "failed to install $1 as $2" 1762 newins "$1" "$2" || die "failed to install $1 as $2"
1677} 1763}
1764
1765# make a wrapper script ...
1766# NOTE: this was originally games_make_wrapper, but I noticed other places where
1767# this could be used, so I have moved it here and made it not games-specific
1768# -- wolf31o2
1769# $1 == wrapper name
1770# $2 == binary to run
1771# $3 == directory to chdir before running binary
1772# $4 == extra LD_LIBRARY_PATH's (make it : delimited)
1773make_wrapper() {
1774 local wrapper=$1 bin=$2 chdir=$3 libdir=$4
1775 local tmpwrapper=$(emktemp)
1776 cat << EOF > "${tmpwrapper}"
1777#!/bin/sh
1778cd "${chdir}"
1779export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1780exec ${bin} "\$@"
1781EOF
1782 chmod go+rx "${tmpwrapper}"
1783 newbin "${tmpwrapper}" "${wrapper}"
1784}

Legend:
Removed from v.1.157  
changed lines
  Added in v.1.161

  ViewVC Help
Powered by ViewVC 1.1.20