Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Josephgbr

By: a guest on Feb 11th, 2011  |  syntax: Bash  |  size: 2.81 KB  |  views: 144  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # PKGBUILD for lib32-python2. It is build-able, but some files are being placed in /usr/lib - shouldn't
  2.  
  3. _pkgbasename=python2
  4. pkgname=lib32-$_pkgbasename
  5. pkgver=2.7.1
  6. pkgrel=4
  7. _pybasever=2.7
  8. pkgdesc="A high-level scripting language (32 bit, libraries only)"
  9. arch=('x86_64')
  10. license=('PSF')
  11. url="http://www.python.org/"
  12. depends=('lib32-db' 'lib32-bzip2' 'lib32-gdbm' 'lib32-openssl' 'lib32-zlib'
  13.                  'lib32-expat' 'lib32-sqlite3' 'lib32-libffi' "$_pkgbasename>=$pkgver")
  14. makedepends=('tk' 'gcc-multilib')
  15. optdepends=('tk: for IDLE')
  16. conflicts=('python<3')
  17. options=('!makeflags')
  18. source=(http://www.python.org/ftp/python/${pkgver}/Python-${pkgver}.tar.bz2
  19.         python-2.7-db51.diff)
  20. md5sums=('aa27bc25725137ba155910bd8e5ddc4f'
  21.          'd9b8161568ce17a305c1b71e61ccd4b5')
  22.  
  23. build() {
  24.   cd "${srcdir}/Python-${pkgver}"
  25.  
  26.   patch -Np1 -i ../python-2.7-db51.diff
  27.  
  28.   # Temporary workaround for FS#22322
  29.   # See http://bugs.python.org/issue10835 for upstream report
  30.   sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c
  31.  
  32.   # Enable built-in SQLite3 module to load extensions (fix FS#22122)
  33.   sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
  34.  
  35.   # Ensure that we are using the system copy of various libraries (expat, zlib and libffi),
  36.   # rather than copies shipped in the tarball
  37.   rm -r Modules/expat
  38.   rm -r Modules/zlib
  39.   rm -r Modules/_ctypes/{darwin,libffi}*
  40.  
  41.   export OPT="${CFLAGS}"
  42.   export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
  43.   ./configure --prefix=/usr --enable-shared --with-threads --enable-ipv6 \
  44.               --enable-unicode=ucs4 --with-system-expat --with-system-ffi \
  45.               --libdir=/usr/lib32 --libexecdir=/usr/lib32 CC='gcc -m32' \
  46.               CXX='g++ -m32'
  47.  
  48.   # Uncomment to force /usr/lib to /usr/lib32
  49.   #sed -i -e 's#$(prefix)/lib#$(prefix)/lib32#' Makefile
  50.  
  51.   make
  52. }
  53.  
  54. package() {
  55.   cd "${srcdir}/Python-${pkgver}"
  56.  
  57.   make DESTDIR=${pkgdir} altinstall
  58.  
  59.   ln -sf ../../libpython${_pybasever}.so \
  60.     ${pkgdir}/usr/lib32/python${_pybasever}/config/libpython${_pybasever}.so
  61.  
  62.   mv ${pkgdir}/usr/bin/smtpd.py $pkgdir/usr/lib32/python${_pybasever}/
  63.  
  64.   # some useful "stuff"
  65.   install -dm755 ${pkgdir}/usr/lib32/python${_pybasever}/Tools/{i18n,scripts}
  66.   install -m755 Tools/i18n/{msgfmt,pygettext}.py \
  67.     ${pkgdir}/usr/lib32/python${_pybasever}/Tools/i18n/
  68.   install -m755 Tools/scripts/{README,*py} \
  69.     ${pkgdir}/usr/lib32/python${_pybasever}/Tools/scripts/
  70.  
  71.   # clean up #!s
  72.   find ${pkgdir}/usr/lib32/python2.7/ -name '*.py' | \
  73.     xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"
  74.  
  75.   # clean-up reference to build directory
  76.   sed -i "s#${srcdir}/Python-${pkgver}:##" \
  77.     ${pkgdir}/usr/lib32/python${_pybasever}/config/Makefile
  78.  
  79.   # Clean up, only libraries needed
  80.   rm -rf ${pkgdir}/usr/{bin,include,share}
  81. }