# Description: James Clark's implementation of Document Style Semantics and Specification Language
# URL: http://openjade.sourceforge.net/ 
# Packager: tnut at nutyx dot org
# Depends on: opensp

name=openjade
version=1.3.2
release=1

source=(
http://downloads.sourceforge.net/openjade/openjade-$version.tar.gz
http://www.linuxfromscratch.org/patches/blfs/7.5/openjade-1.3.2-gcc_4.6-1.patch)

build(){
    cd $name-$version
    # fix a compilation problem identified in gcc-4.6 and later
    patch -Np1 -i ../openjade-1.3.2-gcc_4.6-1.patch
    # fix a compilation problem with perl-5.16 and later
    sed -i -e '/getopts/{N;s#&G#g#;s#do .getopts.pl.;##;}' \
               -e '/use POSIX/ause Getopt::Std;' msggen.pl
    
    ./configure --prefix=/usr \
                --mandir=/usr/share/man \
                --enable-http \
                --disable-static \
                --enable-default-catalog=/etc/sgml/catalog \
                --enable-default-search-path=/usr/share/sgml \
                --datadir=/usr/share/sgml/openjade-$version
    make
    make DESTDIR=$PKG install
    make DESTDIR=$PKG/usr/share/man install-man

    # create the Jade equivalents of OpenJade executables and libraries
    cd $PKG/usr/bin
    ln -v -sf openjade jade
    cd $PKG/usr/lib
    ln -v -sf libogrove.so libgrove.so
    ln -v -sf libospgrove.so libspgrove.so
    ln -v -sf libostyle.so libstyle.so
    
    cd $SRC/$name-$version
    install -v -m644 dsssl/catalog $PKG/usr/share/sgml/openjade-$version
    install -v -m644 dsssl/*.{dtd,dsl,sgm} \
        $PKG/usr/share/sgml/openjade-$version
}



# NuTyX Pkgfile (http://nutyx.org)
