-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[email protected]_py310 update formula to build on linux
- Loading branch information
Showing
1 changed file
with
30 additions
and
11 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 |
---|---|---|
|
@@ -22,7 +22,7 @@ class FreecadAT0202Py310 < Formula | |
depends_on "hdf5" => :build # requires fortran compiler | ||
# epends_on "llvm" => :build | ||
depends_on "mesa" => :build if OS.linux? | ||
depends_on "ninja" => :build | ||
depends_on "ninja" => :build if OS.linux? | ||
depends_on "pkg-config" => :build | ||
depends_on "[email protected]" => :build | ||
depends_on "tbb" => :build | ||
|
@@ -39,7 +39,8 @@ class FreecadAT0202Py310 < Formula | |
depends_on "freetype" | ||
depends_on "glew" | ||
depends_on "icu4c" | ||
depends_on macos: :high_sierra # no access to sierra test box | ||
depends_on macos: :high_sierra | ||
depends_on "mesa-glu" if OS.linux? # no access to sierra test box | ||
depends_on "openblas" | ||
depends_on "opencascade" | ||
depends_on "orocos-kdl" | ||
|
@@ -131,15 +132,18 @@ def install | |
# | ||
# NOTE: `which` cmd is not installed by default on some OSes | ||
# ENV["PYTHON"] = which("python3.10") | ||
# | ||
# Get the Python includes directory without duplicates | ||
ENV["PYTHON"] = Formula["[email protected]"].opt_bin/"python3.10" | ||
|
||
# Get the Python includes directory without duplicates | ||
py_inc_output = `python3.10-config --includes` | ||
py_inc_dirs = py_inc_output.scan(/-I([^\s]+)/).flatten.uniq | ||
py_inc_dir = py_inc_dirs.join(" ") | ||
|
||
py_lib_path = `python3.10-config --configdir`.strip + "/libpython3.10.dylib" | ||
py_lib_path = if OS.mac? | ||
`python3.10-config --configdir`.strip + "/libpython3.10.dylib" | ||
else | ||
`python3.10-config --configdir`.strip + "/libpython3.10.a" | ||
end | ||
|
||
puts "--------------------------------------------" | ||
puts "PYTHON=#{ENV["PYTHON"]}" | ||
|
@@ -199,6 +203,12 @@ def install | |
# cmake_prefix_paths << Formula["llvm"].prefix | ||
cmake_prefix_paths << Formula["tbb"].prefix | ||
|
||
if OS.linux? | ||
cmake_prefix_paths << Formula["mesa-glu"].prefix | ||
cmake_prefix_paths << Formula["mesa"].prefix | ||
cmake_prefix_paths << Formula["libx11"].prefix | ||
end | ||
|
||
cmake_prefix_path_string = cmake_prefix_paths.join(";") | ||
|
||
# Check if Xcode.app exists | ||
|
@@ -252,6 +262,19 @@ def install | |
] | ||
end | ||
|
||
if OS.linux? | ||
ninja_bin = Formula["ninja"].opt_bin/"ninja" | ||
gcc_ar = Formula["gcc"].opt_bin/"gcc-ar-13" | ||
# -DOPENGL_gl_LIBRARY= | ||
# -DOPENGL_INCLUDE_DIR= | ||
args_linux_only = %W[ | ||
-GNinja | ||
-DCMAKE_MAKE_PROGRAM=#{ninja_bin} | ||
-DX11_X11_INCLUDE_PATH=#{hbp}/opt/libx11/include/X11 | ||
-DCMAKE_AR=#{gcc_ar} | ||
] | ||
end | ||
|
||
args = %W[ | ||
-DHOMEBREW_PREFIX=#{hbp} | ||
-DCMAKE_PREFIX_PATH=#{cmake_prefix_path_string} | ||
|
@@ -282,15 +305,11 @@ def install | |
|
||
ENV.remove "CMAKE_FRAMEWORK_PATH", Formula["qt"].opt_prefix/"Frameworks" | ||
|
||
# TODO: ipatch, causes audit exception, ie. `brew style freecad/freecad` | ||
# TODO: ipatch, below cause audit exceptions, ie. `brew style freecad/freecad` | ||
# ENV.remove "PATH", Formula["[email protected]"].opt_prefix/"bin" | ||
# ENV.remove "PATH", Formula["[email protected]"].opt_prefix/"libexec/bin" | ||
# ENV.remove "PKG_CONFIG_PATH", Formula["[email protected]"].opt_prefix/"lib/pkgconfig" | ||
|
||
# NOTE: ipatch, required for successful build | ||
# ENV.prepend_path "PYTHONPATH", Formula["[email protected]"].opt_prefix/Language::Python.site_packages(python3) | ||
# ENV.prepend_path "PYTHONPATH", Formula["[email protected]"].opt_prefix/Language::Python.site_packages(python3) | ||
|
||
# NOTE: ipatch, do not make build dir a sub dir of the src dir | ||
puts "current working directory: #{Dir.pwd}" | ||
src_dir = Dir.pwd.to_s | ||
|
@@ -308,7 +327,7 @@ def install | |
if OS.mac? | ||
system "cmake", *args, *args_macos_only, src_dir.to_s | ||
else | ||
system "cmake", *args, src_dir.to_s | ||
system "cmake", *args, *args_linux_only, src_dir.to_s | ||
end | ||
system "cmake", "--build", build_dir.to_s | ||
system "cmake", "--install", build_dir.to_s | ||
|