• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright © 2010, 2013
2//    Thorsten Glaser <t.glaser@tarent.de>
3// This file is provided under the same terms as mksh.
4
5cc_defaults {
6    name: "sh-defaults",
7
8    srcs: [
9        "src/lalloc.c",
10        "src/edit.c",
11        "src/eval.c",
12        "src/exec.c",
13        "src/expr.c",
14        "src/funcs.c",
15        "src/histrap.c",
16        "src/jobs.c",
17        "src/lex.c",
18        "src/main.c",
19        "src/misc.c",
20        "src/shf.c",
21        "src/syn.c",
22        "src/tree.c",
23        "src/var.c",
24    ],
25
26    local_include_dirs: ["src"],
27
28    cflags: [
29        // Compiler flags...
30        "-Wall",
31        "-Werror",
32        "-Wno-deprecated-declarations",
33        "-fno-asynchronous-unwind-tables",
34        "-fno-strict-aliasing",
35        "-fwrapv",
36
37        // ...various options we choose
38        "-DDEBUG_LEAKS",
39        "-DMKSH_ASSUME_UTF8",
40        "-DMKSH_DONT_EMIT_IDSTRING",
41        "-DKSH_VERSIONNAME_VENDOR_EXT=\" Android\"",
42
43        // ...and the defines from Build.sh.
44        "-DMKSH_BUILDSH",
45        "-D_GNU_SOURCE",
46        "-DSETUID_CAN_FAIL_WITH_EAGAIN",
47        "-DHAVE_STRING_POOLING=1",
48        "-DHAVE_ATTRIBUTE_BOUNDED=1",
49        "-DHAVE_ATTRIBUTE_FORMAT=1",
50        "-DHAVE_ATTRIBUTE_NORETURN=1",
51        "-DHAVE_ATTRIBUTE_PURE=1",
52        "-DHAVE_ATTRIBUTE_UNUSED=1",
53        "-DHAVE_ATTRIBUTE_USED=1",
54        "-DHAVE_SYS_TIME_H=1",
55        "-DHAVE_TIME_H=1",
56        "-DHAVE_BOTH_TIME_H=1",
57        "-DHAVE_SYS_BSDTYPES_H=0",
58        "-DHAVE_SYS_FILE_H=1",
59        "-DHAVE_SYS_MKDEV_H=0",
60        "-DHAVE_SYS_MMAN_H=1",
61        "-DHAVE_SYS_PARAM_H=1",
62        "-DHAVE_SYS_RESOURCE_H=1",
63        "-DHAVE_SYS_SELECT_H=1",
64        "-DHAVE_SYS_SYSMACROS_H=1",
65        "-DHAVE_BSTRING_H=0",
66        "-DHAVE_GRP_H=1",
67        "-DHAVE_IO_H=0",
68        "-DHAVE_LIBGEN_H=1",
69        "-DHAVE_LIBUTIL_H=0",
70        "-DHAVE_PATHS_H=1",
71        "-DHAVE_STDINT_H=1",
72        "-DHAVE_STRINGS_H=1",
73        "-DHAVE_TERMIOS_H=1",
74        "-DHAVE_ULIMIT_H=0",
75        "-DHAVE_VALUES_H=0",
76        "-DHAVE_CAN_INTTYPES=1",
77        "-DHAVE_CAN_UCBINTS=1",
78        "-DHAVE_CAN_INT8TYPE=1",
79        "-DHAVE_CAN_UCBINT8=1",
80        "-DHAVE_RLIM_T=1",
81        "-DHAVE_SIG_T=1",
82        "-DHAVE_SYS_ERRLIST=0",
83        "-DHAVE_SYS_SIGNAME=1",
84        "-DHAVE_SYS_SIGLIST=1",
85        "-DHAVE_FLOCK=1",
86        "-DHAVE_LOCK_FCNTL=1",
87        "-DHAVE_GETRUSAGE=1",
88        "-DHAVE_GETSID=1",
89        "-DHAVE_GETTIMEOFDAY=1",
90        "-DHAVE_KILLPG=1",
91        "-DHAVE_MEMMOVE=1",
92        "-DHAVE_MKNOD=0",
93        "-DHAVE_MMAP=1",
94        "-DHAVE_FTRUNCATE=1",
95        "-DHAVE_NICE=1",
96        "-DHAVE_REVOKE=0",
97        "-DHAVE_SETLOCALE_CTYPE=1",
98        "-DHAVE_LANGINFO_CODESET=1",
99        "-DHAVE_SELECT=1",
100        "-DHAVE_SETRESUGID=1",
101        "-DHAVE_SETGROUPS=1",
102        "-DHAVE_STRERROR=1",
103        "-DHAVE_STRSIGNAL=0",
104        "-DHAVE_STRLCPY=1",
105        "-DHAVE_FLOCK_DECL=1",
106        "-DHAVE_REVOKE_DECL=1",
107        "-DHAVE_SYS_ERRLIST_DECL=0",
108        "-DHAVE_SYS_SIGLIST_DECL=1",
109        "-DHAVE_PERSISTENT_HISTORY=0",
110        "-DMKSH_BUILD_R=571",
111
112        // Additional flags
113        "-DMKSH_DEFAULT_PROFILEDIR=\"/system/etc\"",
114        "-DMKSHRC_PATH=\"/system/etc/mkshrc\"",
115        "-DMKSH_DEFAULT_EXECSHELL=\"/system/bin/sh\"",
116        "-DMKSH_DEFAULT_TMPDIR=\"/data/local\"",
117    ],
118}
119
120cc_binary {
121    name: "sh",
122    defaults: ["sh-defaults"],
123    recovery_available: true,
124}
125
126cc_binary {
127    name: "sh_vendor",
128    defaults: ["sh-defaults"],
129    stem: "sh",
130    vendor: true,
131    cflags: [
132        // Additional flags for vendor variant
133        "-UMKSH_DEFAULT_PROFILEDIR",
134        "-UMKSHRC_PATH",
135        "-UMKSH_DEFAULT_EXECSHELL",
136        "-DMKSH_DEFAULT_PROFILEDIR=\"/vendor/etc\"",
137        "-DMKSHRC_PATH=\"/vendor/etc/mkshrc\"",
138        "-DMKSH_DEFAULT_EXECSHELL=\"/vendor/bin/sh\"",
139        "-DMKSH_DEFPATH_OVERRIDE=\"/vendor/bin:/vendor/xbin\"",
140    ],
141}
142
143// /system/etc/mkshrc
144prebuilt_etc {
145    name: "mkshrc",
146    src: "mkshrc",
147}
148
149// /vendor/etc/mkshrc
150prebuilt_etc {
151    name: "mkshrc_vendor",
152    src: "mkshrc_vendor",
153    filename: "mkshrc",
154    soc_specific: true,
155}
156