#!/bin/sh

BASE_VER=1.8.1
PACKAGING=3
VER=${BASE_VER}-${PACKAGING}

rm -f gdal-*.bz2

rm -rf release
mkdir release
mkdir release/include
mkdir release/bin
mkdir release/bin/gdalplugins
mkdir release/bin/gdalplugins/1.8
mkdir release/lib
mkdir release/etc
mkdir release/etc/ini
mkdir release/share
mkdir release/share/gdal
mkdir release/share/gdal/html

#nmake /f makefile.vc install devinstall

touch release/bin/gdalplugins/1.8/placeholder

cp gdal-config.tmpl release/bin

echo "SET GDAL_DATA=%OSGEO4W_ROOT%\share\gdal" > release/etc/ini/gdal.bat

###############################################################################
# tar up with proper path names.

cd release
tar cjvf ../gdal-$VER.tar.bz2 *
cd ..

tar cjf src-wrk.tar.bz2 nmake.opt nmake.local gdal-config.tmpl \
        rebuild.sh upload.sh package.sh \
	ogr/ogrsf_frmts/ogdi/makefile.vc \
        ogr/ogrsf_frmts/generic/ogrsfdriverregistrar.cpp \
        gcore/gdaldrivermanager.cpp \
	frmts/ogdi/makefile.vc

mkdir release/src
mkdir release/src/gdal-${BASE_VER}

cd release/src/gdal-${BASE_VER}

tar xjvf ../../../src-wrk.tar.bz2
cd ../..
tar cjvf ../gdal-$VER-src.tar.bz2 src
cd ..
