···2525 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryfs/files/cryfs-0.10.2-unbundle-libs.patch?id=192ac7421ddd4093125f4997898fb62e8a140a44";
2626 sha256 = "0hzss5rawcjrh8iqzc40w5yjhxdqya4gbg6dzap70180s50mahzs";
2727 })
2828+2929+ # Backported from https://github.com/cryfs/cryfs/pull/378
3030+ ./use-macfuse.patch
2831 ];
29323033 postPatch = ''
···48514952 strictDeps = true;
50535151- buildInputs = [ boost cryptopp curl fuse openssl gtest ];
5454+ buildInputs = [ boost cryptopp curl fuse openssl ];
5555+5656+ checkInputs = [ gtest ];
52575358 cmakeFlags = [
5459 "-DCRYFS_UPDATE_CHECKS:BOOL=FALSE"
5560 "-DBoost_USE_STATIC_LIBS:BOOL=FALSE" # this option is case sensitive
5661 "-DUSE_SYSTEM_LIBS:BOOL=TRUE"
5757- "-DBUILD_TESTING:BOOL=TRUE"
5858- ];
6262+ "-DBUILD_TESTING:BOOL=${if doCheck then "TRUE" else "FALSE"}"
6363+ ] ++ lib.optional doCheck "-DCMAKE_PREFIX_PATH=${gtest.dev}/lib/cmake";
59646060- doCheck = (!stdenv.isDarwin); # Cryfs tests are broken on darwin
6565+ doCheck = true;
61666267 checkPhase = ''
6368 # Skip CMakeFiles directory and tests depending on fuse (does not work well with sandboxing)
···7378 homepage = "https://www.cryfs.org";
7479 license = licenses.lgpl3;
7580 maintainers = with maintainers; [ peterhoeg c0bw3b ];
7676- platforms = with platforms; linux;
8181+ platforms = platforms.unix;
7782 };
7883}
+207
pkgs/tools/filesystems/cryfs/use-macfuse.patch
···11+diff --git a/.travisci/install.sh b/.travisci/install.sh
22+index 9057a75b..2929c360 100755
33+--- a/.travisci/install.sh
44++++ b/.travisci/install.sh
55+@@ -6,12 +6,11 @@ set -e
66+ if [ "${CXX}" == "g++" ]; then
77+ # We need to uninstall oclint because it creates a /usr/local/include/c++ symlink that clashes with the gcc5 package
88+ # see https://github.com/Homebrew/homebrew-core/issues/21172
99+- brew cask uninstall oclint
1010++ brew uninstall oclint
1111+ brew install gcc@7
1212+ fi
1313+1414+-brew cask install osxfuse
1515+-brew install libomp
1616++brew install libomp pkg-config macfuse
1717+1818+ # 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.
1919+ git fetch --unshallow --tags
2020+diff --git a/README.md b/README.md
2121+index b0f4a684..7001119a 100644
2222+--- a/README.md
2323++++ b/README.md
2424+@@ -19,7 +19,7 @@ OSX
2525+2626+ CryFS is distributed via Homebrew. Just do
2727+2828+- brew cask install osxfuse
2929++ brew install osxfuse
3030+ brew install cryfs
3131+3232+ Windows (experimental)
3333+@@ -45,6 +45,7 @@ Requirements
3434+ - Git (for getting the source code)
3535+ - GCC version >= 5.0 or Clang >= 4.0
3636+ - CMake version >= 3.0
3737++ - pkg-config (on Unix)
3838+ - libcurl4 (including development headers)
3939+ - Boost libraries version >= 1.65.1 (including development headers)
4040+ - filesystem
4141+@@ -53,20 +54,20 @@ Requirements
4242+ - program_options
4343+ - thread
4444+ - SSL development libraries (including development headers, e.g. libssl-dev)
4545+- - libFUSE version >= 2.8.6 (including development headers), on Mac OS X instead install osxfuse from https://osxfuse.github.io/
4646++ - libFUSE version >= 2.8.6 (including development headers), on Mac OS X instead install macFUSE from https://osxfuse.github.io/
4747+ - Python >= 2.7
4848+ - OpenMP
4949+5050+ You can use the following commands to install these requirements
5151+5252+ # Ubuntu
5353+- $ 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
5454++ $ 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
5555+5656+ # Fedora
5757+- sudo dnf install git gcc-c++ cmake make libcurl-devel boost-devel boost-static openssl-devel fuse-devel python
5858++ sudo dnf install git gcc-c++ cmake make pkgconf libcurl-devel boost-devel boost-static openssl-devel fuse-devel python
5959+6060+ # Macintosh
6161+- brew install cmake boost openssl libomp
6262++ brew install cmake pkg-config boost openssl libomp
6363+6464+ Build & Install
6565+ ---------------
6666+@@ -116,17 +117,17 @@ On most systems, CMake should find the libraries automatically. However, that do
6767+6868+ cmake .. -DBoost_USE_STATIC_LIBS=off
6969+7070+-2. **Fuse/Osxfuse library not found**
7171++2. **Fuse library not found**
7272+7373+ Pass in the library path with
7474+7575+- cmake .. -DFUSE_LIB_PATH=/path/to/fuse/or/osxfuse
7676++ PKG_CONFIG_PATH=/path-to-fuse-or-macFUSE/lib/pkgconfig cmake ..
7777+7878+-3. **Fuse/Osxfuse headers not found**
7979++3. **Fuse headers not found**
8080+8181+ Pass in the include path with
8282+8383+- cmake .. -DCMAKE_CXX_FLAGS="-I/path/to/fuse/or/osxfuse/headers"
8484++ PKG_CONFIG_PATH=/path-to-fuse-or-macFUSE/lib/pkgconfig cmake ..
8585+8686+ 4. **Openssl headers not found**
8787+8888+diff --git a/cmake-utils/utils.cmake b/cmake-utils/utils.cmake
8989+index da4dff8c..66021c5c 100644
9090+--- a/cmake-utils/utils.cmake
9191++++ b/cmake-utils/utils.cmake
9292+@@ -157,33 +157,6 @@ function(require_clang_version VERSION)
9393+ endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
9494+ endfunction(require_clang_version)
9595+9696+-##################################################
9797+-# Find the location of a library and return its full path in OUTPUT_VARIABLE.
9898+-# If PATH_VARIABLE points to a defined variable, then the library will only be searched in this path.
9999+-# If PATH_VARIABLE points to a undefined variable, default system locations will be searched.
100100+-#
101101+-# 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.
102102+-# find_library_with_path(MYLIBRARY fuse FUSE_LIB_PATH)
103103+-# target_link_library(target ${MYLIBRARY})
104104+-##################################################
105105+-function(find_library_with_path OUTPUT_VARIABLE LIBRARY_NAME PATH_VARIABLE)
106106+- if(${PATH_VARIABLE})
107107+- find_library(${OUTPUT_VARIABLE} ${LIBRARY_NAME} PATHS ${${PATH_VARIABLE}} NO_DEFAULT_PATH)
108108+- if (${OUTPUT_VARIABLE} MATCHES NOTFOUND)
109109+- 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.")
110110+- else(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
111111+- message(STATUS "Found ${LIBRARY_NAME} in user-defined path ${${PATH_VARIABLE}}")
112112+- endif(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
113113+- else(${PATH_VARIABLE})
114114+- find_library(${OUTPUT_VARIABLE} ${LIBRARY_NAME})
115115+- if (${OUTPUT_VARIABLE} MATCHES NOTFOUND)
116116+- 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.")
117117+- else(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
118118+- message(STATUS "Found ${LIBRARY_NAME} in system location")
119119+- endif(${OUTPUT_VARIABLE} MATCHES NOTFOUND)
120120+- endif(${PATH_VARIABLE})
121121+-endfunction(find_library_with_path)
122122+-
123123+ include(cmake-utils/TargetArch.cmake)
124124+ function(get_target_architecture output_var)
125125+ target_architecture(local_output_var)
126126+diff --git a/src/fspp/fuse/CMakeLists.txt b/src/fspp/fuse/CMakeLists.txt
127127+index b991bd72..8df3dbb7 100644
128128+--- a/src/fspp/fuse/CMakeLists.txt
129129++++ b/src/fspp/fuse/CMakeLists.txt
130130+@@ -35,12 +35,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
131131+ DESTINATION "${CMAKE_INSTALL_BINDIR}"
132132+ )
133133+134134+-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
135135+- set(CMAKE_FIND_FRAMEWORK LAST)
136136+- find_library_with_path(FUSE "osxfuse" FUSE_LIB_PATH)
137137+- target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})
138138+-else() # Linux
139139+- find_library_with_path(FUSE "fuse" FUSE_LIB_PATH)
140140+- target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})
141141++else() # Linux and macOS
142142++ find_package(PkgConfig REQUIRED)
143143++ pkg_check_modules(Fuse REQUIRED IMPORTED_TARGET fuse)
144144++ target_link_libraries(${PROJECT_NAME} PUBLIC PkgConfig::Fuse)
145145+ endif()
146146+147147++if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
148148++ set(CMAKE_FIND_FRAMEWORK LAST)
149149++endif()
150150+diff --git a/src/fspp/fuse/Fuse.cpp b/src/fspp/fuse/Fuse.cpp
151151+index 52cd5644..df0b400d 100644
152152+--- a/src/fspp/fuse/Fuse.cpp
153153++++ b/src/fspp/fuse/Fuse.cpp
154154+@@ -295,7 +295,7 @@ vector<char *> Fuse::_build_argv(const bf::path &mountdir, const vector<string>
155155+ // Make volume name default to mountdir on macOS
156156+ _add_fuse_option_if_not_exists(&argv, "volname", mountdir.filename().string());
157157+ #endif
158158+- // TODO Also set read/write size for osxfuse. The options there are called differently.
159159++ // TODO Also set read/write size for macFUSE. The options there are called differently.
160160+ // large_read not necessary because reads are large anyhow. This option is only important for 2.4.
161161+ //argv.push_back(_create_c_string("-o"));
162162+ //argv.push_back(_create_c_string("large_read"));
163163+diff --git a/src/fspp/fuse/params.h b/src/fspp/fuse/params.h
164164+index 4a45ef79..9903ac82 100644
165165+--- a/src/fspp/fuse/params.h
166166++++ b/src/fspp/fuse/params.h
167167+@@ -3,14 +3,6 @@
168168+ #define MESSMER_FSPP_FUSE_PARAMS_H_
169169+170170+ #define FUSE_USE_VERSION 26
171171+-#if defined(__linux__) || defined(__FreeBSD__)
172172+ #include <fuse.h>
173173+-#elif __APPLE__
174174+-#include <osxfuse/fuse.h>
175175+-#elif defined(_MSC_VER)
176176+-#include <fuse.h> // Dokany fuse
177177+-#else
178178+-#error System not supported
179179+-#endif
180180+181181+ #endif
182182+diff --git a/src/fspp/impl/FilesystemImpl.cpp b/src/fspp/impl/FilesystemImpl.cpp
183183+index bc0ffbd7..23b28601 100644
184184+--- a/src/fspp/impl/FilesystemImpl.cpp
185185++++ b/src/fspp/impl/FilesystemImpl.cpp
186186+@@ -321,7 +321,7 @@ void FilesystemImpl::statfs(struct ::statvfs *fsstat) {
187187+ fsstat->f_namemax = stat.max_filename_length;
188188+189189+ //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
190190+- fsstat->f_frsize = fsstat->f_bsize; // even though this is supposed to be ignored, osxfuse needs it.
191191++ fsstat->f_frsize = fsstat->f_bsize; // even though this is supposed to be ignored, macFUSE needs it.
192192+ }
193193+194194+ void FilesystemImpl::createSymlink(const bf::path &to, const bf::path &from, ::uid_t uid, ::gid_t gid) {
195195+diff --git a/test/fspp/testutils/FuseThread.cpp b/test/fspp/testutils/FuseThread.cpp
196196+index 277a2dac..7f3638db 100644
197197+--- a/test/fspp/testutils/FuseThread.cpp
198198++++ b/test/fspp/testutils/FuseThread.cpp
199199+@@ -23,7 +23,7 @@ void FuseThread::start(const bf::path &mountDir, const vector<string> &fuseOptio
200200+ //Wait until it is running (busy waiting is simple and doesn't hurt much here)
201201+ while(!_fuse->running()) {}
202202+ #ifdef __APPLE__
203203+- // 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.
204204++ // 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.
205205+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
206206+ #endif
207207+ }