Skip to content

Commit

Permalink
Merge pull request Aorimn#246 from midchildan/feat/macfuse
Browse files Browse the repository at this point in the history
Support the latest FUSE on macOS
  • Loading branch information
Aorimn authored Apr 3, 2021
2 parents c3d4cbc + 677fb08 commit 5b576bc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 34 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ jobs:
- os: linux
dist: xenial
- os: osx
osx_image: xcode11.6

before_install:
- echo $PATH
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install -qq libfuse-dev ruby-dev libmbedtls-dev; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install -v Caskroom/cask/osxfuse; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install -v Caskroom/cask/macfuse; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ./src/mbed_install.sh; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH="/usr/bin:/usr/local/bin:$PATH"; fi

install:
- cmake .
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake .; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake . -DCMAKE_C_COMPILER=/usr/bin/clang; fi
- make VERBOSE=1
- sudo make install

Expand Down
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ You need:
- Compiler, gcc or clang;
- cmake (at least version 2.6);
- make (or gmake, for FreeBSD);
- pkg-config;
- Headers for FUSE;
- Headers for mbedTLS (previously known as PolarSSL);
- A partition encrypted with BitLocker, from Windows Vista, 7 or 8.
Expand Down Expand Up @@ -56,7 +57,7 @@ Each OS type has its own section below, beware to follow yours:
Just install Homebrew (http://brew.sh/) and run the following commands:
```
brew update
brew install Caskroom/cask/osxfuse
brew install Caskroom/cask/macfuse
brew install src/dislocker.rb
```
This will install dislocker.
Expand Down
25 changes: 3 additions & 22 deletions cmake/FindFUSE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,7 @@ IF (FUSE_INCLUDE_DIRS)
SET (FUSE_FIND_QUIETLY TRUE)
ENDIF (FUSE_INCLUDE_DIRS)

# find includes
FIND_PATH (FUSE_INCLUDE_DIRS fuse.h
/usr/local/include/osxfuse
/usr/local/include
/usr/include
)
FIND_PACKAGE (PkgConfig REQUIRED)
pkg_check_modules (FUSE REQUIRED fuse)

# find lib
if (APPLE)
SET(FUSE_NAMES libosxfuse.dylib fuse)
else (APPLE)
SET(FUSE_NAMES fuse)
endif (APPLE)
FIND_LIBRARY(FUSE_LIBRARIES
NAMES ${FUSE_NAMES}
PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib
)

include ("FindPackageHandleStandardArgs")
find_package_handle_standard_args ("FUSE" DEFAULT_MSG
FUSE_INCLUDE_DIRS FUSE_LIBRARIES)

mark_as_advanced (FUSE_INCLUDE_DIRS FUSE_LIBRARIES)
mark_as_advanced (FUSE_INCLUDE_DIRS FUSE_LIBRARIES FUSE_LIBRARY_DIRS)
7 changes: 3 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
# Don't use `-read_only_relocs' here as it seems to only work for 32 bits
# binaries
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-bind_at_load")
set (FUSE_LIB osxfuse_i64)
else()
# Useless warnings when used within Darwin
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
set (FUSE_LIB fuse)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
link_directories ( ${LINK_DIRECTORIES} /usr/local/lib )
endif()
Expand Down Expand Up @@ -138,8 +136,9 @@ if(RUBY_FOUND AND RUBY_INCLUDE_DIRS AND RUBY_LIBRARY)
endif()

find_package (FUSE)
if(FUSE_FOUND AND FUSE_INCLUDE_DIRS AND FUSE_LIBRARIES)
if(FUSE_FOUND AND FUSE_INCLUDE_DIRS AND FUSE_LIBRARIES AND FUSE_LIBRARY_DIRS)
include_directories (${FUSE_INCLUDE_DIRS})
link_directories(${FUSE_LIBRARY_DIRS})
set (LIB ${LIB} ${FUSE_LIBRARIES})
endif()

Expand Down Expand Up @@ -201,7 +200,7 @@ set (CLEAN_FILES "")

set (BIN_FUSE ${PROJECT_NAME}-fuse)
add_executable (${BIN_FUSE} ${BIN_FUSE}.c)
target_link_libraries (${BIN_FUSE} ${FUSE_LIB} ${PROJECT_NAME})
target_link_libraries (${BIN_FUSE} ${FUSE_LIBRARIES} ${PROJECT_NAME})
set_target_properties (${BIN_FUSE} PROPERTIES COMPILE_DEFINITIONS FUSE_USE_VERSION=26)
set_target_properties (${BIN_FUSE} PROPERTIES LINK_FLAGS "-pie -fPIE")
add_custom_command (TARGET ${BIN_FUSE} POST_BUILD
Expand Down
5 changes: 0 additions & 5 deletions src/dislocker-fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@
#include "dislocker/dislocker.h"



#ifdef __DARWIN
# include <osxfuse/fuse.h>
#else
# include <fuse.h>
#endif /* __DARWIN */


/** NTFS virtual partition's name */
Expand Down

0 comments on commit 5b576bc

Please sign in to comment.