1 # SPDX-License-Identifier: MIT
3 # Copyright (C) 2021-2022 Gerald Kerma <gandalf@gk2.net>
6 include $(TOPDIR
)/rules.mk
12 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
13 PKG_SOURCE_URL
:=https
://codeload.github.com
/crowdsecurity
/crowdsec
/tar.gz
/v
$(PKG_VERSION
)?
14 PKG_HASH
:=6d79d67383c7faed6c5b2019e4f01c6ed84334c8c45cd1736ff18a03167aa192
17 PKG_LICENSE_FILES
:=LICENSE
18 PKG_MAINTAINER
:=Gerald Kerma
<gandalf@gk2.net
>
20 PKG_BUILD_DEPENDS
:=golang
/host
22 PKG_BUILD_FLAGS
:=no-mips16
26 CWD_BUILD_VERSION?
=v
$(PKG_VERSION
)
27 CWD_BUILD_GOVERSION
:=$(shell go version | cut
-d
" " -f3 | sed
-E
's/[go]+//g')
28 CWD_BUILD_CODENAME
:=alphaga
29 CWD_BUILD_TIMESTAMP
:=$(shell date
+%F
"_"%T
)
30 CWD_BUILD_TAG
:=openwrt-
$(PKG_VERSION
)-$(PKG_RELEASE
)
32 CWD_VERSION_PKG
:=github.com
/crowdsecurity
/go-cs-lib
/version
34 GO_PKG
:=github.com
/crowdsecurity
/crowdsec
36 GO_PKG_LDFLAGS_X
:=$(CWD_VERSION_PKG
).Version
=$(CWD_BUILD_VERSION
) \
37 $(CWD_VERSION_PKG
).System
=$(CWD_SYSTEM
) \
38 $(CWD_VERSION_PKG
).BuildDate
=$(CWD_BUILD_TIMESTAMP
) \
39 $(CWD_VERSION_PKG
).Codename
=$(CWD_BUILD_CODENAME
) \
40 $(CWD_VERSION_PKG
).Tag
=$(CWD_BUILD_TAG
) \
41 $(CWD_VERSION_PKG
).GoVersion
=$(CWD_BUILD_GOVERSION
)
43 include $(INCLUDE_DIR
)/package.mk
44 include ..
/..
/lang
/golang
/golang-package.mk
46 define Package
/crowdsec
/Default
49 TITLE
:=Crowdsec detection engine
50 URL
:=https
://crowdsec.net
/
53 define Package
/crowdsec
54 $(call Package
/crowdsec
/Default
)
55 DEPENDS
:=$(GO_ARCH_DEPENDS
)
58 define Package
/golang-crowdsec-dev
59 $(call Package
/crowdsec
/Default
)
60 $(call GoPackage
/GoSubMenu
)
61 TITLE
+= (source files
)
62 DEPENDS
:=$(GO_ARCH_DEPENDS
)
66 define Package
/crowdsec
/Default
/description
67 Crowdsec
- An open-source
, lightweight agent to detect
68 and respond to bad behaviours.
69 It also automatically benefits from a global
70 community-wide IP reputation database.
73 define Package
/crowdsec
/description
74 $(call Package
/crowdsec
/Default
/description
)
76 This package contains the main program.
79 define Package
/golang-crowdsec-dev
/description
80 $(call Package
/crowdsec
/Default
/description
)
82 This package provides the source files for the program.
85 ifneq ($(CONFIG_USE_MUSL
),)
86 TARGET_CFLAGS
+= -D_LARGEFILE64_SOURCE
89 define Package
/crowdsec
/install
90 $(call GoPackage
/Package
/Install
/Bin
,$(1))
92 $(INSTALL_DIR
) $(1)/etc
/crowdsec
93 $(INSTALL_DIR
) $(1)/etc
/crowdsec
/scenarios
94 $(INSTALL_DIR
) $(1)/etc
/crowdsec
/postoverflows
95 $(INSTALL_DIR
) $(1)/etc
/crowdsec
/collections
96 $(INSTALL_DIR
) $(1)/etc
/crowdsec
/patterns
97 $(INSTALL_DIR
) $(1)/etc
/crowdsec
/hub
100 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/config.yaml \
103 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/dev.yaml \
106 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/user.yaml \
109 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/acquis.yaml \
112 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/profiles.yaml \
115 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/simulation.yaml \
118 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/local_api_credentials.yaml \
121 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/online_api_credentials.yaml \
125 $(GO_PKG_BUILD_DIR
)/src
/$(GO_PKG
)/config
/patterns
/* \
126 $(1)/etc
/crowdsec
/patterns
128 $(INSTALL_DIR
) $(1)/srv
/crowdsec
/data
/
130 $(INSTALL_DIR
) $(1)/etc
/init.d
132 .
/files
/crowdsec.initd \
133 $(1)/etc
/init.d
/crowdsec
135 $(INSTALL_DIR
) $(1)/etc
/config
137 .
/files
/crowdsec.config \
138 $(1)/etc
/config
/crowdsec
140 $(LN
) /usr
/bin
/crowdsec-cli
$(1)/usr
/bin
/cscli
142 $(INSTALL_DIR
) $(1)/etc
/uci-defaults
144 .
/files
/crowdsec.defaults \
145 $(1)/etc
/uci-defaults
/99_crowdsec
148 define Package
/crowdsec
/conffiles
153 $(eval
$(call GoBinPackage
,crowdsec
))
154 $(eval
$(call BuildPackage
,crowdsec
))