From 391cbd467033862c8a4295040a0257f42eff4088 Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Wed, 12 Feb 2025 14:45:01 -0500 Subject: [PATCH] rofs-filtered-mac: update build Closes #99. Signed-off-by: Adrian Ho <215702+gromgit@users.noreply.github.com> --- Formula/rofs-filtered-mac.rb | 40 ++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/Formula/rofs-filtered-mac.rb b/Formula/rofs-filtered-mac.rb index b9c212d..02e584e 100644 --- a/Formula/rofs-filtered-mac.rb +++ b/Formula/rofs-filtered-mac.rb @@ -16,18 +16,50 @@ class RofsFilteredMac < Formula end depends_on "cmake" => :build + depends_on "pkgconf" => :build depends_on MacfuseRequirement depends_on :macos + # Use pkgconfig to find FUSE + patch :DATA + def install setup_fuse - mkdir "build" do - system "cmake", "..", "-DCMAKE_INSTALL_SYSCONFDIR=#{etc}", *fuse_cmake_args, *std_cmake_args - system "make", "install" - end + system "cmake", "-S", ".", "-B", "build", + "-DCMAKE_INSTALL_SYSCONFDIR=#{etc}", + *fuse_cmake_args, *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" end test do system "#{bin}/rofs-filtered", "--version" end end +__END__ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 53a6687..cb4f121 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,8 +12,8 @@ add_definitions(-D_GNU_SOURCE) + set(CMAKE_C_FLAGS "-Wall -std=c99") + + # find fuse library +-find_package (FUSE REQUIRED) +-include_directories (${FUSE_INCLUDE_DIR}) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(FUSE fuse REQUIRED) + add_definitions(-D_FILE_OFFSET_BITS=64) + + # generate config file +@@ -24,7 +24,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) + + # create and configure targets + add_executable(rofs-filtered rofs-filtered.c) +-target_link_libraries(rofs-filtered ${FUSE_LIBRARIES}) ++target_include_directories(rofs-filtered PUBLIC ${FUSE_INCLUDE_DIRS}) ++target_link_libraries(rofs-filtered PUBLIC ${LIBS} ${FUSE_LDFLAGS}) ++target_compile_options(rofs-filtered PUBLIC ${FUSE_CFLAGS}) + + # configure installation + install(TARGETS rofs-filtered DESTINATION ${CMAKE_INSTALL_BINDIR})