Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 462488
Collapse All | Expand All

(-)mozcoreconf-2.eclass.orig (-19 / +67 lines)
Lines 108-114 Link Here
108
}
108
}
109
109
110
mozconfig_init() {
110
mozconfig_init() {
111
	declare enable_optimize pango_version myext x
111
	declare _annomsg _oflag enable_optimize pango_version myext x 
112
	declare XUL=$([[ ${PN} == xulrunner ]] && echo true || echo false)
112
	declare XUL=$([[ ${PN} == xulrunner ]] && echo true || echo false)
113
	declare FF=$([[ ${PN} == firefox ]] && echo true || echo false)
113
	declare FF=$([[ ${PN} == firefox ]] && echo true || echo false)
114
	declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false)
114
	declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false)
Lines 140-174 Link Here
140
140
141
	####################################
141
	####################################
142
	#
142
	#
143
	# BUILD / HOST / TARGET setup
144
	#
145
	# http://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html says
146
	#   If [c]host and [c]target are the same, but [c]build is different,
147
	#   you are using a cross-compiler to build a native for [chost].
148
	#   the machine            you are building on (--build),  CBUILD
149
	#   the machine      that you are building for (--host),   CHOST
150
	#   the machine that GCC will produce code for (--target), CTARGET
151
	#
152
	#
153
	# Mozilla's configure terms differ to this for historic reasons, i.e.
154
	#   ./configure --host=${CBUILD} --build=${CHOST} --target=${CTARGET}
155
	#     The meaning of build and host is swapped.
156
	#
157
	#   ./configure defaults for most mozilla software are
158
	#     to guess --host, i.e. CBUILD in gcc terminology
159
	#     and to set --build := --target := --host
160
	#
161
	#   Guessing CBUILD (here: --host) is error-prone.
162
	#   make.conf hardcodes CHOST on most Gentoo installs.
163
	#   We use CHOST as a fallback to CTARGET here.
164
	#
165
	#   If CTARGET is not set, configure might miss a native build,
166
	#   when (config.guessed CBUILD) != (hardcoded CHOST). Passing
167
	#   CBUILD (here: --host) prevents this, bug #462608 comment #8.
168
	#
169
	#
170
	# http://www.gentoo.org/proj/en/base/embedded/cross-development.xml
171
	#   asserts $CHOST == $CTARGET, just binaries here, no toolchains
172
	#     mozconfig_annotate "" --build=${CHOST}
173
	#     mozconfig_annotate "" --build=${CTARGET:-${CHOST}}
174
	#   should both do the same if ENVs are set according to the guide
175
	#
176
	####################################
177
	mozconfig_annotate "" --host=${CBUILD:-${CHOST}}
178
	mozconfig_annotate "" --build=${CTARGET:-${CHOST}}
179
	mozconfig_annotate "" --target=${CTARGET:-${CHOST}}
180
181
	####################################
182
	#
143
	# CFLAGS setup and ARCH support
183
	# CFLAGS setup and ARCH support
144
	#
184
	#
145
	####################################
185
	####################################
146
186
147
	# Set optimization level
187
	# Known to be broken
148
	if [[ ${ARCH} == hppa ]]; then
188
	if [[ "$(tc-getCC)" == "gcc" ]]; then
149
		mozconfig_annotate "more than -O0 causes a segfault on hppa" --enable-optimize=-O0
189
		if [[ ${ARCH} == hppa ]]; then
150
	elif [[ ${ARCH} == x86 ]]; then
190
			_annomsg="more than -O0 causes a segfault on hppa"
151
		mozconfig_annotate "less then -O2 causes a segfault on x86" --enable-optimize=-O2
191
			replace-flags "-O*" "-O0"
152
	elif use custom-optimization || [[ ${ARCH} =~ (alpha|ia64) ]]; then
153
		# Set optimization level based on CFLAGS
154
		if is-flag -O0; then
155
			mozconfig_annotate "from CFLAGS" --enable-optimize=-O0
156
		elif [[ ${ARCH} == ppc ]] && has_version '>=sys-libs/glibc-2.8'; then
192
		elif [[ ${ARCH} == ppc ]] && has_version '>=sys-libs/glibc-2.8'; then
157
			mozconfig_annotate "more than -O1 segfaults on ppc with glibc-2.8" --enable-optimize=-O1
193
			_annomsg="more than -O1 causes a segfault on ppc with >=sys-libs/glibc-2.8"
158
		elif is-flag -O3; then
194
			replace-flags "-O[2-9]" "-O1"
159
			mozconfig_annotate "from CFLAGS" --enable-optimize=-O3
195
		elif [[ ${ARCH} == x86 ]]; then
160
		elif is-flag -O1; then
196
			_annomsg="less than -O2 causes a segfault on x86"
161
			mozconfig_annotate "from CFLAGS" --enable-optimize=-O1
197
			replace-flags "-O[0-1]" "-O2"
162
		elif is-flag -Os; then
198
		fi
163
			mozconfig_annotate "from CFLAGS" --enable-optimize=-Os
199
	fi
200
201
	# Determine optimization level
202
	if use custom-optimization || [[ ${ARCH} =~ (alpha|ia64) ]]; then
203
		# Set optimization level based on CFLAGS
204
		if is-flag "-O*"; then
205
			_annomsg="${_annomsg:-from CFLAGS}"
206
			_oflag=$(get-flag "-O*")
164
		else
207
		else
165
			mozconfig_annotate "Gentoo's default optimization" --enable-optimize=-O2
208
			_annomsg="Gentoo\'s default optimization"
209
			_oflag="-O2"
166
		fi
210
		fi
167
	else
211
	else
168
		# Enable Mozilla's default
212
		# Enable Mozilla's default
169
		mozconfig_annotate "mozilla default" --enable-optimize
213
		_annomsg="mozilla default"
214
		_oflag=
170
	fi
215
	fi
171
216
217
	# Set optimization level
218
	mozconfig_annotate "$_annomsg" --enable-optimize${_oflag:+=$_oflag}
219
172
	# Strip optimization so it does not end up in compile string
220
	# Strip optimization so it does not end up in compile string
173
	filter-flags '-O*'
221
	filter-flags '-O*'
174
222

Return to bug 462488