#!/bin/sh

# Build script for bash-4.2.x


##############################################
## place these 3 files in /tmp dir
#
#bash_build_script.sh
#bash-4.2-fixes-12.patch
#bash.tar.gz
#
# then run this build script 
##############################################

## load build deps
tce-load -i readline ncurses ncurses-dev


rm -rf /tmp/bash

[ -d /tmp/bash ] || mkdir -p /tmp/bash

cp ./bash-4.2.tar.gz /tmp/bash && tar -xvzf bash-4.2.tar.gz -C /tmp/bash

cp ./bash-4.2-fixes-12.patch /tmp/bash/bash-4.2

cd /tmp/bash/bash-4.2

patch -Np1 -i ./bash-4.2-fixes-12.patch

CFLAGS="-march=i486 -mtune=i686 -Os -pipe" CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --without-bash-malloc

make

strip --strip-debug --strip-unneeded bash

read -p "waiting to install, press Enter to continue.."

sudo make install

