Ticket #29595: Portfile

File Portfile, 13.1 KB (added by cooljeanius (Eric Gallager), 11 years ago)

Portfile for Scilab

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
5PortGroup             archcheck 1.0
6PortGroup             active_variants 1.1
7
8name                  scilab
9version               5.4.1
10revision              6
11categories            science
12platforms             macosx
13maintainers           debian.org:sylvestre gwmail.gwu.edu:egall openmaintainer
14license               cecill
15
16description           open source software for numerical computation
17
18long_description      ${name} is ${description}.
19
20homepage              http://www.${name}.org/
21master_sites          ${homepage}download/${version}/
22distfiles             ${name}-${version}-src-repack1.tar.gz \
23                      prerequirements-${name}-${version}-x86_64-src.dmg
24
25checksums             scilab-5.4.1-src-repack1.tar.gz \
26                      md5     00a78bd58903c50000a28e50ff652000 \
27                      sha1    814fd9ff488b153a95621c297cca097d85758e1f \
28                      rmd160  bfd47dc9e20128d812b9ac5a7ce0f33b67a0d041 \
29                      sha256  e58eafab87575f8c85d62250a6ab30f80d356293121e2748886ea70b3aa0680e \
30                      prerequirements-scilab-5.4.1-x86_64-src.dmg \
31                      md5     0fa4b4d7f73a002a81fbf071a311963b \
32                      sha1    8d8bc9f9e3a63ca1087dabff2bd6db9501f8ed4c \
33                      rmd160  d00b40aa25bd4b2a4cf882fca35ae67ae1030367 \
34                      sha256  e73024561b2ab20e8c3491efca2c0f9a69edd52d1d2c31e99e4b7fed1627507a
35
36extract.only          ${name}-${version}-src-repack1.tar.gz
37
38worksrcdir            ${name}-${version}
39
40patchfiles-append     patch-macosx.m4.diff \
41                      patch-configure.ac.diff \
42                      patch-Makefile.am.diff \
43                      patch-modules-Makefile.am.diff
44
45post-patch {
46    if {![file isfile ${filespath}/patch-Makefile.am.diff]} {
47        reinplace "s|m4\/|m4|" ${worksrcpath}/Makefile.am
48    }
49    if {![file isfile ${filespath}/patch-configure.ac.diff]} {
50        reinplace "s|m4\/|m4|" ${worksrcpath}/configure.ac
51        # Trick the script into thinking MacPorts is Fink, until the patch
52        # for the configure.ac file applies properly again:
53        reinplace "s|FINK_PREFIX\=\"\/sw\/\"|FINK_PREFIX\=\"${prefix}\"|g" ${worksrcpath}/configure.ac
54    }
55    # Fix an issue I had with the Makefile using $(top_srdir) in a way
56    # that somehow messed up...
57    reinplace "s|\$\(top_srcdir\)|${worksrcpath}|" ${worksrcpath}/Makefile.am
58    # Run glibtoolize before autoreconf runs it, to silence some
59    # warnings from aclocal
60    system -W ${worksrcpath} "${prefix}/bin/glibtoolize --copy --automake --force"
61    xinstall ${prefix}/share/aclocal/autobuild.m4 ${worksrcpath}/m4
62    xinstall ${prefix}/share/aclocal/ax_check_gnu_make.m4 ${worksrcpath}/m4
63    xinstall ${prefix}/share/aclocal/bakefile.m4 ${worksrcpath}/m4
64    xinstall ${prefix}/share/aclocal/cmake.m4 ${worksrcpath}/m4
65    xinstall ${prefix}/share/aclocal/pkg.m4 ${worksrcpath}/m4
66    xinstall ${prefix}/share/aclocal/xorg-macros.m4 ${worksrcpath}/m4
67    if {![file exists ${worksrcpath}/po]} {
68        xinstall -d ${worksrcpath}/po
69    }
70    xinstall ${filespath}/Makevars.in ${worksrcpath}/po
71    xinstall ${filespath}/POTFILES.in ${worksrcpath}/po
72    xinstall ${prefix}/share/gettext/gettext.h ${worksrcpath}
73}
74
75use_autoreconf        yes
76autoreconf.args       -fvi
77
78# Too many things that Scilab depends on are not universal
79universal_variant     no
80# The prerequirements dmg only says x86_64, so assume that that is the only
81# supported arch
82supported_archs       x86_64
83
84# Some of these build dependencies will only be needed once I add a test phase,
85# and then only until http://trac.macports.org/ticket/38208 is resolved
86depends_build-append  port:pkgconfig \
87                      port:intltool \
88                      port:docbook-xsl \
89                      port:checkstyle \
90                      port:cobertura \
91                      port:commons-beanutils \
92                      port:commons-logging \
93                      port:junit \
94                      port:objectweb-asm \
95                      port:saxon \
96                      port:saxpath \
97                      port:SuiteSparse \
98                      path:bin/xmkmf:imake \
99                      path:bin/ant:apache-ant \
100                      path:share/aclocal/autobuild.m4:autobuild \
101                      path:share/aclocal/ax_check_gnu_make.m4:autoconf-archive \
102                      path:share/aclocal/bakefile.m4:bakefile \
103                      path:share/aclocal/cmake.m4:cmake \
104                      path:share/aclocal/xorg-macros.m4:xorg-util-macros \
105                      path:share/java/antlr.jar:antlr3 \
106                      bin:antlr:antlr \
107                      bin:astyle:astyle \
108                      bin:doxygen:doxygen \
109                      bin:dot:graphviz \
110                      bin:fop:fop \
111                      bin:gawk:gawk \
112                      bin:grep:grep \
113                      bin:runtest:dejagnu \
114                      bin:splint:splint \
115                      bin:xmlindent:xmlindent
116
117# Most of these library dependencies are taken from Fink's list of dependencies
118# for Scilab (some were from the outdated version of the Fink package):
119depends_lib-append    port:readline \
120                      port:tcl \
121                      port:atlas \
122                      port:gettext \
123                      path:lib/pkgconfig/glib-2.0.pc:glib2 \
124                      port:libiconv \
125                      port:libpng \
126                      port:libtool \
127                      port:libxml2 \
128                      port:ncurses \
129                      port:xorg-libX11 \
130                      port:pcre \
131                      path:lib/pkgconfig/fftw3.pc:fftw-3 \
132                      path:lib/libhdf5.dylib:hdf5-18 \
133                      path:lib/pkgconfig/eigen3.pc:eigen3 \
134                      port:xz \
135                      port:zlib \
136                      port:matio
137
138# Needed for some of the data files
139depends_run-append    bin:dia:dia
140
141pre-configure {
142    if {![file exists ${worksrcpath}/bin]} {
143        xinstall -d ${worksrcpath}/bin
144    }
145    if {![file exists ${worksrcpath}/thirdparty]} {
146        xinstall -d ${worksrcpath}/thirdparty
147    }
148    if {![file exists ${worksrcpath}/mountpoint]} {
149        xinstall -d ${worksrcpath}/mountpoint
150    }
151    system -W ${worksrcpath} "hdiutil attach -mountroot mountpoint -nobrowse -noautoopen ${distpath}/prerequirements-${name}-${version}-x86_64-src.dmg"
152    ui_debug "Copying prerequirements from dmg..."
153    # Use "copy" instead of "xinstall" here because of folders
154    eval copy [glob ${worksrcpath}/mountpoint/${name}-${version}/thirdparty/*] ${worksrcpath}/thirdparty
155    eval copy [glob ${worksrcpath}/mountpoint/${name}-${version}/bin/*] ${worksrcpath}/bin
156    ui_debug "Done copying prerequirements."
157    system -W ${worksrcpath} "hdiutil detach mountpoint/${name}-${version}"
158    xinstall ${prefix}/share/gettext/gettext.jar ${worksrcpath}/thirdparty
159    eval xinstall [glob ${prefix}/share/java/antlr*.jar] ${worksrcpath}/thirdparty
160    eval xinstall [glob ${prefix}/share/java/*asm*.jar] ${worksrcpath}/thirdparty
161    eval xinstall [glob ${prefix}/share/java/checkstyle*.jar] ${worksrcpath}/thirdparty
162    eval xinstall [glob ${prefix}/share/java/commons-beanutils*.jar] ${worksrcpath}/thirdparty
163    eval xinstall [glob ${prefix}/share/java/commons-logging*.jar] ${worksrcpath}/thirdparty
164    eval xinstall [glob ${prefix}/share/java/sax*.jar] ${worksrcpath}/thirdparty
165    eval xinstall [glob ${prefix}/share/java/cobertura*.jar] ${worksrcpath}/thirdparty
166    eval xinstall [glob ${prefix}/share/java/junit*.jar] ${worksrcpath}/thirdparty
167    configure.classpath-append [join [glob ${prefix}/share/java/*.jar] ":"]
168    configure.classpath-append [join [glob ${worksrcpath}/thirdparty/*.jar] ":"]
169    if {[file isdirectory ${prefix}/GNUstep/lib/GNUstep/Libraries/Java]} {
170        configure.classpath-append ${prefix}/GNUstep/lib/GNUstep/Libraries/Java
171    }
172    ui_debug "configure.classpath will be displayed when displaying configuration environment."
173}
174
175configure.args-append --with-macports-prefix=${prefix} \
176                      --without-tk \
177                      --with-tcl-include=${prefix}/include \
178                      --with-tcl-library=${prefix}/lib \
179                      --without-modelica \
180                      --without-javasci \
181                      --disable-ccache \
182                      --enable-debug-java \
183                      --disable-build-swig \
184                      --disable-build-giws \
185                      --without-gui \
186                      --with-x \
187                      --x-includes=${prefix}/include \
188                      --x-libraries=${prefix}/lib \
189                      --disable-build-help \
190                      --enable-build-doxygen \
191                      --without-openmp \
192                      --without-arpack-ng \
193                      --with-umfpack-library=${prefix}/lib \
194                      --with-umfpack-include=${prefix}/include \
195                      --with-pcre=${prefix} \
196                      --without-gfortran \
197                      --with-hdf5-include=${prefix}/include \
198                      --with-hdf5-library=${prefix}/lib \
199                      --disable-dependency-tracking \
200                      --with-libiconv-prefix=${prefix} \
201                      --with-libintl-prefix=${prefix} \
202                      --with-ant=${prefix} \
203                      --with-matio-include=${prefix}/include \
204                      --with-matio-library=${prefix}/lib \
205                      --with-fop \
206                      --with-lint \
207                      --with-docbook=${prefix}/share/xsl/docbook-xsl \
208                      --with-install-help-xml
209
210configure.ldflags-append \
211                      -llapack \
212                      -latlas \
213                      -lblas \
214                      -lpng \
215                      -lreadline \
216                      -lX11
217
218if {[active_variants path:lib/pkgconfig/eigen3.pc:eigen3 blas]} {
219    configure.ldflags-append \
220                      -leigen_blas
221}
222
223# ccache support has been removed because:
224# ccache: FATAL: Recursive invocation (the name of the ccache binary must be "ccache")
225if {[tbool configure.ccache]} {
226    configure.ccache no
227}
228
229# ./configure --help said that these were influential environment variables:
230configure.env-append XMKMF=${prefix}/bin/xmkmf \
231                     PCRE_LIBS=-L${prefix}/lib -lpcreposix -lpcre \
232                     FOP=${prefix}/bin/fop
233
234configure.pkg_config ${prefix}/bin/pkg-config
235
236# This is to disable checking for jgraphx, which MacPorts does not have yet
237# (it has just "jgraph" without the "x", but I think that is different)
238configure.env-append XCOS_ENABLE="no"
239
240# gcc is needed for gfortran
241# so therefore we shall use the "fortran recipe"
242set gcc_versions {4.3 4.4 4.5 4.6 4.7 4.8 4.9}
243set default_fortran_variant +gcc48
244set g95_conflicts {}
245
246foreach ver ${gcc_versions} {
247    set ver_no_dot [join [split ${ver} "."] ""]
248
249    set variant_line {variant gcc${ver_no_dot} description "build with gfortran from gcc${ver_no_dot}" conflicts g95}
250
251    foreach over ${gcc_versions} {
252        if {${ver} == ${over}} {
253            continue
254        }
255
256        set over_no_dot [join [split ${over} "."] ""]
257        append variant_line " conflicts gcc${over_no_dot}"
258    }
259    append variant_line { {}}
260
261    eval $variant_line
262
263    append g95_conflicts " conflicts gcc${ver_no_dot}"
264
265    if {[variant_isset gcc${ver_no_dot}]} {
266        if {${default_fortran_variant} != "+gcc${ver_no_dot}"} {
267            set default_fortran_variant ""
268        }
269    }
270}
271
272eval [concat {variant g95 description {build with g95}} $g95_conflicts {{}}]
273
274if {[variant_isset g95]} {
275    if {${default_fortran_variant} != "+g95"} {
276        set default_fortran_variant ""
277    }
278}
279
280if {${default_fortran_variant} != ""} {
281    default_variants-append "${default_fortran_variant}"
282}
283
284foreach ver ${gcc_versions} {
285    set ver_no_dot [join [split ${ver} "."] ""]
286
287    if {[variant_isset gcc${ver_no_dot}]} {
288        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
289        depends_build-append port:gcc${ver_no_dot}
290
291        configure.args-delete --without-gfortran
292        configure.args-append --with-gfortran \
293                              --with-gcc
294
295        configure.ldflags-append -L${prefix}/lib/libgcc -lgcc
296
297        configure.fc  ${prefix}/bin/gfortran-mp-${ver}
298        configure.f77 ${prefix}/bin/gfortran-mp-${ver}
299        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
300    }
301}
302
303if {[variant_isset g95]} {
304    depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
305    depends_build-append port:g95
306
307    configure.args-delete --without-gfortran
308    configure.args-append --with-gfortran
309
310    configure.fc ${prefix}/bin/g95
311    configure.f77 ${prefix}/bin/g95
312    configure.f90 ${prefix}/bin/g95
313}
314
315# warning: this variant is untested
316variant ocaml description {Build OCaml module (modelica)} {
317    depends_lib-append  port:ocaml \
318                        port:swig-ocaml
319    configure.args-delete --without-modelica \
320                          --disable-build-swig \
321                          --disable-build-giws
322    configure.args-append --with-modelica
323}
324
325#TODO: fix livecheck