-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,59 +15,64 @@ class MedFileAT411 < Formula | |
sha256 cellar: :any, mojave: "ccdbcb2c39a985b2a4538fc96e39354312635b84f50761c5ebbf1f2206d02faf" | ||
end | ||
|
||
# TODO: a valid regex is required for livecheck | ||
# livecheck do | ||
# url :stable | ||
# # url "https://files.salome-platform.org/Salome/other/" | ||
# # regex(/^v?(\d+(?:\.\d+)+)$/i) | ||
# # regex(/^med-4.\d.\d.tar.gz$/i) | ||
# end | ||
|
||
depends_on "cmake" => :build | ||
depends_on "freecad/freecad/[email protected]" => :build | ||
depends_on "[email protected]" => :build | ||
depends_on "gcc" | ||
depends_on "hdf5" | ||
depends_on "libaec" | ||
|
||
patch do | ||
# TODO: add shasum | ||
url "https://raw.githubusercontent.com/FreeCAD/homebrew-freecad/8efd96c520e35c36cbd55460669a643b53b27c29/patches/med-file-4.1.1-cmake-find-python-h.patch" | ||
sha256 "8fe32c1217704c5c963f35adbf1a05f3e7e3f1b3db686066c5bdd34bf45e409a" | ||
end | ||
|
||
patch do | ||
url "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/med/files/med-4.1.0-0003-build-against-hdf5-1.14.patch" | ||
sha256 "d4551df69f4dcb3c8a649cdeb0a6c9d27a03aebc0c6dcdba74cac39a8732f8d1" | ||
end | ||
|
||
# def pythons | ||
# deps.map(&:to_formula) | ||
# .select { |f| f.name.match?(/^python@3\.\d+$/) } | ||
# TODO: a valid regex is required for livecheck | ||
# livecheck do | ||
# url :stable | ||
# # url "https://files.salome-platform.org/Salome/other/" | ||
# # regex(/^v?(\d+(?:\.\d+)+)$/i) | ||
# # regex(/^med-4.\d.\d.tar.gz$/i) | ||
# end | ||
|
||
def pythons | ||
deps.map(&:to_formula) | ||
.select { |f| f.name.match?(/^python@\d\.\d+$/) } | ||
.map { |f| f.opt_libexec/"bin/python" } | ||
end | ||
|
||
def python3 | ||
"python3.11" | ||
end | ||
|
||
def install | ||
Check warning on line 44 in Formula/[email protected]
|
||
# ENV.cxx11 | ||
hbp = HOMEBREW_PREFIX | ||
|
||
# hb default values not used | ||
rm_std_cmake_args = [ | ||
"-DBUILD_TESTING=OFF", | ||
"-DCMAKE_INSTALL_LIBDIR", | ||
] | ||
|
||
args = std_cmake_args + %W[ | ||
-DHOMEBREW_PREFIX=#{hbp} | ||
-DMEDFILE_BUILD_PYTHON=ON | ||
-DMEDFILE_BUILD_TESTS=OFF | ||
-DMEDFILE_INSTALL_DOC=OFF | ||
-DPYTHON_EXECUTABLE=#{which(python3)}" | ||
-DCMAKE_PREFIX_PATH=#{Formula["hdf5"].opt_lib};#{Formula["gcc"].opt_lib}; | ||
-DPYTHON_EXECUTABLE=#{Formula["[email protected]"].opt_bin}/python3.11 | ||
-DCMAKE_PREFIX_PATH=#{Formula["hdf5"].opt_prefix};#{Formula["gcc"].opt_prefix}; | ||
-DCMAKE_INSTALL_RPATH=#{rpath} | ||
] | ||
|
||
args << if OS.mac? | ||
"-DPYTHON_LIBRARY=#{hbp}/opt/[email protected]/Frameworks/Python.framework/Versions/Current/lib/libpython3.11.dylib" | ||
if OS.mac? | ||
args << "-DPYTHON_LIBRARY=#{hbp}/opt/[email protected]/Frameworks/Python.framework/Versions/Current/lib" \ | ||
"/libpython3.11.dylib" | ||
else | ||
"-DPYTHON_LIBRARY=#{hbp}/opt/[email protected]/lib/libpython3.11.so" | ||
# NOTE: specifying the below cmake var still did not help in finding `Python.h` | ||
args << "-DPYTHON_INCLUDE_DIRS=#{hbp}/opt/[email protected]/include/python3.11" | ||
args << "-DPYTHON_LIBRARY=#{hbp}/opt/[email protected]/lib/libpython3.11.so" | ||
end | ||
|
||
# Remove unwanted values from args | ||
args.reject! { |arg| rm_std_cmake_args.any? { |value| arg.include?(value) } } | ||
|
||
mkdir "build" do | ||
system "cmake", "..", *args | ||
system "make" | ||
|