diff --git a/.travis.yml b/.travis.yml index b4c0bee..38b3cc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,13 +18,15 @@ env: - secure: "KuAAwjiIqkk4vqSX/M3ZZIvQs6edm+tV8IADiklTUYZIFyxu8FgZ6RbDdMD2sef5bNZA1OZhlcbeRtiKff5CfMtvzc607Lg3NUkpi+ShMynWgqS/e0uCMf9ogEJlUiZMxf4juBi7v6DyMl/WV6pAdJmdfHtzcj8GF2mgTfQjkO8=" before_script: + - sh ci/install-cmake.sh - sudo modprobe fuse - mkdir build - cd build - - cmake .. + - ../ci/cmake/bin/cmake --version + - ../ci/cmake/bin/cmake .. script: - - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && ./checkops && cd .. && ./test.sh ; fi + - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && make check ; fi addons: coverity_scan: @@ -42,6 +44,6 @@ addons: packages: - attr - clang - - cmake - fuse - libfuse-dev + - gettext diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e90827..7998f9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ -# 3.1 preferred, but we can often get by with 2.8. +# 3.0.2 preferred, but we can often get by with 2.8. cmake_minimum_required(VERSION 2.8) +if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 3.0.2) + message(WARNING "You should use cmake 3.0.2 or newer for configuration to run correctly.") +endif() + project(EncFS C CXX) set (ENCFS_MAJOR 1) @@ -245,15 +249,26 @@ endif (POD2MAN) # Tests enable_testing() + +if (CMAKE_CONFIGURATION_TYPES) + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} + --force-new-ctest-process --output-on-failure + --build-config "$") +else() + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} + --force-new-ctest-process --output-on-failure) +endif() + add_test (NAME checkops COMMAND checkops) find_program (PERL_PROGRAM perl) if (PERL_PROGRAM) file(GLOB pl_test_files "tests/*.t.pl") - #add_test (NAME scriptedtests - # COMMAND ${PERL_PROGRAM} -I ${CMAKE_CURRENT_LIST_DIR} - # -MTest::Harness - # -e "$$Test::Harness::verbose=1; runtests @ARGV;" - # ${pl_test_files}) + add_test (NAME scriptedtests + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${PERL_PROGRAM} + -MTest::Harness + -e "$$Test::Harness::verbose=1; runtests @ARGV;" + ${pl_test_files}) endif (PERL_PROGRAM) diff --git a/INSTALL.md b/INSTALL.md index 28cb422..7ae48fa 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -21,7 +21,7 @@ Optional, but strongly recommended, is running the test suite to verify that the generated binaries work as expected (runtime: 20 seconds) - make test + make check The compilation process creates two executables, encfs and encfsctl in the encfs directory. You can install to in a system directory via @@ -46,7 +46,7 @@ EncFS depends on a number of libraries: * tinyxml2 : for reading and writing XML configuration files * gettext : internationalization support * libintl : internationalization support - * cmake : version 3.2 or newer + * cmake : version 3.0.2 (Debian jessie version) or newer * GNU make or ninja-build : to run the build for cmake Compiling on Debian and Ubuntu diff --git a/ci/cmake-3.0.2-Linux-x86_64.tar.gz b/ci/cmake-3.0.2-Linux-x86_64.tar.gz new file mode 100644 index 0000000..0ea5d3c Binary files /dev/null and b/ci/cmake-3.0.2-Linux-x86_64.tar.gz differ diff --git a/ci/install-cmake.sh b/ci/install-cmake.sh index 6d83860..92da1de 100755 --- a/ci/install-cmake.sh +++ b/ci/install-cmake.sh @@ -1,7 +1,7 @@ set -x set -e if [ ! -e ci/cmake/bin/cmake ]; then - wget http://www.cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz - tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz - mv cmake-3.1.3-Linux-x86_64 ci/cmake + #wget http://www.cmake.org/files/v3.1/cmake-3.1.0-Linux-x86_64.tar.gz + tar -xzf ci/cmake-3.0.2-Linux-x86_64.tar.gz + mv cmake-3.0.2-Linux-x86_64 ci/cmake fi diff --git a/cmake/FindIntl.cmake b/cmake/FindIntl.cmake new file mode 100644 index 0000000..5b719c6 --- /dev/null +++ b/cmake/FindIntl.cmake @@ -0,0 +1,59 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindIntl +# -------- +# +# Find the Gettext libintl headers and libraries. +# +# This module reports information about the Gettext libintl +# installation in several variables. General variables:: +# +# Intl_FOUND - true if the libintl headers and libraries were found +# Intl_INCLUDE_DIRS - the directory containing the libintl headers +# Intl_LIBRARIES - libintl libraries to be linked +# +# The following cache variables may also be set:: +# +# Intl_INCLUDE_DIR - the directory containing the libintl headers +# Intl_LIBRARY - the libintl library (if any) +# +# .. note:: +# On some platforms, such as Linux with GNU libc, the gettext +# functions are present in the C standard library and libintl +# is not required. ``Intl_LIBRARIES`` will be empty in this +# case. +# +# .. note:: +# If you wish to use the Gettext tools (``msgmerge``, +# ``msgfmt``, etc.), use :module:`FindGettext`. + + +# Written by Roger Leigh + +# Find include directory +find_path(Intl_INCLUDE_DIR + NAMES "libintl.h" + DOC "libintl include directory") +mark_as_advanced(Intl_INCLUDE_DIR) + +# Find all Intl libraries +find_library(Intl_LIBRARY "intl" + DOC "libintl libraries (if not in the C library)") +mark_as_advanced(Intl_LIBRARY) + +#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl + FOUND_VAR Intl_FOUND + REQUIRED_VARS Intl_INCLUDE_DIR + FAIL_MESSAGE "Failed to find Gettext libintl") + +if(Intl_FOUND) + set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}") + if(Intl_LIBRARY) + set(Intl_LIBRARIES "${Intl_LIBRARY}") + else() + unset(Intl_LIBRARIES) + endif() +endif() diff --git a/test.sh b/test.sh deleted file mode 100755 index 4b57724..0000000 --- a/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -eux - -if [ ! -d build ] -then - ./build.sh -fi - -perl -MTest::Harness -e '$$Test::Harness::verbose=1; runtests @ARGV;' tests/*.t.pl