# -*- 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 PortSystem 1.0 # cmake does not build universal on BigSur Intel if { ${os.platform} eq "darwin" && ${os.major} >= 20 && ${build_arch} eq "x86_64"} { universal_variant no } else { PortGroup muniversal 1.0 } PortGroup github 1.0 PortGroup legacysupport 1.1 # CMake is a dependency of clang PortGroup clang_dependency 1.0 name cmake conflicts cmake-devel categories devel license BSD installs_libs no maintainers {michaelld @michaelld} description Cross-platform make set base_long_description \ "An extensible, open-source system that manages the build \ process in an operating system and compiler independent manner. \ Unlike many cross-platform systems, CMake is designed to be \ used in conjunction with the native build environment." homepage https://cmake.org platforms darwin freebsd github.setup Kitware CMake 3.24.4 v checksums rmd160 27361e6bac14691aacb46a132d7c016f39b022a9 \ sha256 32c9e499510eff7070d3f0adfbabe0afea2058608c5fa93e231beb49fbfa2296 \ size 10400358 revision 0 # limit livecheck to the current major.minor version set branch [join [lrange [split ${version} .] 0 1] .] github.livecheck.regex ([quotemeta ${branch}]\\.\[0-9.\]+) github.tarball_from releases distname ${name}-${version} # CMake can be built with C++11, but some older Clang on OSX 10.9 and # earlier claim C++11 support yet don't actually support certain features. # Bump to C++14 to avoid these issues. # See also https://trac.macports.org/ticket/66340 and # https://trac.macports.org/ticket/66040 compiler.cxx_standard 2014 platform darwin { if {!((${os.major} < 9) || ${build_arch} eq "ppc" || ${build_arch} eq "ppc64")} { depends_lib-append port:libcxx configure.cxx_stdlib libc++ } } # OSX <= 10.11 does not provide "clock_gettime" legacysupport.newest_darwin_requires_legacy 15 # see https://trac.macports.org/ticket/59832 # see https://trac.macports.org/ticket/60885 legacysupport.redirect_bins cmake ccmake cpack ctest long_description ${base_long_description} \ The ${subport} release port is updated roughly every few months. patchfiles-append \ patch-Modules-noArchCheck.diff \ patch-CMakeFindFrameworks.cmake.diff \ patch-Source_Modules_FindLibUV.cmake.diff \ patch-fix_cxx14_17_checks.diff \ patch-fix-system-prefix-path.diff \ patch-cmake-leopard-tiger.diff \ patch-fix-clock_gettime-test.diff \ patch-qt5gui.diff \ patch-cmake-cmInstallRuntime-initializer-fix.diff depends_lib-append \ port:curl \ port:expat \ port:zlib \ port:bzip2 \ port:libarchive \ port:ncurses \ port:libuv # configure is just a shell script that passes directly to bootstrap configure.cmd ./bootstrap # bootstrap takes cmake-style args for the build of the cmake to # be installed. the args are passed as usual for cmake, after # "--", so we pass them as post_args configure.post_args -- configure.env-append \ CMAKE_PREFIX_PATH=${prefix} \ CMAKE_INCLUDE_PATH=${prefix}/include/ncurses \ CMAKE_LIBRARY_PATH=${prefix}/lib # Check if the default compiler has yet to be installed. Used to # prevent circular deps involving variants. Has to be tested here # before our blacklisting and whitelisting is applied. if {${os.platform} eq "darwin" && ${os.major} <= 10 && ${cxx_stdlib} eq "libc++" && ![file exists ${configure.cxx}]} { set cmake_bootstrapping yes } # clang 3.4 can't build certain parts of the # cmake self-testing infrastructure # https://trac.macports.org/ticket/59782 if {${configure.compiler} eq "macports-clang-3.4"} { configure.post_args-append -DBUILD_TESTING=OFF } platform darwin { configure.env-append \ CMAKE_OSX_DEPLOYMENT_TARGET=${macosx_deployment_target} if {${configure.sdkroot} eq ""} { configure.env-append SDKROOT=/ } if {${os.arch} eq "i386" && ${os.major} <= 9} { # The old system headers do some bit shifting on Intel about which # newer compilers throw errors: # SecKeychain.h:102:46: error: shift expression '(1853123693 << 8)' overflows [-fpermissive] configure.cflags-append -fpermissive configure.cxxflags-append -fpermissive } if {${os.major} >= 11 && ${os.major} <= 12} { # some functions in xlocale.h are hidden without this define # https://trac.macports.org/ticket/60885 configure.cxxflags-append -D_DARWIN_C_SOURCE } } # jsoncpp 1.0+ requires CMake for building; circular dependencies # are not possible in MacPorts. In addition, jsoncpp uses C++, so # it would not be possible for CMake, which uses libc++ on # 10.6-10.8, to link with a MacPorts copy of jsoncpp, which would # usually use libstdc++ on those systems. Fortunately CMake comes # bundled with its own internal copy of jsoncpp, so we use that. configure.args-append \ --docdir=share/doc/cmake \ --parallel=${build.jobs} \ --init=${worksrcpath}/macports.cmake \ --system-libs \ --no-system-jsoncpp \ --no-system-librhash configure.universal_args # CMake's configure script doesn't recognize `--host`. array set merger_host {i386 {} x86_64 {} ppc {} ppc64 {} arm64 {}} platform darwin 8 { configure.ldflags-append -Wl,-framework -Wl,ApplicationServices } # Leopard's Rosetta has some difficulties configuring the ppc slice platform darwin 9 { global universal_archs_supported if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} { supported_archs i386 x86_64 } elseif {${build_arch} eq "ppc" || ${build_arch} eq "ppc64"} { supported_archs ppc ppc64 } set universal_archs_supported ${supported_archs} } build.post_args VERBOSE=ON post-patch { # copy cmake init file, ready to be patched below copy ${filespath}/macports.cmake ${worksrcpath} # patch PREFIX reinplace "s|__PREFIX__|${prefix}|g" \ ${worksrcpath}/macports.cmake \ ${worksrcpath}/Modules/Platform/Darwin.cmake # patch FRAMEWORKS reinplace "s|__FRAMEWORKS_DIR__|${frameworks_dir}|g" \ ${worksrcpath}/Modules/CMakeFindFrameworks.cmake # patch APPLICATIONS_DIR reinplace "s|__APPLICATIONS_DIR__|${applications_dir}|g" \ ${worksrcpath}/macports.cmake } post-destroot { xinstall -d -m 0755 ${destroot}${prefix}/share/emacs/site-lisp xinstall -m 0644 ${worksrcpath}/Auxiliary/cmake-mode.el \ ${destroot}${prefix}/share/emacs/site-lisp foreach type {syntax indent} { xinstall -d -m 0755 ${destroot}${prefix}/share/vim/vimfiles/${type} xinstall -m 0644 -W ${worksrcpath}/Auxiliary/vim/${type} cmake.vim \ ${destroot}${prefix}/share/vim/vimfiles/${type} } } # All the variants create circular dependencies on 10.6 with libc++, # due to the default compiler needing cmake to build. if {[info exists cmake_bootstrapping]} { set some_variant_disabled 0 foreach vname { qt5 docs python35 python36 python37 python38 python39 python310 python311 } { if {[variant_isset $vname]} { unset ::variations($vname) set some_variant_disabled 1 } } if {$some_variant_disabled} { notes-append "Installing $name with variants would create\ circular dependencies, so all variants have been\ deselected. You can install again with your desired\ variants after the default compiler has been installed." } } variant qt5 description {Build Qt GUI using Qt5} { PortGroup qt5 1.0 configure.args-append --qt-gui --qt-qmake=${qt_qmake_cmd} } if {![variant_isset qt5]} { configure.args-append --no-qt-gui } # Supported pythons set python_versions {35 36 37 38 39 310 311} # declare all +python* variants, with conflicts foreach pyver ${python_versions} { # Conflicting python versions set other_python_versions {} foreach other_pyver ${python_versions} { if {${other_pyver} ne ${pyver}} { if {${other_pyver} ni ${other_python_versions}} { lappend other_python_versions python${other_pyver} } } } set python_branch "[string index ${pyver} 0].[string range ${pyver} 1 end]" variant python${pyver} conflicts {*}${other_python_versions} description "Build documentation using ${python_branch} sphinx" {} } # +docs requires one +python* variant if {[variant_isset docs]} { # see if one or more +python* variants is set set python_isset false foreach pyver ${python_versions} { if {!${python_isset}} { set python_isset [variant_isset python${pyver}] set python_isset_ver_no_dot ${pyver} } elseif {[variant_isset python${pyver}]} { ui_error "\n\nDetected multiple +python* variants: +python${python_isset_ver_no_dot} and +python${pyver}.\nCannot have multiple +python* variants set.\n" return -code error "Invalid variant selection" } } # set default +python* variant if none were already selected if {!${python_isset}} { default_variants +python311 } # make sure one of the +python* variants is set # this loop checks for "+docs" and - default Python variant set python_isset false foreach pyver ${python_versions} { if {!${python_isset}} { set python_isset [variant_isset python${pyver}] set PYTHON_VERSION_WITH_DOT "[string index ${pyver} 0].[string range ${pyver} 1 end]" set PYTHON_VERSION_NO_DOT ${pyver} } } if {!${python_isset}} { ui_error "\n\nYou must select exactly one of the +python35, +python36, +python37, +python38, +python39, +python310, or +python311 variants when using variant +docs.\n" return -code error "Invalid variant selection" } } variant docs description {Build documentation: HTML and manpages} { configure.args-append \ --mandir=share/man \ --sphinx-man \ --sphinx-html \ --sphinx-build=${prefix}/bin/sphinx-build-${PYTHON_VERSION_WITH_DOT} depends_build-append \ port:py${PYTHON_VERSION_NO_DOT}-sphinx \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-applehelp \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-devhelp \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-htmlhelp \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-jsmath \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-qthelp \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-serializinghtml \ port:py${PYTHON_VERSION_NO_DOT}-sphinxcontrib-websupport post-patch { reinplace "s|__PYTHON_VERSION_WITH_DOT__|${PYTHON_VERSION_WITH_DOT}|g" ${worksrcpath}/macports.cmake } }