Skip to content

Commit

Permalink
Fix macapp build with homebrew(inreplace solution).
Browse files Browse the repository at this point in the history
  • Loading branch information
ageeye committed Jul 31, 2021
1 parent df3c4d9 commit d96d1f7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Formula/freecad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ def install
ENV["CC"] = Formula["llvm"].opt_bin/"clang"
ENV["CXX"] = Formula["llvm"].opt_bin/"clang++"
end

# NOTE: bundle fixes, should integrated in freecad source code
if build.with? 'macos-app'
cmakelist = 'src/MacAppBundle/CMakeLists.txt'
gccfra = Formula['gcc']
gcctxt = gccfra.lib.to_s + '/gcc/' + gccfra.version.to_s.split('.')[0]
inreplace cmakelist do |ln|
ln.gsub! '/usr/local', '${HOMEBREW_PREFIX}' # similar HOMEBREW_PREFIX.to_s
ln.gsub! 'Cellar/icu4c', 'Cellar/icu4c@67.1' # formula is renamed with version
ln.gsub! '${WEBKIT_FRAMEWORK_DIR}', '' if Hardware::CPU.arm? # do not need for apple silicon, see below
ln.gsub! 'pkg_check_modules(ICU icu-uc)', "pkg_check_modules(ICU icu-uc)\n\nfind_package(OpenCasCade)\nfind_package(llvm)\n" # from other PR stolen
ln.gsub! '${MACPORTS_PREFIX}/lib', '/lib ${LLVM_LIBRARY_DIR} ${OCC_LIBRARY_DIR} ' + gcctxt # from other PR + gcc lib path
end
end

python_exe = Formula["#{@tap}/python3.9"].opt_prefix/"bin/python3"
python_headers = Formula["#{@tap}/python3.9"].opt_prefix/"Frameworks/Python.framework/Headers"
Expand Down

0 comments on commit d96d1f7

Please sign in to comment.