summaryrefslogtreecommitdiffstats
blob: c6d4d9b8473aa5b7395bf66992d6a8537ccf0623 (plain) (blame)
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
120
121
122
123
124
125
cc_defaults {
    name: "toolbox_defaults",

    cflags: [
        "-Werror",
        "-Wno-unused-parameter",
        "-Wno-unused-const-variable",
        "-include bsd-compatibility.h",
        "-D_FILE_OFFSET_BITS=64",
    ],
    local_include_dirs: ["upstream-netbsd/include/"],
}

cc_library_static {
    name: "libtoolbox_dd",
    defaults: ["toolbox_defaults"],
    vendor_available: true,
    srcs: [
        "upstream-netbsd/bin/dd/args.c",
        "upstream-netbsd/bin/dd/conv.c",
        "upstream-netbsd/bin/dd/dd.c",
        "upstream-netbsd/bin/dd/dd_hostops.c",
        "upstream-netbsd/bin/dd/misc.c",
        "upstream-netbsd/bin/dd/position.c",
        "upstream-netbsd/lib/libc/gen/getbsize.c",
        "upstream-netbsd/lib/libc/gen/humanize_number.c",
        "upstream-netbsd/lib/libc/stdlib/strsuftoll.c",
        "upstream-netbsd/lib/libc/string/swab.c",
        "upstream-netbsd/lib/libutil/raise_default_signal.c",
    ],
    cflags: [
        "-Dmain=dd_main",
        "-DNO_CONV",
    ],
}

genrule {
    name: "toolbox_input_labels",
    tool_files: ["generate-input.h-labels.py"],
    cmd: "$(location) $(in) >$(out)",
    srcs: [":kernel_input_headers"],
    out: ["input.h-labels.h"],
}

cc_defaults {
    name: "toolbox_binary_defaults",
    defaults: ["toolbox_defaults"],
    cpp_std: "experimental",
    srcs: [
        "toolbox.c",
        "getevent.c",
        "getprop.cpp",
        "newfs_msdos.c",
    ],
    generated_headers: [
        "toolbox_input_labels",
    ],
    whole_static_libs: ["libtoolbox_dd"],
    shared_libs: [
        "libbase",
        "libcutils",
    ],
    static_libs: ["libpropertyinfoparser"],

    symlinks: [
        "getevent",
        "getprop",
        "newfs_msdos",
    ],
}

cc_binary {
    name: "toolbox",
    defaults: ["toolbox_binary_defaults"],
}

cc_binary {
    name: "toolbox_vendor",
    stem: "toolbox",
    vendor: true,
    defaults: ["toolbox_binary_defaults"],
}

// We only want 'r' on userdebug and eng builds.
cc_binary {
    name: "r",
    defaults: ["toolbox_defaults"],
    srcs: ["r.c"],
}

// We build BSD grep separately, so it can provide egrep and fgrep too.
cc_defaults {
    name: "grep_common",
    defaults: ["toolbox_defaults"],
    srcs: [
        "upstream-netbsd/usr.bin/grep/fastgrep.c",
        "upstream-netbsd/usr.bin/grep/file.c",
        "upstream-netbsd/usr.bin/grep/grep.c",
        "upstream-netbsd/usr.bin/grep/queue.c",
        "upstream-netbsd/usr.bin/grep/util.c",
    ],
    symlinks: [
        "egrep",
        "fgrep",
    ],

    sanitize: {
        integer_overflow: false,
    },
}

cc_binary {
    name: "grep",
    defaults: ["grep_common"],
}

// Build vendor grep.
// TODO: Add vendor_available to "grep" module and remove "grep_vendor" module
//       when vendor_available is fully supported.
cc_binary {
    name: "grep_vendor",
    stem: "grep",
    vendor: true,
    defaults: ["grep_common"],
}