/makefiles/ripgrep.mk

https://github.com/ProcursusTeam/Procursus · Makefile · 44 lines · 30 code · 9 blank · 5 comment · 1 complexity · 44fed641d925651dd16cc4f2773c4158 MD5 · raw file

  1. ifneq ($(PROCURSUS),1)
  2. $(error Use the main Makefile)
  3. endif
  4. SUBPROJECTS += ripgrep
  5. RIPGREP_VERSION := 12.1.1
  6. DEB_RIPGREP_V ?= $(RIPGREP_VERSION)-1
  7. ripgrep-setup: setup
  8. $(call GITHUB_ARCHIVE,BurntSushi,ripgrep,$(RIPGREP_VERSION),$(RIPGREP_VERSION))
  9. $(call EXTRACT_TAR,ripgrep-$(RIPGREP_VERSION).tar.gz,ripgrep-$(RIPGREP_VERSION),ripgrep)
  10. ifneq ($(wildcard $(BUILD_WORK)/ripgrep/.build_complete),)
  11. ripgrep:
  12. @echo "Using previously built ripgrep."
  13. else
  14. ripgrep: ripgrep-setup pcre2
  15. cd $(BUILD_WORK)/ripgrep && $(DEFAULT_RUST_FLAGS) cargo build \
  16. --release \
  17. --target=$(RUST_TARGET) \
  18. --features pcre2
  19. $(INSTALL) -Dm755 $(BUILD_WORK)/ripgrep/target/$(RUST_TARGET)/release/rg $(BUILD_STAGE)/ripgrep/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin/rg
  20. $(INSTALL) -Dm644 $(BUILD_WORK)/ripgrep/complete/_rg $(BUILD_STAGE)/ripgrep/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/zsh/site-functions/_rg
  21. $(INSTALL) -Dm644 $(BUILD_WORK)/ripgrep/target/$(RUST_TARGET)/release/build/ripgrep-*/out/rg.bash $(BUILD_STAGE)/ripgrep/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/bash-completion/completions/rg
  22. $(call AFTER_BUILD)
  23. endif
  24. ripgrep-package: ripgrep-stage
  25. # ripgrep.mk Package Structure
  26. rm -rf $(BUILD_DIST)/ripgrep
  27. # ripgrep.mk Prep ripgrep
  28. cp -a $(BUILD_STAGE)/ripgrep $(BUILD_DIST)
  29. # ripgrep.mk Sign
  30. $(call SIGN,ripgrep,general.xml)
  31. # ripgrep.mk Make .debs
  32. $(call PACK,ripgrep,DEB_RIPGREP_V)
  33. # ripgrep.mk Build cleanup
  34. rm -rf $(BUILD_DIST)/ripgrep
  35. .PHONY: ripgrep ripgrep-package