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

(-)ebuild.sh_old (-22 / +126 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
    #echo ">>> Passed to remove_man_files: $@"
121
122
	for MANDIR in ${MANPATH//:/ }; do
123
		if [ -d "${D}/$MANDIR" ]; then
124
            #echo $MANDIR
125
			for directory in ${D}/${MANDIR}/*; do
126
				language=${directory##*/} # basename
127
				if [ "${language:0:3}" != "man" ]; then
128
                    #echo $language
129
					# check if language is in passed args and if so leave it alone
130
					has ${language:0:2} $@ || rm -rf $directory
131
				fi
132
			done
133
		fi
134
	done
135
}
136
137
remove_locale_files() {
138
	
139
	local directory
140
	local language
141
142
	LOCALEDIR=${D}/usr/share/locale
143
    #echo ">>> Locale dir $LOCALEDIR"
144
	if [ -d ${LOCALEDIR} ]; then
145
		for directory in ${LOCALEDIR}/*; do
146
            #echo ">>> Directory: $directory"
147
			language=${x##*/} #basename
148
			if [ "${language}" != "C" ] ; then
149
				# check if language is in passed args and if so leave it alone
150
				has ${language:0:2} || rm -rf $directory
151
				#has ${language:0:2} || echo $directory
152
			fi
153
		done
154
	fi
155
}
156
157
remove_unnecessary_language_files() {
158
159
	# Blanket language file removing -- attempts to remove all language files not specified
160
	# in USE_LANG. The USE_LANG variable must be set or USE must contain '-nls'. With USE containing  
161
	# '-nls' everything except english will be removed. USE_LANG can be *equal* to "+*" in order for
162
	# _no language files to be remove_. In addition to the USE_LANG variable being set USE must
163
	# contain '+nls'.  
164
165
	# If the user has nls disabled attempt to remove everything but english
166
167
    echo ">>> Removing unnecessary language files"
168
169
	if has '-nls' $USE; then
170
        echo '-nls'
171
		USE_LANG="en"
172
	fi
173
174
	if ! has '+nls' $USE && ! has 'nls' $USE; then
175
        echo '>>> Bailed'
176
        return
177
    fi
178
179
	# If USE_LANG doesn't exist there's nothing for us to do
180
	if [ -z "${USE_LANG}" ]; then
181
        echo "Returned"
182
		return
183
	fi
184
185
	if [ "$USE_LANG" = "+*" ]; then
186
		continue
187
	else
188
        echo ">>> Removing man files"
189
		remove_man_files $USE_LANG
190
        echo ">>> Removing locale files"
191
		remove_locale_files $USE_LANG
192
	fi
193
}
194
95
has() {
195
has() {
96
	local x
196
	local x
97
197
Lines 309-323 Link Here
309
			EXTRA_ECONF="--build=${CBUILD} ${EXTRA_ECONF}"
409
			EXTRA_ECONF="--build=${CBUILD} ${EXTRA_ECONF}"
310
		fi
410
		fi
311
		./configure \
411
		./configure \
312
		    --prefix=/usr \
412
			--prefix=/usr \
313
		    --host=${CHOST} \
413
			--host=${CHOST} \
314
		    --mandir=/usr/share/man \
414
			--mandir=/usr/share/man \
315
		    --infodir=/usr/share/info \
415
			--infodir=/usr/share/info \
316
		    --datadir=/usr/share \
416
			--datadir=/usr/share \
317
		    --sysconfdir=/etc \
417
			--sysconfdir=/etc \
318
		    --localstatedir=/var/lib \
418
			--localstatedir=/var/lib \
319
				${EXTRA_ECONF} \
419
				${EXTRA_ECONF} \
320
		    "$@" || die "econf failed" 
420
			"$@" || die "econf failed" 
321
	else
421
	else
322
		die "no configure script found"
422
		die "no configure script found"
323
	fi
423
	fi
Lines 327-346 Link Here
327
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
427
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
328
		if [ ! -z "${PORTAGE_DEBUG}" ]; then
428
		if [ ! -z "${PORTAGE_DEBUG}" ]; then
329
			make -n prefix=${D}/usr \
429
			make -n prefix=${D}/usr \
330
			    datadir=${D}/usr/share \
430
				datadir=${D}/usr/share \
331
			    infodir=${D}/usr/share/info \
431
				infodir=${D}/usr/share/info \
332
		  	  localstatedir=${D}/var/lib \
432
			  localstatedir=${D}/var/lib \
333
			    mandir=${D}/usr/share/man \
433
				mandir=${D}/usr/share/man \
334
			    sysconfdir=${D}/etc \
434
				sysconfdir=${D}/etc \
335
			    "$@" install
435
				"$@" install
336
		fi
436
		fi
337
		make prefix=${D}/usr \
437
		make prefix=${D}/usr \
338
		    datadir=${D}/usr/share \
438
			datadir=${D}/usr/share \
339
		    infodir=${D}/usr/share/info \
439
			infodir=${D}/usr/share/info \
340
		    localstatedir=${D}/var/lib \
440
			localstatedir=${D}/var/lib \
341
		    mandir=${D}/usr/share/man \
441
			mandir=${D}/usr/share/man \
342
		    sysconfdir=${D}/etc \
442
			sysconfdir=${D}/etc \
343
		    "$@" install || die "einstall failed" 
443
			"$@" install || die "einstall failed" 
344
	else
444
	else
345
		die "no Makefile found"
445
		die "no Makefile found"
346
	fi
446
	fi
Lines 561-567 Link Here
561
		#if we have a debug build, let's not strip anything
661
		#if we have a debug build, let's not strip anything
562
		if has nostrip $FEATURES $RESTRICT && [ "$x" == "-s" ]; then
662
		if has nostrip $FEATURES $RESTRICT && [ "$x" == "-s" ]; then
563
			continue
663
			continue
564
 		else
664
		else
565
			INSOPTIONS="$INSOPTIONS $x"
665
			INSOPTIONS="$INSOPTIONS $x"
566
		fi
666
		fi
567
	done
667
	done
Lines 758-763 Link Here
758
	export PWORKDIR="$WORKDIR"
858
	export PWORKDIR="$WORKDIR"
759
	src_install 
859
	src_install 
760
	#|| abort_install "fail"
860
	#|| abort_install "fail"
861
862
	#remove unnesseary man/locale files
863
	remove_unnecessary_language_files
864
761
	prepall
865
	prepall
762
	cd ${D}
866
	cd ${D}
763
867

Return to bug 9988