Ticket #50490: Portfile

File Portfile, 11.7 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: Portfile 142633 2015-11-18 00:19:41Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    reduce
7# snapshot of the REDUCE development, dated Nov 30,2014 (svn revision 2855)
8version                 20141130
9set version_dashes      [regsub {^(\d{4})(\d{2})(\d{2})$} ${version} {\1-\2-\3}]
10categories              math
11platforms               darwin
12maintainers             gmail.com:mark.brethen openmaintainer
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
19
20description             REDUCE Computer Algebra System
21
22long_description        REDUCE is a graphical Computer Algebra System. It\
23    allows for solving differential equations, integration,\
24    matrix manipulation and 3D plotting. It also contains a\
25    large number of additional packages.
26
27homepage                http://reduce-algebra.sourceforge.net/
28master_sites            sourceforge:project/reduce-algebra/Snapshot_${version_dashes}
29distname                reduce-src-${version_dashes}
30use_bzip2               yes
31checksums               rmd160  b08512ea6bc8900a3a557c85d0576be640489202 \
32                        sha256  b15debc944475d4daee1bcbdbaff415693522306785507f2d3110d75df6e7006
33
34depends_lib-append \
35    port:libedit\
36    port:xorg-libXcursor\
37    port:Xft2\
38    port:xorg-libXrandr\
39    port:freetype\
40    port:ncurses
41
42depends_build-append    port:autoconf
43
44depends_run             port:gnuplot
45
46universal_variant       no
47use_parallel_build      no
48
49set docsrcdir        ${worksrcpath}/doc/manual
50set docprimersdir    ${worksrcpath}/doc/primers
51
52set docbasename      manual
53
54set genericdir       ${worksrcpath}/generic
55set redfrontsrcdir   ${genericdir}/redfront/src
56set redfrontbuilddir ${genericdir}/redfront
57
58set libexecdir       ${destroot}${prefix}/libexec/${name}
59set sharedir         ${destroot}${prefix}/share/${name}
60set redfrontsharedir ${destroot}${prefix}/share/reduce-addons/redfront
61set fontdir          ${destroot}${prefix}/share/${name}/fonts
62set resourcesdir     ${destroot}${prefix}/share/${name}/resources
63set testlogsdir      ${destroot}${prefix}/share/${name}/testlogs
64set docdir           ${destroot}${prefix}/share/doc/${name}
65set addondocdir      ${destroot}${prefix}/share/doc/reduce-addons
66set mandir           ${destroot}${prefix}/share/man/man1
67set sitelispdir      ${destroot}${prefix}/share/emacs/site-lisp/${name}
68set bindir           ${destroot}${prefix}/bin
69
70pre-fetch {
71    if {${os.major} < 13} {
72        ui_error "${name} is only supported on OS X 10.9 Mavericks or later."
73        return -code error "unsupported platform version"
74    }
75}
76
77# This is just a stub that installs all REDUCE subports.
78if {${name} eq ${subport}} {
79    supported_archs noarch
80    distfiles
81    archive_sites
82
83    use_configure   no
84
85    build           {}
86
87    depends_run-append\
88        port:reduce-common\
89        port:reduce-csl\
90        port:reduce-psl\
91        port:reduce-addons
92
93    destroot {
94        # Create a dummy file so the port can be successfully activated.
95        xinstall -d ${docdir}
96        set docfile [open ${docdir}/README.${name}.txt "w"]
97        puts $docfile "REDUCE ${version} (MacPorts revision ${version}_${revision})\n"
98        puts $docfile "${long_description}\n"
99        close $docfile
100    }
101
102    livecheck.version       ${version_dashes}
103    livecheck.regex         {reduce-src-(\d{4}-\d{2}-\d{2})}
104} else {
105    livecheck.type          none
106}
107
108subport reduce-common {
109    license                 BSD
110    revision                0
111    description             ${description} -- common files
112
113    long_description        "${long_description}
114
115This installs the files that are independent of the Lisp system used.
116"
117    use_configure           no
118
119    build.dir               ${worksrcpath}/doc/manual
120    # Build errors were caused by broken symlinks in the texlive-bin port.
121    # Fixed in r142269.
122    depends_build-append \
123        port:texlive-basic\
124        port:texlive-htmlxml\
125        port:dvipng
126
127    patch {
128        reinplace "s|'\${JOBNAME}'|'\"\${JOBNAME}\"'|g" ${docsrcdir}/mkhtml.sh
129    }
130
131    pre-build {
132        system -W ${docsrcdir} "${build.cmd} clean"
133    }
134
135    destroot {
136        # Create target directory
137        xinstall -d ${docdir} ${resourcesdir}
138
139        # Copy common files
140        xinstall -m 644 -W ${docprimersdir}\
141            primer.pdf\
142            sl.pdf\
143            insidereduce.pdf ${docdir}
144        xinstall -m 644 -W ${worksrcpath}/csl/reduce.doc\
145            BSD-LICENSE.txt\
146            LGPL-2.1.txt ${docdir}
147        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.tex] ${docdir}
148        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.html] ${docdir}
149        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.png] ${docdir}
150        xinstall -m 644 -W ${docsrcdir}\
151            ${docbasename}.pdf\
152            index.html\
153            redlogo.png\
154            ${docbasename}.css ${docdir}
155        xinstall -m 644 ${worksrcpath}/README ${docdir}
156        xinstall -m 644 ${worksrcpath}/packages/package.map ${resourcesdir}
157    }
158}
159
160
161subport reduce-csl {
162    license                 {BSD LGPL-2.1}
163    revision                1
164    description             ${description} -- CSL version
165
166    long_description        "${long_description}
167
168This installs the Codemist Standard Lisp version of REDUCE.
169"
170
171    patchfiles-append       patch-csl-cslbase-crlibm-configure.diff \
172                            patch-csl-cslbase-print.c.diff
173
174    configure.args-append   --with-csl
175
176    destroot {
177        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
178        set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
179        # Create target directories
180        xinstall -d \
181            ${libexecdir}/cslbuild/csl\
182            ${sharedir}\
183            ${fontdir}\
184            ${resourcesdir}\
185            ${mandir}
186        # Copy CSL files
187        xinstall -p -W ${cslbuilddir}/csl\
188            reduce\
189            reduce.img\
190            csl\
191            csl.img ${libexecdir}/cslbuild/csl
192        ln -s ${prefix}/share/doc/${name} ${libexecdir}/cslbuild/csl/reduce.doc
193        ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts
194        ln -s ${prefix}/share/${name}/resources ${libexecdir}/cslbuild/csl/reduce.resources
195        ln -s ${prefix}/libexec/${name}/cslbuild ${sharedir}/cslbuild
196        # Font files
197        foreach f [glob -tails -directory ${cslbuilddir}/csl/reduce.fonts/ *] {
198            if {![string equal $f "src"]} {
199                file copy ${cslbuilddir}/csl/reduce.fonts/$f ${fontdir}
200            }
201        }
202        # Resource files
203        xinstall -m 644 -W ${cslbuilddir}/csl/reduce.resources\
204            mma.awk\
205            qepcad.awk ${resourcesdir}
206        # Copy man files
207        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redcsl.1 ${mandir}
208        # Shell script for running REDUCE
209        xinstall ${filespath}/runcsl.in ${bindir}/redcsl
210        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl
211    }
212}
213
214
215subport reduce-psl {
216    license                 BSD
217    revision                0
218    description             ${description} -- PSL version
219
220    long_description        "${long_description}
221
222This installs the Portable Standard Lisp version of REDUCE.
223"
224
225    configure.args-append   --with-psl
226
227    destroot {
228        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
229        set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
230        # create target directories
231        xinstall -d \
232            ${libexecdir}/pslbuild/psl\
233            ${libexecdir}/pslbuild/red\
234            ${sharedir}\
235            ${mandir}
236        ### Create a second image after all (psl) modules have been built, with
237        ### the final value of loaddirectories!*.
238        ui_debug "Saving a new image..."
239        system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh\
240           ${pslbuilddir} \
241           ${pslbuilddir}/red \
242           ${prefix}/libexec/${name}/pslbuild"
243        # copy PSL files
244        xinstall -p {*}[glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl
245        xinstall -p {*}[glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red
246        ln -s ${prefix}/libexec/${name}/pslbuild ${sharedir}/pslbuild
247        # copy man files
248        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redpsl.1 ${mandir}
249        # shell script for running REDUCE
250        xinstall ${filespath}/runpsl.in ${bindir}/redpsl
251        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl
252    }
253}
254
255
256subport reduce-addons {
257    license                 GPL
258    revision                1
259    description             Useful addons for the REDUCE Computer Algebra System
260
261    long_description        "${description}
262These include:
263  reduce-mode, an emacs mode
264  redfront, a frontend with line editing and color output
265  breduce, a REDUCE batch processing utility"
266
267    depends_lib-append      bin:makeinfo:texinfo
268
269    worksrcdir              ${redfrontbuilddir}
270
271    patchfiles-append       patch-src-redline.c.diff
272
273    configure.cmd           ./src/configure
274    configure.args-append\
275        --with-libedit\
276        --with-package-map=${prefix}/share/${name}/resources/package.map\
277        --with-csl-reduce=${prefix}/libexec/${name}/cslbuild/csl/reduce\
278        --with-bpsl=${prefix}/libexec/${name}/pslbuild/psl/bpsl\
279        --with-reduce-img=${prefix}/libexec/${name}/pslbuild/red/reduce.img
280
281    post-patch {
282        reinplace "s|/usr/share/doc/reduce-addons|${prefix}/share/doc/reduce-addons|g"\
283            ${genericdir}/breduce/breduce.1
284    }
285
286    pre-configure {
287        system -W ${redfrontbuilddir} "${build.cmd} maintainer-clean"
288        system -W ${redfrontsrcdir} "autoconf ; autoheader"
289    }
290
291    post-build {
292        system -W ${genericdir}/emacs "makeinfo reduce-ide.texinfo"
293    }
294
295    destroot {
296        # create target directories
297        xinstall -d \
298            ${addondocdir}\
299            ${mandir}\
300            ${sitelispdir}
301        # copy addons
302        xinstall -m 644 ${redfrontsrcdir}/README ${addondocdir}
303        xinstall -m 644 -W ${genericdir}/breduce\
304            breduce.bbl\
305            breduce.pdf\
306            breduce.tex ${addondocdir}
307        xinstall -m 644 ${redfrontsrcdir}/redfront.1 ${mandir}
308        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfcsl.1
309        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfpsl.1
310        xinstall -m 644 ${genericdir}/breduce/breduce.1 ${mandir}
311        xinstall ${redfrontbuilddir}/redfront ${bindir}
312        ln -s ${prefix}/bin/redfront ${bindir}/rfcsl
313        ln -s ${prefix}/bin/redfront ${bindir}/rfpsl
314        xinstall ${genericdir}/breduce/breduce ${bindir}
315        xinstall -m 644 -W ${genericdir}/emacs\
316            reduce-ide.info\
317            reduce-ide.texinfo ${addondocdir}
318        xinstall -m 644 -W ${genericdir}/emacs \
319            reduce-mode.el \
320            reduce-run.el \
321            ${sitelispdir}
322    }
323
324    notes-append    "
325REDUCE edit mode is provided by a file called 'reduce-mode.el'. This file\
326is installed in ${prefix}/share/emacs/site-lisp/${name}. To automatically\
327load this file, put the following lines in your '.emacs' file:
328
329\(autoload ’reduce-mode \"reduce-mode\" \"Major mode for REDUCE code editing\" t)
330
331;; Automatically start .red files in reduce mode.
332\(add-to-list ’auto-mode-alist ’(\"\\\.red\\\’\" . reduce-mode))
333
334Installation of REDUCE run mode is documented separately. See\
335'${prefix}/share/doc/reduce-addons/reduce-ide.info'.
336"
337}