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

# 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='libffi32 expat32 openssl32 sqlite3_32' # util-linux (need setarch/linux32)
SLACKDESC="python32: python32 $PKGVER (Python programming language)  
python32:  
python32: The Python 2 package contains the Python development environment. It 
python32: is useful for object-oriented programming, writing scripts, 
python32: prototyping large programs or developing entire applications. This 
python32: version is for backward compatibility with other dependent packages.  
python32: 
python32: This contains 32-bit python and libraries.
python32: 
python32: 
python32:
"

### 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
}

### package - only collect the libraries
pkg_package() {
	rm -rf usr/include usr/share &&
	mkdir -p usr/include/python2.7 &&
	mv -v tmp/pyconfig-32.h usr/include/python2.7
	
}

### 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{,-32} &&
	mv -v /usr/bin/python2{,-32} &&
	mv -v /usr/bin/python2.7{,-32} &&
	ln -sfv python2.7-32 /usr/bin/python2-32 &&
	ln -sfv python2-32 /usr/bin/python-32 &&
	mv -v /usr/include/python2.7/pyconfig{,-32}.h &&
	
	rm -v /usr/bin/{2to3,*config,pydoc,idle,*.py}
	mv /usr/include/python2.7/pyconfig-32.h /tmp
}


