require/macfuse: generate/use alt fuse.pc

This commit is contained in:
Adrian Ho 2021-08-17 20:17:38 +08:00
parent b4c0a2c740
commit 534bfb04c1

View file

@ -38,9 +38,9 @@ class Formula
-DCMAKE_INCLUDE_PATH=#{alt_fuse_root}/include/fuse;#{alt_fuse_root}/include -DCMAKE_INCLUDE_PATH=#{alt_fuse_root}/include/fuse;#{alt_fuse_root}/include
-DCMAKE_LIBRARY_PATH=#{alt_fuse_root}/lib -DCMAKE_LIBRARY_PATH=#{alt_fuse_root}/lib
-DCMAKE_CXX_FLAGS=-I#{alt_fuse_root}/include/fuse\ -D_USE_FILE_OFFSET_BITS=64 -DCMAKE_CXX_FLAGS=-I#{alt_fuse_root}/include/fuse\ -D_USE_FILE_OFFSET_BITS=64
-DPKG_CONFIG=#{fuse_pkgconfig}
-DPKG_CONFIG_EXECUTABLE=#{fuse_pkgconfig}
] ]
# -DPKG_CONFIG=#{fuse_pkgconfig}
# -DPKG_CONFIG_EXECUTABLE=#{fuse_pkgconfig}
# -DFUSE_INCLUDE_DIR=#{alt_fuse_root}/include/fuse # -DFUSE_INCLUDE_DIR=#{alt_fuse_root}/include/fuse
# -DFUSE_LIBRARIES=#{alt_fuse_root}/lib/libfuse.dylib # -DFUSE_LIBRARIES=#{alt_fuse_root}/lib/libfuse.dylib
end end
@ -58,16 +58,25 @@ class Formula
end end
def setup_fuse_pkgconfig def setup_fuse_pkgconfig
mkdir "#{alt_fuse_root}/bin" do ### OLD METHOD: Fake pkg-config
cp path/"../../lib/fuse-pkg-config", "." # mkdir "#{alt_fuse_root}/bin" do
inreplace "fuse-pkg-config", "%FUSE_ROOT%", "#{alt_fuse_root}" # cp path/"../../lib/fuse-pkg-config", "."
# inreplace "fuse-pkg-config", "%FUSE_ROOT%", "#{alt_fuse_root}"
# end
# ENV["PKG_CONFIG"] = "#{fuse_pkgconfig}"
### NEW METHOD: Fix fuse.pc in alt root
mkdir "#{alt_fuse_root}/lib/pkgconfig" do
cp "/usr/local/lib/pkgconfig/fuse.pc", "."
inreplace "fuse.pc", "/usr/local", alt_fuse_root.to_s
end end
ENV.prepend_path "PKG_CONFIG_PATH", "#{alt_fuse_root}/lib/pkgconfig"
end end
def fuse_pkgconfig # def fuse_pkgconfig
return "#{alt_fuse_root}/bin/fuse-pkg-config" if need_alt_fuse? # return "#{alt_fuse_root}/bin/fuse-pkg-config" if need_alt_fuse?
"pkg-config" # "pkg-config"
end # end
def setup_fuse_env def setup_fuse_env
odebug "Setting up FUSE temp environment under #{alt_fuse_root}" odebug "Setting up FUSE temp environment under #{alt_fuse_root}"
@ -91,8 +100,8 @@ class Formula
ENV.append "CGO_CPPFLAGS", "-I#{alt_fuse_root}/include" ENV.append "CGO_CPPFLAGS", "-I#{alt_fuse_root}/include"
ENV.append "CGO_CPPFLAGS", "-D_USE_FILE_OFFSET_BITS=64" ENV.append "CGO_CPPFLAGS", "-D_USE_FILE_OFFSET_BITS=64"
ENV.append "CGO_LDFLAGS", "-L#{alt_fuse_root}/lib" ENV.append "CGO_LDFLAGS", "-L#{alt_fuse_root}/lib"
ENV["PKG_CONFIG"] = "#{fuse_pkgconfig}"
odebug "PKG_CONFIG = #{ENV["PKG_CONFIG"]}" odebug "PKG_CONFIG = #{ENV["PKG_CONFIG"]}"
odebug "PKG_CONFIG_PATH = #{ENV["PKG_CONFIG_PATH"]}"
odebug "CFLAGS = #{ENV["CFLAGS"]}" odebug "CFLAGS = #{ENV["CFLAGS"]}"
end end