Skip to content

Commit 391cbd4

Browse files
EricFromCanadagromgit
authored andcommitted
rofs-filtered-mac: update build
Closes #99. Signed-off-by: Adrian Ho <[email protected]>
1 parent 768e89c commit 391cbd4

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

Formula/rofs-filtered-mac.rb

+36-4
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,50 @@ class RofsFilteredMac < Formula
1616
end
1717

1818
depends_on "cmake" => :build
19+
depends_on "pkgconf" => :build
1920
depends_on MacfuseRequirement
2021
depends_on :macos
2122

23+
# Use pkgconfig to find FUSE
24+
patch :DATA
25+
2226
def install
2327
setup_fuse
24-
mkdir "build" do
25-
system "cmake", "..", "-DCMAKE_INSTALL_SYSCONFDIR=#{etc}", *fuse_cmake_args, *std_cmake_args
26-
system "make", "install"
27-
end
28+
system "cmake", "-S", ".", "-B", "build",
29+
"-DCMAKE_INSTALL_SYSCONFDIR=#{etc}",
30+
*fuse_cmake_args, *std_cmake_args
31+
system "cmake", "--build", "build"
32+
system "cmake", "--install", "build"
2833
end
2934

3035
test do
3136
system "#{bin}/rofs-filtered", "--version"
3237
end
3338
end
39+
__END__
40+
diff --git a/CMakeLists.txt b/CMakeLists.txt
41+
index 53a6687..cb4f121 100644
42+
--- a/CMakeLists.txt
43+
+++ b/CMakeLists.txt
44+
@@ -12,8 +12,8 @@ add_definitions(-D_GNU_SOURCE)
45+
set(CMAKE_C_FLAGS "-Wall -std=c99")
46+
47+
# find fuse library
48+
-find_package (FUSE REQUIRED)
49+
-include_directories (${FUSE_INCLUDE_DIR})
50+
+find_package(PkgConfig REQUIRED)
51+
+pkg_check_modules(FUSE fuse REQUIRED)
52+
add_definitions(-D_FILE_OFFSET_BITS=64)
53+
54+
# generate config file
55+
@@ -24,7 +24,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
56+
57+
# create and configure targets
58+
add_executable(rofs-filtered rofs-filtered.c)
59+
-target_link_libraries(rofs-filtered ${FUSE_LIBRARIES})
60+
+target_include_directories(rofs-filtered PUBLIC ${FUSE_INCLUDE_DIRS})
61+
+target_link_libraries(rofs-filtered PUBLIC ${LIBS} ${FUSE_LDFLAGS})
62+
+target_compile_options(rofs-filtered PUBLIC ${FUSE_CFLAGS})
63+
64+
# configure installation
65+
install(TARGETS rofs-filtered DESTINATION ${CMAKE_INSTALL_BINDIR})

0 commit comments

Comments
 (0)