### this file is sourced not run
PKGVER=2.7.11
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 7.5 + updated to BLFS post 7.8 2015-12-31 + multilib patch from 
# https://build.opensuse.org/package/view_file/openSUSE:Factory:PowerLE/python/python-2.7.5-multilib.patch?expand=1
TARBALL=Python-$PKGVER.tar.xz
MD5SUM=1dbcc848b4cd8399a8199d000f9f823c
SRC_URL=http://www.python.org/ftp/python/$PKGVER/$TARBALL
BUNDLE=

SLACKREQ='libffi expat openssl sqlite3'
SLACKDESC="python: python $PKGVER (Python programming language)  
python:  
python: The Python 2 package contains the Python development environment. It 
python: is useful for object-oriented programming, writing scripts, 
python: prototyping large programs or developing entire applications. This 
python: version is for backward compatibility with other dependent packages.  
python: 
python: 
python: 
python: 
python:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/Python* &&
	patch -Np1 -i $CHROOT_DIR/tmp/pkg/python-2.7.5-multilib.patch  &&   # libdir patch
	patch -Np1 -i $CHROOT_DIR/tmp/pkg/python-2.7.6-fixed-libs.patch  && # libdir patch
	sed -i -e '/^SCRIPTDIR=/ s|^.*$|SCRIPTDIR= /usr/lib64|' Makefile.pre.in
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/Python*
	autoreconf -fi
	
	CONFFLAGS="$CONFFLAGS --enable-shared \
            --with-system-expat \
            --with-system-ffi   \
            --enable-unicode=ucs4"
	pkg_build_autoconf && 
	chmod -v 755 /usr/$LIBDIR/libpython2.7.so.1.0 &&
	pkg_build_slackdesc &&
	
	# multilib (CBLFS)
	mv -v /usr/bin/python{,-64} &&
	mv -v /usr/bin/python2{,-64} &&
	mv -v /usr/bin/python2.7{,-64} &&
	ln -sfv python2.7-64 /usr/bin/python2-64 &&
	ln -sfv python2-64 /usr/bin/python-64 &&
	ln -sfv multiarch_wrapper /usr/bin/python &&
	ln -sfv multiarch_wrapper /usr/bin/python2 &&
	ln -sfv multiarch_wrapper /usr/bin/python2.7 &&
	mv -v /usr/include/python2.7/pyconfig{,-64}.h &&
	install -m644 /tmp/pkg/pyconfig.h /usr/include
}


