diff --git a/BUILD.gn b/BUILD.gn index b8f9020e254c0f065f1ba7edfe252a9c093d83f0..e25601202f59f9e61593742d2b2512871428fe92 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,46 +1,63 @@ -# Copyright (C) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") - -liburing_source = [ - "//third_party/liburing/src/nolibc.c", - "//third_party/liburing/src/queue.c", - "//third_party/liburing/src/register.c", - "//third_party/liburing/src/setup.c", - "//third_party/liburing/src/syscall.c", -] - -import("//build/ohos.gni") - -config("liburing_config") { - visibility = [ ":*" ] - - include_dirs = [ - "//third_party/liburing", - "//third_party/liburing/src", - "//third_party/liburing/src/include", - "//third_party/liburing/src/include/liburing", - "//third_party/liburing/src/arch" - - ] -} - -ohos_shared_library("liburing") { - configs = [ "//third_party/liburing:liburing_config" ] - sources = liburing_source - external_deps = [ "c_utils:utils" ] - subsystem_name = "thirdparty" - part_name = "liburing" - output_name = "liburing" -} \ No newline at end of file +# Copyright (C) 2023-2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +src_path = "//third_party/liburing" +out_dir = root_out_dir + "/third_party_liburing" +code_dir = out_dir + "/liburing" + +liburing_source = [ + "src/queue.c", + "src/register.c", + "src/setup.c", + "src/syscall.c", +] + +config("liburing_config") { + visibility = [ ":*" ] + + include_dirs = [ + "$code_dir", + "$code_dir/src", + "$code_dir/src/include", + "$code_dir/src/include/liburing", + "$code_dir/src/arch", + ] +} + +action("liburing_configure") { + script = "install.sh" + args = [ + rebase_path(src_path), + rebase_path(out_dir), + ] + inputs = [ src_path ] + outputs = [] + foreach(src, liburing_source) { + outputs += [ "$code_dir/" + src ] + } +} + +ohos_shared_library("liburing") { + configs = [ "//third_party/liburing:liburing_config" ] + sources = [] + foreach(src, liburing_source) { + sources += [ "$code_dir/" + src ] + } + deps = [ ":liburing_configure" ] + external_deps = [ "c_utils:utils" ] + subsystem_name = "thirdparty" + part_name = "liburing" + output_name = "liburing" +} diff --git a/bundle.json b/bundle.json index de03fb5837e072fa6b5c1d57b5d69dd7e09ba7eb..5faf865278b5c6fefb3da778d818973d16ffd18a 100644 --- a/bundle.json +++ b/bundle.json @@ -22,7 +22,9 @@ "rom": "", "ram": "", "deps": { - "components": [], + "components": [ + "c_utils" + ], "third_party": [] }, "build": { diff --git a/install.sh b/install.sh new file mode 100755 index 0000000000000000000000000000000000000000..048222774f162a37c0ff9fb2682c80f9a1982e24 --- /dev/null +++ b/install.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SRC_DIR="$1" +CODE_DIR="$2" + +set -e +if [ "$SRC_DIR" == "" ] || [ "$CODE_DIR" == "" ]; then + exit 1 +fi + +mkdir -p $CODE_DIR +cp -r $SRC_DIR $CODE_DIR + +CURRENT_DIR=$(pwd) +cd $CODE_DIR/liburing +sh ./configure +cd "$CURRENT_DIR"