mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
add cmake config
This commit is contained in:
parent
08e918f8ff
commit
852887d38d
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@ Makefile.in
|
||||
|
||||
/ABOUT-NLS
|
||||
/autom4te.cache/
|
||||
/build
|
||||
/build-aux/
|
||||
/config.h
|
||||
/config.h.in
|
||||
|
147
CMakeLists.txt
Normal file
147
CMakeLists.txt
Normal file
@ -0,0 +1,147 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(EncFS C CXX)
|
||||
|
||||
set (ENCFS_MAJOR 1)
|
||||
set (ENCFS_MINOR 9)
|
||||
set (ENCFS_VERSION "${ENCFS_MAJOR}.${ENCFS_MINOR}")
|
||||
set (ENCFS_SOVERSION 7)
|
||||
set (ENCFS_NAME "Encrypted Filesystem")
|
||||
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
# We need C++ 11
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||
|
||||
# Check for FUSE.
|
||||
find_package (FUSE REQUIRED)
|
||||
include_directories (${FUSE_INCLUDE_DIR})
|
||||
add_definitions (-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26)
|
||||
|
||||
# Check for OpenSSL.
|
||||
find_package (OpenSSL REQUIRED)
|
||||
include_directories (${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
find_package(Boost
|
||||
1.34.0
|
||||
REQUIRED
|
||||
COMPONENTS serialization)
|
||||
include_directories (${Boost_INCLUDE_DIRS})
|
||||
|
||||
find_package (RLog REQUIRED)
|
||||
add_definitions (-DRLOG_COMPONENT="encfs")
|
||||
include_directories (${RLOG_INCLUDE_DIR})
|
||||
|
||||
find_program (POD2MAN pod2man)
|
||||
include (FindGettext)
|
||||
|
||||
# Check for include files and stdlib properties.
|
||||
include (CheckIncludeFileCXX)
|
||||
check_include_file_cxx (attr/xattr.h HAVE_ATTR_XATTR_H)
|
||||
check_include_file_cxx (sys/xattr.h HAVE_SYS_XATTR_H)
|
||||
|
||||
check_include_file_cxx (tr1/memory HAVE_TR1_MEMORY)
|
||||
check_include_file_cxx (tr1/unordered_map HAVE_TR1_UNORDERED_MAP)
|
||||
check_include_file_cxx (tr1/unordered_set HAVE_TR1_UNORDERED_SET)
|
||||
check_include_file_cxx (tr1/tuple HAVE_TR1_TUPLE)
|
||||
|
||||
# Check if xattr functions take extra arguments, as they do on OSX.
|
||||
include (CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles ("#include <sys/types.h>
|
||||
#include <sys/xattr.h>
|
||||
int main() { getxattr(0,0,0,0,0,0); return 1; }
|
||||
" XATTR_ADD_OPT)
|
||||
|
||||
# Check if we have lchmod.
|
||||
include (CheckFuncs)
|
||||
check_function_exists_glibc (lchmod HAVE_LCHMOD)
|
||||
|
||||
set (CMAKE_THREAD_PREFER_PTHREAD)
|
||||
find_package (Threads REQUIRED)
|
||||
|
||||
# Packaging config.
|
||||
set (CPACK_PACKAGE_NAME "encfs")
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR ${ENCFS_MAJOR})
|
||||
set (CPACK_PACKAGE_VERSION_MINOR ${ENCFS_MINOR})
|
||||
set (CPACK_SOURCE_GENERATOR TGZ)
|
||||
set (CPACK_SOURCE_IGNORE_FILES
|
||||
"/build/")
|
||||
include (CPack)
|
||||
|
||||
configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake
|
||||
${CMAKE_BINARY_DIR}/config.h)
|
||||
|
||||
include_directories (${CMAKE_BINARY_DIR})
|
||||
include_directories (${CMAKE_SOURCE_DIR})
|
||||
|
||||
set(SOURCE_FILES
|
||||
encfs/autosprintf.cpp
|
||||
encfs/base64.cpp
|
||||
encfs/BlockFileIO.cpp
|
||||
encfs/BlockNameIO.cpp
|
||||
encfs/Cipher.cpp
|
||||
encfs/CipherFileIO.cpp
|
||||
encfs/CipherKey.cpp
|
||||
encfs/ConfigReader.cpp
|
||||
encfs/ConfigVar.cpp
|
||||
encfs/Context.cpp
|
||||
encfs/DirNode.cpp
|
||||
encfs/encfs.cpp
|
||||
encfs/FileIO.cpp
|
||||
encfs/FileNode.cpp
|
||||
encfs/FileUtils.cpp
|
||||
encfs/Interface.cpp
|
||||
encfs/MACFileIO.cpp
|
||||
encfs/MemoryPool.cpp
|
||||
encfs/NameIO.cpp
|
||||
encfs/NullCipher.cpp
|
||||
encfs/NullNameIO.cpp
|
||||
encfs/openssl.cpp
|
||||
encfs/RawFileIO.cpp
|
||||
encfs/readpassphrase.cpp
|
||||
encfs/SSL_Cipher.cpp
|
||||
encfs/StreamNameIO.cpp
|
||||
)
|
||||
add_library(encfs1 SHARED ${SOURCE_FILES})
|
||||
set_property(TARGET encfs1 PROPERTY VERSION ${ENCFS_VERSION})
|
||||
set_property(TARGET encfs1 PROPERTY SOVERSION ${ENCFS_SOVERSION})
|
||||
target_link_libraries(encfs1
|
||||
${FUSE_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
${RLOG_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
add_executable (encfs encfs/main.cpp)
|
||||
target_link_libraries (encfs encfs1)
|
||||
|
||||
add_executable (encfsctl encfs/encfsctl.cpp)
|
||||
target_link_libraries (encfsctl encfs1)
|
||||
|
||||
add_executable (makekey encfs/makeKey.cpp)
|
||||
target_link_libraries (makekey encfs1)
|
||||
|
||||
add_executable (checkops encfs/test.cpp)
|
||||
target_link_libraries (checkops encfs1)
|
||||
|
||||
# Reference all headers, to make certain IDEs happy.
|
||||
file (GLOB_RECURSE all_headers ${CMAKE_SOURCE_DIR}/*.h)
|
||||
add_custom_target (all_placeholder SOURCES ${all_headers})
|
||||
|
||||
if (POD2MAN)
|
||||
add_custom_target (encfs-man ALL
|
||||
COMMAND ${POD2MAN} -u --section=1 --release=${ENCFS_VERSION} --center=${ENCFS_NAME}
|
||||
${CMAKE_SOURCE_DIR}/encfs/encfs.pod encfs.1)
|
||||
|
||||
add_custom_target (encfsctl-man ALL
|
||||
COMMAND ${POD2MAN} -u --section=1 --release=${ENCFS_VERSION} --center=${ENCFS_NAME}
|
||||
${CMAKE_SOURCE_DIR}/encfs/encfsctl.pod encfsctl.1)
|
||||
|
||||
install (FILES ${CMAKE_BINARY_DIR}/encfs.1 ${CMAKE_BINARY_DIR}/encfsctl.1
|
||||
DESTINATION share/man/man1)
|
||||
endif (POD2MAN)
|
||||
|
||||
install (TARGETS encfs DESTINATION bin)
|
||||
install (FILES ${CMAKE_SOURCE_DIR}/encfs/encssh DESTINATION bin)
|
49
cmake/CheckFuncs.cmake
Normal file
49
cmake/CheckFuncs.cmake
Normal file
@ -0,0 +1,49 @@
|
||||
# Check if the system has the specified function; treat glibc "stub"
|
||||
# functions as nonexistent:
|
||||
# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR)
|
||||
#
|
||||
# FUNCTION - the function(s) where the prototype should be declared
|
||||
# FUNCVAR - variable to define if the function does exist
|
||||
#
|
||||
# In particular, this understands the glibc convention of
|
||||
# defining macros __stub_XXXX or __stub___XXXX if the function
|
||||
# does appear in the library but is merely a stub that does nothing.
|
||||
# By detecting this case, we can select alternate behavior on
|
||||
# platforms that don't support this functionality.
|
||||
#
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# Copyright (c) 2009, Michihiro NAKAJIMA
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
INCLUDE(CheckFunctionExists)
|
||||
GET_FILENAME_COMPONENT(_selfdir_CheckFunctionExistsGlibc
|
||||
"${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR)
|
||||
IF(NOT DEFINED ${_FUNCVAR})
|
||||
SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}")
|
||||
SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}")
|
||||
CONFIGURE_FILE( ${_selfdir_CheckFunctionExistsGlibc}/CheckFuncs_stub.c.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE)
|
||||
TRY_COMPILE(__stub
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS
|
||||
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
|
||||
"${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}")
|
||||
IF (__stub)
|
||||
SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}")
|
||||
ELSE (__stub)
|
||||
CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}")
|
||||
ENDIF (__stub)
|
||||
ENDIF(NOT DEFINED ${_FUNCVAR})
|
||||
ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC)
|
||||
|
16
cmake/CheckFuncs_stub.c.in
Normal file
16
cmake/CheckFuncs_stub.c.in
Normal file
@ -0,0 +1,16 @@
|
||||
#ifdef __STDC__
|
||||
#include <limits.h>
|
||||
#else
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
#if defined ${CHECK_STUB_FUNC_1} || defined ${CHECK_STUB_FUNC_2}
|
||||
return 0;
|
||||
#else
|
||||
this system have stub
|
||||
return 0;
|
||||
#endif
|
||||
}
|
42
cmake/FindFUSE.cmake
Normal file
42
cmake/FindFUSE.cmake
Normal file
@ -0,0 +1,42 @@
|
||||
# Find the FUSE includes and library
|
||||
#
|
||||
# FUSE_INCLUDE_DIR - where to find fuse.h, etc.
|
||||
# FUSE_LIBRARIES - List of libraries when using FUSE.
|
||||
# FUSE_FOUND - True if FUSE lib is found.
|
||||
|
||||
# check if already in cache, be silent
|
||||
IF (FUSE_INCLUDE_DIR)
|
||||
SET (FUSE_FIND_QUIETLY TRUE)
|
||||
ENDIF (FUSE_INCLUDE_DIR)
|
||||
|
||||
# find includes
|
||||
FIND_PATH (FUSE_INCLUDE_DIR fuse.h
|
||||
/usr/include/fuse
|
||||
/usr/local/include/fuse
|
||||
/opt/include/fuse
|
||||
/opt/local/include/fuse
|
||||
/usr/include/osxfuse
|
||||
/usr/local/include/osxfuse
|
||||
/opt/local/include/osxfuse
|
||||
/usr/pkg/include/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
|
||||
/opt/local/lib /usr/pkg/lib
|
||||
)
|
||||
|
||||
include ("FindPackageHandleStandardArgs")
|
||||
find_package_handle_standard_args ("FUSE" DEFAULT_MSG
|
||||
FUSE_INCLUDE_DIR FUSE_LIBRARIES)
|
||||
|
||||
mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES)
|
||||
|
28
cmake/FindRLog.cmake
Normal file
28
cmake/FindRLog.cmake
Normal file
@ -0,0 +1,28 @@
|
||||
# FindRLog
|
||||
# --------
|
||||
#
|
||||
# Find RLog
|
||||
#
|
||||
# Find the RLog logging library. This module defines
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# RLOG_INCLUDE_DIR, where to find rlog.h, etc.
|
||||
# RLOG_LIBRARIES, the libraries needed to use RLog.
|
||||
# RLOG_FOUND, If false, do not try to use RLog.
|
||||
|
||||
find_path(RLOG_INCLUDE_DIR rlog/rlog.h)
|
||||
|
||||
set(RLOG_NAMES ${RLOG_NAMES} rlog librlog)
|
||||
find_library(RLOG_LIBRARY NAMES ${RLOG_NAMES} )
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set RLOG_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include (FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RLOG DEFAULT_MSG RLOG_LIBRARY RLOG_INCLUDE_DIR)
|
||||
|
||||
if(RLOG_FOUND)
|
||||
set(RLOG_LIBRARIES ${RLOG_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(RLOG_LIBRARY RLOG_INCLUDE_DIR )
|
16
config.h.cmake
Normal file
16
config.h.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
#define VERSION "@ENCFS_VERSION@"
|
||||
|
||||
#cmakedefine HAVE_ATTR_XATTR_H
|
||||
#cmakedefine HAVE_SYS_XATTR_H
|
||||
#cmakedefine XATTR_ADD_OPT
|
||||
|
||||
#cmakedefine HAVE_TR1_MEMORY
|
||||
#cmakedefine HAVE_TR1_UNORDERED_MAP
|
||||
#cmakedefine HAVE_TR1_UNORDERED_SET
|
||||
#cmakedefine HAVE_TR1_TUPLE
|
||||
|
||||
#cmakedefine HAVE_LCHMOD
|
||||
|
||||
/* TODO: add other thread library support. */
|
||||
#cmakedefine CMAKE_USE_PTHREADS_INIT
|
||||
|
4
devmode
Normal file
4
devmode
Normal file
@ -0,0 +1,4 @@
|
||||
# Script which sets up the CMake build for Debug mode.
|
||||
# After running, chdir to the build subdir ane run "make"
|
||||
mkdir build
|
||||
cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug $@
|
@ -158,7 +158,7 @@ int TimedPBKDF2(const char *pass, int passlen, const unsigned char *salt,
|
||||
static Interface BlowfishInterface("ssl/blowfish", 3, 0, 2);
|
||||
static Interface AESInterface("ssl/aes", 3, 0, 2);
|
||||
|
||||
#if defined(HAVE_EVP_BF)
|
||||
#ifndef OPENSSL_NO_BF
|
||||
|
||||
static Range BFKeyRange(128, 256, 32);
|
||||
static Range BFBlockRange(64, 4096, 8);
|
||||
@ -182,7 +182,7 @@ static bool BF_Cipher_registered =
|
||||
BFKeyRange, BFBlockRange, NewBFCipher);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EVP_AES)
|
||||
#ifndef OPENSSL_NO_AES
|
||||
|
||||
static Range AESKeyRange(128, 256, 64);
|
||||
static Range AESBlockRange(64, 4096, 16);
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include <sys/fsuid.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_XATTR_H
|
||||
#if defined(HAVE_SYS_XATTR_H)
|
||||
#include <sys/xattr.h>
|
||||
#elif HAVE_ATTR_XATTR_H
|
||||
#elif defined(HAVE_ATTR_XATTR_H)
|
||||
#include <attr/xattr.h>
|
||||
#endif
|
||||
|
||||
|
@ -29,10 +29,8 @@
|
||||
#include <rlog/StdioNode.h>
|
||||
#include <rlog/RLogChannel.h>
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#define NO_DES
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
#include "Cipher.h"
|
||||
#include "Context.h"
|
||||
@ -697,10 +695,8 @@ int main(int argc, char **argv) {
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
#endif
|
||||
|
||||
StdioNode *slog = new StdioNode(STDERR_FILENO);
|
||||
slog->subscribeTo(GetGlobalChannel("error"));
|
||||
|
@ -39,13 +39,11 @@
|
||||
#include <rlog/StdioNode.h>
|
||||
#include <rlog/RLogChannel.h>
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
#define NO_DES
|
||||
#include <openssl/ssl.h>
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace rel;
|
||||
@ -397,7 +395,6 @@ int main(int argc, char *argv[]) {
|
||||
stdLog.subscribeTo(RLOG_CHANNEL("debug"));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
|
||||
@ -406,7 +403,6 @@ int main(int argc, char *argv[]) {
|
||||
ENGINE_register_all_ciphers();
|
||||
ENGINE_register_all_digests();
|
||||
ENGINE_register_all_RAND();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
srand(time(0));
|
||||
|
Loading…
Reference in New Issue
Block a user