Ticket #33298: Portfile-cgal

File Portfile-cgal, 3.2 KB (added by Russell-Jones-OxPhys (Russell Jones), 12 years ago)

Portfile for cgal to apply patch to allow port to build.

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 87615 2011-11-28 21:12:21Z ryandesign@macports.org $
3
4PortSystem                      1.0
5PortGroup                       cmake 1.0
6
7name                            cgal
8version                         3.9
9license                         LGPL-2.1 QPL Commercial
10categories                      gis science
11maintainers                     vince
12description                     Computational Geometry Algorithm Library
13long_description        \
14                                        The goal of the CGAL is to provide easy access to\
15                                        efficient and reliable geometric algorithms in the\
16                                        form of a C++ library. CGAL is used in various areas\
17                                        needing geometric computation, such as: computer\
18                                        graphics, scientific visualization, computer aided\
19                                        design and modeling, geographic information systems,\
20                                        molecular biology, medical imaging, robotics and\
21                                        motion planning, mesh generation, numerical methods...
22
23platforms                       darwin
24homepage                        http://www.cgal.org/
25
26fetch.ignore_sslcert    yes
27master_sites            https://gforge.inria.fr/frs/download.php/29125/
28
29distname                        CGAL-${version}
30checksums           rmd160  0a5a929ecedeeac3833ec90f802b7f5ac069ad47 \
31                    sha256  241194ad9487d62d1287f863eab3adbbfd0836e2bebcd50c9fc21d473f947ba4
32
33depends_lib-append      port:boost \
34                                        port:mpfr \
35                                        port:zlib \
36                                        port:gmp
37
38patchfiles              patch-src-config.h.diff
39configure.args-append   -DCGAL_INSTALL_CMAKE_DIR="${prefix}/lib/cmake"
40
41# gcc 4.0 is too old to compile CGAL properly; see <http://www.cgal.org/FAQ.html#mac_optimization_bug>
42# And the demos don't compile with llvm-gcc-4.2 or clang
43if {${configure.compiler} == "gcc-4.0" || [variant_isset demos]} {
44    configure.compiler gcc-4.2
45    if {![file executable ${configure.cc}]} {
46        depends_build-append port:apple-gcc42
47        configure.compiler apple-gcc-4.2
48        # base (as of 2.0.3) doesn't set cxx for apple-gcc-4.2
49        configure.cxx ${prefix}/bin/g++-apple-4.2
50    }
51}
52
53pre-build {
54    # When building 3.9 with 3.8 active:
55    # error: 'CGAL_CORE_finite' was not declared in this scope
56    if {[file exists ${prefix}/include/CGAL/version.h]} {
57        set installed_version [exec awk {/^#define +CGAL_VERSION +/ {print $3}} ${prefix}/include/CGAL/version.h]
58        if {${version} != ${installed_version}} {
59            ui_error "${name} ${version} cannot be built while ${name} ${installed_version} is installed and active."
60            ui_error "Please deactivate ${name} ${installed_version} first."
61            return -code error "incompatible ${name} version active"
62        }
63    }
64}
65
66variant demos description {Create demos} {
67        PortGroup                               qt4 1.0
68
69        depends_lib-append              port:libQGLViewer \
70                                                        port:ipe
71
72        patchfiles                              patch-CMakeLists.txt.diff
73
74        configure.args-append   -DWITH_examples=TRUE
75        configure.args-append   -DWITH_demos=TRUE
76
77  # MacPorts installs IPE version 7; make sure to use it.
78        configure.args-append   -DWITH_IPE_7=TRUE
79
80  # include Qt's CMake defines, just in case
81        configure.args-append   ${qt_cmake_defines}
82
83        build.target-append             examples demos
84        use_parallel_build              no
85
86        post-destroot {                 xinstall -d ${destroot}${prefix}/share/${name}
87                                                        copy ${worksrcpath}/demo ${destroot}${prefix}/share/${name}
88                                                        copy ${worksrcpath}/examples ${destroot}${prefix}/share/${name}
89        }
90}