reduce portfile using subport

Mark Brethen mark.brethen at gmail.com
Tue Jan 3 18:36:58 PST 2012


Seeking comments on this version of the reduce portfile:

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem              1.0

name                    reduce
# Keep the CSL version of Reduce and PSL in sync.
svn.revision            1535
version                 3.8.0-r${svn.revision}
categories              math
platforms               darwin
maintainers             gmail.com:mark.brethen
use_parallel_build      no
homepage                http://reduce-algebra.sourceforge.net/
fetch.type              svn
svn.url                 https://reduce-algebra.svn.sourceforge.net/svnroot/reduce-algebra/trunk
svn.method              checkout
worksrcdir              trunk

description             REDUCE Computer Algebra System

long_description        REDUCE is a system for doing scalar, vector and matrix algebra \
                        by computer, which also supports arbitrary precision numerical \
                        approximation and interfaces to gnuplot to provide graphics. \
                        It can be used interactively for simple calculations but also \
                        provides a full programming language, with a syntax similar to \
                        other modern programming languages.

depends_run             port:gnuplot

universal_variant       no

if {${name} == ${subport}} { 
    license                 LGPL-2+ BSD

    depends_build           port:pkgconfig \
                            bin:makeindex:texlive-basic \
                            bin:mk4ht:texlive-htmlxml

    depends_lib             port:ncurses \
                            port:Xft2 \
                            port:xorg-libX11 \
                            port:xorg-libXext \
                            port:tiff \
                            port:libpng \
                            port:jpeg \
                            port:xorg-libXcursor \
                            port:xorg-libXrandr \
                            port:freetype \
                            port:mesa

    configure.args          --with-csl \
                            --with-x \
                            --with-xft \
                            --with-opengl \
                            --enable-threadsafe

    post-build {
        system -W ${worksrcpath}/doc/manual "./mkhtml.sh"
    }

    livecheck.type          none
} else {
	livecheck.type          none
}

subport reduce-fetch-psl {
    license                 BSD

    configure.args          --with-psl

    # create a second image after all modules have been built, with the final value of 
    # loaddirectories!*. Otherwise loading a module will always search the build directories
    # in worksrcpath (which don't exist).
    post-build {
        set builddir    [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
        set pslbuilddir ${worksrcpath}/pslbuild/${builddir}

        system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh \
            ${pslbuilddir} ${pslbuilddir}/red ${topdir}/pslbuild"
    }
}

set topdir     ${prefix}/libexec/${name}

set sharedir   ${destroot}${prefix}/share/${name}
set libexecdir ${destroot}${prefix}/libexec/${name}
set fontdir    ${destroot}${prefix}/share/${name}/fonts
set docdir     ${destroot}${prefix}/share/doc/${name}
set bindir     ${destroot}${prefix}/bin
set mandir     ${destroot}${prefix}/share/man

destroot {
# 'make install' is outdated, so manually install required files
    set builddir   [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]

    set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
    set pslbuilddir ${worksrcpath}/pslbuild/${builddir}

    xinstall -d ${libexecdir}/pslbuild/psl ${libexecdir}/pslbuild/red ${libexecdir}/cslbuild/csl \
        ${sharedir}/packages ${bindir} ${docdir}/manual ${fontdir} ${mandir}/man1

    if {${subport} == "${name}"} {
        eval copy ${cslbuilddir}/csl/reduce.img ${libexecdir}/cslbuild/csl
        eval copy ${cslbuilddir}/csl/reduce ${libexecdir}/cslbuild/csl

        eval copy [glob ${cslbuilddir}/csl/reduce.fonts/*] ${fontdir}

        eval copy ${worksrcpath}/debianbuild/redcsl.1 ${mandir}/man1

        xinstall ${filespath}/runcsl.in ${bindir}/redcsl
        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl

        eval xinstall -m 0644 [glob ${worksrcpath}/doc/manual/*.html] ${docdir}/manual
        eval xinstall -m 0644 [glob ${worksrcpath}/doc/manual/*.css] ${docdir}/manual

        ln -s manual-pdf.html ${docdir}/manual/index.html
        ln -s ${prefix}/share/doc/${name}/manual ${libexecdir}/cslbuild/csl/reduce.doc
        ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts
    }

    if {${subport} == "${name}-fetch-psl"} {
        eval copy [glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl
        eval copy [glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red

        eval copy ${worksrcpath}/debianbuild/redpsl.1 ${mandir}/man1

        xinstall ${filespath}/runpsl.in ${bindir}/redpsl
        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl
    }

    eval copy [glob ${worksrcpath}/packages/*] ${sharedir}/packages

    eval copy [glob ${worksrcpath}/doc/manual/*.tex] ${docdir}/manual
    eval copy [glob ${worksrcpath}/doc/manual/*.sh] ${docdir}/manual
    eval copy [glob ${worksrcpath}/doc/manual/*.cfg] ${docdir}/manual
    eval copy ${worksrcpath}/doc/manual/README ${docdir}/manual
}

variant pdf description {Build paper copy of reference manual} {
    depends_build-append bin:makeindex:texlive-basic
    depends_build-append bin:pdflatex:texlive-basic

    post-build {
        system -W ${worksrcpath}/doc/manual "./mkpdf.sh"
    }

    post-destroot {
        xinstall -m 0644 ${worksrcpath}/doc/manual/manual-pdf.pdf ${docdir}/manual
    }
}



Mark






More information about the macports-dev mailing list