Ticket #45739: Portfile

File Portfile, 15.2 KB (added by mbrethen, 9 years ago)
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$
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    configure.args-append   --with-csl
191
192    post-fetch {
193        set urlfrom {
194            http://svn.code.sf.net/p/reduce-algebra/code/trunk/csl\
195                http://svn.code.sf.net/p/reduce-algebra/code/trunk/debianbuild/reduce/debian/redcsl.1\
196                http://svn.code.sf.net/p/reduce-algebra/code/trunk/packages\
197                http://svn.code.sf.net/p/reduce-algebra/code/trunk/scripts
198        }
199
200        set pathto [list ${worksrcdir}/csl\
201                        ${worksrcdir}/debianbuild/reduce/debian\
202                        ${worksrcdir}/packages\
203                        ${worksrcdir}/scripts
204                   ]
205
206        foreach u $urlfrom p $pathto {
207            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
208            file mkdir ${workpath}/$p
209            ui_debug "Executing ${cmdstring}"
210            if {[catch {system -W ${workpath}/$p ${cmdstring}} -]} {
211                return -code error [msgcat::mc "svn export failed"]
212            }
213        }
214    }
215
216    destroot {
217        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
218        set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
219        # Create target directories
220        xinstall -d \
221            ${libexecdir}/cslbuild/csl\
222            ${sharedir}\
223            ${fontdir}\
224            ${resourcesdir}\
225            ${mandir}
226        # Copy CSL files
227        xinstall -p -W ${cslbuilddir}/csl\
228            reduce\
229            reduce.img\
230            csl\
231            csl.img ${libexecdir}/cslbuild/csl
232        ln -s ${prefix}/share/doc/${name} ${libexecdir}/cslbuild/csl/reduce.doc
233        ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts
234        ln -s ${prefix}/share/${name}/resources ${libexecdir}/cslbuild/csl/reduce.resources
235        ln -s ${prefix}/libexec/${name}/cslbuild ${sharedir}/cslbuild
236        # Font files
237        foreach f [glob -tails -directory ${cslbuilddir}/csl/reduce.fonts/ *] {
238            if {![string equal $f "src"]} {
239                file copy ${cslbuilddir}/csl/reduce.fonts/$f ${fontdir}
240            }
241        }
242        # Resource files
243        xinstall -m 644 -W ${cslbuilddir}/csl/reduce.resources\
244            mma.awk\
245            qepcad.awk ${resourcesdir}
246        # Copy man files
247        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redcsl.1 ${mandir}
248        # Shell script for running REDUCE
249        xinstall ${filespath}/runcsl.in ${bindir}/redcsl
250        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl
251    }
252}
253
254
255subport reduce-psl {
256    license                 BSD
257    description             ${description} -- PSL version
258
259    long_description        "${long_description}
260
261This installs the Portable Standard Lisp version of REDUCE.
262"
263
264    configure.args-append   --with-psl
265
266    post-fetch {
267        set urlfrom {
268            http://svn.code.sf.net/p/reduce-algebra/code/trunk/psl\
269                http://svn.code.sf.net/p/reduce-algebra/code/trunk/debianbuild/reduce/debian/redpsl.1\
270                http://svn.code.sf.net/p/reduce-algebra/code/trunk/packages\
271                http://svn.code.sf.net/p/reduce-algebra/code/trunk/scripts
272        }
273
274        set pathto [list ${worksrcdir}/psl\
275                        ${worksrcdir}/debianbuild/reduce/debian\
276                        ${worksrcdir}/packages\
277                        ${worksrcdir}/scripts
278                   ]
279
280        foreach u $urlfrom p $pathto {
281            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
282            file mkdir ${workpath}/$p
283            ui_debug "Executing ${cmdstring}"
284            if {[catch {system -W ${workpath}/$p ${cmdstring}} -]} {
285                return -code error [msgcat::mc "svn export failed"]
286            }
287        }
288    }
289
290    destroot {
291        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
292        set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
293        # create target directories
294        xinstall -d \
295            ${libexecdir}/pslbuild/psl\
296            ${libexecdir}/pslbuild/red\
297            ${sharedir}\
298            ${mandir}
299        ### Create a second image after all (psl) modules have been built, with
300        ### the final value of loaddirectories!*.
301        ui_debug "Saving a new image..."
302        system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh\
303           ${pslbuilddir} \
304           ${pslbuilddir}/red \
305           ${prefix}/libexec/${name}/pslbuild"
306        # copy PSL files
307        copy {*}[glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl
308        copy {*}[glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red
309        ln -s ${prefix}/libexec/${name}/pslbuild ${sharedir}/pslbuild
310        # copy man files
311        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redpsl.1 ${mandir}
312        # shell script for running REDUCE
313        xinstall ${filespath}/runpsl.in ${bindir}/redpsl
314        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl
315    }
316}
317
318
319subport reduce-addons {
320    license                 GPL
321    svn.dir                 ${workpath}
322    description             Useful addons for the REDUCE Computer Algebra System
323
324    long_description        "${description}
325These include:
326  reduce-mode, an emacs mode
327  redfront, a frontend with line editing and color output
328  breduce, a REDUCE batch processing utility"
329
330    depends_lib-append      bin:makeinfo:texinfo
331
332    depends_build-append    port:emacs-app
333
334    patchfiles-append       src-redline.c.diff
335
336    worksrcdir              ${redfrontbuilddir}
337
338    configure.cmd           ./src/configure
339    configure.args-append\
340        --with-libedit\
341        --with-package-map=${prefix}/share/${name}/resources/package.map\
342        --with-csl-reduce=${prefix}/libexec/${name}/cslbuild/csl/reduce\
343        --with-bpsl=${prefix}/libexec/${name}/pslbuild/psl/bpsl\
344        --with-reduce-img=${prefix}/libexec/${name}/pslbuild/red/reduce.img
345
346    post-fetch {
347        set urlfrom {
348                http://svn.code.sf.net/p/reduce-algebra/code/trunk/bin\
349                    http://svn.code.sf.net/p/reduce-algebra/code/trunk/generic\
350                    http://svn.code.sf.net/p/reduce-algebra/code/trunk/scripts
351        }
352
353        set pathto [list ${svn.dir}/trunk/bin\
354                        ${svn.dir}/trunk/generic\
355                        ${svn.dir}/trunk/scripts
356                   ]
357        foreach u $urlfrom p $pathto {
358            set cmdstring "${svn.cmd} ${svn.method} -r ${svn.revision} --force $u . 2>&1"
359            file mkdir $p
360            ui_debug "Executing ${cmdstring}"
361            if {[catch {system -W $p ${cmdstring}} -]} {
362                return -code error [msgcat::mc "svn export failed"]
363            }
364        }
365    }
366
367    post-patch {
368        reinplace "s|/usr/share/doc/reduce-addons|${prefix}/share/doc/reduce-addons|g"\
369            ${genericdir}/breduce/breduce.1
370    }
371
372    pre-configure {
373        system -W ${redfrontbuilddir} "${build.cmd} maintainer-clean"
374        system -W ${redfrontsrcdir} "autoconf ; autoheader"
375    }
376
377    post-build {
378        system -W ${genericdir}/emacs\
379            "${applications_dir}/Emacs.app/Contents/MacOS/Emacs -q --no-site-file -batch -f batch-byte-compile reduce-mode.el reduce-run.el"
380        system -W ${genericdir}/emacs "makeinfo reduce-ide.texinfo"
381    }
382
383    destroot {
384        # create target directories
385        xinstall -d \
386            ${addondocdir}\
387            ${mandir}\
388            ${sitelispdir}
389        # copy addons
390        xinstall -m 644 ${redfrontsrcdir}/README ${addondocdir}
391        xinstall -m 644 -W ${genericdir}/breduce\
392            breduce.bbl\
393            breduce.pdf\
394            breduce.tex ${addondocdir}
395        xinstall -m 644 ${redfrontsrcdir}/redfront.1 ${mandir}
396        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfcsl.1
397        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfpsl.1
398        xinstall -m 644 ${genericdir}/breduce/breduce.1 ${mandir}
399        xinstall ${redfrontbuilddir}/redfront ${bindir}
400        ln -s ${prefix}/bin/redfront ${bindir}/rfcsl
401        ln -s ${prefix}/bin/redfront ${bindir}/rfpsl
402        xinstall ${genericdir}/breduce/breduce ${bindir}
403        xinstall -m 644 -W ${genericdir}/emacs\
404            reduce-ide.info\
405            reduce-ide.texinfo ${addondocdir}
406        xinstall -m 644 -W ${genericdir}/emacs \
407            reduce-mode.el \
408            reduce-mode.elc \
409            reduce-run.el \
410            reduce-run.elc \
411            ${sitelispdir}
412    }
413
414    notes-append    "
415REDUCE edit mode is provided by a file called 'reduce-mode.el'. This file\
416is byte-compiled, and the compiled file 'reduce-mode.elc' is installed in\
417${prefix}/share/emacs/site-lisp/${name}. To automatically load this file,\
418put the following lines in your '.emacs' file:
419
420\(autoload ’reduce-mode \"reduce-mode\" \"Major mode for REDUCE code editing\" t)
421
422;; Automatically start .red files in reduce mode.
423\(add-to-list ’auto-mode-alist ’(\"\\\.red\\\’\" . reduce-mode))
424
425Installation of REDUCE run mode is documented separately. See\
426'${prefix}/share/doc/reduce-addons/reduce-ide.info'.
427"
428}