File: BubblewrapSandboxChecks.cmake

package info (click to toggle)
wpewebkit 2.38.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 311,508 kB
  • sloc: cpp: 2,653,313; javascript: 289,013; ansic: 121,268; xml: 64,149; python: 35,534; ruby: 17,287; perl: 15,877; asm: 11,072; yacc: 2,326; sh: 1,863; lex: 1,319; java: 937; makefile: 146; pascal: 60
file content (44 lines) | stat: -rw-r--r-- 1,919 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
if (ENABLE_BUBBLEWRAP_SANDBOX)
    find_program(BWRAP_EXECUTABLE bwrap)
    if (NOT BWRAP_EXECUTABLE)
        message(FATAL_ERROR "bwrap executable is needed for ENABLE_BUBBLEWRAP_SANDBOX")
    endif ()

    find_package(Libseccomp)
    if (NOT Libseccomp_FOUND)
        message(FATAL_ERROR "libseccomp is needed for ENABLE_BUBBLEWRAP_SANDBOX")
    endif ()

    find_program(DBUS_PROXY_EXECUTABLE xdg-dbus-proxy)
    if (NOT DBUS_PROXY_EXECUTABLE)
        message(FATAL_ERROR "xdg-dbus-proxy not found and is needed for ENABLE_BUBBLEWRAP_SANDBOX")
    endif ()

    if (NOT CMAKE_CROSSCOMPILING)
        execute_process(
            COMMAND "${BWRAP_EXECUTABLE}" --version
            RESULT_VARIABLE BWRAP_RET
            OUTPUT_VARIABLE BWRAP_OUTPUT
        )
        if (BWRAP_RET)
            message(FATAL_ERROR "Failed to run ${BWRAP_EXECUTABLE}")
        endif ()
        string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BWRAP_VERSION "${BWRAP_OUTPUT}")
        if (NOT "${BWRAP_VERSION}" VERSION_GREATER_EQUAL "0.3.1")
            message(FATAL_ERROR "bwrap must be >= 0.3.1 but ${BWRAP_VERSION} found")
        endif ()
    elseif (NOT SILENCE_CROSS_COMPILATION_NOTICES)
        message(NOTICE
            "***--------------------------------------------------------***\n"
            "***  Cannot check Bubblewrap version when cross-compiling. ***\n"
            "***  The target system MUST have version 0.3.1 or newer.   ***\n"
            "***  Use the BWRAP_EXECUTABLE and DBUS_PROXY_EXECUTABLE    ***\n"
            "***  variables to set the run-time paths for the 'bwrap'   ***\n"
            "***  and 'xdg-dbus-proxy' programs.                        ***\n"
            "***--------------------------------------------------------***"
        )
    endif ()

    add_definitions(-DBWRAP_EXECUTABLE="${BWRAP_EXECUTABLE}")
    add_definitions(-DDBUS_PROXY_EXECUTABLE="${DBUS_PROXY_EXECUTABLE}")
endif ()