formula: allow std_cmake_args to take parameters

We have a handful of of formulae that do `std_cmake_args.reject` to
override some of flags (e.g. emscripten, icemon, ortp, qt, klee,
watchman).

Let's try to simplify some of this code by allowing these formulae to
override these flags by passing arguments to `std_cmake_args`.

While we're here, let's update the type signature of `std_cargo_args`.
This commit is contained in:
Carlo Cabrera 2021-08-10 11:55:00 +08:00
parent 764959b73a
commit 12435565f3
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -1480,7 +1480,7 @@ class Formula
end
# Standard parameters for cargo builds.
sig { params(root: String, path: String).returns(T::Array[T.any(String, Pathname)]) }
sig { params(root: T.any(String, Pathname), path: String).returns(T::Array[T.any(String, Pathname)]) }
def std_cargo_args(root: prefix, path: ".")
["--locked", "--root", root, "--path", path]
end
@ -1490,13 +1490,19 @@ class Formula
# Setting `CMAKE_FIND_FRAMEWORK` to "LAST" tells CMake to search for our
# libraries before trying to utilize Frameworks, many of which will be from
# 3rd party installs.
sig { returns(T::Array[String]) }
def std_cmake_args
sig {
params(
install_prefix: T.any(String, Pathname),
install_libdir: String,
find_framework: String,
).returns(T::Array[String])
}
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")
args = %W[
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_INSTALL_PREFIX=#{install_prefix}
-DCMAKE_INSTALL_LIBDIR=#{install_libdir}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_FIND_FRAMEWORK=#{find_framework}
-DCMAKE_VERBOSE_MAKEFILE=ON
-Wno-dev
-DBUILD_TESTING=OFF