#! /bin/sh -e

# DP: build shared libgpc (pascal runtime library)

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- gcc/p/Make-lang.in~	2003-01-13 22:37:21.000000000 +0100
+++ gcc/p/Make-lang.in	2003-01-13 22:42:48.000000000 +0100
@@ -98,7 +98,7 @@
 GPCSOLIBSHORTNAME=libgpc.so
 GPCSOLIBNAME=$(GPCSOLIBSHORTNAME).$(gpc_major).$(gpc_minor).$(rts_version)
 GPCSOLIBDIR=lib
-WITH_SHARED=@with_shared@
+WITH_SHARED=yes
 
 BISON=bison
 BISONFLAGS=
--- gcc/p/rts/Makefile.in~	2002-11-14 17:23:41.000000000 +0100
+++ gcc/p/rts/Makefile.in	2003-01-13 22:43:00.000000000 +0100
@@ -42,7 +42,7 @@
 WITH_SHARED=@with_shared@
 VERSION_FILENAME=$(srcdir)/rts-version
 gpc_major=2
-gpc_minor=0
+gpc_minor=1
 rts_version=`cat $(VERSION_FILENAME)`
 GPCSOLIBSHORTNAME=libgpc.so
 GPCSOLIBNAME=$(GPCSOLIBSHORTNAME).$(gpc_major).$(gpc_minor).$(rts_version)
