Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected]_py310: rebottle for linux #509

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions Formula/[email protected]_py310.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class Shiboken2AT51511Py310 < Formula

depends_on "cmake" => :build
depends_on "[email protected]" => :build
depends_on "freecad/freecad/[email protected]_py310"
depends_on "llvm@15"
depends_on "numpy"
depends_on "qt@5"
depends_on "sphinx-doc"

Expand All @@ -35,22 +35,37 @@ def install
rpaths = if OS.mac?
shiboken2_module = prefix/Language::Python.site_packages(python3)/"shiboken2"
[rpath, rpath(source: shiboken2_module)]
elsif OS.linux?
shiboken2_module = prefix/Language::Python.site_packages(python3)/"shiboken2"
[rpath, rpath(source: shiboken2_module)]
end

ENV.append_path "CMAKE_PREFIX_PATH", Formula["qt@5"].opt_lib
ENV.append_path "CMAKE_PREFIX_PATH", Formula["llvm@15"].opt_lib
ENV.append_path "CMAKE_PREFIX_PATH", Formula["freecad/freecad/[email protected]_py310"].opt_lib

cmake_args = std_cmake_args

# NOTE: ipatch, build will fail if using `python3` cmake requires major+minor ie. `python3.10`
python_executable = Formula["[email protected]"].opt_bin/"python3.10"
python_lib = Formula["[email protected]"].opt_lib/"libpython3.10.dylib"
py_exe = Formula["[email protected]"].opt_bin/"python3.10"

py_lib = if OS.mac?
Formula["[email protected]"].opt_lib/"libpython3.10.dylib"
else
Formula["[email protected]"].opt_lib/"libpython3.10.so"
end

cmake_args << "-DPYTHON_EXECUTABLE=#{python_executable}"
cmake_args << "-DPYTHON_LIBRARY=#{python_lib}"
cmake_args << "-DPYTHON_EXECUTABLE=#{py_exe}"
cmake_args << "-DPYTHON_LIBRARY=#{py_lib}"

cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"

# Avoid shim reference.
# NOTE: ipatch, required or linux bottle will not build
# ref: https://github.com/FreeCAD/homebrew-freecad/pull/509#issuecomment-2098926437
inreplace "sources/shiboken2/ApiExtractor/CMakeLists.txt", "${CMAKE_CXX_COMPILER}", ENV.cxx

system "cmake", "-S", "./sources/shiboken2", "-B", "build",
"-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}",
"-DFORCE_LIMITED_API=no",
"-DLLVM_CONFIG=#{Formula["llvm@15"].opt_bin}/llvm-config",
"-DCMAKE_LIBRARY_PATH=#{Formula["llvm@15"].opt_lib}",
Expand All @@ -59,6 +74,14 @@ def install

system "cmake", "--build", "build"
system "cmake", "--install", "build"

if OS.linux?
# remove references to the Homebrew shims directory
#---
# NOWORK!
# inreplace bin/"shiboken2", Superenv.shims_path, "/usr/bin"
#---
end
end

def post_install
Expand Down
Loading