Ticket #57772: Portfile.diff

File Portfile.diff, 19.8 KB (added by mbrethen, 6 years ago)
  • Portfile

    old new  
    11# -*- 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
    22
     3
    34PortSystem              1.0
    45
    56name                    reduce
    6 # snapshot of the REDUCE development, dated Nov 30,2014 (svn revision 2855)
    7 version                 20141130
     7version             20180920
     8
    89set version_dashes      [regsub {^(\d{4})(\d{2})(\d{2})$} ${version} {\1-\2-\3}]
     10set svnrev          4765
     11
    912categories              math
     13license             BINARY BSD-2 LGPL-2.1
    1014platforms               darwin
    11 maintainers             {gmail.com:mark.brethen @mbrethen} 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
    17 license                 BSD LGPL-2.1
     15maintainers         gmail.com:mark.brethen openmaintainer
    1816
    1917description             REDUCE Computer Algebra System
    2018
     
    2321    matrix manipulation and 3D plotting. It also contains a\
    2422    large number of additional packages.
    2523
    26 homepage                http://reduce-algebra.sourceforge.net/
    27 master_sites            sourceforge:project/reduce-algebra/Snapshot_${version_dashes}
    28 distname                reduce-src-${version_dashes}
    29 use_bzip2               yes
    30 checksums               rmd160  b08512ea6bc8900a3a557c85d0576be640489202 \
    31                         sha256  b15debc944475d4daee1bcbdbaff415693522306785507f2d3110d75df6e7006
    32 
    33 depends_lib-append \
    34     port:libedit\
    35     port:xorg-libXcursor\
    36     port:Xft2\
    37     port:xorg-libXrandr\
    38     port:freetype\
    39     port:ncurses
    40 
    41 depends_build-append    port:autoconf \
    42                         port:automake
    43 
    44 depends_run             port:gnuplot
    45 
    46 universal_variant       no
    47 use_parallel_build      no
    48 
    49 set docsrcdir        ${worksrcpath}/doc/manual
    50 set docprimersdir    ${worksrcpath}/doc/primers
    51 
    52 set docbasename      manual
    53 
    54 set genericdir       ${worksrcpath}/generic
    55 set redfrontsrcdir   ${genericdir}/redfront/src
    56 set redfrontbuilddir ${genericdir}/redfront
    57 
    58 set libexecdir       ${destroot}${prefix}/libexec/${name}
    59 set sharedir         ${destroot}${prefix}/share/${name}
    60 set redfrontsharedir ${destroot}${prefix}/share/reduce-addons/redfront
    61 set fontdir          ${destroot}${prefix}/share/${name}/fonts
    62 set resourcesdir     ${destroot}${prefix}/share/${name}/resources
    63 set testlogsdir      ${destroot}${prefix}/share/${name}/testlogs
    64 set docdir           ${destroot}${prefix}/share/doc/${name}
    65 set addondocdir      ${destroot}${prefix}/share/doc/reduce-addons
    66 set mandir           ${destroot}${prefix}/share/man/man1
    67 set sitelispdir      ${destroot}${prefix}/share/emacs/site-lisp/${name}
    68 set bindir           ${destroot}${prefix}/bin
     24homepage            https://reduce-algebra.sourceforge.io/
     25master_sites        sourceforge:project/reduce-algebra/snapshot_${version_dashes}
     26distname            Reduce-svn${svnrev}-src
     27
     28checksums           rmd160 d547b19362af6e4ca31e52f718bdcdbf0cd0e063                         \
     29                    sha256 58873b4337e3bb31bb561cbea53866dc60bcfa7ea5faed4297597bfb85483a2e \
     30                    size   261850189
    6931
    7032pre-fetch {
    7133    if {${os.major} < 13} {
     
    7436    }
    7537}
    7638
    77 # This is just a stub that installs all REDUCE subports.
    78 if {${name} eq ${subport}} {
    79     supported_archs noarch
    80     distfiles
    81     archive_sites
    82 
    83     use_configure   no
    84 
    85     build           {}
     39universal_variant   no
    8640
    87     depends_run-append\
    88         port:reduce-common\
    89         port:reduce-csl\
    90         port:reduce-psl\
    91         port:reduce-addons
     41if {${name} eq ${subport}} {
     42    patchfiles-append   patch-packages-plot-gnuintfc.red.diff      \
     43                        patch-csl-cslbase-create_bundle.sh.diff    \
     44                        patch-csl-cslbase-create_old_bundle.sh.diff
    9245
    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
     46    post-patch {
     47        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/packages/plot/gnuintfc.red
    10048    }
    10149
    102     livecheck.version       ${version_dashes}
    103     livecheck.url           https://sourceforge.net/projects/reduce-algebra/files/
    104     livecheck.regex         {snapshot_(\d{4}-\d{2}-\d{2})}
    105 } else {
    106     livecheck.type          none
    107 }
     50    use_parallel_build  no
     51
     52    depends_lib-append  port:libedit         \
     53                        port:libtool         \
     54                        port:xorg-libXcursor \
     55                        port:Xft2            \
     56                        port:xorg-libXrandr  \
     57                        port:fontconfig      \
     58                        port:freetype        \
     59                        port:ncurses
    10860
    109 subport reduce-common {
    110     license                 BSD
    111     revision                0
    112     description             ${description} -- common files
    113 
    114     long_description        "${long_description}
    115 
    116 This installs the files that are independent of the Lisp system used.
    117 "
    118     use_configure           no
    119 
    120     build.dir               ${worksrcpath}/doc/manual
    121     # Build errors were caused by broken symlinks in the texlive-bin port.
    122     # Fixed in r142269.
    12361    depends_build-append \
    124         port:texlive-basic\
    125         port:texlive-formats-extra\
    126         port:dvipng
     62                        port:automake \
     63                        port:autoconf \
     64                        port:netpbm
    12765
    128     patch {
    129         reinplace "s|'\${JOBNAME}'|'\"\${JOBNAME}\"'|g" ${docsrcdir}/mkhtml.sh
    130     }
     66    configure.args-append --with-csl
     67    configure.ldflags-append  "-lintl"
    13168
    132     pre-build {
    133         system -W ${docsrcdir} "${build.cmd} clean"
     69    # Technically portconfigure::configure_main is not part of the official exposed
     70    # MacPorts API, so theoretically it could change in the future and the port
     71    # would break... but it should work for now.
     72    post-configure {
     73        configure.args-replace --with-csl --with-psl
     74        portconfigure::configure_main
    13475    }
    13576
    136     destroot {
    137         # Create target directory
    138         xinstall -d ${docdir} ${resourcesdir}
    139 
    140         # Copy common files
    141         xinstall -m 644 -W ${docprimersdir}\
    142             primer.pdf\
    143             sl.pdf\
    144             insidereduce.pdf ${docdir}
    145         xinstall -m 644 -W ${worksrcpath}/csl/reduce.doc\
    146             BSD-LICENSE.txt\
    147             LGPL-2.1.txt ${docdir}
    148         xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.tex] ${docdir}
    149         xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.html] ${docdir}
    150         xinstall -m 644 {*}[glob ${docsrcdir}/${docbasename}*.png] ${docdir}
    151         xinstall -m 644 -W ${docsrcdir}\
    152             ${docbasename}.pdf\
    153             index.html\
    154             redlogo.png\
    155             ${docbasename}.css ${docdir}
    156         xinstall -m 644 ${worksrcpath}/README ${docdir}
    157         xinstall -m 644 ${worksrcpath}/packages/package.map ${resourcesdir}
     77    # Documentation is also re-generated in the tree so that regardless of
     78    # history it should end up clean and organized.
     79    post-build {
     80        if {[variant_isset doc]} {
     81            system -W ${worksrcpath}/doc/misc ${build.cmd}
     82            system -W ${worksrcpath}/doc/manual ${build.cmd}
    15883    }
    15984}
    16085
     86    depends_run         port:gnuplot
    16187
    162 subport reduce-csl {
    163     license                 {BSD LGPL-2.1}
    164     revision                1
    165     description             ${description} -- CSL version
     88    destroot {
     89        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
    16690
    167     long_description        "${long_description}
     91        set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
     92        set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
    16893
    169 This installs the Codemist Standard Lisp version of REDUCE.
    170 "
     94        set genericdir  ${worksrcpath}/generic
    17195
    172     patchfiles-append       patch-csl-cslbase-crlibm-configure.diff \
    173                             patch-csl-cslbase-print.c.diff
     96        set sharedir    ${prefix}/share/${subport}
     97        set libexecdir  ${prefix}/libexec/${subport}
     98        set bindir      ${prefix}/bin
     99        set mandir      ${prefix}/share/man/man1
    174100
    175     configure.args-append   --with-csl
    176 
    177     destroot {
    178         set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
    179         set cslbuilddir ${worksrcpath}/cslbuild/${builddir}
    180101        # Create target directories
    181102        xinstall -d \
    182             ${libexecdir}/cslbuild/csl\
    183             ${sharedir}\
    184             ${fontdir}\
    185             ${resourcesdir}\
    186             ${mandir}
    187         # Copy CSL files
    188         xinstall -p -W ${cslbuilddir}/csl\
    189             reduce\
    190             reduce.img\
    191             csl\
    192             csl.img ${libexecdir}/cslbuild/csl
    193         ln -s ${prefix}/share/doc/${name} ${libexecdir}/cslbuild/csl/reduce.doc
    194         ln -s ${prefix}/share/${name}/fonts ${libexecdir}/cslbuild/csl/reduce.fonts
    195         ln -s ${prefix}/share/${name}/resources ${libexecdir}/cslbuild/csl/reduce.resources
    196         ln -s ${prefix}/libexec/${name}/cslbuild ${sharedir}/cslbuild
    197         # Font files
    198         foreach f [glob -tails -directory ${cslbuilddir}/csl/reduce.fonts/ *] {
    199             if {![string equal $f "src"]} {
    200                 file copy ${cslbuilddir}/csl/reduce.fonts/$f ${fontdir}
    201             }
    202         }
    203         # Resource files
    204         xinstall -m 644 -W ${cslbuilddir}/csl/reduce.resources\
    205             mma.awk\
    206             qepcad.awk ${resourcesdir}
    207         # Copy man files
    208         xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redcsl.1 ${mandir}
    209         # Shell script for running REDUCE
    210         xinstall ${filespath}/runcsl.in ${bindir}/redcsl
    211         reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redcsl
    212     }
     103            ${destroot}${sharedir}                   \
     104            ${destroot}${libexecdir}/csl             \
     105            ${destroot}${libexecdir}/psl/psl         \
     106            ${destroot}${libexecdir}/psl/red         \
     107            ${destroot}${applications_dir}/${subport}
     108        # Manual files
     109        copy                                  \
     110            ${filespath}/redcsl.1             \
     111            ${filespath}/redpsl.1             \
     112            ${genericdir}/newfront/redfront.1 \
     113            ${destroot}${mandir}
     114        ln -s ${prefix}/share/man/man1/redfront.1 ${destroot}${mandir}/rfcsl.1
     115        ln -s ${prefix}/share/man/man1/redfront.1 ${destroot}${mandir}/rfpsl.1
     116        # CSL files
     117        foreach d {reduce bootstrapreduce csl} {
     118            copy ${cslbuilddir}/csl/${d}.app ${destroot}${libexecdir}/csl
     119            ln -s ${prefix}/libexec/${subport}/csl/${d}.app \
     120                ${destroot}${applications_dir}/${subport}/${d}.app
     121        }
     122        copy ${filespath}/runcsl.sh ${destroot}${bindir}/redcsl
     123        copy ${filespath}/runbootstrapreduce.sh ${destroot}${bindir}/bootstrapreduce
     124        copy ${filespath}/runcsllisp.sh ${destroot}${bindir}/csl
     125        foreach f {redcsl bootstrapreduce csl} {
     126            file attributes ${destroot}${bindir}/${f} -permissions +x
     127        }
     128        copy ${cslbuilddir}/redfront/rfcsl ${destroot}${bindir}
     129        # PSL files
     130        copy {*}[glob ${pslbuilddir}/psl/*] ${destroot}${libexecdir}/psl/psl
     131        copy {*}[glob ${pslbuilddir}/red/*] ${destroot}${libexecdir}/psl/red
     132        copy ${filespath}/runpsl.sh ${destroot}${bindir}/redpsl
     133        file attributes ${destroot}${bindir}/redpsl -permissions +x
     134        # Note (ha ha) that rfpsl is built in the cslbuild part of the tree.
     135        copy ${cslbuilddir}/redfront/rfpsl ${destroot}${bindir}
    213136}
    214137
     138    # Install licenses and (if +doc) documentation
     139    post-destroot {
     140        set docsrcdir       ${worksrcpath}/doc/manual
     141        set docmiscdir      ${worksrcpath}/doc/misc
    215142
    216 subport reduce-psl {
    217     license                 BSD
    218     revision                0
    219     description             ${description} -- PSL version
    220 
    221     long_description        "${long_description}
     143        set docbasename     manual
     144        set extradocimagebasenames {bild cmsy10 gnuplotex turtleeg}
    222145
    223 This installs the Portable Standard Lisp version of REDUCE.
    224 "
     146        set docdir ${prefix}/share/doc/${subport}
     147        xinstall -d ${destroot}${docdir}/html ${destroot}${docdir}/pdf
     148        xinstall -m 0644 -W ${worksrcpath}/csl/reduce.doc \
     149            BINARY-LICENSE.txt                            \
     150            BSD-LICENSE.txt                               \
     151            LGPL-2.1.txt                                  \
     152            ${destroot}${docdir}
    225153
    226     configure.args-append   --with-psl
     154        # Install documentation if requested
     155        if {[variant_isset doc]} {
     156            copy                                \
     157                {*}[glob ${docmiscdir}/*.pdf]   \
     158                ${docsrcdir}/${docbasename}.pdf \
     159                ${destroot}${docdir}/pdf
     160            copy                                            \
     161                ${docsrcdir}/redlogo.png                    \
     162                {*}[glob ${docsrcdir}/${docbasename}*.html] \
     163                {*}[glob ${docsrcdir}/${docbasename}*.png]  \
     164                ${docsrcdir}/${docbasename}.css             \
     165                ${docsrcdir}/index.html                     \
     166                ${destroot}${docdir}/html
     167            foreach n ${extradocimagebasenames} {
     168                copy {*}[glob ${docsrcdir}/${n}*.png] ${destroot}${docdir}/html
     169            }
     170        }
     171    }
    227172
    228     destroot {
    229         set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
    230         set pslbuilddir ${worksrcpath}/pslbuild/${builddir}
    231         # create target directories
    232         xinstall -d \
    233             ${libexecdir}/pslbuild/psl\
    234             ${libexecdir}/pslbuild/red\
    235             ${sharedir}\
    236             ${mandir}
    237         ### Create a second image after all (psl) modules have been built, with
    238         ### the final value of loaddirectories!*.
    239         ui_debug "Saving a new image..."
    240         system "cd ${pslbuilddir}; exec ${worksrcpath}/psl/saveimage.sh\
    241            ${pslbuilddir} \
    242            ${pslbuilddir}/red \
    243            ${prefix}/libexec/${name}/pslbuild"
    244         # copy PSL files
    245         xinstall -p {*}[glob ${pslbuilddir}/psl/*] ${libexecdir}/pslbuild/psl
    246         xinstall -p {*}[glob ${pslbuilddir}/red/*] ${libexecdir}/pslbuild/red
    247         ln -s ${prefix}/libexec/${name}/pslbuild ${sharedir}/pslbuild
    248         # copy man files
    249         xinstall -m 644 ${worksrcpath}/debianbuild/reduce/debian/redpsl.1 ${mandir}
    250         # shell script for running REDUCE
    251         xinstall ${filespath}/runpsl.in ${bindir}/redpsl
    252         reinplace "s|@LIBEXECDIR@|${prefix}/libexec/${name}|g" ${bindir}/redpsl
     173    variant doc description {Install HTML and PDF documentation} {
     174        depends_build-append              \
     175            port:dvipng                   \
     176            port:texlive-fonts-extra      \
     177            port:texlive-formats-extra    \
     178            port:texlive-latex-extra      \
     179            port:texlive-plain-generic    \
     180            port:texlive-bin-extra        \
     181            port:texlive-fonts-recommended
    253182    }
     183
     184    livecheck.version   ${version_dashes}
     185    livecheck.url       https://sourceforge.net/projects/reduce-algebra/files/
     186    livecheck.regex     {snapshot_(\d{4}-\d{2}-\d{2})}
     187} else {
     188    livecheck.type      none
    254189}
    255190
     191subport breduce {
     192    license             BSD-2
     193    description         A REDUCE batch processing utility.
     194    long_description    ${description}
    256195
    257 subport reduce-addons {
    258     license                 GPL
    259     revision                1
    260     description             Useful addons for the REDUCE Computer Algebra System
    261 
    262     long_description        "${description}
    263 These include:
    264   reduce-mode, an emacs mode
    265   redfront, a frontend with line editing and color output
    266   breduce, a REDUCE batch processing utility"
    267 
    268     depends_lib-append      bin:makeinfo:texinfo
    269 
    270     worksrcdir              ${redfrontbuilddir}
    271 
    272     patchfiles-append       patch-src-redline.c.diff
    273 
    274     configure.cmd           ./src/configure
    275     configure.args-append\
    276         --with-libedit\
    277         --with-package-map=${prefix}/share/${name}/resources/package.map\
    278         --with-csl-reduce=${prefix}/libexec/${name}/cslbuild/csl/reduce\
    279         --with-bpsl=${prefix}/libexec/${name}/pslbuild/psl/bpsl\
    280         --with-reduce-img=${prefix}/libexec/${name}/pslbuild/red/reduce.img
     196    patchfiles-append   patch-generic-breduce-breduce.1.diff
    281197
    282198    post-patch {
    283         reinplace "s|/usr/share/doc/reduce-addons|${prefix}/share/doc/reduce-addons|g"\
    284             ${genericdir}/breduce/breduce.1
     199        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/generic/breduce/breduce.1
    285200    }
    286201
    287     pre-configure {
    288         system -W ${redfrontbuilddir} "${build.cmd} maintainer-clean"
    289         system -W ${redfrontsrcdir} "autoconf ; autoheader"
    290     }
     202    configure {}
    291203
    292     post-build {
    293         system -W ${genericdir}/emacs "makeinfo reduce-ide.texinfo"
    294     }
     204    build {}
     205
     206    depends_run         path:bin/latex:texlive \
     207                        port:reduce
    295208
    296209    destroot {
    297         # create target directories
    298         xinstall -d \
    299             ${addondocdir}\
    300             ${mandir}\
    301             ${sitelispdir}
    302         # copy addons
    303         xinstall -m 644 ${redfrontsrcdir}/README ${addondocdir}
    304         xinstall -m 644 -W ${genericdir}/breduce\
     210        set libexecdir  ${prefix}/libexec/${subport}
     211        set mandir      ${prefix}/share/man/man1
     212        xinstall -d ${destroot}/${libexecdir}
     213        copy ${worksrcpath}/generic/breduce/breduce ${destroot}/${libexecdir}
     214        copy ${worksrcpath}/packages/breduce/breduce.red ${destroot}/${libexecdir}
     215        ln -s ${prefix}/libexec/breduce/breduce ${destroot}${prefix}/bin/breduce
     216        copy ${worksrcpath}/generic/breduce/breduce.1 ${destroot}/${mandir}
     217    }
     218
     219    post-destroot {
     220        set docdir ${prefix}/share/doc/${subport}
     221        xinstall -d ${destroot}${docdir}
     222        xinstall -m 0644 -W ${worksrcpath}/generic/breduce \
    305223            breduce.bbl\
    306224            breduce.pdf\
    307             breduce.tex ${addondocdir}
    308         xinstall -m 644 ${redfrontsrcdir}/redfront.1 ${mandir}
    309         ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfcsl.1
    310         ln -s ${prefix}/share/man/man1/redfront.1 ${mandir}/rfpsl.1
    311         xinstall -m 644 ${genericdir}/breduce/breduce.1 ${mandir}
    312         xinstall ${redfrontbuilddir}/redfront ${bindir}
    313         ln -s ${prefix}/bin/redfront ${bindir}/rfcsl
    314         ln -s ${prefix}/bin/redfront ${bindir}/rfpsl
    315         xinstall ${genericdir}/breduce/breduce ${bindir}
    316         xinstall -m 644 -W ${genericdir}/emacs\
    317             reduce-ide.info\
    318             reduce-ide.texinfo ${addondocdir}
    319         xinstall -m 644 -W ${genericdir}/emacs \
    320             reduce-mode.el \
    321             reduce-run.el \
    322             ${sitelispdir}
    323     }
    324 
    325     notes-append    "
    326 REDUCE edit mode is provided by a file called 'reduce-mode.el'. This file\
    327 is installed in ${prefix}/share/emacs/site-lisp/${name}. To automatically\
    328 load this file, put the following lines in your '.emacs' file:
    329 
    330 \(autoload ’reduce-mode \"reduce-mode\" \"Major mode for REDUCE code editing\" t)
    331 
    332 ;; Automatically start .red files in reduce mode.
    333 \(add-to-list ’auto-mode-alist ’(\"\\\.red\\\’\" . reduce-mode))
    334 
    335 Installation of REDUCE run mode is documented separately. See\
    336 '${prefix}/share/doc/reduce-addons/reduce-ide.info'.
    337 "
     225            breduce.tex                                    \
     226            ${destroot}${docdir}
     227    }
    338228}