Ticket #57796: Portfile

File Portfile, 8.2 KB (added by mbrethen, 5 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
2PortSystem              1.0
3PortGroup               cxx11 1.1
4
5name                    reduce
6version                 20181123
7revision                1
8set version_dashes      [regsub {^(\d{4})(\d{2})(\d{2})$} ${version} {\1-\2-\3}]
9set svnrev              4829
10checksums               rmd160  cf81887b9bab0d6fd7b4e4ff88e3eb67223d1330 \
11                        sha256  9787f31ef1ec23988f4c551388c6ffffe5b97ca290de6eed1c12dff1737763c8 \
12                        size    261842669
13
14categories              math
15license                 BINARY BSD LGPL-2.1
16platforms               darwin
17maintainers             {gmail.com:mark.brethen @mbrethen} openmaintainer
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                https://reduce-algebra.sourceforge.io/
27master_sites            sourceforge:project/reduce-algebra/snapshot_${version_dashes}
28distname                Reduce-svn${svnrev}-src
29
30universal_variant       no
31
32patchfiles-append       patch-packages-plot-gnuintfc.red.diff      \
33                        patch-generic-breduce-breduce.1.diff       \
34                        patch-reduce-deployment-target.diff        \
35                        patch-csl-prefix.diff                      \
36                        patch-csl-create_old_bundle.diff
37
38post-patch {
39    reinplace           -W ${worksrcpath} "s|@PREFIX@|${prefix}|g" \
40                        csl/cslbase/configure                      \
41                        csl/cslbase/configure.ac                   \
42                        csl/fox/configure                          \
43                        csl/fox/configure.ac                       \
44                        csl/foxtests/configure                     \
45                        csl/foxtests/configure.ac                  \
46                        packages/plot/gnuintfc.red                 \
47                        generic/breduce/breduce.1
48}
49
50use_parallel_build      no
51
52depends_build-append    port:automake        \
53                        port:autoconf        \
54                        port:libtool         \
55                        port:netpbm
56
57if {[variant_isset doc]} {
58    depends_build-append  \
59                        port:dvipng                   \
60                        port:texlive-fonts-extra      \
61                        port:texlive-formats-extra    \
62                        port:texlive-latex-extra      \
63                        port:texlive-plain-generic    \
64                        port:texlive-bin-extra        \
65                        port:texlive-fonts-recommended
66}
67
68depends_lib-append      port:libedit         \
69                        port:xorg-libXcursor \
70                        port:Xft2            \
71                        port:xorg-libXrandr  \
72                        port:fontconfig      \
73                        port:freetype        \
74                        port:ncurses
75
76depends_run-append      port:gnuplot         \
77                        path:bin/latex:texlive
78
79configure.ldflags-append \
80                       -lintl
81
82configure {
83    # we have to run configure twice, once --with-csl
84    # and another time --with-psl, prior to building
85    # this generates two different build directories
86    # and both are built during the build phase
87    # we do it like this to make it clear what is happening here...
88   
89    # Technically portconfigure::configure_main is not part of the official exposed
90    # MacPorts API, so theoretically it could change in the future and the port
91    # would break... but it should work for now.
92
93    configure.args-append --with-csl
94    portconfigure::configure_main
95
96    configure.args-replace --with-csl --with-psl
97    portconfigure::configure_main
98}
99
100# Documentation is also re-generated in the tree so that regardless of
101# history it should end up clean and organized.
102post-build {
103    if {[variant_isset doc]} {
104        system -W ${worksrcpath}/doc/misc ${build.cmd}
105        system -W ${worksrcpath}/doc/manual ${build.cmd}
106    }
107}
108
109destroot {
110    set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
111
112    set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
113    set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
114    set genericdir  ${worksrcpath}/generic
115
116    set sharedir    ${prefix}/share/${name}
117    set libexecdir  ${prefix}/libexec/${name}
118    set bindir      ${prefix}/bin
119    set mandir      ${prefix}/share/man/man1
120    set docdir      ${prefix}/share/doc/${name}
121
122    # Create target directories
123    xinstall -d \
124        ${destroot}${sharedir}           \
125        ${destroot}${libexecdir}/csl     \
126        ${destroot}${libexecdir}/psl/psl \
127        ${destroot}${libexecdir}/psl/red
128
129    # Manual files
130    copy                                  \
131        ${filespath}/redcsl.1             \
132        ${filespath}/redpsl.1             \
133        ${genericdir}/newfront/redfront.1 \
134        ${destroot}${mandir}
135
136    ln -s ${prefix}/share/man/man1/redfront.1 ${destroot}${mandir}/rfcsl.1
137    ln -s ${prefix}/share/man/man1/redfront.1 ${destroot}${mandir}/rfpsl.1
138
139    # CSL files
140    copy {*}[glob ${cslbuilddir}/csl/*.app] ${destroot}${libexecdir}/csl
141    ln -s ${prefix}/libexec/${name}/csl/reduce.app ${destroot}${applications_dir}/reduce.app
142
143    copy ${filespath}/runcsl.sh ${destroot}${bindir}/redcsl
144    copy ${filespath}/runbootstrapreduce.sh ${destroot}${bindir}/bootstrapreduce
145    copy ${filespath}/runcsllisp.sh ${destroot}${bindir}/csl
146
147    foreach f {redcsl bootstrapreduce csl} {
148        file attributes ${destroot}${bindir}/${f} -permissions +x
149    }
150
151    copy ${cslbuilddir}/redfront/rfcsl ${destroot}${bindir}
152
153    # PSL files
154    copy {*}[glob ${pslbuilddir}/psl/*] ${destroot}${libexecdir}/psl/psl
155    copy {*}[glob ${pslbuilddir}/red/*] ${destroot}${libexecdir}/psl/red
156    copy ${filespath}/runpsl.sh ${destroot}${bindir}/redpsl
157    file attributes ${destroot}${bindir}/redpsl -permissions +x
158
159    # Note (ha ha) that rfpsl is built in the cslbuild part of the tree.
160    copy ${cslbuilddir}/redfront/rfpsl ${destroot}${bindir}
161
162    xinstall -d ${destroot}${docdir}
163    xinstall -m 0644 -W ${worksrcpath}/csl/reduce.doc \
164        BINARY-LICENSE.txt                            \
165        BSD-LICENSE.txt                               \
166        LGPL-2.1.txt                                  \
167        ${destroot}${docdir}
168
169    # install breduce
170    copy ${worksrcpath}/generic/breduce/breduce.1 ${destroot}/${mandir}
171    copy ${worksrcpath}/generic/breduce/breduce.pdf ${destroot}${docdir}
172    copy ${worksrcpath}/generic/breduce/breduce     \
173        ${worksrcpath}/packages/breduce/breduce.red \
174        ${destroot}/${libexecdir}
175    ln -s ${prefix}/libexec/reduce/breduce ${destroot}${prefix}/bin/breduce
176
177    # Install documentation if requested
178    if {[variant_isset doc]} {
179        set docsrcdir       ${worksrcpath}/doc/manual
180        set docmiscdir      ${worksrcpath}/doc/misc
181        set docbasename     manual
182        set extradocimagebasenames {bild cmsy10 gnuplotex turtleeg}
183
184        xinstall -d ${destroot}${docdir}/html ${destroot}${docdir}/pdf
185
186        copy                                \
187            {*}[glob ${docmiscdir}/*.pdf]   \
188            ${docsrcdir}/${docbasename}.pdf \
189            ${destroot}${docdir}/pdf
190        copy                                            \
191            ${docsrcdir}/redlogo.png                    \
192            {*}[glob ${docsrcdir}/${docbasename}*.html] \
193            {*}[glob ${docsrcdir}/${docbasename}*.png]  \
194            ${docsrcdir}/${docbasename}.css             \
195            ${docsrcdir}/index.html                     \
196            ${destroot}${docdir}/html
197        foreach n ${extradocimagebasenames} {
198            copy {*}[glob ${docsrcdir}/${n}*.png] ${destroot}${docdir}/html
199        }
200    }
201}
202
203variant doc description {Install HTML and PDF documentation} {}
204
205livecheck.version   ${version_dashes}
206livecheck.url       https://sourceforge.net/projects/reduce-algebra/files/
207livecheck.regex     {snapshot_(\d{4}-\d{2}-\d{2})}