diff options
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | CMake/FindLibcap.cmake | 56 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | sway/main.c | 2 |
4 files changed, 59 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index a8e292ba..2bb17d40 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -18,6 +18,7 @@ arch: | |||
18 | - cairo | 18 | - cairo |
19 | - gdk-pixbuf2 | 19 | - gdk-pixbuf2 |
20 | - wlc-git | 20 | - wlc-git |
21 | - libcap | ||
21 | script: | 22 | script: |
22 | - "cmake ." | 23 | - "cmake ." |
23 | - "make" | 24 | - "make" |
diff --git a/CMake/FindLibcap.cmake b/CMake/FindLibcap.cmake new file mode 100644 index 00000000..b34e5e37 --- /dev/null +++ b/CMake/FindLibcap.cmake | |||
@@ -0,0 +1,56 @@ | |||
1 | #.rst: | ||
2 | # FindLibcap | ||
3 | # ------- | ||
4 | # | ||
5 | # Find Libcap library | ||
6 | # | ||
7 | # Try to find Libcap library. The following values are defined | ||
8 | # | ||
9 | # :: | ||
10 | # | ||
11 | # Libcap_FOUND - True if Libcap is available | ||
12 | # Libcap_INCLUDE_DIRS - Include directories for Libcap | ||
13 | # Libcap_LIBRARIES - List of libraries for Libcap | ||
14 | # Libcap_DEFINITIONS - List of definitions for Libcap | ||
15 | # | ||
16 | # and also the following more fine grained variables | ||
17 | # | ||
18 | # :: | ||
19 | # | ||
20 | # Libcap_VERSION | ||
21 | # Libcap_VERSION_MAJOR | ||
22 | # Libcap_VERSION_MINOR | ||
23 | # | ||
24 | #============================================================================= | ||
25 | # Copyright (c) 2017 Jerzi Kaminsky | ||
26 | # | ||
27 | # Distributed under the OSI-approved BSD License (the "License"); | ||
28 | # | ||
29 | # This software is distributed WITHOUT ANY WARRANTY; without even the | ||
30 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
31 | # See the License for more information. | ||
32 | #============================================================================= | ||
33 | |||
34 | include(FeatureSummary) | ||
35 | set_package_properties(Libcap PROPERTIES | ||
36 | URL "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2" | ||
37 | DESCRIPTION "Library for getting and setting POSIX.1e capabilities") | ||
38 | |||
39 | find_package(PkgConfig) | ||
40 | pkg_check_modules(PC_CAP QUIET Libcap) | ||
41 | find_library(Libcap_LIBRARIES NAMES cap HINTS ${PC_CAP_LIBRARY_DIRS}) | ||
42 | find_path(Libcap_INCLUDE_DIRS sys/capability.h HINTS ${PC_CAP_INCLUDE_DIRS}) | ||
43 | |||
44 | set(Libcap_VERSION ${PC_CAP_VERSION}) | ||
45 | string(REPLACE "." ";" VERSION_LIST "${PC_CAP_VERSION}") | ||
46 | |||
47 | LIST(LENGTH VERSION_LIST n) | ||
48 | if (n EQUAL 2) | ||
49 | list(GET VERSION_LIST 0 Libcap_VERSION_MAJOR) | ||
50 | list(GET VERSION_LIST 1 Libcap_VERSION_MINOR) | ||
51 | endif () | ||
52 | |||
53 | include(FindPackageHandleStandardArgs) | ||
54 | find_package_handle_standard_args(Libcap DEFAULT_MSG Libcap_INCLUDE_DIRS Libcap_LIBRARIES) | ||
55 | mark_as_advanced(Libcap_INCLUDE_DIRS Libcap_LIBRARIES Libcap_DEFINITIONS | ||
56 | Libcap_VERSION Libcap_VERSION_MAJOR Libcap_VERSION_MICRO Libcap_VERSION_MINOR) | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt index ec2c73a2..017b0994 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -66,6 +66,7 @@ find_package(GdkPixbuf) | |||
66 | find_package(PAM) | 66 | find_package(PAM) |
67 | 67 | ||
68 | find_package(LibInput REQUIRED) | 68 | find_package(LibInput REQUIRED) |
69 | find_package(Libcap REQUIRED) | ||
69 | 70 | ||
70 | if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) | 71 | if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) |
71 | find_package(EpollShim REQUIRED) | 72 | find_package(EpollShim REQUIRED) |
diff --git a/sway/main.c b/sway/main.c index 55b71fa4..b9f8936f 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -11,8 +11,8 @@ | |||
11 | #include <signal.h> | 11 | #include <signal.h> |
12 | #include <unistd.h> | 12 | #include <unistd.h> |
13 | #include <getopt.h> | 13 | #include <getopt.h> |
14 | #include <sys/capability.h> | ||
15 | #ifdef __linux__ | 14 | #ifdef __linux__ |
15 | #include <sys/capability.h> | ||
16 | #include <sys/prctl.h> | 16 | #include <sys/prctl.h> |
17 | #endif | 17 | #endif |
18 | #include "sway/extensions.h" | 18 | #include "sway/extensions.h" |