# -*- 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: Portfile 142633 2015-11-18 00:19:41Z ryandesign@macports.org $ PortSystem 1.0 name reduce # snapshot of the REDUCE development, dated Nov 30,2014 (svn revision 2855) version 20141130 set version_dashes [regsub {^(\d{4})(\d{2})(\d{2})$} ${version} {\1-\2-\3}] categories math platforms darwin maintainers gmail.com:mark.brethen openmaintainer # The BULK of the files are subject to the (modified) BSD license. # There are some components that are subject to more restrictive # terms (notably the FOX GUI Toolkit, used in one version of the # code, is under LGPL). # See http://sourceforge.net/p/reduce-algebra/code/HEAD/tree/trunk/README license BSD LGPL-2.1 description REDUCE Computer Algebra System long_description REDUCE is a graphical Computer Algebra System. It\ allows for solving differential equations, integration,\ matrix manipulation and 3D plotting. It also contains a\ large number of additional packages. homepage http://reduce-algebra.sourceforge.net/ master_sites sourceforge:project/reduce-algebra/Snapshot_${version_dashes} distname reduce-src-${version_dashes} use_bzip2 yes checksums rmd160 b08512ea6bc8900a3a557c85d0576be640489202 \ sha256 b15debc944475d4daee1bcbdbaff415693522306785507f2d3110d75df6e7006 depends_lib-append \ port:libedit\ port:xorg-libXcursor\ port:Xft2\ port:xorg-libXrandr\ port:freetype\ port:ncurses depends_build-append port:autoconf depends_run port:gnuplot universal_variant no use_parallel_build no set docsrcdir ${worksrcpath}/doc/manual set docprimersdir ${worksrcpath}/doc/primers set docbasename manual set genericdir ${worksrcpath}/generic set redfrontsrcdir ${genericdir}/redfront/src set redfrontbuilddir ${genericdir}/redfront set libexecdir ${destroot}${prefix}/libexec/${name} set sharedir ${destroot}${prefix}/share/${name} set redfrontsharedir ${destroot}${prefix}/share/reduce-addons/redfront set fontdir ${destroot}${prefix}/share/${name}/fonts set resourcesdir ${destroot}${prefix}/share/${name}/resources set testlogsdir ${destroot}${prefix}/share/${name}/testlogs set docdir ${destroot}${prefix}/share/doc/${name} set addondocdir ${destroot}${prefix}/share/doc/reduce-addons set mandir ${destroot}${prefix}/share/man/man1 set sitelispdir ${destroot}${prefix}/share/emacs/site-lisp/${name} set bindir ${destroot}${prefix}/bin pre-fetch { if {${os.major} < 13} { ui_error "${name} is only supported on OS X 10.9 Mavericks or later." return -code error "unsupported platform version" } } # This is just a stub that installs all REDUCE subports. if {${name} eq ${subport}} { supported_archs noarch distfiles archive_sites use_configure no build {} depends_run-append\ port:reduce-common\ port:reduce-csl\ port:reduce-psl\ port:reduce-addons destroot { # Create a dummy file so the port can be successfully activated. xinstall -d ${docdir} set docfile [open ${docdir}/README.${name}.txt "w"] puts $docfile "REDUCE ${version} (MacPorts revision ${version}_${revision})\n" puts $docfile "${long_description}\n" close $docfile } livecheck.version ${version_dashes} livecheck.regex {reduce-src-(\d{4}-\d{2}-\d{2})} } else { livecheck.type none } subport reduce-common { license BSD revision 0 description ${description} -- common files long_description "${long_description} This installs the files that are independent of the Lisp system used. " use_configure no build.dir ${worksrcpath}/doc/manual # Build errors were caused by broken symlinks in the texlive-bin port. # Fixed in r142269. depends_build-append \ port:texlive-basic\ port:texlive-htmlxml\ port:dvipng patch { reinplace "s|'\${JOBNAME}'|'\"\${JOBNAME}\"'|g" ${docsrcdir}/mkhtml.sh } pre-build { system -W ${docsrcdir} "${build.cmd} clean" } destroot { # Create target directory xinstall -d ${docdir} ${resourcesdir} # Copy common files xinstall -m 644 -W ${docprimersdir}\ primer.pdf\ sl.pdf\ insidereduce.pdf ${docdir} xinstall -m 644 -W ${worksrcpath}/csl/reduce.doc\ BSD-LICENSE.txt\ LGPL-2.1.txt ${docdir} xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.tex] ${docdir} xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.html] ${docdir} xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.png] ${docdir} xinstall -m 644 -W ${docsrcdir}\ ${docbasename}.pdf\ index.html\ redlogo.png\ ${docbasename}.css ${docdir} xinstall -m 644 ${worksrcpath}/README ${docdir} xinstall -m 644 ${worksrcpath}/packages/package.map ${resourcesdir} } } subport reduce-csl { license {BSD LGPL-2.1} revision 1 description ${description} -- CSL version long_description "${long_description} This installs the Codemist Standard Lisp version of REDUCE. " patchfiles-append patch-csl-cslbase-crlibm-configure.diff \ patch-csl-cslbase-print.c.diff configure.args-append --with-csl destroot { set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]] set cslbuilddir ${worksrcpath}/cslbuild/${builddir} # Create target directories xinstall -d \ ${libexecdir}/cslbuild/csl\ ${sharedir}\ ${fontdir}\ ${resourcesdir}\ ${mandir} # Copy CSL files xinstall -p -W ${cslbuilddir}/csl\ reduce\ reduce.img\ csl\ csl.img ${libexecdir}/cslbuild/csl ln -s ${prefix}/share/doc/${name} ${libexecdir}/cslbuild/csl/reduce.doc ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts ln -s ${prefix}/share/${name}/resources ${libexecdir}/cslbuild/csl/reduce.resources ln -s ${prefix}/libexec/${name}/cslbuild ${sharedir}/cslbuild # Font files foreach f [glob -tails -directory ${cslbuilddir}/csl/reduce.fonts/ *] { if {![string equal $f "src"]} { file copy ${cslbuilddir}/csl/reduce.fonts/$f ${fontdir} } } # Resource files xinstall -m 644 -W ${cslbuilddir}/csl/reduce.resources\ mma.awk\ qepcad.awk ${resourcesdir} # Copy man files xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redcsl.1 ${mandir} # Shell script for running REDUCE xinstall ${filespath}/runcsl.in ${bindir}/redcsl reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl } } subport reduce-psl { license BSD revision 0 description ${description} -- PSL version long_description "${long_description} This installs the Portable Standard Lisp version of REDUCE. " configure.args-append --with-psl destroot { set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]] set pslbuilddir ${worksrcpath}/pslbuild/${builddir} # create target directories xinstall -d \ ${libexecdir}/pslbuild/psl\ ${libexecdir}/pslbuild/red\ ${sharedir}\ ${mandir} ### Create a second image after all (psl) modules have been built, with ### the final value of loaddirectories!*. ui_debug "Saving a new image..." system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh\ ${pslbuilddir} \ ${pslbuilddir}/red \ ${prefix}/libexec/${name}/pslbuild" # copy PSL files xinstall -p {*}[glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl xinstall -p {*}[glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red ln -s ${prefix}/libexec/${name}/pslbuild ${sharedir}/pslbuild # copy man files xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redpsl.1 ${mandir} # shell script for running REDUCE xinstall ${filespath}/runpsl.in ${bindir}/redpsl reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl } } subport reduce-addons { license GPL revision 1 description Useful addons for the REDUCE Computer Algebra System long_description "${description} These include: reduce-mode, an emacs mode redfront, a frontend with line editing and color output breduce, a REDUCE batch processing utility" depends_lib-append bin:makeinfo:texinfo worksrcdir ${redfrontbuilddir} patchfiles-append patch-src-redline.c.diff configure.cmd ./src/configure configure.args-append\ --with-libedit\ --with-package-map=${prefix}/share/${name}/resources/package.map\ --with-csl-reduce=${prefix}/libexec/${name}/cslbuild/csl/reduce\ --with-bpsl=${prefix}/libexec/${name}/pslbuild/psl/bpsl\ --with-reduce-img=${prefix}/libexec/${name}/pslbuild/red/reduce.img post-patch { reinplace "s|/usr/share/doc/reduce-addons|${prefix}/share/doc/reduce-addons|g"\ ${genericdir}/breduce/breduce.1 } pre-configure { system -W ${redfrontbuilddir} "${build.cmd} maintainer-clean" system -W ${redfrontsrcdir} "autoconf ; autoheader" } post-build { system -W ${genericdir}/emacs "makeinfo reduce-ide.texinfo" } destroot { # create target directories xinstall -d \ ${addondocdir}\ ${mandir}\ ${sitelispdir} # copy addons xinstall -m 644 ${redfrontsrcdir}/README ${addondocdir} xinstall -m 644 -W ${genericdir}/breduce\ breduce.bbl\ breduce.pdf\ breduce.tex ${addondocdir} xinstall -m 644 ${redfrontsrcdir}/redfront.1 ${mandir} ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfcsl.1 ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfpsl.1 xinstall -m 644 ${genericdir}/breduce/breduce.1 ${mandir} xinstall ${redfrontbuilddir}/redfront ${bindir} ln -s ${prefix}/bin/redfront ${bindir}/rfcsl ln -s ${prefix}/bin/redfront ${bindir}/rfpsl xinstall ${genericdir}/breduce/breduce ${bindir} xinstall -m 644 -W ${genericdir}/emacs\ reduce-ide.info\ reduce-ide.texinfo ${addondocdir} xinstall -m 644 -W ${genericdir}/emacs \ reduce-mode.el \ reduce-run.el \ ${sitelispdir} } notes-append " REDUCE edit mode is provided by a file called 'reduce-mode.el'. This file\ is installed in ${prefix}/share/emacs/site-lisp/${name}. To automatically\ load this file, put the following lines in your '.emacs' file: \(autoload ’reduce-mode \"reduce-mode\" \"Major mode for REDUCE code editing\" t) ;; Automatically start .red files in reduce mode. \(add-to-list ’auto-mode-alist ’(\"\\\.red\\\’\" . reduce-mode)) Installation of REDUCE run mode is documented separately. See\ '${prefix}/share/doc/reduce-addons/reduce-ide.info'. " }