#!/bin/bash

CFLAGS="-Wall -O3 -fomit-frame-pointer -pipe" 
HERE=`pwd`
VER=2.3.7
ARCHI=i486
CPULEVEL=4  ##### 3 for i386, 4 for i486, 5 for i586, 6 for i686

PKG=/mnt/hda3/bochs-"$VER"-"$ARCHI"/package/pkg-"$VER"-"$ARCHI"

[ -d bochs-"$VER" ] && rm -rf bochs-"$VER"
[ -d /mnt/hda3/bochs/package/pkg-"$VER"-"$ARCHI" ] && rm -rf /mnt/hda3/bochs/package/pkg-"$VER"-"$ARCHI"
tar xzvf bochs-"$VER".tar.xz
cd bochs-"$VER"
#./configure --prefix=/usr/local/bochs-"$VER"-"$ARCHI" --enable-acpi --enable-pci --enable-cpu-level=4 #--enable-acpi --enable-pci --enable-vbe --enable-logging 
./configure --prefix=/usr/local/bochs-"$VER"-"$ARCHI" --enable-cpu-level=4 --enable-plugins --with-all-libs --enable-pci --enable-usb --build=i486-pc-linux-gnu --enable-ne2000 --enable-sb16=linux --enable-vbe 




make
make install DESTDIR="$PKG"

cd "$HERE"
mv "$PKG"/usr/local/bochs-"$VER"-"$ARCHI"/bin/bochs "$PKG"/usr/local/bochs-"$VER"-"$ARCHI"/bin/bochs-"$ARCHI"
cp bochs-wrapper "$PKG"/usr/local/bochs-"$VER"-"$ARCHI"/bin/bochs
chmod 775 "$PKG"/usr/local/bochs-"$VER"-"$ARCHI"/bin/bochs
cp bochsrc-default "$PKG"/usr/local/bochs-"$VER"-"$ARCHI"/share/bochs/
cp bochsrc-upstream "$PKG"/usr/local/bochs-"$VER"-"$ARCHI"/share/bochs/
mkdir -p "$PKG"/usr/local/tce.installed
cp bochs-startup "$PKG"/usr/local/tce.installed/bochs-2.3.7-i486
chmod -R 775 "$PKG"/usr/local/tce.installed
chown -R root:staff "$PKG"/usr/local/tce.installed
mkdir -p "$PKG"/usr/local/share/applications
cp bochs-"$VER"-"$ARCHI".desktop "$PKG"/usr/local/share/applications


