Sources

The Tree of Radix and Third Party Sources

1388 Commits   0 Branches   11 Tags
author: kx <kx@radix.pro> 2022-01-12 17:08:09 +0300 committer: kx <kx@radix.pro> 2022-01-12 17:08:09 +0300 commit: f3f17b42f4e2ea98164dea3801ba9f2c3033fe02 parent: baa4d6c7c061a6bceeacf5f33238414a0b46f6ff
Commit Summary:
re2c-2.2
Diffstat:
1 file changed, 38 insertions, 23 deletions
diff --git a/packages/d/re2c/Makefile b/packages/d/re2c/Makefile
index 2cbac0a..7a37ac0 100644
--- a/packages/d/re2c/Makefile
+++ b/packages/d/re2c/Makefile
@@ -1,43 +1,62 @@
 #
 # Project Home:
 # ============
-# http://re2c.org/
+#   https://re2c.org
 #
-# GitHub:
-# ======
-# https://github.com/skvadrik/re2c
-#
-# Downloads:
-# =========
-# https://sourceforge.net/projects/re2c/files
+# Clone:
+# =====
+#   git clone https://github.com/skvadrik/re2c.git
 #
 
-url         = https://sourceforge.net/projects/re2c/files
+url        = https://github.com/skvadrik
+
+repo_name  = re2c
+pkg_name   = re2c
+suffix     = tar.xz
+
+versions   = 2.2
 
-versions    = 0.14.3 0.15.3 0.16
-pkgname     = re2c
-suffix      = tar.gz
+# List of tags to be extracted:
+TAGS       = $(versions)
 
-tarballs    = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
-sha1s       = $(addsuffix .sha1sum, $(tarballs))
+git_repo   = .git_clone
+tarballs   = $(addsuffix .tar.xz, $(addprefix $(pkg_name)-, $(versions)))
+sha1s      = $(addsuffix .sha1sum, $(tarballs))
 
+TARGETS = repository_clean
 
-all: $(tarballs) $(sha1s)
 
-.PHONY: downloads_clean
+all: $(TARGETS)
 
-$(tarballs):
-	@echo -e "\n======= Downloading source tarballs =======\n"
-	@for tarball in $(tarballs) ; do \
-	  version=`echo $$tarball | sed 's/\([a-zA-Z0-9-]*\)\([0-9][.][0-9]*[.0-9]*\)\(\..*\)/\2/'` ; \
-	  wget -N $(url)/$$version/$$tarball ; \
+.PHONY: downloads_clean repository_clean
+
+$(git_repo):
+	@echo -e "\n======= Clone $(repo_name).git repository =======\n"
+	@rm -rf $(repo_name)
+	@git clone $(url)/$(repo_name).git $(repo_name)
+	@touch $@
+
+$(tarballs): $(git_repo)
+	@for version in $(versions) ; do \
+	  tag=`echo $$version` ; \
+	  if [ ! -f $(repo_name)-$$version.$(suffix) ]; then \
+	    echo -e "\n======= Creating '$(repo_name)-$$version.$(suffix)' snapshot =======" ; \
+	    ( cd $(repo_name) && \
+	      git archive --format=tar --prefix=$(pkg_name)-$$version/ $$tag | \
+	      xz >../$(pkg_name)-$$version.$(suffix) ) ; \
+	  fi ; \
 	done
 
-$(sha1s): %.$(suffix).sha1sum : %.$(suffix)
+$(sha1s): %.tar.xz.sha1sum : %.tar.xz
 	@for tarball in $< ; do \
-	  echo -e "\n======= Calculation the '$$tarball' sha1sum =======\n" ; \
+	  echo -e "\n======= Calculation the '$$tarball' sha1sum =======" ; \
 	  sha1sum --binary $$tarball > $$tarball.sha1sum ; \
 	done
 
+repository_clean: $(sha1s)
+	@echo -e "\n======= Remove cloned $(repo_name).git repository =======\n"
+	@rm -rf $(git_repo) $(repo_name)
+
 downloads_clean:
 	@rm -rf $(tarballs) $(sha1s)
+	@rm -rf $(git_repo) $(repo_name)