### this file is sourced not run
PKGVER=4.3
PKGBUILD=33 # patchlevel
PKGARCH=x86_64

# source: CLFS 4.3 updated with patchlevel 33.
TARBALL=bash-$PKGVER.tar.gz
MD5SUM=81348932d5da294953e15d4814c74dd1
SRC_URL=http://distro.ibiblio.org/fatdog/source/710/clfs-packages-3.0.0.tar
BUNDLE=clfs-packages-3.0.0.tar

SLACKREQ='libncurses libreadline'
SLACKDESC="bash: bash $PKGVER (Bourne-Again shell)  
bash:  
bash: Bash is the shell, or command language interpreter. Bash is largely 
bash: compatible with sh and incorporates useful features from the Korn shell 
bash: ksh and the C shell csh. It is intended to be a conformant 
bash: implementation of the IEEE POSIX Shell and Tools portion of the IEEE 
bash: POSIX specification (IEEE Standard 1003.1). It offers functional 
bash: improvements over sh for both interactive and programming use.  
bash: 
bash: 
bash:
"


### override download for LFS sources bundle
# $1-src-dir $2-tarball 
pkg_download() {
	echo downloading $BUNDLE for $TARBALL
	wget -P $1 $SRC_URL
	tar -xf $1/$BUNDLE --strip-components=1 -C $1 
	rm $1/$BUNDLE
}

### prepare
pkg_prepare() {
	if pkg_prepare_default; then
		cd tmp/bash*
		
		# upstream fixes
		patch -Np1 -i $SRC_DIR/bash-4.3-branch_update-5.patch &&
		
		# updated patches
		for p in $(seq 31 42); do
			patch -Np0 -i ../pkg/bash43-0$p || return 1
		done &&
		
		# CLFS 3.0.0 lib64 fix
		sed -i "/ac_cv_rl_libdir/s@/lib@&64@" configure
	fi
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/bash*
	
	CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" \
		./configure --prefix=/usr --bindir=/bin \
		--without-bash-malloc --with-installed-readline \
		--docdir=/usr/share/doc/bash-4.3 &&

    make $MAKEFLAGS && make install &&
    
	pkg_build_slackdesc
}


