source: trunk/dports/devel/cmake/Portfile

Last change on this file was 154286, checked in by michaelld@…, 12 months ago

cmake-devel: update to 20161025 (g552121).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.4 KB
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 154286 2016-10-26 16:10:56Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           muniversal 1.0
6
7name                cmake
8
9categories          devel
10license             BSD
11installs_libs       no
12maintainers         michaelld
13description         Cross-platform make
14set base_long_description \
15    "An extensible, open-source system that manages the build \
16    process in an operating system and compiler independent manner. \
17    Unlike many cross-platform systems, CMake is designed to be \
18    used in conjunction with the native build environment."
19homepage            http://www.cmake.org/
20platforms           darwin freebsd
21
22dist_subdir         cmake
23
24subport cmake-devel {}
25
26set branch          3.6
27
28if {${subport} eq ${name}} {
29
30    # release
31
32    version         ${branch}.2
33    checksums       rmd160 2b9a04eec4964302ddb0e3b48060407cbdab8455 \
34                    sha256 189ae32a6ac398bb2f523ae77f70d463a6549926cde1544cd9cc7c6609f8b346
35
36    master_sites    http://www.cmake.org/files/v${branch}/
37    conflicts       cmake-devel
38
39    long_description ${base_long_description} \
40        The ${subport} release port is updated roughly every few months.
41
42    # release-only patches
43    patchfiles-append \
44        patch-Modules-FindQt4.cmake.release.diff \
45        patch-Modules-FindFreetype.cmake.release.diff \
46        patch-Modules-noArchCheck.release.diff \
47        patch-CMakeFindFrameworks.cmake.release.diff
48
49    livecheck.type  regex
50    livecheck.regex ${name}-(\[0-9.\]+)${extract.suffix}
51    livecheck.url   [lindex $master_sites 0]
52
53} else {
54
55    # devel
56
57    version         20161025
58    set dist_branch 3.7
59    set dist_date   20161025
60    set dist_hash   g552121
61    checksums       rmd160 7371708787ced3fbc0be0d667f12d9bf8a6baa49 \
62                    sha256 c008d5f93113f2f5a22871754d044015f89b1795cfa27bdb37ca2d9d6d6ce234
63
64    master_sites    http://www.cmake.org/files/dev/
65    distname        ${name}-${dist_branch}.${dist_date}-${dist_hash}
66    conflicts       cmake
67
68    long_description ${base_long_description} \
69        The ${subport} port is updated roughly every week.
70
71    # devel-only patches
72    patchfiles-append \
73        patch-Modules-FindQt4.cmake.devel.diff \
74        patch-Modules-FindFreetype.cmake.devel.diff \
75        patch-Modules-noArchCheck.devel.diff \
76        patch-CMakeFindFrameworks.cmake.devel.diff \
77        patch-Source_CMakeVersionCompute.cmake.devel.diff
78
79    # allow use of libuv or libuv-devel;
80    # system libuv is the default as of 20160830 (g320f5)
81    depends_lib-append \
82        path:lib/pkgconfig/libuv.pc:libuv
83
84    livecheck.type  regex
85    livecheck.regex (${name}-\[0-9a-g.-\]+)${extract.suffix}
86    livecheck.version ${distname}
87    livecheck.url   http://www.cmake.org/files/dev/
88
89}
90
91depends_lib-append  port:curl \
92                    port:expat \
93                    port:zlib \
94                    port:bzip2 \
95                    port:libarchive \
96                    port:ncurses
97
98# CMake 3.2 changed dependency requirements to include jsoncpp.
99# jsoncpp 1.0+ requires CMake for building. catch 22. So, have CMake
100# use its internal jsoncpp until a better solution comes about.
101
102patchfiles-append   patch-Modules-Platform-Darwin.cmake.diff
103
104configure.env-append \
105                    CMAKE_PREFIX_PATH=${prefix} \
106                    CMAKE_INCLUDE_PATH=${prefix}/include/ncurses \
107                    CMAKE_LIBRARY_PATH=${prefix}/lib
108
109platform darwin {
110    configure.env-append \
111                    CMAKE_OSX_DEPLOYMENT_TARGET="${macosx_deployment_target}"
112
113    if {${configure.sdkroot} != ""} {
114        configure.env-append CMAKE_OSX_SYSROOT="${configure.sdkroot}"
115    } else {
116        configure.env-append CMAKE_OSX_SYSROOT="/"
117    }
118}
119
120configure.args-append --docdir=share/doc/cmake \
121                    --parallel=${build.jobs} \
122                    --init=${worksrcpath}/macports.cmake \
123                    --system-libs \
124                    --no-system-jsoncpp
125
126configure.universal_args
127configure.post_args
128
129# CMake's configure script doesn't recognize `--host`.
130array set merger_host {i386 {} x86_64 {} ppc {} ppc64 {}}
131
132# Leopard's Rosetta has some difficulties configuring the ppc slice
133platform darwin 9 {
134    global universal_archs_supported
135    if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} {
136        supported_archs i386 x86_64
137    } elseif {${build_arch} eq "ppc" || ${build_arch} eq "ppc64"} {
138        supported_archs ppc ppc64
139    }
140    set universal_archs_supported ${supported_archs}
141}
142
143platform darwin {
144    # TODO: Figure out why using libc++ fails on Lion and fix the bootstrap
145    #       script to honor CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET.
146    #       Since nothing links against cmake and cmake is just using the STL,
147    #       we're safe to force libstdc++
148    #
149    #       https://www.cmake.org/Bug/view.php?id=15039&nbn=16
150    if {${os.major} < 12} {
151        configure.cxx_stdlib libstdc++
152    }
153}
154
155build.post_args VERBOSE=ON
156
157post-patch {
158    # copy cmake init file, ready to be patched below
159    copy ${filespath}/macports.cmake ${worksrcpath}
160
161    # patch PREFIX
162    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/macports.cmake
163    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Modules/CMakeFindFrameworks.cmake
164
165    # patch Python Version; doing this is OK even when +docs is not
166    # used, because the PYTHON_EXECUTABLE is used only when building
167    # docs -- so, when not building docs its setting makes no difference.
168
169    if {[variant_isset python27]} {
170        set PYTHON_VERSION_WITH_DOT "2.7"
171    } else {
172        set PYTHON_VERSION_WITH_DOT "3.4"
173    }
174    reinplace "s|__PYTHON_VERSION_WITH_DOT__|${PYTHON_VERSION_WITH_DOT}|g" ${worksrcpath}/macports.cmake
175}
176
177post-destroot {
178    xinstall -d -m 0755 ${destroot}${prefix}/share/emacs/site-lisp
179    xinstall -m 0644 ${worksrcpath}/Auxiliary/cmake-mode.el \
180        ${destroot}${prefix}/share/emacs/site-lisp
181    if {${subport} eq ${name}} {
182        foreach type {syntax indent} {
183            xinstall -d -m 0755 ${destroot}${prefix}/share/vim/vimfiles/${type}
184            xinstall -m 0644 -W ${worksrcpath}/Auxiliary cmake-${type}.vim \
185                ${destroot}${prefix}/share/vim/vimfiles/${type}
186        }
187    } else {
188        foreach type {syntax indent} {
189            xinstall -d -m 0755 ${destroot}${prefix}/share/vim/vimfiles/${type}
190            xinstall -m 0644 -W ${worksrcpath}/Auxiliary/vim/${type} cmake.vim \
191                ${destroot}${prefix}/share/vim/vimfiles/${type}
192        }
193    }
194    if ([variant_isset gui]) {
195        set app CMake
196        xinstall -d ${destroot}${applications_dir}/${app}.app/Contents/MacOS \
197            ${destroot}${applications_dir}/${app}.app/Contents/Resources
198        xinstall -m 644 ${filespath}/Info.plist.in ${destroot}${applications_dir}/${app}.app/Contents/Info.plist
199        reinplace "s|@VERSION@|${version}|g" ${destroot}${applications_dir}/${app}.app/Contents/Info.plist
200        reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${applications_dir}/${app}.app/Contents/Info.plist
201        ln -s ${prefix}/bin/cmake-gui ${destroot}${applications_dir}/${app}.app/Contents/MacOS/cmake-gui
202        xinstall -m 644 ${worksrcpath}/Source/QtDialog/CMakeSetup.icns ${destroot}${applications_dir}/${app}.app/Contents/Resources/CMakeSetup.icns
203    }
204}
205
206variant gui description {Build Qt-based cmake-gui} {
207    configure.args-append --qt-gui
208
209    # when building the GUI with Qt, CMake uses C++11. So, make sure
210    # the compiler used is c++11 compliant.
211   
212    if {${configure.cxx_stdlib} eq "libstdc++"} {
213
214        # *clang* when using libstdc++ do not seem to support C++11;
215        # C++11 support seems to need GCC 4.7+ when using libstdc++;
216        # could use C++0x support on GCC4.[56], but just ignore it since
217        # there are newer compilers already in place as defaults.
218
219        # Blacklist GCC compilers not supporting C++11 and all CLANG.
220        # This is probably not necessary, but it's good practice.
221
222        compiler.blacklist-append *clang* {*gcc-3*} {*gcc-4.[0-6]}
223
224        # and whitelist those we do want to use. wish there were a better way.
225        # these will be used in the order provided.
226
227        compiler.whitelist macports-gcc-4.9 macports-gcc-4.8 macports-gcc-4.7
228
229    } else {
230
231        # using libc++;
232        # Blacklist Clang not supporting C++11 in some form and all GCC.
233        # Just use the cxx11 PortGroup for this specific case.
234
235        PortGroup cxx11 1.0
236
237    }
238}
239
240variant qt4 conflicts qt5 requires gui description {Build Qt GUI using Qt4} {
241    PortGroup qt4 1.0
242    if {${subport} eq ${name}} {
243        patchfiles-append patch-qt4gui.release.diff
244    } else {
245        patchfiles-append patch-qt4gui.devel.diff
246    }
247    configure.args-append --qt-qmake=${qt_qmake_cmd}
248}
249
250variant qt5 conflicts qt4 requires gui description {Build Qt GUI using Qt5} {
251    PortGroup qt5 1.0
252    if {${subport} eq ${name}} {
253        patchfiles-append patch-qt5gui.release.diff
254    } else {
255        patchfiles-append patch-qt5gui.devel.diff
256    }
257    configure.args-append --qt-qmake=${qt_qmake_cmd}
258}
259
260if {[variant_isset gui]} {
261    if {![variant_isset qt4] && ![variant_isset qt5]} {
262        default_variants +qt4
263    }
264
265    if {![variant_isset qt4] && ![variant_isset qt5]} {
266        ui_error "\n\nYou must select either the +qt4 or +qt5 variant when using variant +gui.\n"
267        return -code error "Invalid variant selection"
268    }
269} else {
270    configure.args-append --no-qt-gui
271}
272
273variant docs description {Build documentation: HTML and manpages} {
274    configure.args-append \
275        --mandir=share/man \
276        --sphinx-man \
277        --sphinx-html
278}
279
280variant python27 conflicts python34 requires docs description {Build documentation using Sphinx from Python 2.7} {
281    depends_build-append port:py27-sphinx
282    configure.args-append \
283        --sphinx-build=${prefix}/bin/sphinx-build-2.7
284}
285
286variant python34 conflicts python27 requires docs description {Build documentation using Sphinx from Python 3.4} {
287    depends_build-append port:py34-sphinx
288    configure.args-append \
289        --sphinx-build=${prefix}/bin/sphinx-build-3.4
290}
291
292if {[variant_isset docs]} {
293    if {![variant_isset python27] && ![variant_isset python34]} {
294        default_variants +python27
295    }
296
297    if {![variant_isset python27] && ![variant_isset python34]} {
298        ui_error "\n\nYou must select either the +python27 or +python34 variant when using variant +docs.\n"
299        return -code error "Invalid variant selection"
300    }
301}
Note: See TracBrowser for help on using the repository browser.