|
| 1 | +class Cmake < Formula |
| 2 | + desc "Cross-platform make" |
| 3 | + homepage "https://www.cmake.org/" |
| 4 | + url "https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3.tar.gz" |
| 5 | + mirror "http://fresh-center.net/linux/misc/cmake-3.30.3.tar.gz" |
| 6 | + mirror "http://fresh-center.net/linux/misc/legacy/cmake-3.30.3.tar.gz" |
| 7 | + sha256 "6d5de15b6715091df7f5441007425264bdd477809f80333fdf95f846aaff88e4" |
| 8 | + license "BSD-3-Clause" |
| 9 | + head "https://gitlab.kitware.com/cmake/cmake.git", branch: "master" |
| 10 | + |
| 11 | + # The "latest" release on GitHub has been an unstable version before, and |
| 12 | + # there have been delays between the creation of a tag and the corresponding |
| 13 | + # release, so we check the website's downloads page instead. |
| 14 | + livecheck do |
| 15 | + url "https://cmake.org/download/" |
| 16 | + regex(/href=.*?cmake[._-]v?(\d+(?:\.\d+)+)\.t/i) |
| 17 | + end |
| 18 | + |
| 19 | + bottle do |
| 20 | + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/cmake-3.30.3" |
| 21 | + sha256 cellar: :any_skip_relocation, aarch64_linux: "743e0b2f47179b3ca76bc288215a93262f15b804fbb0590532040ce2098506e1" |
| 22 | + end |
| 23 | + |
| 24 | + uses_from_macos "ncurses" |
| 25 | + |
| 26 | + on_linux do |
| 27 | + depends_on "openssl@3" |
| 28 | + end |
| 29 | + |
| 30 | + # The completions were removed because of problems with system bash |
| 31 | + |
| 32 | + # The `with-qt` GUI option was removed due to circular dependencies if |
| 33 | + # CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake. |
| 34 | + # For the GUI application please instead use `brew install --cask cmake`. |
| 35 | + |
| 36 | + def install |
| 37 | + args = %W[ |
| 38 | + --prefix=#{prefix} |
| 39 | + --no-system-libs |
| 40 | + --parallel=#{ENV.make_jobs} |
| 41 | + --datadir=/share/cmake |
| 42 | + --docdir=/share/doc/cmake |
| 43 | + --mandir=/share/man |
| 44 | + ] |
| 45 | + if OS.mac? |
| 46 | + args += %w[ |
| 47 | + --system-zlib |
| 48 | + --system-bzip2 |
| 49 | + --system-curl |
| 50 | + ] |
| 51 | + end |
| 52 | + |
| 53 | + system "./bootstrap", *args, "--", *std_cmake_args, |
| 54 | + "-DCMake_INSTALL_BASH_COMP_DIR=#{bash_completion}", |
| 55 | + "-DCMake_INSTALL_EMACS_DIR=#{elisp}", |
| 56 | + "-DCMake_BUILD_LTO=ON" |
| 57 | + system "make" |
| 58 | + system "make", "install" |
| 59 | + end |
| 60 | + |
| 61 | + def caveats |
| 62 | + <<~EOS |
| 63 | + To install the CMake documentation, run: |
| 64 | + brew install cmake-docs |
| 65 | + EOS |
| 66 | + end |
| 67 | + |
| 68 | + test do |
| 69 | + (testpath/"CMakeLists.txt").write("find_package(Ruby)") |
| 70 | + system bin/"cmake", "." |
| 71 | + |
| 72 | + # These should be supplied in a separate cmake-docs formula. |
| 73 | + refute_path_exists doc/"html" |
| 74 | + refute_path_exists man |
| 75 | + end |
| 76 | +end |
0 commit comments