@if exist patches goto start
@echo The current working directory must be \emx\gnu
@goto end
:start
if not "%1"=="" goto %1
:tar
if exist libg++-2.5.2 goto end
gzip -d <libg++-2.5.2.tar.gz|tar xf - libg++-2.5.2/libg++/old-stream/Filebuf.* libg++-2.5.2/libg++/src/Complex.h libg++-2.5.2/libg++/src/Regex.*
ren libg++-2.5.2\libg++\old-stream\Filebuf.* Filebuff.*
ren libg++-2.5.2\libg++\src\Complex.h Complx.h
ren libg++-2.5.2\libg++\src\Regex.* Regx.*
gzip -d <libg++-2.5.2.tar.gz|tar xf -
ren libg++-2.5.2\libg++\src\Complex.cc Complx.cc
gzip -d <libg++-2.5.2.tar.gz|tar xf - libg++-2.5.2/libg++/old-stream/filebuf.* libg++-2.5.2/libg++/src/complex.h libg++-2.5.2/libg++/src/regex.*
ren libg++-2.5.2\libg++\src\String.* Strng.*
if "%2" == "tar" goto end
:del
rm -rf libg++-2.5.2\config
rm -rf libg++-2.5.2\etc
rm -rf libg++-2.5.2\include
rm -rf libg++-2.5.2\libiberty
rm -rf libg++-2.5.2\xiberty
rm -rf libg++-2.5.2\libio\config
rm -rf libg++-2.5.2\libio\dbz
rm -rf libg++-2.5.2\libio\stdio
rm -rf libg++-2.5.2\libg++\config
rm -rf libg++-2.5.2\libg++\etc
rm -rf libg++-2.5.2\libg++\gperf
rm -rf libg++-2.5.2\libg++\no-stream
rm -rf libg++-2.5.2\libg++\old-stream
rm -rf libg++-2.5.2\libg++\proto-kit
rm -rf libg++-2.5.2\libg++\utils
rm -rf libg++-2.5.2\libg++\vms
del libg++-2.5.2\libg++\libg++.info*
del libg++-2.5.2\libg++\README.386bsd
del libg++-2.5.2\libg++\src\.cvsignore
del libg++-2.5.2\libg++\test-install\.cvsignore
del libg++-2.5.2\libg++\tests\.cvsignore
del libg++-2.5.2\libio\iostream.info
if "%2" == "del" goto end
:ren
if "%2" == "ren" goto end
:config
@rem libio\gen-params is change with sed in the config section and with
@rem lwpatch in the patch section
cd libg++-2.5.2
sed -f ..\patches\lgpp-emx.sed libg++\src\Makefile.in >libg++\src\Makefile
copy ..\patches\gconfig.h "libg++\src\_G_config.h"
sed -f ..\patches\lgpp-emx.sed libio\Makefile.in >libio\Makefile
ren libio\gen-params gen-params.in
sed -f ..\patches\genparam.sed libio\gen-params.in >libio\gen-params
del libio\gen-params.in
sed -f ..\patches\lgpp-emx.sed libio\Makefile.in >libio\Makefile
copy ..\patches\gconfig.h "libio\_G_config.h"
copy ..\patches\genclass.mak "libg++\genclass\Makefile"
copy ..\patches\genclass.c "libg++\genclass"
copy ..\patches\dirent.c "libg++\genclass"
copy ..\patches\dirent.h "libg++\genclass"
cd ..
if "%2" == "config" goto end
if "%2" == "no-patch" goto end
:patch
setlocal
set tmp=
lwpatch -p0 <patches\lgpp-emx.pat
endlocal
if "%2" == "patch" goto end
:end
