Ticket #49729: Portfile

File Portfile, 11.5 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
7# snapshot of the REDUCE development, dated Nov 30,2014 (svn revision 2855)
8version                 20141130
9categories              math
10platforms               darwin
11maintainers             gmail.com:mark.brethen openmaintainer
12# The BULK of the files are subject to the (modified) BSD license.
13# There are some components that are subject to more restrictive
14# terms (notably the FOX GUI Toolkit, used in one version of the
15# code, is under LGPL).
16# See http://sourceforge.net/p/reduce-algebra/code/HEAD/tree/trunk/README
17license                 BSD LGPL-2.1
18
19description             REDUCE Computer Algebra System
20
21long_description        REDUCE is a graphical Computer Algebra System. It\
22    allows for solving differential equations, integration,\
23    matrix manipulation and 3D plotting. It also contains a\
24    large number of additional packages.
25
26homepage                http://reduce-algebra.sourceforge.net/
27master_sites            sourceforge:reduce-algebra
28distname                reduce-src-2014-11-30
29use_bzip2               yes
30checksums           \
31    sha256  b15debc944475d4daee1bcbdbaff415693522306785507f2d3110d75df6e7006 \
32    rmd160  b08512ea6bc8900a3a557c85d0576be640489202
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
103subport reduce-common {
104    license                 BSD
105    description             ${description} -- common files
106
107    long_description        "${long_description}
108
109This installs the files that are independent of the Lisp system used.
110"
111    use_configure           no
112
113    build.dir               ${worksrcpath}/doc/manual
114    # Build errors were caused by broken symlinks in the texlive-bin port.
115    # Fixed in r142269.
116    depends_build-append \
117        port:texlive-basic\
118        port:texlive-htmlxml\
119        port:dvipng
120
121    patch {
122        reinplace "s|'\${JOBNAME}'|'\"\${JOBNAME}\"'|g" ${docsrcdir}/mkhtml.sh
123    }
124
125    pre-build {       
126        system -W ${docsrcdir} "${build.cmd} clean"
127    }
128
129    destroot {
130        # Create target directory
131        xinstall -d ${docdir} ${resourcesdir}
132
133        # Copy common files
134        xinstall -m 644 -W ${docprimersdir}\
135            primer.pdf\
136            sl.pdf\
137            insidereduce.pdf ${docdir}
138        xinstall -m 644 -W ${worksrcpath}/csl/reduce.doc\
139            BSD-LICENSE.txt\
140            LGPL-2.1.txt ${docdir}
141        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.tex] ${docdir}
142        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.html] ${docdir}
143        xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.png] ${docdir}
144        xinstall -m 644 -W ${docsrcdir}\
145            ${docbasename}.pdf\
146            index.html\
147            redlogo.png\
148            ${docbasename}.css ${docdir}
149        xinstall -m 644 ${worksrcpath}/README ${docdir}
150        xinstall -m 644 ${worksrcpath}/packages/package.map ${resourcesdir}
151    }
152}
153
154
155subport reduce-csl {
156    license                 {BSD LGPL-2.1}
157    description             ${description} -- CSL version
158
159    long_description        "${long_description}
160
161This installs the Codemist Standard Lisp version of REDUCE.
162"
163
164    patchfiles-append       patch-csl-cslbase-crlibm-configure.diff
165   
166    configure.args-append   --with-csl
167
168    destroot {
169        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
170        set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
171        # Create target directories
172        xinstall -d \
173            ${libexecdir}/cslbuild/csl\
174            ${sharedir}\
175            ${fontdir}\
176            ${resourcesdir}\
177            ${mandir}
178        # Copy CSL files
179        xinstall -p -W ${cslbuilddir}/csl\
180            reduce\
181            reduce.img\
182            csl\
183            csl.img ${libexecdir}/cslbuild/csl
184        ln -s ${prefix}/share/doc/${name} ${libexecdir}/cslbuild/csl/reduce.doc
185        ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts
186        ln -s ${prefix}/share/${name}/resources ${libexecdir}/cslbuild/csl/reduce.resources
187        ln -s ${prefix}/libexec/${name}/cslbuild ${sharedir}/cslbuild
188        # Font files
189        foreach f [glob -tails -directory ${cslbuilddir}/csl/reduce.fonts/ *] {
190            if {![string equal $f "src"]} {
191                file copy ${cslbuilddir}/csl/reduce.fonts/$f ${fontdir}
192            }
193        }
194        # Resource files
195        xinstall -m 644 -W ${cslbuilddir}/csl/reduce.resources\
196            mma.awk\
197            qepcad.awk ${resourcesdir}
198        # Copy man files
199        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redcsl.1 ${mandir}
200        # Shell script for running REDUCE
201        xinstall ${filespath}/runcsl.in ${bindir}/redcsl
202        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl
203    }
204}
205
206
207subport reduce-psl {
208    license                 BSD
209    description             ${description} -- PSL version
210
211    long_description        "${long_description}
212
213This installs the Portable Standard Lisp version of REDUCE.
214"
215
216    configure.args-append   --with-psl
217
218    destroot {
219        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
220        set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
221        # create target directories
222        xinstall -d \
223            ${libexecdir}/pslbuild/psl\
224            ${libexecdir}/pslbuild/red\
225            ${sharedir}\
226            ${mandir}
227        ### Create a second image after all (psl) modules have been built, with
228        ### the final value of loaddirectories!*.
229        ui_debug "Saving a new image..."
230        system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh\
231           ${pslbuilddir} \
232           ${pslbuilddir}/red \
233           ${prefix}/libexec/${name}/pslbuild"
234        # copy PSL files
235        xinstall -p {*}[glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl
236        xinstall -p {*}[glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red
237        ln -s ${prefix}/libexec/${name}/pslbuild ${sharedir}/pslbuild
238        # copy man files
239        xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redpsl.1 ${mandir}
240        # shell script for running REDUCE
241        xinstall ${filespath}/runpsl.in ${bindir}/redpsl
242        reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl
243    }
244}
245
246
247subport reduce-addons {
248    license                 GPL
249
250    description             Useful addons for the REDUCE Computer Algebra System
251
252    long_description        "${description}
253These include:
254  reduce-mode, an emacs mode
255  redfront, a frontend with line editing and color output
256  breduce, a REDUCE batch processing utility"
257
258    depends_lib-append      bin:makeinfo:texinfo
259
260    depends_build-append    port:emacs-app
261
262    patchfiles-append       src-redline.c.diff
263
264    worksrcdir              ${redfrontbuilddir}
265
266    configure.cmd           ./src/configure
267    configure.args-append\
268        --with-libedit\
269        --with-package-map=${prefix}/share/${name}/resources/package.map\
270        --with-csl-reduce=${prefix}/libexec/${name}/cslbuild/csl/reduce\
271        --with-bpsl=${prefix}/libexec/${name}/pslbuild/psl/bpsl\
272        --with-reduce-img=${prefix}/libexec/${name}/pslbuild/red/reduce.img
273
274    post-patch {
275        reinplace "s|/usr/share/doc/reduce-addons|${prefix}/share/doc/reduce-addons|g"\
276            ${genericdir}/breduce/breduce.1
277    }
278
279    pre-configure {
280        system -W ${redfrontbuilddir} "${build.cmd} maintainer-clean"
281        system -W ${redfrontsrcdir} "autoconf ; autoheader"
282    }
283
284    post-build {
285        system -W ${genericdir}/emacs\
286            "${applications_dir}/Emacs.app/Contents/MacOS/Emacs -q --no-site-file -batch -f batch-byte-compile reduce-mode.el reduce-run.el"
287        system -W ${genericdir}/emacs "makeinfo reduce-ide.texinfo"
288    }
289
290    destroot {
291        # create target directories
292        xinstall -d \
293            ${addondocdir}\
294            ${mandir}\
295            ${sitelispdir}
296        # copy addons
297        xinstall -m 644 ${redfrontsrcdir}/README ${addondocdir}
298        xinstall -m 644 -W ${genericdir}/breduce\
299            breduce.bbl\
300            breduce.pdf\
301            breduce.tex ${addondocdir}
302        xinstall -m 644 ${redfrontsrcdir}/redfront.1 ${mandir}
303        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfcsl.1
304        ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfpsl.1
305        xinstall -m 644 ${genericdir}/breduce/breduce.1 ${mandir}
306        xinstall ${redfrontbuilddir}/redfront ${bindir}
307        ln -s ${prefix}/bin/redfront ${bindir}/rfcsl
308        ln -s ${prefix}/bin/redfront ${bindir}/rfpsl
309        xinstall ${genericdir}/breduce/breduce ${bindir}
310        xinstall -m 644 -W ${genericdir}/emacs\
311            reduce-ide.info\
312            reduce-ide.texinfo ${addondocdir}
313        xinstall -m 644 -W ${genericdir}/emacs \
314            reduce-mode.el \
315            reduce-mode.elc \
316            reduce-run.el \
317            reduce-run.elc \
318            ${sitelispdir}
319    }
320
321    notes-append    "
322REDUCE edit mode is provided by a file called 'reduce-mode.el'. This file\
323is byte-compiled, and the compiled file 'reduce-mode.elc' is installed in\
324${prefix}/share/emacs/site-lisp/${name}. To automatically load this file,\
325put the following lines in your '.emacs' file:
326
327\(autoload ’reduce-mode \"reduce-mode\" \"Major mode for REDUCE code editing\" t)
328
329;; Automatically start .red files in reduce mode.
330\(add-to-list ’auto-mode-alist ’(\"\\\.red\\\’\" . reduce-mode))
331
332Installation of REDUCE run mode is documented separately. See\
333'${prefix}/share/doc/reduce-addons/reduce-ide.info'.
334"
335}