2021-07-29 17:36:58 +02:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
#
|
2022-01-15 10:59:49 +01:00
|
|
|
# Copyright (C) 2021-2022 Gerald Kerma <gandalf@gk2.net>
|
2021-07-29 17:36:58 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=crowdsec
|
2024-02-02 13:28:37 +01:00
|
|
|
PKG_VERSION:=1.6.0
|
2023-05-17 22:09:53 +02:00
|
|
|
PKG_RELEASE:=1
|
2021-07-29 17:36:58 +02:00
|
|
|
|
2022-01-07 14:29:58 +01:00
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
|
|
PKG_SOURCE_URL:=https://codeload.github.com/crowdsecurity/crowdsec/tar.gz/v$(PKG_VERSION)?
|
2024-02-02 13:28:37 +01:00
|
|
|
PKG_HASH:=6d79d67383c7faed6c5b2019e4f01c6ed84334c8c45cd1736ff18a03167aa192
|
2021-07-29 17:36:58 +02:00
|
|
|
|
|
|
|
PKG_LICENSE:=MIT
|
|
|
|
PKG_LICENSE_FILES:=LICENSE
|
|
|
|
PKG_MAINTAINER:=Gerald Kerma <gandalf@gk2.net>
|
|
|
|
|
|
|
|
PKG_BUILD_DEPENDS:=golang/host
|
|
|
|
PKG_BUILD_PARALLEL:=1
|
2023-03-23 08:39:01 +01:00
|
|
|
PKG_BUILD_FLAGS:=no-mips16
|
2021-07-29 17:36:58 +02:00
|
|
|
|
|
|
|
CWD_SYSTEM:=openwrt
|
2022-01-07 14:29:58 +01:00
|
|
|
|
|
|
|
CWD_BUILD_VERSION?=v$(PKG_VERSION)
|
2021-07-29 17:36:58 +02:00
|
|
|
CWD_BUILD_GOVERSION:=$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')
|
|
|
|
CWD_BUILD_CODENAME:=alphaga
|
2022-01-07 14:29:58 +01:00
|
|
|
CWD_BUILD_TIMESTAMP:=$(shell date +%F"_"%T)
|
|
|
|
CWD_BUILD_TAG:=openwrt-$(PKG_VERSION)-$(PKG_RELEASE)
|
2021-07-29 17:36:58 +02:00
|
|
|
|
2023-09-19 14:51:45 +02:00
|
|
|
CWD_VERSION_PKG:=github.com/crowdsecurity/go-cs-lib/version
|
2021-07-29 17:36:58 +02:00
|
|
|
|
|
|
|
GO_PKG:=github.com/crowdsecurity/crowdsec
|
2022-01-07 14:29:58 +01:00
|
|
|
GO_PKG_INSTALL_ALL:=1
|
2021-07-29 17:36:58 +02:00
|
|
|
GO_PKG_LDFLAGS_X:=$(CWD_VERSION_PKG).Version=$(CWD_BUILD_VERSION) \
|
|
|
|
$(CWD_VERSION_PKG).System=$(CWD_SYSTEM) \
|
|
|
|
$(CWD_VERSION_PKG).BuildDate=$(CWD_BUILD_TIMESTAMP) \
|
|
|
|
$(CWD_VERSION_PKG).Codename=$(CWD_BUILD_CODENAME) \
|
|
|
|
$(CWD_VERSION_PKG).Tag=$(CWD_BUILD_TAG) \
|
|
|
|
$(CWD_VERSION_PKG).GoVersion=$(CWD_BUILD_GOVERSION)
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
include ../../lang/golang/golang-package.mk
|
|
|
|
|
|
|
|
define Package/crowdsec/Default
|
|
|
|
SECTION:=net
|
|
|
|
CATEGORY:=Network
|
|
|
|
TITLE:=Crowdsec detection engine
|
|
|
|
URL:=https://crowdsec.net/
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/crowdsec
|
|
|
|
$(call Package/crowdsec/Default)
|
|
|
|
DEPENDS:=$(GO_ARCH_DEPENDS)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/golang-crowdsec-dev
|
|
|
|
$(call Package/crowdsec/Default)
|
|
|
|
$(call GoPackage/GoSubMenu)
|
|
|
|
TITLE+= (source files)
|
|
|
|
DEPENDS:=$(GO_ARCH_DEPENDS)
|
|
|
|
PKGARCH:=all
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/crowdsec/Default/description
|
|
|
|
Crowdsec - An open-source, lightweight agent to detect
|
|
|
|
and respond to bad behaviours.
|
|
|
|
It also automatically benefits from a global
|
|
|
|
community-wide IP reputation database.
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/crowdsec/description
|
|
|
|
$(call Package/crowdsec/Default/description)
|
|
|
|
|
|
|
|
This package contains the main program.
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/golang-crowdsec-dev/description
|
|
|
|
$(call Package/crowdsec/Default/description)
|
|
|
|
|
|
|
|
This package provides the source files for the program.
|
|
|
|
endef
|
|
|
|
|
crowdsec: fix compilation with musl 1.2.4
_LARGEFILE64_SOURCE has to be defined in the source, or CFLAGS can be used
to pass -D_LARGEFILE64_SOURCE to allow to keep using LFS64 definitions.
Fixes errors in the form of:
Building targets
github.com/mattn/go-sqlite3
sqlite3-binding.c:35901:42: error: 'pread64' undeclared here (not in a function); did you mean 'pread'?
35901 | { "pread64", (sqlite3_syscall_ptr)pread64, 0 },
| ^~~~~~~
| pread
sqlite3-binding.c:35919:42: error: 'pwrite64' undeclared here (not in a function); did you mean 'pwrite'?
35919 | { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 },
| ^~~~~~~~
| pwrite
sqlite3-binding.c: In function 'seekAndRead':
sqlite3-binding.c:35905:49: error: unknown type name 'off64_t'; did you mean 'off_t'?
35905 | #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
| ^~~~~~~
sqlite3-binding.c:38767:11: note: in expansion of macro 'osPread64'
38767 | got = osPread64(id->h, pBuf, cnt, offset);
| ^~~~~~~~~
sqlite3-binding.c:35905:58: error: expected ')' before 'aSyscall'
35905 | #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
| ~ ^~~~~~~~
sqlite3-binding.c:38767:11: note: in expansion of macro 'osPread64'
38767 | got = osPread64(id->h, pBuf, cnt, offset);
| ^~~~~~~~~
sqlite3-binding.c: In function 'seekAndWriteFd':
sqlite3-binding.c:35923:57: error: unknown type name 'off64_t'; did you mean 'off_t'?
35923 | #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\
| ^~~~~~~
sqlite3-binding.c:38896:17: note: in expansion of macro 'osPwrite64'
38896 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
| ^~~~~~~~~~
sqlite3-binding.c:35924:21: error: expected ')' before 'aSyscall'
35924 | aSyscall[13].pCurrent)
| ^~~~~~~~
sqlite3-binding.c:38896:17: note: in expansion of macro 'osPwrite64'
38896 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
| ^~~~~~~~~~
sqlite3-binding.c:35923:21: note: to match this '('
35923 | #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\
| ^
sqlite3-binding.c:38896:17: note: in expansion of macro 'osPwrite64'
38896 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
| ^~~~~~~~~~
make[2]: *** [Makefile:153: /home/nick/openwrt/build_dir/target-aarch64_cortex-a53_musl/crowdsec-1.4.6/.built] Error 1
make[2]: Leaving directory '/home/nick/openwrt/feeds/packages/net/crowdsec'
Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-17 00:20:44 +02:00
|
|
|
ifneq ($(CONFIG_USE_MUSL),)
|
|
|
|
TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
|
|
|
|
endif
|
|
|
|
|
2021-07-29 17:36:58 +02:00
|
|
|
define Package/crowdsec/install
|
|
|
|
$(call GoPackage/Package/Install/Bin,$(1))
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DIR) $(1)/etc/crowdsec/scenarios
|
|
|
|
$(INSTALL_DIR) $(1)/etc/crowdsec/postoverflows
|
|
|
|
$(INSTALL_DIR) $(1)/etc/crowdsec/collections
|
|
|
|
$(INSTALL_DIR) $(1)/etc/crowdsec/patterns
|
|
|
|
$(INSTALL_DIR) $(1)/etc/crowdsec/hub
|
|
|
|
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/config.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/dev.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/user.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/acquis.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/profiles.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/simulation.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/local_api_credentials.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/online_api_credentials.yaml \
|
|
|
|
$(1)/etc/crowdsec
|
|
|
|
|
|
|
|
$(CP) \
|
|
|
|
$(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/patterns/* \
|
|
|
|
$(1)/etc/crowdsec/patterns
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/srv/crowdsec/data/
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
|
|
|
$(INSTALL_BIN) \
|
|
|
|
./files/crowdsec.initd \
|
|
|
|
$(1)/etc/init.d/crowdsec
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/etc/config
|
|
|
|
$(INSTALL_CONF) \
|
|
|
|
./files/crowdsec.config \
|
|
|
|
$(1)/etc/config/crowdsec
|
|
|
|
|
|
|
|
$(LN) /usr/bin/crowdsec-cli $(1)/usr/bin/cscli
|
|
|
|
|
|
|
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
|
|
|
$(INSTALL_BIN) \
|
|
|
|
./files/crowdsec.defaults \
|
|
|
|
$(1)/etc/uci-defaults/99_crowdsec
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/crowdsec/conffiles
|
|
|
|
/etc/crowdsec/
|
|
|
|
/etc/config/crowdsec
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call GoBinPackage,crowdsec))
|
|
|
|
$(eval $(call BuildPackage,crowdsec))
|