Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 2d0acdc

Browse files
author
HYChang
committed
fix(endpoint): Revise endpoint build targets in favor of Bazel
It's hard to build endpoint library with mixed build system. This commit removed the http-parser and the mbedtls submodules from GNU Make build system and changed them to build from Bazel. The http_parser changed to use the source from entangled. Add `@http_parser` into deps if needed. The mbedtls's version from entangled has not been updated for a long time. So the mbedtls source is still pull from github. But changed the build system from GNU Make to Bazel. In order to avoid conflict with the same library inside entangled. The mbedtls library which pulled from github add a suffix `2_16_6`. Add `@mbedtls_2_16_6` into deps if needed. Close #647
1 parent 5b9207b commit 2d0acdc

File tree

9 files changed

+19
-41
lines changed

9 files changed

+19
-41
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,3 @@
77
[submodule "third_party/mosquitto"]
88
path = third_party/mosquitto
99
url = https://github.com/eclipse/mosquitto.git
10-
[submodule "third_party/http-parser"]
11-
path = third_party/http-parser
12-
url = https://github.com/nodejs/http-parser.git
13-
[submodule "third_party/mbedtls"]
14-
path = third_party/mbedtls
15-
url = https://github.com/ARMmbed/mbedtls.git

Makefile

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ DCURL_DIR := third_party/dcurl
22
DCURL_LIB := $(DCURL_DIR)/build/libdcurl.so
33
MOSQUITTO_DIR := third_party/mosquitto
44
MOSQUITTO_LIB := $(MOSQUITTO_DIR)/lib/libmosquitto.so.1
5-
MBEDTLS_DIR := third_party/mbedtls
6-
MBEDTLS_LIB := $(MBEDTLS_PATH)/library/libmbedx509.so $(MBEDTLS_PATH)/library/libmbedtls.so $(MBEDTLS_PATH)/library/libmbedcrypto.so
7-
HTTPPARSER_DIR := third_party/http-parser
8-
HTTPPARSER_LIB := $(HTTPPARSER_DIR)/libhttp_parser.so
95
PEM_DIR = pem
10-
DEPS += $(DCURL_LIB) $(HTTPPARSER_LIB) $(MBEDTLS_LIB)
6+
DEPS += $(DCURL_LIB)
117
PEM := $(PEM_DIR)/cert.pem
128

139
all: $(DEPS) cert
@@ -27,14 +23,6 @@ $(MOSQUITTO_LIB): $(MOSQUITTO_DIR)
2723
@echo
2824
$(MAKE) -C $^ WITH_DOCS=no
2925

30-
$(HTTPPARSER_LIB): $(HTTPPARSER_DIR)
31-
git submodule update --init $^
32-
$(MAKE) -C $^ library
33-
34-
$(MBEDTLS_LIB): $(MBEDTLS_DIR)
35-
git submodule update --init $^
36-
$(MAKE) -C $^ SHARED=1 lib
37-
3826
cert: check_pem
3927
@xxd -i $(PEM) > $(PEM_DIR)/ca_crt.inc
4028
@sed -E \
@@ -52,9 +40,6 @@ endif
5240
clean:
5341
$(MAKE) -C $(DCURL_DIR) clean
5442
$(MAKE) -C $(MOSQUITTO_DIR) clean
55-
$(MAKE) -C $(HTTPPARSER_DIR) clean
56-
$(MAKE) -C $(MBEDTLS_DIR) clean
57-
5843

5944
distclean: clean
6045
$(RM) -r $(DCURL_DIR)

WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ git_repository(
2525
tag = "v0.9.0",
2626
)
2727

28+
new_git_repository(
29+
name = "mbedtls_2_16_6",
30+
build_file = "//third_party:mbedtls.BUILD",
31+
remote = "https://github.com/ARMmbed/mbedtls.git",
32+
tag = "mbedtls-2.16.6",
33+
)
34+
2835
load("@rules_iota//:defs.bzl", "iota_deps")
2936
load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")
3037

third_party/BUILD

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,3 @@ cc_library(
1818
"mosquitto/lib/mqtt_protocol.h",
1919
],
2020
)
21-
22-
cc_library(
23-
name = "http-parser",
24-
srcs = glob(["http-parser/*.so.*"]),
25-
hdrs = ["http-parser/http_parser.h"],
26-
includes = ["http-parser"],
27-
)
28-
29-
cc_library(
30-
name = "mbedtls",
31-
srcs = glob(["mbedtls/library/*.so.*"]),
32-
hdrs = glob(["mbedtls/include/mbedtls/*.h"]) + glob(["mbedtls/include/psa/*.h"]),
33-
includes = ["mbedtls/include"],
34-
)

third_party/http-parser

Lines changed: 0 additions & 1 deletion
This file was deleted.

third_party/mbedtls

Lines changed: 0 additions & 1 deletion
This file was deleted.

third_party/mbedtls.BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cc_library(
2+
name = "mbedtls_2_16_6",
3+
srcs = glob(["library/*.c"]),
4+
hdrs = glob(["include/mbedtls/*.h"]) + glob(["include/psa/*.h"]),
5+
include_prefix = "mbedtls",
6+
strip_include_prefix = "include/mbedtls",
7+
visibility = ["//visibility:public"],
8+
)

utils/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cc_library(
5050
hdrs = ["cipher.h"],
5151
deps = [
5252
"//common:ta_errors",
53-
"//third_party:mbedtls",
53+
"@mbedtls_2_16_6",
5454
],
5555
)
5656

utils/connectivity/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cc_library(
99
deps = [
1010
"//common",
1111
"//pem:cert",
12-
"//third_party:http-parser",
13-
"//third_party:mbedtls",
12+
"@http_parser",
13+
"@mbedtls_2_16_6",
1414
],
1515
)

0 commit comments

Comments
 (0)