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

Diff of /eclass/portability.eclass

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

Revision 1.8 Revision 1.15
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/portability.eclass,v 1.8 2006/03/08 20:08:13 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.15 2010/02/26 18:09:43 grobian Exp $
4# 4#
5# Author: Diego Pettenò <flameeyes@gentoo.org> 5# Author: Diego Pettenò <flameeyes@gentoo.org>
6# 6#
7# This eclass is created to avoid using non-portable GNUisms inside ebuilds 7# This eclass is created to avoid using non-portable GNUisms inside ebuilds
8# 8#
52 fi 52 fi
53} 53}
54 54
55# Gets the linker flag to link to dlopen() function 55# Gets the linker flag to link to dlopen() function
56dlopen_lib() { 56dlopen_lib() {
57 if [[ ${ELIBC} != *BSD ]]; then 57 # - Solaris needs nothing
58 # - Darwin needs nothing
59 # - *BSD needs nothing
60 # - Linux needs -ldl (glibc and uclibc)
61 # - Interix needs -ldl
62 case "${CHOST}" in
63 *-linux-gnu*|*-linux-uclibc|*-interix*)
58 echo "-ldl" 64 echo "-ldl"
59 fi 65 ;;
66 esac
60} 67}
61 68
62# Gets the home directory for the specified user 69# Gets the home directory for the specified user
63# it's a wrap around egetent as the position of the home directory in the line 70# it's a wrap around egetent as the position of the home directory in the line
64# varies depending on the os used. 71# varies depending on the os used.
127 echo bsdmake 134 echo bsdmake
128 else 135 else
129 echo pmake 136 echo pmake
130 fi 137 fi
131} 138}
139
140# Portable method of getting mount names and points.
141# Returns as "point node fs options"
142# Remember to convert 040 back to a space.
143get_mounts() {
144 local point= node= fs= opts= foo=
145
146 # Linux has /proc/mounts which should always exist
147 if [[ $(uname -s) == "Linux" ]] ; then
148 while read node point fs opts foo ; do
149 echo "${point} ${node} ${fs} ${opts}"
150 done < /proc/mounts
151 return
152 fi
153
154 # OK, pray we have a -p option that outputs mounts in fstab format
155 # using tabs as the seperator.
156 # Then pray that there are no tabs in the either.
157 # Currently only FreeBSD supports this and the other BSDs will
158 # have to be patched.
159 # Athough the BSD's may support /proc, they do NOT put \040 in place
160 # of the spaces and we should not force a /proc either.
161 local IFS=$'\t'
162 LC_ALL=C mount -p | while read node point fs foo ; do
163 opts=${fs#* }
164 fs=${fs%% *}
165 echo "${point// /\040} ${node// /\040} ${fs%% *} ${opts// /\040}"
166 done
167}
168

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20