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

Collapse All | Expand All

(-)python-2.6.5-r1.ebuild (-21 / +251 lines)
Lines 19-33 Link Here
19
LICENSE="PSF-2.2"
19
LICENSE="PSF-2.2"
20
SLOT="2.6"
20
SLOT="2.6"
21
PYTHON_ABI="${SLOT}"
21
PYTHON_ABI="${SLOT}"
22
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
22
KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
23
IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
23
IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
24
24
25
# NOTE: dev-python/{elementtree,celementtree,pysqlite,ctypes}
25
# NOTE: dev-python/{elementtree,celementtree,pysqlite,ctypes}
26
#       do not conflict with the ones in python proper. - liquidx
26
#       do not conflict with the ones in python proper. - liquidx
27
27
28
RDEPEND=">=app-admin/eselect-python-20091230
28
RDEPEND=">=app-admin/eselect-python-20091230
29
		>=sys-libs/zlib-1.1.3
29
		>=sys-libs/zlib-1.1.3
30
		virtual/libffi
30
		!m68k-mint? ( virtual/libffi )
31
		virtual/libintl
31
		virtual/libintl
32
		!build? (
32
		!build? (
33
			berkdb? ( || (
33
			berkdb? ( || (
Lines 74-81 Link Here
74
		rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
74
		rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
75
	fi
75
	fi
76
76
77
	# hardcoding GNU specifics breaks platforms not using GNU binutils
78
	case $($(tc-getAS) --noexecstack -v 2>&1 </dev/null) in
79
		*"GNU Binutils"*) # GNU as with noexecstack support
80
			:
81
		;;
82
		*)
83
			EPATCH_EXCLUDE=07_all_ctypes_execstack.patch
84
		;;
85
	esac
77
	EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
86
	EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
78
87
88
	# apply before Gentoo libdir comes into effect
89
	# these patches get rid of unwanted looking around in the host OS
90
	epatch "${FILESDIR}"/${PN}-2.6.5-readline-prefix.patch
91
	epatch "${FILESDIR}"/${PN}-2.5.1-no-usrlocal.patch
92
	epatch "${FILESDIR}"/${PN}-2.6.2-use-first-bsddb-found.patch
93
	epatch "${FILESDIR}"/${PN}-2.6.2-no-bsddb185.patch
94
95
	# Darwin/OSX Framework related patches and tweaks
96
	epatch "${FILESDIR}"/${PN}-2.5.1-darwin-bundle.patch
97
	epatch "${FILESDIR}"/${PN}-2.6.2-no-special-darwin-libffi.patch
98
	epatch "${FILESDIR}"/${PN}-2.6.2-darwin-no-framework-lookup.patch
99
	epatch "${FILESDIR}"/${PN}-2.6.2-mac.patch
100
	epatch "${FILESDIR}"/${PN}-2.6.5-mac-just-prefix.patch # injects @@LIBDIR
101
	# need this to have _NSGetEnviron being used, which by default isn't, also
102
	# in a non-Framework build (use !aqua)   upstream doesn't build like this
103
	[[ ${CHOST} == *-darwin* ]] && use !aqua && \
104
		append-flags -DWITH_NEXT_FRAMEWORK
105
	# this activates stuff from python-2.6.2-mac.patch (2.7+ has this fixed)
106
	sed -i -e "s:@@APPLICATIONS_DIR@@:${EPREFIX}/Applications:g" \
107
		Mac/Makefile.in \
108
		Mac/IDLE/Makefile.in \
109
		Mac/Tools/Doc/setup.py \
110
		Mac/PythonLauncher/Makefile.in || die
111
	# we need to set this to prevent the framework path to be used in an OSX
112
	# Framework build, which causes misc unwanted effects in our UNIX-savvy env
113
	sed -i -e '/-DPREFIX=/s:$(prefix):'"${EPREFIX}/usr"':' \
114
		-e '/-DEXEC_PREFIX=/s:$(exec_prefix):'"${EPREFIX}/usr"':' \
115
		Makefile.pre.in || die
116
79
	sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
117
	sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
80
		Lib/distutils/command/install.py \
118
		Lib/distutils/command/install.py \
81
		Lib/distutils/sysconfig.py \
119
		Lib/distutils/sysconfig.py \
Lines 94-99 Link Here
94
		rm Lib/distutils/command/wininst-*.exe
132
		rm Lib/distutils/command/wininst-*.exe
95
	fi
133
	fi
96
134
135
	# build static for mint
136
	[[ ${CHOST} == *-mint* ]] && epatch "${FILESDIR}"/${PN}-2.6.2-mint.patch
137
138
	# do not use 'which' to find binaries, but go through the PATH.
139
	epatch "${FILESDIR}"/${PN}-2.4.4-ld_so_aix-which.patch
140
	# at least IRIX starts spitting out ugly errors, but we want to use Prefix
141
	# grep anyway
142
	epatch "${FILESDIR}"/${PN}-2.5.1-no-hardcoded-grep.patch
143
	# make it compile on IRIX as well
144
	epatch "${FILESDIR}"/${PN}-2.6.5-irix.patch
145
	# and generate a libpython2.6.so
146
	epatch "${FILESDIR}"/${PN}-2.6-irix-libpython2.6.patch
147
	# AIX sometimes keeps ".nfsXXX" files around: ignore them in distutils
148
	epatch "${FILESDIR}"/${PN}-2.5.1-distutils-aixnfs.patch
149
	# this fails to compile on OpenSolaris at least, do we need it?
150
	epatch "${FILESDIR}"/${PN}-2.6.2-no-sunaudiodev.patch
151
	# 64-bits Solaris 8-10 have a missing libcrypt symlink
152
	epatch "${FILESDIR}"/${PN}-2.6.2-solaris64-crypt.patch
153
	# fixes compilation on more recent OpenSolaris, from them
154
	epatch "${FILESDIR}"/${PN}-2.6.4-netpacket-solaris.patch
155
	# http://bugs.python.org/issue6308
156
	epatch "${FILESDIR}"/${PN}-2.6.2-termios-noqnx.patch
157
	# build shared library on aix #278845
158
	epatch "${FILESDIR}"/${PN}-2.6.2-aix-shared.patch
159
	# hpux before 11.31
160
	epatch "${FILESDIR}"/${PN}-2.6.2-missing-SEM_FAILED.patch
161
162
	# patch to make python behave nice with interix. There is one part
163
	# maybe affecting other x86-platforms, thus conditional.
164
	if [[ ${CHOST} == *-interix* ]] ; then
165
		# this one could be applied unconditionally, but to keep it
166
		# clean, I do it together with the conditional one.
167
		epatch "${FILESDIR}"/${PN}-2.5.1-interix-sleep.patch
168
		# some more modules fixed (_multiprocessing, dl)
169
		epatch "${FILESDIR}"/${PN}-2.6.2-interix-modules.patch
170
		# -r2 because of 12_all_check_availability_of_nis_headers
171
		epatch "${FILESDIR}"/${PN}-2.6.4-r2-interix-nis.patch
172
	fi
173
97
	# Fix OtherFileTests.testStdin() not to assume
174
	# Fix OtherFileTests.testStdin() not to assume
98
	# that stdin is a tty for bug #248081.
175
	# that stdin is a tty for bug #248081.
99
	sed -e "s:'osf1V5':'osf1V5' and sys.stdin.isatty():" -i Lib/test/test_file.py || die "sed failed"
176
	sed -e "s:'osf1V5':'osf1V5' and sys.stdin.isatty():" -i Lib/test/test_file.py || die "sed failed"
Lines 119-124 Link Here
119
		use ssl      || export PYTHON_DISABLE_SSL="1"
196
		use ssl      || export PYTHON_DISABLE_SSL="1"
120
		use tk       || disable+=" _tkinter"
197
		use tk       || disable+=" _tkinter"
121
		use xml      || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
198
		use xml      || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
199
		use x64-macos && disable+=" Nav _Qt" # Carbon
122
		export PYTHON_DISABLE_MODULES="${disable}"
200
		export PYTHON_DISABLE_MODULES="${disable}"
123
201
124
		if ! use xml; then
202
		if ! use xml; then
Lines 146-151 Link Here
146
		use hardened && replace-flags -O3 -O2
224
		use hardened && replace-flags -O3 -O2
147
	fi
225
	fi
148
226
227
	# http://bugs.gentoo.org/show_bug.cgi?id=302137
228
	[[ ${CHOST} == powerpc-*-darwin* ]] && is-flag "-mtune=*" \
229
		&& replace-flags -O2 -O3
230
149
	if tc-is-cross-compiler; then
231
	if tc-is-cross-compiler; then
150
		OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
232
		OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
151
		./configure --{build,host}=${CBUILD} || die "cross-configure failed"
233
		./configure --{build,host}=${CBUILD} || die "cross-configure failed"
Lines 167-182 Link Here
167
	# Please query BSD team before removing this!
249
	# Please query BSD team before removing this!
168
	append-ldflags "-L."
250
	append-ldflags "-L."
169
251
252
	# python defaults to use 'cc_r' on aix
253
	[[ ${CHOST} == *-aix* ]] && myconf="${myconf} --with-gcc=$(tc-getCC)"
254
255
	# Don't include libmpc on IRIX - it is only available for 64bit MIPS4
256
	[[ ${CHOST} == *-irix* ]] && export ac_cv_lib_mpc_usconfig=no
257
258
	# Interix poll is broken
259
	[[ ${CHOST} == *-interix* ]] && export ac_cv_func_poll=no
260
261
	[[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
262
263
	# we need this to get pythonw, the GUI version of python
264
	# --enable-framework and --enable-shared are mutually exclusive:
265
	# http://bugs.python.org/issue5809
266
	use aqua \
267
		&& myconf="${myconf} --enable-framework=${EPREFIX}/usr/lib" \
268
		|| myconf="${myconf} --enable-shared"
269
270
	# note: for a framework build we need to use ucs2 because OSX
271
	# uses that internally too:
272
	# http://bugs.python.org/issue763708
170
	OPT="" econf \
273
	OPT="" econf \
171
		--with-fpectl \
274
		--with-fpectl \
172
		--enable-shared \
173
		$(use_enable ipv6) \
275
		$(use_enable ipv6) \
174
		$(use_with threads) \
276
		$(use_with threads) \
175
		$(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
277
		$( (use wide-unicode && use !aqua) && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
176
		--infodir='${prefix}/share/info' \
278
		--infodir='${prefix}/share/info' \
177
		--mandir='${prefix}/share/man' \
279
		--mandir='${prefix}/share/man' \
178
		--with-libc="" \
280
		--with-libc="" \
179
		--with-system-ffi
281
		--with-system-ffi \
282
		${myconf}
180
}
283
}
181
284
182
src_compile() {
285
src_compile() {
Lines 218-251 Link Here
218
	done
321
	done
219
322
220
	elog "If you'd like to run them, you may:"
323
	elog "If you'd like to run them, you may:"
221
	elog "cd $(python_get_libdir)/test"
324
	elog "cd ${EPREFIX}$(python_get_libdir)/test"
222
	elog "and run the tests separately."
325
	elog "and run the tests separately."
223
326
224
	python_disable_pyc
327
	python_disable_pyc
225
}
328
}
226
329
227
src_install() {
330
src_install() {
228
	emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
331
	[[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
332
	# do not make multiple targets in parallel when there are broken
333
	# sharedmods (during bootstrap), would build them twice in parallel.
334
	if use aqua ; then
335
		local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework
336
337
		# let the makefiles do their thing
338
		emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= frameworkinstall || die "emake frameworkinstall failed"
339
		emake DESTDIR="${D}" maninstall || die "emake maninstall failed"
340
341
		# avoid framework incompatability, degrade to a normal UNIX lib
342
		mkdir -p "${ED}"/usr/$(get_libdir)
343
		cp "${D}${fwdir}"/Versions/${SLOT}/Python \
344
			"${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die
345
		chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
346
		install_name_tool \
347
			-id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
348
			"${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
349
		chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
350
		cp "${S}"/libpython${SLOT}.a \
351
			"${ED}"/usr/$(get_libdir)/ || die
352
353
		# rebuild python executable to be the non-pythonw (python wrapper)
354
		# version so we don't get framework crap
355
		$(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
356
			-o "${ED}"/usr/bin/python${SLOT} \
357
			Modules/python.o || die
358
359
		# don't install the "Current" symlink, will always conflict
360
		rm "${D}${fwdir}"/Versions/Current || die
361
		# update whatever points to it, eselect-python sets them
362
		rm "${D}${fwdir}"/{Headers,Python,Resources} || die
363
364
		# remove unversioned files (that are not made versioned below)
365
		pushd "${ED}"/usr/bin > /dev/null
366
		rm -f python python-config python${SLOT}-config
367
		# python${SLOT} was created above
368
		for f in pythonw smtpd${SLOT}.py pydoc idle ; do
369
			rm -f ${f} ${f}${SLOT}
370
		done
371
		# pythonw needs to remain in the framework (that's the whole
372
		# reason we go through this framework hassle)
373
		ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw2.6 || die
374
		# copy the scripts to we can fix their shebangs
375
		for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do
376
			cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die
377
			sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \
378
				${f} || die
379
		done
380
		# "fix" to have below collision fix not to bail
381
		mv pydoc${SLOT} pydoc || die
382
		mv idle${SLOT} idle || die
383
		popd > /dev/null
384
385
		# basically we don't like the framework stuff at all, so just move
386
		# stuff around or add some symlinks to make our life easier
387
		mkdir -p "${ED}"/usr
388
		mv "${D}${fwdir}"/Versions/${SLOT}/share \
389
			"${ED}"/usr/ || die "can't move share"
390
		# get includes just UNIX style
391
		mkdir -p "${ED}"/usr/include
392
		mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \
393
			"${ED}"/usr/include/ || die "can't move include"
394
		pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null
395
		ln -s ../../../../../include/python${SLOT} || die
396
		popd > /dev/null
397
		# remove now dead symlink
398
		rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.a
399
400
		# same for libs
401
		# NOTE: can't symlink the entire dir, because a real dir already exists
402
		# on upgrade (site-packages), however since we h4x0rzed python to
403
		# actually look into the UNIX-style dir, we just switch them around.
404
		mkdir -p "${ED}"/usr/$(get_libdir)
405
		mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} \
406
			"${ED}"/usr/lib/ || die "can't move python${SLOT}"
407
		pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null
408
		ln -s ../../../../python${SLOT} || die
409
		popd > /dev/null
410
411
		# fix up Makefile
412
		sed -i \
413
			-e '/^LINKFORSHARED=/s/_PyMac_Error.*$/PyMac_Error/' \
414
			-e '/^LDFLAGS=/s/=.*$/=/' \
415
			-e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \
416
			-e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \
417
			-e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \
418
			-e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \
419
			-e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \
420
			-e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \
421
			"${ED}"/usr/lib/python${SLOT}/config/Makefile || die
422
423
		# add missing version.plist file
424
		mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources
425
		cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF
426
<?xml version="1.0" encoding="UTF-8"?>
427
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
428
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
429
<plist version="1.0">
430
<dict>
431
	<key>BuildVersion</key>
432
	<string>1</string>
433
	<key>CFBundleShortVersionString</key>
434
	<string>${PV}</string>
435
	<key>CFBundleVersion</key>
436
	<string>${PV}</string>
437
	<key>ProjectName</key>
438
	<string>Python</string>
439
	<key>SourceVersion</key>
440
	<string>${PV}</string>
441
</dict>
442
</plist>
443
EOF
444
	else
445
		emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
446
		emake DESTDIR="${D}" maninstall || die "emake maninstall failed"
447
	fi
229
448
230
	mv "${D}usr/bin/python${SLOT}-config" "${D}usr/bin/python-config-${SLOT}"
449
	mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
231
450
232
	# Fix collisions between different slots of Python.
451
	# Fix collisions between different slots of Python.
233
	mv "${D}usr/bin/2to3" "${D}usr/bin/2to3-${SLOT}"
452
	mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
234
	mv "${D}usr/bin/pydoc" "${D}usr/bin/pydoc${SLOT}"
453
	mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
235
	mv "${D}usr/bin/idle" "${D}usr/bin/idle${SLOT}"
454
	mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
236
	mv "${D}usr/share/man/man1/python.1" "${D}usr/share/man/man1/python${SLOT}.1"
455
	mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
237
	rm -f "${D}usr/bin/smtpd.py"
456
	rm -f "${ED}usr/bin/smtpd.py"
457
458
	# http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec
459
	# These #defines cause problems when building c99 compliant python modules
460
	# http://bugs.python.org/issue1759169
461
	[[ ${CHOST} == *-solaris* ]] && dosed -e \
462
		's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
463
		 /usr/include/python${SLOT}/pyconfig.h
238
464
239
	if use build; then
465
	if use build; then
240
		rm -fr "${D}usr/bin/idle${SLOT}" "${D}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test}
466
		rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test}
241
	else
467
	else
242
		use elibc_uclibc && rm -fr "${D}$(python_get_libdir)/"{bsddb/test,test}
468
		use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test}
243
		use berkdb || rm -fr "${D}$(python_get_libdir)/"{bsddb,test/test_bsddb*}
469
		use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,test/test_bsddb*}
244
		use sqlite || rm -fr "${D}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
470
		use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
245
		use tk || rm -fr "${D}usr/bin/idle${SLOT}" "${D}$(python_get_libdir)/"{idlelib,lib-tk}
471
		use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk}
246
	fi
472
	fi
247
473
248
	use threads || rm -fr "${D}$(python_get_libdir)/multiprocessing"
474
	use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
249
475
250
	prep_ml_includes $(python_get_includedir)
476
	prep_ml_includes $(python_get_includedir)
251
477
Lines 258-264 Link Here
258
	newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
484
	newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
259
485
260
	# Don't install empty directory.
486
	# Don't install empty directory.
261
	rmdir "${D}$(python_get_libdir)/lib-old"
487
	rmdir "${ED}$(python_get_libdir)/lib-old"
488
489
	# fix invalid shebang /usr/local/bin/python
490
	sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python' \
491
		"${ED}"/usr/$(get_libdir)/python${SLOT}/cgi.py
262
}
492
}
263
493
264
pkg_preinst() {
494
pkg_preinst() {

Return to bug 317091