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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
From a7244bd742f999e7ec8462797c7e7a393a844a7b Mon Sep 17 00:00:00 2001
From: hmilylmk <liumingkai@huawei.com>
Date: Sat, 13 Aug 2022 08:21:36 +0800
Subject: [PATCH] add dsoftbus build support for embedded env
Signed-off-by: hmilylmk <liumingkai@huawei.com>
---
build_scripts/build.sh | 9 ++++----
config/BUILDCONFIG.gn | 11 ++++-----
config/compiler/compiler.gni | 6 +----
config/ohos/BUILD.gn | 32 +-------------------------
config/ohos/abi.gni | 5 -----
config/ohos/config.gni | 4 ++--
config/ohos/musl.gni | 4 +++-
core/gn/BUILD.gn | 35 ++---------------------------
loader/preloader/platforms.template | 4 ++--
ohos.gni | 7 ------
subsystem_config.json | 6 +++++
toolchain/linux/BUILD.gn | 8 +++++--
12 files changed, 31 insertions(+), 100 deletions(-)
diff --git a/build_scripts/build.sh b/build_scripts/build.sh
index 3514b36..e2404ca 100755
--- a/build_scripts/build.sh
+++ b/build_scripts/build.sh
@@ -70,22 +70,22 @@ do
shift
done
-
if [[ "${source_root_dir}x" == "x" ]]; then
echo "Error: source_root_dir cannot be empty."
exit 1
fi
+
if [[ ! -d "${source_root_dir}" ]]; then
echo "Error: source_root_dir is incorrect."
exit 1
fi
+
if [[ "${product_name}x" == "x" ]]; then
echo -e "\033[31mError: the product name should be specified!\033[0m"
help
exit 1
fi
-
case $(uname -s) in
Darwin)
HOST_DIR="darwin-x86"
@@ -102,10 +102,9 @@ case $(uname -s) in
esac
# set python3
-PYTHON3=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.8.5/bin/python3
-
+PYTHON3=`which python`
if [[ ! -f "${PYTHON3}" ]]; then
- echo -e "\033[33m Please execute the build/prebuilts_download.sh \033[0m"
+ echo -e "\033[33m python3 not found, please check\033[0m"
exit 1
fi
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 98bb98b..9e016df 100755
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -130,10 +130,7 @@ declare_args() {
is_desktop_linux = current_os == "linux"
# Set to true when compiling with the Clang compiler.
- is_clang = current_os != "linux" ||
- (current_cpu != "s390x" && current_cpu != "s390" &&
- current_cpu != "ppc64" && current_cpu != "ppc" &&
- current_cpu != "mips" && current_cpu != "mips64")
+ is_clang = false
# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
@@ -154,7 +151,7 @@ declare_args() {
}
declare_args() {
- use_musl = true
+ use_musl = false
}
asdk_libs_dir = "//prebuilts/asdk_libs"
@@ -220,7 +217,7 @@ if (host_toolchain == "") {
if (host_os == "linux") {
if (target_os != "linux") {
- host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
+ host_toolchain = "//build/toolchain/linux:$host_cpu"
} else if (is_clang) {
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
} else {
@@ -250,7 +247,7 @@ _default_toolchain = ""
if (target_os == "ohos") {
assert(host_os == "linux" || host_os == "mac",
"ohos builds are only supported on Linux and Mac hosts.")
- _default_toolchain = "//build/toolchain/ohos:ohos_clang_$target_cpu"
+ _default_toolchain = "//build/toolchain/linux:$target_cpu"
} else if (target_os == "linux") {
if (is_clang) {
_default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
diff --git a/config/compiler/compiler.gni b/config/compiler/compiler.gni
index b77100a..ae45cc8 100755
--- a/config/compiler/compiler.gni
+++ b/config/compiler/compiler.gni
@@ -152,11 +152,7 @@ declare_args() {
declare_args() {
# Whether to use the gold linker from binutils instead of lld or bfd.
- use_gold = !use_lld &&
- ((is_linux && (current_cpu == "x64" || current_cpu == "x86" ||
- current_cpu == "arm")) ||
- (is_ohos && (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64")))
+ use_gold = false
}
# If it wasn't manually set, set to an appropriate default.
diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn
index aa5ac7c..941cc2e 100755
--- a/config/ohos/BUILD.gn
+++ b/config/ohos/BUILD.gn
@@ -24,31 +24,17 @@ config("compiler") {
"HAVE_SYS_UIO_H",
]
- defines += [
- "__MUSL__",
- "_LIBCPP_HAS_MUSL_LIBC",
- "__BUILD_LINUX_WITH_CLANG",
- ]
-
ldflags = [
"-Wl,--no-undefined",
- "-Wl,--exclude-libs=libunwind_llvm.a",
- "-Wl,--exclude-libs=libc++_static.a",
# Don't allow visible symbols from libraries that contain
# assembly code with symbols that aren't hidden properly.
# http://crbug.com/448386
- "-Wl,--exclude-libs=libvpx_assembly_arm.a",
]
- cflags += [ "--target=$abi_target" ]
include_dirs = [
- "${musl_sysroot}/usr/include/${abi_target}",
- "${clang_base_path}/include/c++/v1",
]
- ldflags += [ "--target=$abi_target" ]
-
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler.
asmflags = cflags
@@ -66,13 +52,6 @@ config("runtime_library") {
"CHROMIUM_CXX_TWEAK_INLINES", # Saves binary size.
]
- defines += [
- "__MUSL__",
- "_LIBCPP_HAS_MUSL_LIBC",
- "__BUILD_LINUX_WITH_CLANG",
- ]
- ldflags = [ "-nostdlib" ]
-
libs = []
# arm builds of libc++ starting in NDK r12 depend on unwind.
@@ -80,20 +59,11 @@ config("runtime_library") {
libs += [ "unwind" ]
}
- ldflags += [
- "-L" +
- rebase_path("${clang_base_path}/lib/${abi_target}/c++", root_build_dir),
- "-L" + rebase_path("${musl_sysroot}/usr/lib/${abi_target}", root_build_dir),
- "-L" + rebase_path("${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}",
- root_build_dir),
+ ldflags = [
]
- ldflags += [ "-Wl,--dynamic-linker,/system/bin/ld-musl-${musl_arch}.so.1" ]
libs += [
- rebase_path(libclang_rt_file),
"c",
- "c++",
- "c++abi",
]
if (current_cpu == "arm" && arm_version == 6) {
diff --git a/config/ohos/abi.gni b/config/ohos/abi.gni
index 57d1dca..600bc3e 100755
--- a/config/ohos/abi.gni
+++ b/config/ohos/abi.gni
@@ -61,8 +61,3 @@ if (target_cpu == "arm64") {
ohos_secondary_abi_cpu = "x86"
ohos_app_secondary_abi = "x86"
}
-
-if (defined(ohos_secondary_abi_cpu)) {
- ohos_secondary_abi_toolchain =
- "//build/toolchain/ohos:ohos_clang_${ohos_secondary_abi_cpu}"
-}
diff --git a/config/ohos/config.gni b/config/ohos/config.gni
index 072bce1..00c7311 100644
--- a/config/ohos/config.gni
+++ b/config/ohos/config.gni
@@ -26,11 +26,11 @@ if (is_ohos) {
}
if (current_cpu == "arm") {
- abi_target = "arm-linux-ohosmusl"
+ abi_target = ""
} else if (current_cpu == "x86") {
abi_target = ""
} else if (current_cpu == "arm64") {
- abi_target = "aarch64-linux-ohosmusl"
+ abi_target = ""
} else if (current_cpu == "x86_64") {
abi_target = ""
} else {
diff --git a/config/ohos/musl.gni b/config/ohos/musl.gni
index 2468ca8..f9cead9 100644
--- a/config/ohos/musl.gni
+++ b/config/ohos/musl.gni
@@ -16,4 +16,6 @@ if (use_musl){
musl_target = "//third_party/musl:musl_libs"
musl_sysroot = get_label_info(musl_target, "target_out_dir")
import("//third_party/musl/musl_config.gni")
-}
\ No newline at end of file
+} else {
+ musl_sysroot = ""
+}
diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn
index 38d3cc9..cde44b1 100755
--- a/core/gn/BUILD.gn
+++ b/core/gn/BUILD.gn
@@ -86,41 +86,10 @@ if (product_name == "ohos-sdk") {
deps = [ "//build/ohos/sdk:ohos_sdk" ]
}
} else {
- group("make_all") {
- deps = [
- ":images",
- ":make_inner_kits",
- ":packages",
- ]
- }
-
group("images") {
- deps = [ "//build/ohos/images:make_images" ]
- }
-
- group("packages") {
- deps = [ "//build/ohos/packages:make_packages" ]
- }
-
- group("make_inner_kits") {
- deps = [ "$root_build_dir/build_configs:inner_kits" ]
- }
-
- group("build_all_test_pkg") {
- testonly = true
deps = [
- "$root_build_dir/build_configs:parts_test",
- "//test/developertest:make_temp_test",
+ "//foundation/communication/dsoftbus/core/frame:softbus_server_main",
+ "//foundation/communication/dsoftbus/sdk:softbus_client",
]
}
-
- group("make_test") {
- testonly = true
- deps = [ ":build_all_test_pkg" ]
- deps += [ "//build/ohos/packages:package_testcase_mlf" ]
- deps += [ "//build/ohos/packages:package_testcase" ]
- if (archive_component) {
- deps += [ "//build/ohos/testfwk:archive_testcase" ]
- }
- }
}
diff --git a/loader/preloader/platforms.template b/loader/preloader/platforms.template
index 5cad64d..7577fd6 100644
--- a/loader/preloader/platforms.template
+++ b/loader/preloader/platforms.template
@@ -4,13 +4,13 @@
{
"target_os": "ohos",
"target_cpu": "arm64",
- "toolchain": "//build/toolchain/ohos:ohos_clang_arm64",
+ "toolchain": "//build/toolchain/linux:arm64",
"parts_config": "./parts.json"
},
{
"target_os": "ohos",
"target_cpu": "arm",
- "toolchain": "//build/toolchain/ohos:ohos_clang_arm",
+ "toolchain": "//build/toolchain/linux:arm",
"parts_config": "./parts.json"
}
]
diff --git a/ohos.gni b/ohos.gni
index 77be836..a34baa3 100755
--- a/ohos.gni
+++ b/ohos.gni
@@ -11,19 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build/config/sanitizers/sanitizers.gni")
-import("//build/ohos/ndk/ndk.gni")
-import("//build/ohos/notice/notice.gni")
-import("//build/ohos/sa_profile/sa_profile.gni")
import("//build/ohos_var.gni")
import("//build/toolchain/toolchain.gni")
# import cxx base templates
import("//build/templates/cxx/cxx.gni")
-import("//build/ohos/ace/ace.gni")
-import("//build/ohos/app/app.gni")
-
import("//build/templates/common/ohos_templates.gni")
# import prebuilt templates
diff --git a/subsystem_config.json b/subsystem_config.json
index f04f29e..ebc0869 100644
--- a/subsystem_config.json
+++ b/subsystem_config.json
@@ -178,5 +178,11 @@
"path": "kernel/linux/build",
"name": "kernel",
"dir": "kernel/linux"
+ },
+ "depend": {
+ "project":"openEuler/depend",
+ "path": "depend",
+ "name": "depend",
+ "dir": "depend"
}
}
diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn
index 1a4c4e9..c811cf9 100755
--- a/toolchain/linux/BUILD.gn
+++ b/toolchain/linux/BUILD.gn
@@ -22,7 +22,8 @@ clang_toolchain("clang_arm64") {
}
gcc_toolchain("arm64") {
- toolprefix = "aarch64-linux-gnu-"
+ tool_path = rebase_path("//toolchain/bin", root_build_dir)
+ toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-"
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
@@ -31,6 +32,7 @@ gcc_toolchain("arm64") {
ld = cxx
readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
+ strip = "${toolprefix}strip"
toolchain_args = {
current_cpu = "arm64"
@@ -40,7 +42,8 @@ gcc_toolchain("arm64") {
}
gcc_toolchain("arm") {
- toolprefix = "arm-linux-gnueabihf-"
+ tool_path = rebase_path("//toolchain/bin", root_build_dir)
+ toolprefix = "${tool_path}/arm-openeuler-linux-gnu-"
cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"
@@ -49,6 +52,7 @@ gcc_toolchain("arm") {
ld = cxx
readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
+ strip = "${toolprefix}strip"
toolchain_args = {
current_cpu = "arm"
--
2.34.1
|