mirror of
https://github.com/gromgit/homebrew-fuse.git
synced 2025-12-08 09:11:37 +00:00
Preliminary support for M1 builds
NOTE: I don't have an M1 Mac, so the only testing I can do is with a non-`/usr/local` Intel Homebrew installation. This should take care of "`cc` shim forbids `/usr/local` if Homebrew not installed under `/usr/local`", which is the default setup for M1 Homebrew.
This commit is contained in:
parent
7b0c9b121c
commit
2e2f25d0dc
29 changed files with 88 additions and 16 deletions
|
|
@ -23,35 +23,79 @@ end
|
|||
|
||||
# Add `setup_fuse` to base Formula class, for use by FUSE formulae
|
||||
class Formula
|
||||
def need_alt_fuse?
|
||||
HOMEBREW_PREFIX.to_s != "/usr/local"
|
||||
end
|
||||
|
||||
def alt_fuse_root
|
||||
buildpath/"temp"
|
||||
end
|
||||
|
||||
def fuse_cmake_args
|
||||
return unless need_alt_fuse?
|
||||
|
||||
%W[
|
||||
-DCMAKE_INCLUDE_PATH=#{alt_fuse_root}/include/fuse;#{alt_fuse_root}/include
|
||||
-DCMAKE_LIBRARY_PATH=#{alt_fuse_root}/lib
|
||||
-DCMAKE_CXX_FLAGS=-I#{alt_fuse_root}/include/fuse\ -D_USE_FILE_OFFSET_BITS=64
|
||||
-DPKG_CONFIG=#{fuse_pkgconfig}
|
||||
-DPKG_CONFIG_EXECUTABLE=#{fuse_pkgconfig}
|
||||
]
|
||||
# -DFUSE_INCLUDE_DIR=#{alt_fuse_root}/include/fuse
|
||||
# -DFUSE_LIBRARIES=#{alt_fuse_root}/lib/libfuse.dylib
|
||||
end
|
||||
|
||||
def setup_fuse_includes
|
||||
mkdir buildpath/"temp/include" do
|
||||
mkdir "#{alt_fuse_root}/include" do
|
||||
Dir["/usr/local/include/fuse*"].each { |f| cp_r f, "." }
|
||||
end
|
||||
end
|
||||
|
||||
def setup_fuse_libs
|
||||
mkdir buildpath/"temp/lib" do
|
||||
mkdir "#{alt_fuse_root}/lib" do
|
||||
Dir["/usr/local/lib/*fuse*"].each { |f| cp_r f, "." }
|
||||
end
|
||||
end
|
||||
|
||||
def setup_fuse_pkgconfig
|
||||
mkdir "#{alt_fuse_root}/bin" do
|
||||
cp path/"../../lib/fuse-pkg-config", "."
|
||||
inreplace "fuse-pkg-config", "%FUSE_ROOT%", "#{alt_fuse_root}"
|
||||
#ENV.prepend_path "PATH", "#{alt_fuse_root}/bin"
|
||||
end
|
||||
end
|
||||
|
||||
def fuse_pkgconfig
|
||||
return "#{alt_fuse_root}/bin/fuse-pkg-config" if need_alt_fuse?
|
||||
"pkg-config"
|
||||
end
|
||||
|
||||
def setup_fuse_env
|
||||
odebug "Setting up FUSE temp environment under #{buildpath}/temp"
|
||||
odebug "Setting up FUSE temp environment under #{alt_fuse_root}"
|
||||
setup_fuse_includes
|
||||
setup_fuse_libs
|
||||
Dir.glob(buildpath/"temp/**/*.*").each { |f| odebug ">>> #{f}" }
|
||||
setup_fuse_pkgconfig
|
||||
Dir.glob("#{alt_fuse_root}/**/*").each { |f| odebug ">>> #{f}" }
|
||||
end
|
||||
|
||||
def setup_fuse_flags
|
||||
ENV.append "CFLAGS", "-I#{buildpath}/temp/include"
|
||||
ENV.append "CFLAGS", "-I#{buildpath}/temp/include/fuse"
|
||||
ENV.append "CPPFLAGS", "-I#{buildpath}/temp/include"
|
||||
ENV.append "CPPFLAGS", "-I#{buildpath}/temp/include/fuse"
|
||||
ENV.append "LDFLAGS", "-I#{buildpath}/temp/lib"
|
||||
ENV.append "CFLAGS", "-I#{alt_fuse_root}/include"
|
||||
ENV.append "CFLAGS", "-I#{alt_fuse_root}/include/fuse"
|
||||
ENV.append "CFLAGS", "-D_USE_FILE_OFFSET_BITS=64"
|
||||
ENV.append "CPPFLAGS", "-I#{alt_fuse_root}/include"
|
||||
ENV.append "CPPFLAGS", "-I#{alt_fuse_root}/include/fuse"
|
||||
ENV.append "CPPFLAGS", "-D_USE_FILE_OFFSET_BITS=64"
|
||||
ENV.append "CXXFLAGS", "-I#{alt_fuse_root}/include"
|
||||
ENV.append "CXXFLAGS", "-I#{alt_fuse_root}/include/fuse"
|
||||
ENV.append "CXXFLAGS", "-D_USE_FILE_OFFSET_BITS=64"
|
||||
ENV.append "LDFLAGS", "-L#{alt_fuse_root}/lib"
|
||||
ENV.append "CGO_CPPFLAGS", "-I#{alt_fuse_root}/include"
|
||||
ENV.append "CGO_CPPFLAGS", "-D_USE_FILE_OFFSET_BITS=64"
|
||||
ENV.append "CGO_LDFLAGS", "-L#{alt_fuse_root}/lib"
|
||||
end
|
||||
|
||||
def setup_fuse
|
||||
return if HOMEBREW_PREFIX.to_s == "/usr/local"
|
||||
return unless need_alt_fuse?
|
||||
|
||||
setup_fuse_env
|
||||
setup_fuse_flags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue