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