Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 9988 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/sbin/ebuild.sh (-22 / +113 lines)
Lines 1-7 Link Here
1
#!/bin/bash
1
#!/bin/bash
2
# Copyright 1999-2003 Gentoo Technologies, Inc.
2
# Copyright 1999-2003 Gentoo Technologies, Inc.
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
# $Header: /home/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.133 2003/07/02 03:23:36 carpaski Exp $
4
# $Header: /CVS/ebuild_lang_patch/ebuild.sh,v 1.3 2003/07/28 18:05:34 jmob Exp $
5
5
6
if [ "$*" != "depend" ] && [ "$*" != "clean" ]; then
6
if [ "$*" != "depend" ] && [ "$*" != "clean" ]; then
7
	if [ -f ${T}/successful ]; then
7
	if [ -f ${T}/successful ]; then
Lines 92-97 Link Here
92
	return 1
92
	return 1
93
}
93
}
94
94
95
lang() {
96
	local x
97
	for x in ${USE_LANG}; do
98
		if [ "${x}" == "${1}" ]; then
99
			tty --quiet < /dev/stdout || echo "${x}"
100
			return 0
101
		fi
102
	done
103
	return 1
104
}
105
106
primary_lang() {
107
	# only first of USE_LANG
108
	if [ "${USE_LANG%% *}" == "${1}" ]; then
109
		tty --quiet < /dev/stdout || echo "${USE_LANG%% *}"
110
		return 0
111
	fi
112
	return 1
113
}
114
115
remove_man_files() {
116
117
	local language
118
	local directory 
119
120
	for MANDIR in ${MANPATH//:/ }; do
121
		if [ -d "${D}/$MANDIR" ]; then
122
			for directory in ${D}/${MANDIR}/*; do
123
				language=${directory##*/} # basename
124
				if [ "${language:0:3}" != "man" ]; then
125
					# check if language is in passed args and if so leave it alone
126
					! has ${language:0:2} $@ || rm -rf $directory
127
				fi
128
			done
129
		fi
130
	done
131
}
132
133
remove_locale_files() {
134
	
135
	local directory
136
	local language
137
138
	LOCALEDIR=${D}/usr/share/locale
139
	if [ -d ${LOCALEDIR} ]; then
140
		for directory in ${LOCALDIR}/*; do
141
			language=${x##*/} #basename
142
			if [ "${language}" != "C" ] ; then
143
				# check if language is in passed args and if so leave it alone
144
				! has ${language:0:2} || rm -rf $directory
145
			fi
146
		done
147
	fi
148
}
149
150
remove_unnecessary_language_files() {
151
152
	# Blanket language file removing -- attempts to remove all language files not specified
153
	# in USE_LANG. The USE_LANG variable must be set or USE must contain '-nls'. With USE containing  
154
	# '-nls' everything except english will be removed. USE_LANG can be *equal* to "+*" in order for
155
	# _no language files to be remove_. In addition to the USE_LANG variable being set USE must
156
	# contain '+nls'.  
157
158
	# If the user has nls disabled attempt to remove everything but english
159
	if has '-nls' $USE; then
160
		USE_LANG="en"
161
	fi
162
163
	if has '+nls' $USE; then
164
	   continue
165
	else
166
	   return
167
	fi
168
169
	# If USE_LANG doesn't exist there's nothing for us to do
170
	if [ -z "${USE_LANG}" ]; then
171
		return
172
	fi
173
174
	if [ "$USE_LANG" = "+*" ]; then
175
		continue
176
	else
177
		remove_man_files $USE_LANG
178
		remove_locale_files $USE_LANG
179
	fi
180
}
181
95
has() {
182
has() {
96
	local x
183
	local x
97
184
Lines 309-323 Link Here
309
			EXTRA_ECONF="--build=${CBUILD} ${EXTRA_ECONF}"
396
			EXTRA_ECONF="--build=${CBUILD} ${EXTRA_ECONF}"
310
		fi
397
		fi
311
		./configure \
398
		./configure \
312
		    --prefix=/usr \
399
			--prefix=/usr \
313
		    --host=${CHOST} \
400
			--host=${CHOST} \
314
		    --mandir=/usr/share/man \
401
			--mandir=/usr/share/man \
315
		    --infodir=/usr/share/info \
402
			--infodir=/usr/share/info \
316
		    --datadir=/usr/share \
403
			--datadir=/usr/share \
317
		    --sysconfdir=/etc \
404
			--sysconfdir=/etc \
318
		    --localstatedir=/var/lib \
405
			--localstatedir=/var/lib \
319
				${EXTRA_ECONF} \
406
				${EXTRA_ECONF} \
320
		    "$@" || die "econf failed" 
407
			"$@" || die "econf failed" 
321
	else
408
	else
322
		die "no configure script found"
409
		die "no configure script found"
323
	fi
410
	fi
Lines 327-346 Link Here
327
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
414
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
328
		if [ ! -z "${PORTAGE_DEBUG}" ]; then
415
		if [ ! -z "${PORTAGE_DEBUG}" ]; then
329
			make -n prefix=${D}/usr \
416
			make -n prefix=${D}/usr \
330
			    datadir=${D}/usr/share \
417
				datadir=${D}/usr/share \
331
			    infodir=${D}/usr/share/info \
418
				infodir=${D}/usr/share/info \
332
		  	  localstatedir=${D}/var/lib \
419
			  localstatedir=${D}/var/lib \
333
			    mandir=${D}/usr/share/man \
420
				mandir=${D}/usr/share/man \
334
			    sysconfdir=${D}/etc \
421
				sysconfdir=${D}/etc \
335
			    "$@" install
422
				"$@" install
336
		fi
423
		fi
337
		make prefix=${D}/usr \
424
		make prefix=${D}/usr \
338
		    datadir=${D}/usr/share \
425
			datadir=${D}/usr/share \
339
		    infodir=${D}/usr/share/info \
426
			infodir=${D}/usr/share/info \
340
		    localstatedir=${D}/var/lib \
427
			localstatedir=${D}/var/lib \
341
		    mandir=${D}/usr/share/man \
428
			mandir=${D}/usr/share/man \
342
		    sysconfdir=${D}/etc \
429
			sysconfdir=${D}/etc \
343
		    "$@" install || die "einstall failed" 
430
			"$@" install || die "einstall failed" 
344
	else
431
	else
345
		die "no Makefile found"
432
		die "no Makefile found"
346
	fi
433
	fi
Lines 561-567 Link Here
561
		#if we have a debug build, let's not strip anything
648
		#if we have a debug build, let's not strip anything
562
		if has nostrip $FEATURES $RESTRICT && [ "$x" == "-s" ]; then
649
		if has nostrip $FEATURES $RESTRICT && [ "$x" == "-s" ]; then
563
			continue
650
			continue
564
 		else
651
		else
565
			INSOPTIONS="$INSOPTIONS $x"
652
			INSOPTIONS="$INSOPTIONS $x"
566
		fi
653
		fi
567
	done
654
	done
Lines 758-763 Link Here
758
	export PWORKDIR="$WORKDIR"
845
	export PWORKDIR="$WORKDIR"
759
	src_install 
846
	src_install 
760
	#|| abort_install "fail"
847
	#|| abort_install "fail"
848
849
	#remove unnesseary man/locale files
850
	remove_unnecessary_language_files
851
761
	prepall
852
	prepall
762
	cd ${D}
853
	cd ${D}
763
854

Return to bug 9988