source: trunk/dports/math/reduce/Portfile @ 142617

Last change on this file since 142617 was 142617, checked in by ryandesign@…, 4 years ago

reduce-algebra: renamed to reduce (#45740) and updated to 20141022 (#45739)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 15.3 KB
Line 
1# -*- 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
2# $Id: Portfile 142617 2015-11-17 18:48:41Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    reduce
7version                 20141022
8svn.revision            2744
9categories              math
10platforms               darwin
11maintainers             gmail.com:mark.brethen openmaintainer
12
13# The BULK of the files are subject to the (modified) BSD license.
14# There are some components that are subject to more restrictive
15# terms (notably the FOX GUI Toolkit, used in one version of the
16# code, is under LGPL).
17# See http://sourceforge.net/p/reduce-algebra/code/HEAD/tree/trunk/README
18license                 BSD LGPL-2.1
19fetch.type              svn
20svn.url                 http://svn.code.sf.net/p/reduce-algebra/code/trunk
21svn.args-append         --depth files
22worksrcdir              trunk
23
24description             REDUCE Computer Algebra System
25
26long_description        REDUCE is a graphical Computer Algebra System. It\
27    allows for solving differential equations, integration,\
28    matrix manipulation and 3D plotting. It also contains a\
29    large number of additional packages.
30
31homepage                http://reduce-algebra.sourceforge.net/
32
33depends_lib-append \
34    port:libedit\
35    port:xorg-libXcursor\
36    port:Xft2\
37    port:xorg-libXrandr\
38    port:freetype\
39    port:ncurses
40
41depends_build-append    port:autoconf
42
43depends_run             port:gnuplot
44
45universal_variant       no
46use_parallel_build      no
47
48set docsrcdir        ${worksrcpath}/doc/manual
49set docprimersdir    ${worksrcpath}/doc/primers
50
51set docbasename      manual
52
53set genericdir       ${worksrcpath}/generic
54set redfrontsrcdir   ${genericdir}/redfront/src
55set redfrontbuilddir ${genericdir}/redfront
56
57set libexecdir       ${destroot}${prefix}/libexec/${name}
58set sharedir         ${destroot}${prefix}/share/${name}
59set redfrontsharedir ${destroot}${prefix}/share/reduce-addons/redfront
60set fontdir          ${destroot}${prefix}/share/${name}/fonts
61set resourcesdir     ${destroot}${prefix}/share/${name}/resources
62set testlogsdir      ${destroot}${prefix}/share/${name}/testlogs
63set docdir           ${destroot}${prefix}/share/doc/${name}
64set addondocdir      ${destroot}${prefix}/share/doc/reduce-addons
65set mandir           ${destroot}${prefix}/share/man/man1
66set sitelispdir      ${destroot}${prefix}/share/emacs/site-lisp/${name}
67set bindir           ${destroot}${prefix}/bin
68
69pre-fetch {
70    if {${os.major} < 13} {
71        ui_error "${name} is only supported on OS X 10.9 Mavericks or later."
72        return -code error "unsupported platform version"
73    }
74}
75
76# This is just a stub that installs all REDUCE subports.
77if {${name} eq ${subport}} {
78    supported_archs noarch
79    distfiles
80    archive_sites
81
82    use_configure   no
83
84    build           {}
85
86    depends_run-append\
87        port:reduce-common\
88        port:reduce-csl\
89        port:reduce-psl\
90        port:reduce-addons
91
92    destroot {
93        # Create a dummy file so the port can be successfully activated.
94        xinstall -d ${docdir}
95        set docfile [open ${docdir}/README.${name}.txt "w"]
96        puts $docfile "REDUCE ${version} (MacPorts revision ${version}_${revision})\n"
97        puts $docfile "${long_description}\n"
98        close $docfile
99    }
100}
101
102subport reduce-common {
103    license                 BSD
104    description             ${description} -- common files
105
106    long_description        "${long_description}
107
108This installs the files that are independent of the Lisp system used.
109"
110    use_configure           no
111
112    build.dir               ${worksrcpath}/doc/manual
113    # Build errors were caused by broken symlinks in the texlive-bin port.
114    # Fixed in r142269.
115    depends_lib-append \
116        bin:makeindex:texlive-basic\
117        bin:pdftex:texlive-basic\
118        bin:mk4ht:texlive-htmlxml\
119        bin:htlatex:texlive-htmlxml
120
121    patch {
122        reinplace "s|'\${JOBNAME}'|'\"\${JOBNAME}\"'|g" ${docsrcdir}/mkhtml.sh
123    }
124
125    post-fetch {
126        set urlfrom {
127            http://svn.code.sf.net/p/reduce-algebra/code/trunk/csl/reduce.doc/BSD-LICENSE.txt\
128                http://svn.code.sf.net/p/reduce-algebra/code/trunk/csl/reduce.doc/LGPL-2.1.txt\
129                http://svn.code.sf.net/p/reduce-algebra/code/trunk/doc/manual\
130                http://svn.code.sf.net/p/reduce-algebra/code/trunk/doc/primers\
131                http://svn.code.sf.net/p/reduce-algebra/code/trunk/packages/package.map
132        }
133
134        set pathto [list ${worksrcdir}/csl/reduce.doc\
135                        ${worksrcdir}/csl/reduce.doc\
136                        ${worksrcdir}/doc/manual\
137                        ${worksrcdir}/doc/primers\
138                        ${worksrcdir}/packages
139                    ]
140       
141        foreach u $urlfrom p $pathto {
142            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
143            file mkdir ${workpath}/$p
144            ui_debug "Executing ${cmdstring}"
145            if {[catch {system -W ${workpath}/$p ${cmdstring}} -]} {
146                return -code error [msgcat::mc "svn export failed"]
147            }
148        }
149    }
150
151    pre-build {
152        system -W ${docsrcdir} "${build.cmd} clean"
153    }
154
155    destroot {
156        # Create target directory
157        xinstall -d ${docdir} ${resourcesdir}
158
159        # Copy common files
160        xinstall -m 644 -W ${docprimersdir}\
161            primer.pdf\
162            sl.pdf\
163            insidereduce.pdf ${docdir}
164        xinstall -m 644 -W ${worksrcpath}/csl/reduce.doc\
165            BSD-LICENSE.txt\
166            LGPL-2.1.txt ${docdir}
167        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.tex] ${docdir}
168        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.html] ${docdir}
169        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.png] ${docdir}
170        xinstall -m 644 -W ${docsrcdir}\
171            ${docbasename}.pdf\
172            index.html\
173            redlogo.png\
174            ${docbasename}.css ${docdir}
175        xinstall -m 644 ${worksrcpath}/README ${docdir}
176        xinstall -m 644 ${worksrcpath}/packages/package.map ${resourcesdir}
177    }
178}
179
180
181subport reduce-csl {
182    license                 {BSD LGPL-2.1}
183    description             ${description} -- CSL version
184
185    long_description        "${long_description}
186
187This installs the Codemist Standard Lisp version of REDUCE.
188"
189
190    patchfiles-append       patch-csl-cslbase-crlibm-configure.diff
191
192    configure.args-append   --with-csl
193
194    post-fetch {
195        set urlfrom {
196            http://svn.code.sf.net/p/reduce-algebra/code/trunk/csl\
197                http://svn.code.sf.net/p/reduce-algebra/code/trunk/debianbuild/reduce/debian/redcsl.1\
198                http://svn.code.sf.net/p/reduce-algebra/code/trunk/packages\
199                http://svn.code.sf.net/p/reduce-algebra/code/trunk/scripts
200        }
201
202        set pathto [list ${worksrcdir}/csl\
203                        ${worksrcdir}/debianbuild/reduce/debian\
204                        ${worksrcdir}/packages\
205                        ${worksrcdir}/scripts
206                   ]
207
208        foreach u $urlfrom p $pathto {
209            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
210            file mkdir ${workpath}/$p
211            ui_debug "Executing ${cmdstring}"
212            if {[catch {system -W ${workpath}/$p ${cmdstring}} -]} {
213                return -code error [msgcat::mc "svn export failed"]
214            }
215        }
216    }
217
218    destroot {
219        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
220        set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
221        # Create target directories
222        xinstall -d \
223            ${libexecdir}/cslbuild/csl\
224            ${sharedir}\
225            ${fontdir}\
226            ${resourcesdir}\
227            ${mandir}
228        # Copy CSL files
229        xinstall -p -W ${cslbuilddir}/csl\
230            reduce\
231            reduce.img\
232            csl\
233            csl.img ${libexecdir}/cslbuild/csl
234        ln -s ${prefix}/share/doc/${name} ${libexecdir}/cslbuild/csl/reduce.doc
235        ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts
236        ln -s ${prefix}/share/${name}/resources ${libexecdir}/cslbuild/csl/reduce.resources
237        ln -s ${prefix}/libexec/${name}/cslbuild ${sharedir}/cslbuild
238        # Font files
239        foreach f [glob -tails -directory ${cslbuilddir}/csl/reduce.fonts/ *] {
240            if {![string equal $f "src"]} {
241                file copy ${cslbuilddir}/csl/reduce.fonts/$f ${fontdir}
242            }
243        }
244        # Resource files
245        xinstall -m 644 -W ${cslbuilddir}/csl/reduce.resources\
246            mma.awk\
247            qepcad.awk ${resourcesdir}
248        # Copy man files
249        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redcsl.1 ${mandir}
250        # Shell script for running REDUCE
251        xinstall ${filespath}/runcsl.in ${bindir}/redcsl
252        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl
253    }
254}
255
256
257subport reduce-psl {
258    license                 BSD
259    description             ${description} -- PSL version
260
261    long_description        "${long_description}
262
263This installs the Portable Standard Lisp version of REDUCE.
264"
265
266    configure.args-append   --with-psl
267
268    post-fetch {
269        set urlfrom {
270            http://svn.code.sf.net/p/reduce-algebra/code/trunk/psl\
271                http://svn.code.sf.net/p/reduce-algebra/code/trunk/debianbuild/reduce/debian/redpsl.1\
272                http://svn.code.sf.net/p/reduce-algebra/code/trunk/packages\
273                http://svn.code.sf.net/p/reduce-algebra/code/trunk/scripts
274        }
275
276        set pathto [list ${worksrcdir}/psl\
277                        ${worksrcdir}/debianbuild/reduce/debian\
278                        ${worksrcdir}/packages\
279                        ${worksrcdir}/scripts
280                   ]
281
282        foreach u $urlfrom p $pathto {
283            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
284            file mkdir ${workpath}/$p
285            ui_debug "Executing ${cmdstring}"
286            if {[catch {system -W ${workpath}/$p ${cmdstring}} -]} {
287                return -code error [msgcat::mc "svn export failed"]
288            }
289        }
290    }
291
292    destroot {
293        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
294        set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
295        # create target directories
296        xinstall -d \
297            ${libexecdir}/pslbuild/psl\
298            ${libexecdir}/pslbuild/red\
299            ${sharedir}\
300            ${mandir}
301        ### Create a second image after all (psl) modules have been built, with
302        ### the final value of loaddirectories!*.
303        ui_debug "Saving a new image..."
304        system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh\
305           ${pslbuilddir} \
306           ${pslbuilddir}/red \
307           ${prefix}/libexec/${name}/pslbuild"
308        # copy PSL files
309        copy {*}[glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl
310        copy {*}[glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red
311        ln -s ${prefix}/libexec/${name}/pslbuild ${sharedir}/pslbuild
312        # copy man files
313        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redpsl.1 ${mandir}
314        # shell script for running REDUCE
315        xinstall ${filespath}/runpsl.in ${bindir}/redpsl
316        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl
317    }
318}
319
320
321subport reduce-addons {
322    license                 GPL
323    svn.dir                 ${workpath}
324    description             Useful addons for the REDUCE Computer Algebra System
325
326    long_description        "${description}
327These include:
328  reduce-mode, an emacs mode
329  redfront, a frontend with line editing and color output
330  breduce, a REDUCE batch processing utility"
331
332    depends_lib-append      bin:makeinfo:texinfo
333
334    depends_build-append    port:emacs-app
335
336    worksrcdir              ${redfrontbuilddir}
337
338    patchfiles-append       patch-src-redline.c.diff
339
340    configure.cmd           ./src/configure
341    configure.args-append\
342        --with-libedit\
343        --with-package-map=${prefix}/share/${name}/resources/package.map\
344        --with-csl-reduce=${prefix}/libexec/${name}/cslbuild/csl/reduce\
345        --with-bpsl=${prefix}/libexec/${name}/pslbuild/psl/bpsl\
346        --with-reduce-img=${prefix}/libexec/${name}/pslbuild/red/reduce.img
347
348    post-fetch {
349        set urlfrom {
350                http://svn.code.sf.net/p/reduce-algebra/code/trunk/bin\
351                    http://svn.code.sf.net/p/reduce-algebra/code/trunk/generic\
352                    http://svn.code.sf.net/p/reduce-algebra/code/trunk/scripts
353        }
354
355        set pathto [list ${svn.dir}/trunk/bin\
356                        ${svn.dir}/trunk/generic\
357                        ${svn.dir}/trunk/scripts
358                   ]
359        foreach u $urlfrom p $pathto {
360            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
361            file mkdir $p
362            ui_debug "Executing ${cmdstring}"
363            if {[catch {system -W $p ${cmdstring}} -]} {
364                return -code error [msgcat::mc "svn export failed"]
365            }
366        }
367    }
368
369    post-patch {
370        reinplace "s|/usr/share/doc/reduce-addons|${prefix}/share/doc/reduce-addons|g"\
371            ${genericdir}/breduce/breduce.1
372    }
373
374    pre-configure {
375        system -W ${redfrontbuilddir} "${build.cmd} maintainer-clean"
376        system -W ${redfrontsrcdir} "autoconf ; autoheader"
377    }
378
379    post-build {
380        system -W ${genericdir}/emacs\
381            "${applications_dir}/Emacs.app/Contents/MacOS/Emacs -q --no-site-file -batch -f batch-byte-compile reduce-mode.el reduce-run.el"
382        system -W ${genericdir}/emacs "makeinfo reduce-ide.texinfo"
383    }
384
385    destroot {
386        # create target directories
387        xinstall -d \
388            ${addondocdir}\
389            ${mandir}\
390            ${sitelispdir}
391        # copy addons
392        xinstall -m 644 ${redfrontsrcdir}/README ${addondocdir}
393        xinstall -m 644 -W ${genericdir}/breduce\
394            breduce.bbl\
395            breduce.pdf\
396            breduce.tex ${addondocdir}
397        xinstall -m 644 ${redfrontsrcdir}/redfront.1 ${mandir}
398        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfcsl.1
399        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfpsl.1
400        xinstall -m 644 ${genericdir}/breduce/breduce.1 ${mandir}
401        xinstall ${redfrontbuilddir}/redfront ${bindir}
402        ln -s ${prefix}/bin/redfront ${bindir}/rfcsl
403        ln -s ${prefix}/bin/redfront ${bindir}/rfpsl
404        xinstall ${genericdir}/breduce/breduce ${bindir}
405        xinstall -m 644 -W ${genericdir}/emacs\
406            reduce-ide.info\
407            reduce-ide.texinfo ${addondocdir}
408        xinstall -m 644 -W ${genericdir}/emacs \
409            reduce-mode.el \
410            reduce-mode.elc \
411            reduce-run.el \
412            reduce-run.elc \
413            ${sitelispdir}
414    }
415
416    notes-append    "
417REDUCE edit mode is provided by a file called 'reduce-mode.el'. This file\
418is byte-compiled, and the compiled file 'reduce-mode.elc' is installed in\
419${prefix}/share/emacs/site-lisp/${name}. To automatically load this file,\
420put the following lines in your '.emacs' file:
421
422\(autoload ’reduce-mode \"reduce-mode\" \"Major mode for REDUCE code editing\" t)
423
424;; Automatically start .red files in reduce mode.
425\(add-to-list ’auto-mode-alist ’(\"\\\.red\\\’\" . reduce-mode))
426
427Installation of REDUCE run mode is documented separately. See\
428'${prefix}/share/doc/reduce-addons/reduce-ide.info'.
429"
430}
Note: See TracBrowser for help on using the repository browser.