summaryrefslogtreecommitdiff
path: root/Android.bp
blob: 458c1eff2389e6dd7e1aa7b5886178b6c5b3b578 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// uncomment to build libselinux and related artifacts against PCRE2
//common_LIBRARIES = ["libpcre2"]
//common_CFLAGS = [
//    "-DUSE_PCRE2",
//
//    // Persistently stored patterns (pcre2) are architecture dependent.
//    // In particular paterns built on amd64 can not run on devices with armv7
//    // (32bit). Therefore, this feature stays off for now.
//    "-DNO_PERSISTENTLY_STORED_PATTERNS",
//]

common_LIBRARIES = ["libpcre"]
common_CFLAGS = []

cc_defaults {
    name: "libselinux_flags",

    cflags: common_CFLAGS,

    target: {
        host: {
            cflags: ["-DHOST"],
        },
        darwin: {
            cflags: ["-DDARWIN"],
        },
    },
}

cc_library {
    name: "libselinux",
    defaults: ["libselinux_flags"],
    host_supported: true,

    srcs: [
        "src/callbacks.c",
        "src/check_context.c",
        "src/freecon.c",
        "src/init.c",
        "src/label.c",
        "src/label_file.c",
        "src/label_android_property.c",
        "src/regex.c",
        "src/label_support.c",
    ],

    target: {
        android: {
            srcs: [
                "src/booleans.c",
                "src/canonicalize_context.c",
                "src/disable.c",
                "src/enabled.c",
                "src/fgetfilecon.c",
                "src/fsetfilecon.c",
                "src/getenforce.c",
                "src/getfilecon.c",
                "src/getpeercon.c",
                "src/lgetfilecon.c",
                "src/load_policy.c",
                "src/lsetfilecon.c",
                "src/policyvers.c",
                "src/procattr.c",
                "src/setenforce.c",
                "src/setfilecon.c",
                "src/context.c",
                "src/mapping.c",
                "src/stringrep.c",
                "src/compute_create.c",
                "src/compute_av.c",
                "src/avc.c",
                "src/avc_internal.c",
                "src/avc_sidtab.c",
                "src/get_initial_context.c",
                "src/checkAccess.c",
                "src/sestatus.c",
                "src/deny_unknown.c",

                "src/android.c",
            ],

            shared_libs: [
                "libcrypto",
                "liblog",
            ],
            static: {
                whole_static_libs: ["libpackagelistparser"],
            },
            shared: {
                shared_libs: ["libpackagelistparser"],
            },

            // 1003 corresponds to auditd, from system/core/logd/event.logtags
            cflags: ["-DAUDITD_LOG_TAG=1003"],
            // mapping.c has redundant check of array p_in->perms.
            clang_cflags: ["-Wno-pointer-bool-conversion"],
        },
    },

    static: {
        whole_static_libs: common_LIBRARIES,
    },
    shared: {
        shared_libs: common_LIBRARIES,
    },

    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
}

//################################
cc_binary_host {
    name: "sefcontext_compile",
    defaults: ["libselinux_flags"],
    srcs: ["utils/sefcontext_compile.c"],

    static_libs: ["libselinux"],
    whole_static_libs: common_LIBRARIES,
}