diff --git a/cross/ripgrep/Makefile b/cross/ripgrep/Makefile new file mode 100644 index 00000000000..0d460626ae4 --- /dev/null +++ b/cross/ripgrep/Makefile @@ -0,0 +1,20 @@ +PKG_NAME = ripgrep +PKG_VERS = 13.0.0 +PKG_EXT = tar.gz +PKG_DIST_NAME = $(PKG_VERS).$(PKG_EXT) +PKG_DIST_SITE = https://github.com/BurntSushi/ripgrep/archive +PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT) +PKG_DIR = $(PKG_NAME)-$(PKG_VERS) + +DEPENDS = + +# powerpc archs (except qoriq) are not supported +UNSUPPORTED_ARCHS += $(OLD_PPC_ARCHS) + +HOMEPAGE = https://github.com/BurntSushi/ripgrep +COMMENT = ripgrep recursively searches directories for a regex pattern +LICENSE = public domain/Unlicense + +CARGO_BUILD_ARGS += --features 'pcre2' + +include ../../mk/spksrc.cross-rust.mk diff --git a/cross/ripgrep/PLIST b/cross/ripgrep/PLIST new file mode 100644 index 00000000000..070601f448f --- /dev/null +++ b/cross/ripgrep/PLIST @@ -0,0 +1 @@ +bin:bin/rg diff --git a/cross/ripgrep/digests b/cross/ripgrep/digests new file mode 100644 index 00000000000..fa235d32fb2 --- /dev/null +++ b/cross/ripgrep/digests @@ -0,0 +1,3 @@ +ripgrep-13.0.0.tar.gz SHA1 1e67603fbc5dd955d0f65fb6ea3c380145fbcb01 +ripgrep-13.0.0.tar.gz SHA256 0fb17aaf285b3eee8ddab17b833af1e190d73de317ff9648751ab0660d763ed2 +ripgrep-13.0.0.tar.gz MD5 3080265a3ccc09bdc0c81527b09afa15 diff --git a/diyspk/ripgrep/Makefile b/diyspk/ripgrep/Makefile new file mode 100644 index 00000000000..15125af5151 --- /dev/null +++ b/diyspk/ripgrep/Makefile @@ -0,0 +1,21 @@ +SPK_NAME = ripgrep +SPK_VERS = 13.0.0 +SPK_REV = 1 +SPK_ICON = src/ripgrep.png + +DEPENDS = cross/$(SPK_NAME) + +# powerpc archs (except qoriq) are not supported +UNSUPPORTED_ARCHS += $(OLD_PPC_ARCHS) + +MAINTAINER = Hylen +DESCRIPTION = ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern. +DISPLAY_NAME = ripgrep +STARTABLE = no + +SPK_COMMANDS = bin/rg + +HOMEPAGE = https://github.com/BurntSushi/ripgrep +LICENSE = public domain/Unlicense + +include ../../mk/spksrc.spk.mk diff --git a/diyspk/ripgrep/PLIST b/diyspk/ripgrep/PLIST new file mode 100644 index 00000000000..e69de29bb2d diff --git a/diyspk/ripgrep/src/ripgrep.png b/diyspk/ripgrep/src/ripgrep.png new file mode 100644 index 00000000000..123802f2730 Binary files /dev/null and b/diyspk/ripgrep/src/ripgrep.png differ diff --git a/mk/spksrc.cross-rust.mk b/mk/spksrc.cross-rust.mk new file mode 100644 index 00000000000..ee12f3f0cbf --- /dev/null +++ b/mk/spksrc.cross-rust.mk @@ -0,0 +1,182 @@ +# Build rust programs +# +# prerequisites: +# - module does not require kernel (REQUIRE_KERNEL) +# +# remarks: +# - most content is taken from spksrc.cc.mk and modified for rust +# - CONFIGURE_TARGET is not supported (used for rust target installation) +# - build and install is done in one step +# + +# Common makefiles +include ../../mk/spksrc.common.mk +include ../../mk/spksrc.directories.mk + +# Configure the included makefiles +URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME) +NAME = $(PKG_NAME) +COOKIE_PREFIX = $(PKG_NAME)- +ifneq ($(PKG_DIST_FILE),) +LOCAL_FILE = $(PKG_DIST_FILE) +else +LOCAL_FILE = $(PKG_DIST_NAME) +endif +DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE) +DIST_EXT = $(PKG_EXT) + +ifneq ($(ARCH),) +ARCH_SUFFIX = -$(ARCH)-$(TCVERSION) +TC = syno$(ARCH_SUFFIX) +endif + +##### rust specific configurations + +# configure is used to install rust targets +CONFIGURE_TARGET = install_rust_target + +# skip compile_target if not used by module +ifeq ($(strip $(COMPILE_TARGET)),) +COMPILE_TARGET = nop +endif + +RUST_TOOLCHAIN ?= stable + +RUST_TARGET = +# map archs to rust targets +ifeq ($(findstring $(ARCH), $(x64_ARCHS)),$(ARCH)) +RUST_TARGET=x86_64-unknown-linux-gnu +endif +ifeq ($(findstring $(ARCH), $(i686_ARCHS)),$(ARCH)) +RUST_TARGET=i686-unknown-linux-gnu +endif +ifeq ($(findstring $(ARCH), $(ARMv5_ARCHS)),$(ARCH)) +# may be not supported for cargo +RUST_TARGET=armv5te-unknown-linux-gnueabi +endif +ifeq ($(findstring $(ARCH), $(ARMv7_ARCHS) $(ARMv7L_ARCHS)),$(ARCH)) +RUST_TARGET=armv7-unknown-linux-gnueabihf +endif +ifeq ($(findstring $(ARCH), $(ARMv7L_ARCHS)),$(ARCH)) +RUST_TARGET=armv7-unknown-linux-gnueabi +endif +ifeq ($(findstring $(ARCH), $(ARMv8_ARCHS)),$(ARCH)) +RUST_TARGET=aarch64-unknown-linux-gnu +endif +ifeq ($(findstring $(ARCH), $(PPC_ARCHS)),$(ARCH)) +RUST_TARGET=powerpc-unknown-linux-gnu +endif +ifeq ($(RUST_TARGET),) +$(error Arch $(ARCH) not supported) +endif + +# Use distrib folder as cargo download cache +CARGO_HOME_PATH=/spksrc/distrib/cargo +ENV += CARGO_HOME=$(CARGO_HOME_PATH) +ENV += PATH=:$(CARGO_HOME_PATH)/bin/:$(PATH) + +ifeq (,$(shell $(ENV) which rustup)) +install_rustup: + @echo " ==> install rustup" ; \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + CARGO_HOME=$(CARGO_HOME_PATH) sh -s -- -y +else +install_rustup: + @echo " ==> rustup already installed" ; +endif + +install_rust_toolchain: install_rustup + @echo " ==> install rust toolchain [$(RUST_TOOLCHAIN)]" ; \ + env $(ENV) rustup toolchain install $(RUST_TOOLCHAIN) ; + env $(ENV) rustup default $(RUST_TOOLCHAIN) ; + +# Install rust target on demand: +install_rust_target: install_rust_toolchain + @echo " ==> install rust target [$(RUST_TARGET)]" ; \ + env $(ENV) rustup target install $(RUST_TARGET) ; + +# Set default RUST_SRC_DIR +ifeq ($(strip $(RUST_SRC_DIR)),) +RUST_SRC_DIR = $(WORK_DIR)/$(PKG_DIR) +endif + +# Set linker environment variable +RUST_LINKER_ENV=CARGO_TARGET_$(shell echo $(RUST_TARGET) | tr - _ | tr a-z A-Z)_LINKER +CARGO_ENV=$(RUST_LINKER_ENV)=$(TC_PATH)$(TC_PREFIX)gcc + +# Set the cargo parameters +CARGO_BUILD_ARGS += --target=$(RUST_TARGET) +CARGO_BUILD_ARGS += --path $(RUST_SRC_DIR) +CARGO_BUILD_ARGS += --root $(STAGING_INSTALL_PREFIX) + + +ifeq ($(strip $(INSTALL_TARGET)),) +INSTALL_TARGET = rust_build_and_install_target +endif + +# Default rust build and installation with cargo +rust_build_and_install_target: + @echo " ==> Cargo install rust package $(PKG_NAME)" + $(ENV) $(CARGO_ENV) cargo install $(CARGO_BUILD_ARGS) + + +##### + +include ../../mk/spksrc.pre-check.mk + +include ../../mk/spksrc.cross-env.mk + +include ../../mk/spksrc.download.mk + +include ../../mk/spksrc.depend.mk + +checksum: download +include ../../mk/spksrc.checksum.mk + +extract: checksum depend +include ../../mk/spksrc.extract.mk + +patch: extract +include ../../mk/spksrc.patch.mk + +configure: patch +include ../../mk/spksrc.configure.mk + +compile: configure +include ../../mk/spksrc.compile.mk + +install: compile +include ../../mk/spksrc.install.mk + +plist: install +include ../../mk/spksrc.plist.mk + +### Clean rules +smart-clean: + rm -rf $(WORK_DIR)/$(PKG_DIR) + rm -f $(WORK_DIR)/.$(COOKIE_PREFIX)* + +clean: + rm -fr work work-* + +all: install plist + +### For make kernel-required (used by spksrc.spk.mk) +include ../../mk/spksrc.kernel-required.mk + +### For make digests +include ../../mk/spksrc.generate-digests.mk + +### For make dependency-tree +include ../../mk/spksrc.dependency-tree.mk + +.PHONY: all-archs +all-archs: $(addprefix arch-,$(AVAILABLE_TOOLCHAINS)) + +#### + +arch-%: + @$(MSG) Building package for arch $* + -@MAKEFLAGS= $(MAKE) ARCH=$(basename $(subst -,.,$(basename $(subst .,,$*)))) TCVERSION=$(if $(findstring $*,$(basename $(subst -,.,$(basename $(subst .,,$*))))),$(DEFAULT_TC),$(notdir $(subst -,/,$*))) + +#### diff --git a/spk/synocli-file/Makefile b/spk/synocli-file/Makefile index 4a3ad118b70..2289cf85307 100644 --- a/spk/synocli-file/Makefile +++ b/spk/synocli-file/Makefile @@ -1,13 +1,13 @@ SPK_NAME = synocli-file -SPK_VERS = 2.2 -SPK_REV = 9 +SPK_VERS = 2.3 +SPK_REV = 10 SPK_ICON = src/synocli-file.png DEPENDS = cross/less cross/tree cross/ncdu cross/jdupes cross/rhash cross/mc cross/nano cross/file DEPENDS += cross/detox cross/pcre2 DEPENDS += cross/zstd cross/lzip cross/plzip DEPENDS += cross/fdupes -OPTIONAL_DEPENDS = cross/rmlint cross/rnm cross/micro cross/fzf +OPTIONAL_DEPENDS = cross/rmlint cross/rnm cross/micro cross/fzf cross/ripgrep MAINTAINER = SynoCommunity DISPLAY_NAME = SynoCli File Tools @@ -34,13 +34,19 @@ DEPENDS += cross/micro cross/fzf OPTIONAL_DESC := $(OPTIONAL_DESC)", micro (editor), fzf (fuzzy finder)" endif +ifneq ($(findstring $(ARCH), $(OLD_PPC_ARCHS)),$(ARCH)) +DEPENDS += cross/ripgrep +OPTIONAL_DESC := $(OPTIONAL_DESC)", rg \(ripgrep\)" +endif + + # activate additional features for pcre2grep and pcre2test -PCRE2_CLI_FULL=1 +PCRE2_CLI_FULL = 1 export PCRE2_CLI_FULL -DESCRIPTION = "SynoCli File Tools provides a set of small command-line utilities: less, tree, ncdu, jdupes, fdupes, rhash, mc \(midnight commander\), nano, file, detox, pcre2, zstd, lzip, plzip$(OPTIONAL_DESC)." +DESCRIPTION = "SynoCli File Tools provides a set of small command-line utilities: less, tree, ncdu, jdupes, fdupes, rhash, mc \(midnight commander\), nano, file, detox, pcre2, zstd, lzip, plzip, detox$(OPTIONAL_DESC)." STARTABLE = no -CHANGELOG = "1. Add micro (editor)
2. Add Lzip and Plzip
3. Add fzf (fuzzy finder)
4. Update mc to version 4.8.26
Fix rmlint and zstd." +CHANGELOG = "1. Add rg (ripgrep)." HOMEPAGE = https://github.com/SynoCommunity/spksrc/wiki/FAQ-SynoCliFile LICENSE = Each tool is licensed under it's respective license. @@ -61,6 +67,7 @@ SPK_COMMANDS += bin/lzip bin/plzip SPK_COMMANDS += bin/fdupes SPK_COMMANDS += bin/micro SPK_COMMANDS += bin/fzf +SPK_COMMANDS += bin/rg SPK_COMMANDS += bin/rhash SPK_COMMANDS += bin/ed2k-link