/[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.163
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.163 2005/03/26 06:33:16 eradicator 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 for lib in "${@}" ; do
114 cat > "${D}/usr/${libdir}/${1}" << END_LDSCRIPT 115 cat > "${D}/usr/${libdir}/${lib}" <<-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}/${lib} )
123END_LDSCRIPT 125 END_LDSCRIPT
124 fperms a+x "/usr/${libdir}/${1}" 126 fperms a+x "/usr/${libdir}/${lib}"
127 done
125} 128}
126 129
127# Simple function to draw a line consisting of '=' the same length as $* 130# Simple function to draw a line consisting of '=' the same length as $*
128# 131#
129# <azarah@gentoo.org> (11 Nov 2002) 132# <azarah@gentoo.org> (11 Nov 2002)
386 fi 389 fi
387 390
388 if [ "${count}" -eq 5 ] 391 if [ "${count}" -eq 5 ]
389 then 392 then
390 echo 393 echo
391 eerror "Failed Patch: ${patchname}!" 394 eerror "Failed Patch: ${patchname} !"
395 eerror " ( ${PATCH_TARGET} )"
392 eerror 396 eerror
393 eerror "Include in your bugreport the contents of:" 397 eerror "Include in your bugreport the contents of:"
394 eerror 398 eerror
395 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}" 399 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
396 echo 400 echo
912# a full path to an icon 916# a full path to an icon
913# type: what kind of application is this ? for categories: 917# type: what kind of application is this ? for categories:
914# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec 918# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
915# path: if your app needs to startup in a specific dir 919# path: if your app needs to startup in a specific dir
916make_desktop_entry() { 920make_desktop_entry() {
917 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 921 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1
918 922
919 local exec="${1}" 923 local exec=${1}
920 local name="${2:-${PN}}" 924 local name=${2:-${PN}}
921 local icon="${3:-${PN}.png}" 925 local icon=${3:-${PN}.png}
922 local type="${4}" 926 local type=${4}
923 local subdir="${6}" 927 local path=${5}
924 local path="${5:-${GAMES_BINDIR}}" 928
925 if [ -z "${type}" ] 929 if [[ -z ${type} ]] ; then
926 then 930 local catmaj=${CATEGORY%%-*}
927 case ${CATEGORY} in 931 local catmin=${CATEGORY##*-}
928 "app-emulation") 932 case ${catmaj} in
929 type=Emulator 933 app)
930 subdir="Emulation" 934 case ${catmin} in
935 admin) type=System;;
936 cdr) type=DiscBurning;;
937 dicts) type=Dictionary;;
938 editors) type=TextEditor;;
939 emacs) type=TextEditor;;
940 emulation) type=Emulator;;
941 laptop) type=HardwareSettings;;
942 office) type=Office;;
943 vim) type=TextEditor;;
944 xemacs) type=TextEditor;;
945 *) type=;;
946 esac
931 ;; 947 ;;
932 "games-"*) 948
933 type=Game 949 dev)
934 subdir="Games" 950 type="Development"
935 ;; 951 ;;
936 "net-"*) 952
937 type=Network 953 games)
938 subdir="${type}" 954 [[ -z ${path} ]] && path=${GAMES_BINDIR}
955
956 case ${catmin} in
957 action) type=ActionGame;;
958 arcade) type=ArcadeGame;;
959 board) type=BoardGame;;
960 kid) type=KidsGame;;
961 emulation) type=Emulator;;
962 puzzle) type=LogicGame;;
963 rpg) type=RolePlaying;;
964 roguelike) type=RolePlaying;;
965 simulation) type=Simulation;;
966 sports) type=SportsGame;;
967 strategy) type=StrategyGame;;
968 *) type=;;
969 esac
970 type="Game;${type}"
939 ;; 971 ;;
972
973 mail)
974 type="Network;Email"
975 ;;
976
977 media)
978 case ${catmin} in
979 gfx) type=Graphics;;
980 radio) type=Tuner;;
981 sound) type=Audio;;
982 tv) type=TV;;
983 video) type=Video;;
984 *) type=;;
985 esac
986 type="AudioVideo;${type}"
987 ;;
988
989 net)
990 case ${catmin} in
991 dialup) type=Dialup;;
992 ftp) type=FileTransfer;;
993 im) type=InstantMessaging;;
994 irc) type=IRCClient;;
995 mail) type=Email;;
996 news) type=News;;
997 nntp) type=News;;
998 p2p) type=FileTransfer;;
999 *) type=;;
1000 esac
1001 type="Network;${type}"
1002 ;;
1003
1004 sci)
1005 case ${catmin} in
1006 astro*) type=Astronomoy;;
1007 bio*) type=Biology;;
1008 calc*) type=Calculator;;
1009 chem*) type=Chemistry;;
1010 geo*) type=Geology;;
1011 math*) type=Math;;
1012 *) type=;;
1013 esac
1014 type="Science;${type}"
1015 ;;
1016
1017 www)
1018 case ${catmin} in
1019 client) type=WebBrowser;;
1020 *) type=;;
1021 esac
1022 type="Network"
1023 ;;
1024
940 *) 1025 *)
941 type= 1026 type=
942 subdir=
943 ;; 1027 ;;
944 esac 1028 esac
945 fi 1029 fi
1030
946 local desktop="${T}/${exec%% *}-${P}.desktop" 1031 local desktop=${T}/${exec%% *}-${P}.desktop
947 1032
948echo "[Desktop Entry] 1033echo "[Desktop Entry]
949Encoding=UTF-8 1034Encoding=UTF-8
950Version=0.9.2 1035Version=0.9.2
951Name=${name} 1036Name=${name}
1656 [[ -z $1 ]] && die "dopamd requires at least one argument" 1741 [[ -z $1 ]] && die "dopamd requires at least one argument"
1657 1742
1658 use pam || return 0 1743 use pam || return 0
1659 1744
1660 insinto /etc/pam.d 1745 insinto /etc/pam.d
1661 # these are the default doins options, but be explicit just in case
1662 insopts -m 0644 -o root -g root
1663 doins "$@" || die "failed to install $@" 1746 doins "$@" || die "failed to install $@"
1664} 1747}
1665# newpamd <old name> <new name> 1748# newpamd <old name> <new name>
1666# 1749#
1667# Install pam file <old name> as <new name> in /etc/pam.d 1750# Install pam file <old name> as <new name> in /etc/pam.d
1669 [[ $# -ne 2 ]] && die "newpamd requires two arguements" 1752 [[ $# -ne 2 ]] && die "newpamd requires two arguements"
1670 1753
1671 use pam || return 0 1754 use pam || return 0
1672 1755
1673 insinto /etc/pam.d 1756 insinto /etc/pam.d
1674 # these are the default doins options, but be explicit just in case
1675 insopts -m 0644 -o root -g root
1676 newins "$1" "$2" || die "failed to install $1 as $2" 1757 newins "$1" "$2" || die "failed to install $1 as $2"
1677} 1758}
1759
1760# make a wrapper script ...
1761# NOTE: this was originally games_make_wrapper, but I noticed other places where
1762# this could be used, so I have moved it here and made it not games-specific
1763# -- wolf31o2
1764# $1 == wrapper name
1765# $2 == binary to run
1766# $3 == directory to chdir before running binary
1767# $4 == extra LD_LIBRARY_PATH's (make it : delimited)
1768make_wrapper() {
1769 local wrapper=$1 bin=$2 chdir=$3 libdir=$4
1770 local tmpwrapper=$(emktemp)
1771 cat << EOF > "${tmpwrapper}"
1772#!/bin/sh
1773cd "${chdir}"
1774export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1775exec ${bin} "\$@"
1776EOF
1777 chmod go+rx "${tmpwrapper}"
1778 newbin "${tmpwrapper}" "${wrapper}"
1779}

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

  ViewVC Help
Powered by ViewVC 1.1.20