#Packager: Panagiotis Papasotiriou <p~dot~papasot~at~yandex~dot~com>

pkgname=mgrx-x11
pkgver=1.4.1
pkgverstrip=$(echo $pkgver | sed -e 's/\.//g')
mgrxdir=mgrx$pkgverstrip
pkgrel=1pp
source=(
  "https://www.fgrim.com/mgrx/zfiles/$mgrxdir.tar.gz"
  "makedefs.sed" "makedefs32.sed" "examples.txt"
)
sourcetemplate=http://people.salixos.org/papasot/salix/$pkgname
url="https://www.fgrim.com/mgrx"
#docs=("readme")

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"MGRX (2D graphics and GUI library)"
"MGRX is an easy-to-use 2D graphics library written in C. It provides"
"multi-buffering, many graphics primitives, text rendering, and image"
"rendering. A graphical user interface framework specifically designed"
"for MGRX is included as well."
"This is the X11 version of MGRX."
""
"HomePage: https://www.fgrim.com/mgrx"
)

build() {
    cd $startdir/src/mgrx141
    # Change makedefs.grx:
    sed -n -f $startdir/makedefs.sed -i makedefs.grx
    if [ $(arch) = 'i686' ]; then
      sed -n -f $startdir/makedefs32.sed -i makedefs.grx
    fi
    # Compile:
    cd src
    make -f makefile.x11
    make -f makefile.x11 install
    make -f makefile.x11 install-fonts
    make -f makefile.x11 install-bin
    # Add documentation:
    cd ..
    mkdir -p $startdir/pkg/usr/doc/mgrx
    cp -r doc/* $startdir/pkg/usr/doc/mgrx
    cp -r $startdir/examples.txt $startdir/pkg/usr/doc/mgrx
}
