lol
1diff --git a/.travisci/install.sh b/.travisci/install.sh
2index 9057a75b..2929c360 100755
3--- a/.travisci/install.sh
4+++ b/.travisci/install.sh
5@@ -6,12 +6,11 @@ set -e
6 if [ "${CXX}" == "g++" ]; then
7 # We need to uninstall oclint because it creates a /usr/local/include/c++ symlink that clashes with the gcc5 package
8 # see https://github.com/Homebrew/homebrew-core/issues/21172
9- brew cask uninstall oclint
10+ brew uninstall oclint
11 brew install gcc@7
12 fi
13
14-brew cask install osxfuse
15-brew install libomp
16+brew install libomp pkg-config macfuse
17
18 # By default, travis only fetches the newest 50 commits. We need more in case we're further from the last version tag, so the build doesn't fail because it can't generate the version number.
19 git fetch --unshallow --tags
20diff --git a/README.md b/README.md
21index b0f4a684..7001119a 100644
22--- a/README.md
23+++ b/README.md
24@@ -19,7 +19,7 @@ OSX
25
26 CryFS is distributed via Homebrew. Just do
27
28- brew cask install osxfuse
29+ brew install osxfuse
30 brew install cryfs
31
32 Windows (experimental)
33@@ -45,6 +45,7 @@ Requirements
34 - Git (for getting the source code)
35 - GCC version >= 5.0 or Clang >= 4.0
36 - CMake version >= 3.0
37+ - pkg-config (on Unix)
38 - libcurl4 (including development headers)
39 - Boost libraries version >= 1.65.1 (including development headers)
40 - filesystem
41@@ -53,20 +54,20 @@ Requirements
42 - program_options
43 - thread
44 - SSL development libraries (including development headers, e.g. libssl-dev)
45- - libFUSE version >= 2.8.6 (including development headers), on Mac OS X instead install osxfuse from https://osxfuse.github.io/
46+ - libFUSE version >= 2.8.6 (including development headers), on Mac OS X instead install macFUSE from https://osxfuse.github.io/
47 - Python >= 2.7
48 - OpenMP
49
50 You can use the following commands to install these requirements
51
52 # Ubuntu
53- $ sudo apt install git g++ cmake make libcurl4-openssl-dev libboost-filesystem-dev libboost-system-dev libboost-chrono-dev libboost-program-options-dev libboost-thread-dev libssl-dev libfuse-dev python
54+ $ sudo apt install git g++ cmake make pkg-config libcurl4-openssl-dev libboost-filesystem-dev libboost-system-dev libboost-chrono-dev libboost-program-options-dev libboost-thread-dev libssl-dev libfuse-dev python
55
56 # Fedora
57- sudo dnf install git gcc-c++ cmake make libcurl-devel boost-devel boost-static openssl-devel fuse-devel python
58+ sudo dnf install git gcc-c++ cmake make pkgconf libcurl-devel boost-devel boost-static openssl-devel fuse-devel python
59
60 # Macintosh
61- brew install cmake boost openssl libomp
62+ brew install cmake pkg-config boost openssl libomp
63
64 Build & Install
65 ---------------
66@@ -116,17 +117,17 @@ On most systems, CMake should find the libraries automatically. However, that do
67
68 cmake .. -DBoost_USE_STATIC_LIBS=off
69
70-2. **Fuse/Osxfuse library not found**
71+2. **Fuse library not found**
72
73 Pass in the library path with
74
75- cmake .. -DFUSE_LIB_PATH=/path/to/fuse/or/osxfuse
76+ PKG_CONFIG_PATH=/path-to-fuse-or-macFUSE/lib/pkgconfig cmake ..
77
78-3. **Fuse/Osxfuse headers not found**
79+3. **Fuse headers not found**
80
81 Pass in the include path with
82
83- cmake .. -DCMAKE_CXX_FLAGS="-I/path/to/fuse/or/osxfuse/headers"
84+ PKG_CONFIG_PATH=/path-to-fuse-or-macFUSE/lib/pkgconfig cmake ..
85
86 4. **Openssl headers not found**
87
88diff --git a/cmake-utils/utils.cmake b/cmake-utils/utils.cmake
89index da4dff8c..66021c5c 100644
90--- a/cmake-utils/utils.cmake
91+++ b/cmake-utils/utils.cmake
92@@ -157,33 +157,6 @@ function(require_clang_version VERSION)
93 endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
94 endfunction(require_clang_version)
95
96-##################################################
97-# Find the location of a library and return its full path in OUTPUT_VARIABLE.
98-# If PATH_VARIABLE points to a defined variable, then the library will only be searched in this path.
99-# If PATH_VARIABLE points to a undefined variable, default system locations will be searched.
100-#
101-# Uses (the following will search for fuse in system locations by default, and if the user passes -DFUSE_LIB_PATH to cmake, it will only search in this path.
102-# find_library_with_path(MYLIBRARY fuse FUSE_LIB_PATH)
103-# target_link_library(target ${MYLIBRARY})
104-##################################################
105-function(find_library_with_path OUTPUT_VARIABLE LIBRARY_NAME PATH_VARIABLE)
106- if(${PATH_VARIABLE})
107- find_library(${OUTPUT_VARIABLE} ${LIBRARY_NAME} PATHS ${${PATH_VARIABLE}} NO_DEFAULT_PATH)
108- if (${OUTPUT_VARIABLE} MATCHES NOTFOUND)
109- message(FATAL_ERROR "Didn't find ${LIBRARY_NAME} in path specified by the ${PATH_VARIABLE} parameter (${${PATH_VARIABLE}}). Pass in the correct path or remove the parameter to try common system locations.")
110- else(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
111- message(STATUS "Found ${LIBRARY_NAME} in user-defined path ${${PATH_VARIABLE}}")
112- endif(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
113- else(${PATH_VARIABLE})
114- find_library(${OUTPUT_VARIABLE} ${LIBRARY_NAME})
115- if (${OUTPUT_VARIABLE} MATCHES NOTFOUND)
116- message(FATAL_ERROR "Didn't find ${LIBRARY_NAME} library. If ${LIBRARY_NAME} is installed, try passing in the library location with -D${PATH_VARIABLE}=/path/to/${LIBRARY_NAME}/lib.")
117- else(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
118- message(STATUS "Found ${LIBRARY_NAME} in system location")
119- endif(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
120- endif(${PATH_VARIABLE})
121-endfunction(find_library_with_path)
122-
123 include(cmake-utils/TargetArch.cmake)
124 function(get_target_architecture output_var)
125 target_architecture(local_output_var)
126diff --git a/src/fspp/fuse/CMakeLists.txt b/src/fspp/fuse/CMakeLists.txt
127index b991bd72..8df3dbb7 100644
128--- a/src/fspp/fuse/CMakeLists.txt
129+++ b/src/fspp/fuse/CMakeLists.txt
130@@ -35,12 +35,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
131 DESTINATION "${CMAKE_INSTALL_BINDIR}"
132 )
133
134-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
135- set(CMAKE_FIND_FRAMEWORK LAST)
136- find_library_with_path(FUSE "osxfuse" FUSE_LIB_PATH)
137- target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})
138-else() # Linux
139- find_library_with_path(FUSE "fuse" FUSE_LIB_PATH)
140- target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})
141+else() # Linux and macOS
142+ find_package(PkgConfig REQUIRED)
143+ pkg_check_modules(Fuse REQUIRED IMPORTED_TARGET fuse)
144+ target_link_libraries(${PROJECT_NAME} PUBLIC PkgConfig::Fuse)
145 endif()
146
147+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
148+ set(CMAKE_FIND_FRAMEWORK LAST)
149+endif()
150diff --git a/src/fspp/fuse/Fuse.cpp b/src/fspp/fuse/Fuse.cpp
151index 52cd5644..df0b400d 100644
152--- a/src/fspp/fuse/Fuse.cpp
153+++ b/src/fspp/fuse/Fuse.cpp
154@@ -295,7 +295,7 @@ vector<char *> Fuse::_build_argv(const bf::path &mountdir, const vector<string>
155 // Make volume name default to mountdir on macOS
156 _add_fuse_option_if_not_exists(&argv, "volname", mountdir.filename().string());
157 #endif
158- // TODO Also set read/write size for osxfuse. The options there are called differently.
159+ // TODO Also set read/write size for macFUSE. The options there are called differently.
160 // large_read not necessary because reads are large anyhow. This option is only important for 2.4.
161 //argv.push_back(_create_c_string("-o"));
162 //argv.push_back(_create_c_string("large_read"));
163diff --git a/src/fspp/fuse/params.h b/src/fspp/fuse/params.h
164index 4a45ef79..9903ac82 100644
165--- a/src/fspp/fuse/params.h
166+++ b/src/fspp/fuse/params.h
167@@ -3,14 +3,6 @@
168 #define MESSMER_FSPP_FUSE_PARAMS_H_
169
170 #define FUSE_USE_VERSION 26
171-#if defined(__linux__) || defined(__FreeBSD__)
172 #include <fuse.h>
173-#elif __APPLE__
174-#include <osxfuse/fuse.h>
175-#elif defined(_MSC_VER)
176-#include <fuse.h> // Dokany fuse
177-#else
178-#error System not supported
179-#endif
180
181 #endif
182diff --git a/src/fspp/impl/FilesystemImpl.cpp b/src/fspp/impl/FilesystemImpl.cpp
183index bc0ffbd7..23b28601 100644
184--- a/src/fspp/impl/FilesystemImpl.cpp
185+++ b/src/fspp/impl/FilesystemImpl.cpp
186@@ -321,7 +321,7 @@ void FilesystemImpl::statfs(struct ::statvfs *fsstat) {
187 fsstat->f_namemax = stat.max_filename_length;
188
189 //f_frsize, f_favail, f_fsid and f_flag are ignored in fuse, see http://fuse.sourcearchive.com/documentation/2.7.0/structfuse__operations_4e765e29122e7b6b533dc99849a52655.html#4e765e29122e7b6b533dc99849a52655
190- fsstat->f_frsize = fsstat->f_bsize; // even though this is supposed to be ignored, osxfuse needs it.
191+ fsstat->f_frsize = fsstat->f_bsize; // even though this is supposed to be ignored, macFUSE needs it.
192 }
193
194 void FilesystemImpl::createSymlink(const bf::path &to, const bf::path &from, ::uid_t uid, ::gid_t gid) {
195diff --git a/test/fspp/testutils/FuseThread.cpp b/test/fspp/testutils/FuseThread.cpp
196index 277a2dac..7f3638db 100644
197--- a/test/fspp/testutils/FuseThread.cpp
198+++ b/test/fspp/testutils/FuseThread.cpp
199@@ -23,7 +23,7 @@ void FuseThread::start(const bf::path &mountDir, const vector<string> &fuseOptio
200 //Wait until it is running (busy waiting is simple and doesn't hurt much here)
201 while(!_fuse->running()) {}
202 #ifdef __APPLE__
203- // On Mac OS X, _fuse->running() returns true too early, because osxfuse calls init() when it's not ready yet. Give it a bit time.
204+ // On Mac OS X, _fuse->running() returns true too early, because macFUSE calls init() when it's not ready yet. Give it a bit time.
205 std::this_thread::sleep_for(std::chrono::milliseconds(200));
206 #endif
207 }