Skip to content

Commit

Permalink
#medfile fix Python.h error
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatch committed Mar 5, 2024
1 parent c443960 commit 45bd918
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -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]

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

`brew install --verbose --build-bottle freecad/freecad/[email protected]` failed on macOS Sonoma (14) on Apple Silicon!

src/ci/CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo31.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo31.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo31.c.o -c /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/src/ci/_MEDfield23ComputingStepMeshInfo31.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o cd /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/src/ci && /opt/homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/opt/homebrew/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/include -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o -c /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/src/ci/_MEDfield23ComputingStepMeshInfo236.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o cd /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/src/ci && /opt/homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/opt/homebrew/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/include -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o -c /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/src/ci/_MEDfield23nProfile30.c cd /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/src/ci && /opt/homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/opt/homebrew/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/include -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o -c /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/src/ci/_MEDfield23nProfile236.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o cd /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/src/ci && /opt/homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/opt/homebrew/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/include -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o -MF CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o.d -o CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o -c /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/src/ci/MEDfield23nValueWithProfile.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/MEDfield23nProfile.c.o cd /tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/src/ci && /opt/homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/opt/homebrew/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-8054-zyfzdt/med-4.1.1/include -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/MEDfield23nPr

Check failure on line 44 in Formula/[email protected]

View workflow job for this annotation

GitHub Actions / test-bot (macos-13)

`brew install --verbose --build-bottle freecad/freecad/[email protected]` failed on macOS Ventura (13)!

2r1/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo31.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo31.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo31.c.o -c /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/src/ci/_MEDfield23ComputingStepMeshInfo31.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o cd /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/src/ci && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/usr/local/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23ComputingStepMeshInfo236.c.o -c /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/src/ci/_MEDfield23ComputingStepMeshInfo236.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o cd /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/src/ci && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/usr/local/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23nProfile30.c.o -c /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/src/ci/_MEDfield23nProfile30.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o cd /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/src/ci && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/usr/local/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o -MF CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o.d -o CMakeFiles/_ci_static.dir/_MEDfield23nProfile236.c.o -c /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/src/ci/_MEDfield23nProfile236.c [ 94%] Building C object src/ci/CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o cd /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/src/ci && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/usr/local/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -MD -MT src/ci/CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o -MF CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o.d -o CMakeFiles/_ci_static.dir/MEDfield23nValueWithProfile.c.o -c /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/src/ci/MEDfield23nValueWithProfile.c [ 95%] Building C object src/ci/CMakeFiles/_ci_static.dir/MEDfield23ComputingStepMeshInfo.c.o cd /tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/src/ci && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DH5_USE_16_API -DH5_USE_18_API -DMED3_USESTATIC -I/usr/local/opt/hdf5/include -I/tmp/med-fileA4.1.1-20240305-13879-a5m2r1/med-4.1.1/build/include -I/tmp/med-fileA4.1.1-20240305-
# 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"
Expand Down

0 comments on commit 45bd918

Please sign in to comment.