Skip to content

Commit 0e4b2c7

Browse files
authored
trojan-plus: optimize boost version check. (#499)
1 parent dfdc4bd commit 0e4b2c7

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

trojan-plus/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ define Package/trojan-plus
6060
DEPENDS:= \
6161
+libpthread +libstdcpp +libopenssl \
6262
+boost +boost-program_options \
63-
$(if $(filter y,$(BOOST_SYSTEM)),,+boost-system)
63+
$(if $(filter y,$(NEED_BOOST_SYSTEM)),,+boost-system)
6464
endef
6565

6666
define Package/trojan-plus/install

trojan-plus/boost-version.mk

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# boost-version.mk
2-
BOOST_MAKEFILE:= $(TOPDIR)/feeds/packages/libs/boost/Makefile
3-
BOOST_VER := $(shell grep '^PKG_VERSION' $(BOOST_MAKEFILE) 2>/dev/null | sed -E 's/^PKG_VERSION[^0-9]*//')
2+
BOOST_MAKEFILE := $(firstword $(shell find -L $(TOPDIR) -type f -path "*/boost/Makefile"))
43

5-
BOOST_VER_MAJOR := $(word 1,$(subst ., ,$(BOOST_VER)))
6-
BOOST_VER_MINOR := $(word 2,$(subst ., ,$(BOOST_VER)))
7-
BOOST_VER_PATCH := $(word 3,$(subst ., ,$(BOOST_VER)))
4+
BOOST_PKG_VERSION := $(shell grep '^PKG_VERSION:=' $(BOOST_MAKEFILE) | head -n1 | cut -d= -f2)
85

9-
BOOST_VERSION := $(shell echo $$(($(BOOST_VER_MAJOR)*100000 + $(BOOST_VER_MINOR)*100 + $(BOOST_VER_PATCH))))
6+
BOOST_VER_MAJOR := $(word 1,$(subst ., ,$(BOOST_PKG_VERSION)))
7+
BOOST_VER_MINOR := $(word 2,$(subst ., ,$(BOOST_PKG_VERSION)))
8+
BOOST_VER_PATCH := $(word 3,$(subst ., ,$(BOOST_PKG_VERSION)))
109

11-
BOOST_SYSTEM := $(if $(shell [ $(BOOST_VERSION) -ge 108900 ] && echo y),y,n)
10+
BOOST_VERSION_CODE := $(shell echo $$(($(BOOST_VER_MAJOR)*100000 + $(BOOST_VER_MINOR)*100 + $(BOOST_VER_PATCH))))
11+
12+
NEED_BOOST_SYSTEM := $(if $(shell [ $(BOOST_VERSION_CODE) -ge 108900 ] && echo y),y,n)

0 commit comments

Comments
 (0)