Skip to content

Instantly share code, notes, and snippets.

@tlatsas
Created December 10, 2013 18:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlatsas/7895223 to your computer and use it in GitHub Desktop.
Save tlatsas/7895223 to your computer and use it in GitHub Desktop.
python 2.6.9 PKGBUILD
# Contributor: Chris McDonald <xwraithanx@gmail.com>
pkgname=python26
pkgver=2.6.9
pkgrel=1
_pybasever=2.6
pkgdesc="A high-level scripting language"
arch=('i686' 'x86_64')
license=('PSF')
url="http://www.python.org/"
depends=('db>=4.8' 'bzip2' 'gdbm' 'openssl' 'zlib' 'expat' 'sqlite3' 'libffi')
makedepends=('tk>=8.5.0')
optdepends=('tk: for IDLE, pynche and modulator')
provides=('python2=2.6.7')
source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz
python-2.6-internal-expat.patch
python-2.6-db-4.8.patch
python-2.6-dbm.patch
modulator-launcher
pynche-launcher)
md5sums=('933a811f11e3db3d73ae492f6c3a7a76'
'993800dbcc0c4f199c1ceee998a06e71'
'10eb5449ead95b9cb13eae9f9a65894e'
'60890ce7906d3b741dd862de16b3b3ac'
'b4a531570415280dc406c8d5c1fa8d83'
'9f731b9033db285132a3524fb36409e7')
build() {
cd "${srcdir}/Python-${pkgver}"
patch -Np0 -i ${srcdir}/python-2.6-internal-expat.patch
#http://bugs.python.org/issue6949
patch -Np0 -i ${srcdir}/python-2.6-db-4.8.patch
patch -Np0 -i ${srcdir}/python-2.6-dbm.patch
# Ensure that we are using the system copy of various libraries (expat, zlib and libffi),
# rather than copies shipped in the tarball
rm -r Modules/expat
rm -r Modules/zlib
export OPT="${CFLAGS}"
./configure --prefix=/usr --enable-shared --with-threads --enable-ipv6 \
--enable-unicode=ucs4 --with-system-ffi
make MACHDEP=linux2
}
check() {
cd "${srcdir}/Python-${pkgver}"
#make test
}
package() {
cd "${srcdir}/Python-${pkgver}"
make DESTDIR="${pkgdir}" altinstall maninstall
ln -sf ../../libpython${_pybasever}.so \
"${pkgdir}/usr/lib/python${_pybasever}/config/libpython${_pybasever}.so"
mv "${pkgdir}/usr/bin/smtpd.py" "${pkgdir}/usr/lib/python${_pybasever}/"
# Install the tools
#modulator
sed -i "s#%%PYBASEVER%%#${_pybasever}#" ${srcdir}/modulator-launcher
install -m755 ${srcdir}/modulator-launcher ${pkgdir}/usr/bin/modulator2.6
cp -r Tools/modulator ${pkgdir}/usr/lib/python${_pybasever}/site-packages/
#pynche
sed -i "s#%%PYBASEVER%%#${_pybasever}#" ${srcdir}/pynche-launcher
install -m755 ${srcdir}/pynche-launcher ${pkgdir}/usr/bin/pynche2.6
rm -f Tools/pynche/*.pyw
cp -r Tools/pynche ${pkgdir}/usr/lib/python${_pybasever}/site-packages/
# some useful "stuff"
install -dm755 "${pkgdir}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
install -m755 Tools/i18n/{msgfmt,pygettext}.py \
"${pkgdir}/usr/lib/python${_pybasever}/Tools/i18n/"
install -m755 Tools/scripts/{README,*py} \
"${pkgdir}/usr/lib/python${_pybasever}/Tools/scripts/"
# fix conflicts with python
mv "${pkgdir}"/usr/bin/idle{,2.6}
mv "${pkgdir}"/usr/bin/pydoc{,2.6}
mv "${pkgdir}"/usr/bin/2to3{,-2.6}
mv "${pkgdir}"/usr/share/man/man1/python{.1,2.6.1}
# clean up #!s
find "${pkgdir}/usr/lib/python${_pybasever}/" -name '*.py' | \
xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2.6|"
# clean-up reference to build directory
sed -i "s#${srcdir}/Python-${pkgver}:##" \
"${pkgdir}/usr/lib/python${_pybasever}/config/Makefile"
# license
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment