mirror of
https://github.com/openharmony/third_party_mksh.git
synced 2026-07-01 12:24:52 -04:00
05cb65d4e0
Signed-off-by: lyn1121 <335661597@qq.com>
274 lines
7.4 KiB
Plaintext
274 lines
7.4 KiB
Plaintext
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without modification,
|
|
# are permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
# conditions and the following disclaimer.
|
|
#
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
|
# provided with the distribution.
|
|
#
|
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
# to endorse or promote products derived from this software without specific prior written
|
|
# permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# feature: sh
|
|
if (defined(ohos_lite)) {
|
|
executable("mksh") {
|
|
sources = [
|
|
"edit.c",
|
|
"eval.c",
|
|
"exec.c",
|
|
"expr.c",
|
|
"funcs.c",
|
|
"histrap.c",
|
|
"jobs.c",
|
|
"lalloc.c",
|
|
"lex.c",
|
|
"main.c",
|
|
"misc.c",
|
|
"shf.c",
|
|
"strlcpy.c",
|
|
"syn.c",
|
|
"tree.c",
|
|
"var.c",
|
|
]
|
|
|
|
include_dirs = [ "./" ]
|
|
|
|
cflags = [
|
|
"-Wall",
|
|
"-Wno-deprecated-declarations",
|
|
"-fno-asynchronous-unwind-tables",
|
|
"-fwrapv",
|
|
"-fstack-protector-all",
|
|
"-fPIE",
|
|
|
|
# various options we choose
|
|
"-DDEBUG_LEAKS",
|
|
"-DMKSH_ASSUME_UTF8",
|
|
"-DMKSH_DONT_EMIT_IDSTRING",
|
|
|
|
# and the defines from middleware file Rebuild.sh.
|
|
"-DMKSH_BUILDSH",
|
|
"-D_GNU_SOURCE",
|
|
"-DSETUID_CAN_FAIL_WITH_EAGAIN",
|
|
"-DHAVE_STRING_POOLING=2",
|
|
"-DHAVE_ATTRIBUTE_BOUNDED=0",
|
|
"-DHAVE_ATTRIBUTE_FORMAT=1",
|
|
"-DHAVE_ATTRIBUTE_NORETURN=1",
|
|
"-DHAVE_ATTRIBUTE_PURE=1",
|
|
"-DHAVE_ATTRIBUTE_UNUSED=1",
|
|
"-DHAVE_ATTRIBUTE_USED=1",
|
|
"-DHAVE_SYS_TIME_H=1",
|
|
"-DHAVE_TIME_H=1",
|
|
"-DHAVE_BOTH_TIME_H=1",
|
|
"-DHAVE_SYS_BSDTYPES_H=0",
|
|
"-DHAVE_SYS_FILE_H=1",
|
|
"-DHAVE_SYS_MKDEV_H=0",
|
|
"-DHAVE_SYS_MMAN_H=1",
|
|
"-DHAVE_SYS_PARAM_H=1",
|
|
"-DHAVE_SYS_R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",
|
|
"-DHAVE_SYS_SIGLIST_DECL=1",
|
|
"-DHAVE_PERSISTENT_HISTORY=1",
|
|
"-DMKSH_UNLIMITED",
|
|
"-DMKSH_BUILD_R=593",
|
|
]
|
|
|
|
ldflags = [
|
|
"-pie",
|
|
"-Wl,-z,relro",
|
|
"-Wl,-z,now",
|
|
"-Wl,-z,noexecstack",
|
|
]
|
|
}
|
|
} else {
|
|
import("//build/config/ohos/config.gni")
|
|
import("//build/ohos.gni")
|
|
import("mksh.gni")
|
|
ohos_executable("sh") {
|
|
sources = [
|
|
"edit.c",
|
|
"eval.c",
|
|
"exec.c",
|
|
"expr.c",
|
|
"funcs.c",
|
|
"histrap.c",
|
|
"jobs.c",
|
|
"lalloc.c",
|
|
"lex.c",
|
|
"main.c",
|
|
"misc.c",
|
|
"shf.c",
|
|
"strlcpy.c",
|
|
"syn.c",
|
|
"tree.c",
|
|
"var.c",
|
|
]
|
|
|
|
include_dirs = [ "./" ]
|
|
|
|
cflags = [
|
|
"-Wall",
|
|
"-Wno-deprecated-declarations",
|
|
"-fno-asynchronous-unwind-tables",
|
|
"-fwrapv",
|
|
"-fstack-protector-all",
|
|
"-fPIE",
|
|
|
|
# various options we choose
|
|
"-DMKSH_ASSUME_UTF8",
|
|
"-DMKSH_DONT_EMIT_IDSTRING",
|
|
|
|
# and the defines from middleware file Rebuild.sh.
|
|
"-DMKSH_BUILDSH",
|
|
"-D_GNU_SOURCE",
|
|
"-DSETUID_CAN_FAIL_WITH_EAGAIN",
|
|
"-DHAVE_STRING_POOLING=2",
|
|
"-DHAVE_ATTRIBUTE_BOUNDED=0",
|
|
"-DHAVE_ATTRIBUTE_FORMAT=1",
|
|
"-DHAVE_ATTRIBUTE_NORETURN=1",
|
|
"-DHAVE_ATTRIBUTE_PURE=1",
|
|
"-DHAVE_ATTRIBUTE_UNUSED=1",
|
|
"-DHAVE_ATTRIBUTE_USED=1",
|
|
"-DHAVE_SYS_TIME_H=1",
|
|
"-DHAVE_TIME_H=1",
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UPS=1",
|
|
"-DHAVE_STRERROR=1",
|
|
"-DHAVE_STRSIGNAL=0",
|
|
"-DHAVE_STRLCPY=0",
|
|
"-DHAVE_FLOCK_DECL=1",
|
|
"-DHAVE_REVOKE_DECL=1",
|
|
"-DHAVE_SYS_ERRLIST_DECL=1",
|
|
"-DHAVE_SYS_SIGLIST_DECL=1",
|
|
"-DHAVE_PERSISTENT_HISTORY=1",
|
|
"-DMKSH_UNLIMITED",
|
|
"-DMKSH_BUILD_R=593",
|
|
]
|
|
|
|
defines = [ "MKSH_OH_ADAPT" ]
|
|
if (mksh_terminal_ext) {
|
|
defines += [ "MKSH_TERMINAL_EXT" ]
|
|
}
|
|
|
|
ldflags = [
|
|
"-pie",
|
|
"-Wl,-z,relro",
|
|
"-Wl,-z,now",
|
|
"-Wl,-z,noexecstack",
|
|
]
|
|
if (mksh_feature_support_usr_symlink) {
|
|
symlink_target_name = [
|
|
"../usr/bin/sh",
|
|
]
|
|
}
|
|
install_images = [
|
|
"system",
|
|
"ramdisk",
|
|
"updater",
|
|
]
|
|
part_name = "mksh"
|
|
install_enable = true
|
|
}
|
|
}
|