-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathmeta.mk
89 lines (75 loc) · 2.95 KB
/
meta.mk
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
#
# Copyright (C) 2021 jjm2473 <[email protected]>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
META_NAME?=$(notdir ${CURDIR})
META_BASENAME?=$(patsubst app-meta-%,%,$(META_NAME))
META_ARCH?=all
META_FLAGS:=$(if $(realpath entry.sh), entrysh)
PKG_NAME?=$(META_NAME)
PKG_RELEASE?=1
PKG_MAINTAINER:=$(META_AUTHOR)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
escape_json=$(strip $(subst ",\",$(subst \,\\\\,$(1))))
META_ESCAPED_TITLE:=$(call escape_json,$(META_TITLE))
META_ESCAPED_DESCRIPTION:=$(call escape_json,$(META_DESCRIPTION))
META_ESCAPED_TITLE.en:=$(call escape_json,$(META_TITLE.en))
META_ESCAPED_DESCRIPTION.en:=$(call escape_json,$(META_DESCRIPTION.en))
define Package/$(PKG_NAME)
SECTION:=meta
CATEGORY:=Metadata
TITLE:=$(META_TITLE)
DEPENDS:=$(META_DEPENDS)
PKGARCH:=all
endef
ifneq ($(META_DESCRIPTION),)
define Package/$(PKG_NAME)/description
$(strip $(META_DESCRIPTION))
endef
endif
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/JsonInfo
{
"name": "$(META_BASENAME)",
"title": "$(META_ESCAPED_TITLE)",
$(if $(META_ESCAPED_TITLE.en), "title_en": "$(META_ESCAPED_TITLE.en)"$(comma))
"entry": "$(META_LUCI_ENTRY)",
"author": "$(META_AUTHOR)",
"website": "$(META_WEBSITE)",
$(if $(META_TUTORIAL), "tutorial": "$(META_TUTORIAL)"$(comma))
"version": "$(PKG_VERSION)",
"release": $(PKG_RELEASE),
"arch": [$(patsubst %$(comma),%,$(subst $(space),,$(foreach arch,$(META_ARCH),"$(arch)"$(comma))))],
"description": "$(META_ESCAPED_DESCRIPTION)",
$(if $(META_ESCAPED_DESCRIPTION.en), "description_en": "$(META_ESCAPED_DESCRIPTION.en)"$(comma))
$(if $(META_AUTOCONF), "autoconf": [$(patsubst %$(comma),%,$(subst $(space),,$(foreach conf,$(META_AUTOCONF),"$(conf)"$(comma))))]$(comma))
$(if $(META_UCI), "uci": "$(META_UCI)"$(comma))
$(if $(META_FLAGS), "flags": [$(patsubst %$(comma),%,$(subst $(space),,$(foreach flag,$(META_FLAGS),"$(flag)"$(comma))))]$(comma))
"tags": [$(patsubst %$(comma),%,$(subst $(space),,$(foreach tag,$(META_TAGS),"$(tag)"$(comma))))],
"depends": [$(patsubst %$(comma),%,$(subst $(space),,$(foreach dep,$(META_DEPENDS),"$(subst +,,$(dep))"$(comma))))]
}
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/opkg/meta $(1)/usr/libexec/istorea $(1)/usr/libexec/istoree $(1)/www/luci-static/resources/app-icons
if [ -d ./root ]; then \
cp -pR ./root/* $(1)/; \
else true; fi
if [ -f ./logo.png ]; then \
$(INSTALL_DATA) ./logo.png $(1)/www/luci-static/resources/app-icons/$(META_BASENAME).png ; \
fi;
if [ -f ./config.sh ]; then \
$(INSTALL_BIN) ./config.sh $(1)/usr/libexec/istorea/$(META_BASENAME).sh ; \
fi;
if [ -f ./entry.sh ]; then \
$(INSTALL_BIN) ./entry.sh $(1)/usr/libexec/istoree/$(META_BASENAME).sh ; \
fi;
echo "$(call escape_json,$(call Package/$(PKG_NAME)/JsonInfo))" > $(1)/usr/lib/opkg/meta/$(META_BASENAME).json
endef
$(eval $(call BuildPackage,$(PKG_NAME)))