index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | Makefile | 223 |
@@ -1,48 +1,64 @@ V=$(shell git describe --exact-match) +SHELL=/bin/bash BUILDTOOLVER ?= $(V) PREFIX = /usr/local MANDIR = $(PREFIX)/share/man +DATADIR = $(PREFIX)/share/devtools BUILDDIR = build -BINPROGS = $(addprefix $(BUILDDIR)/,$(patsubst src/%,bin/%,$(patsubst %.in,%,$(wildcard src/*.in)))) -LIBUTILS = $(wildcard lib/*) +rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) + +BINPROGS_SRC = $(wildcard src/*.in) +BINPROGS = $(addprefix $(BUILDDIR)/,$(patsubst src/%,bin/%,$(patsubst %.in,%,$(BINPROGS_SRC)))) +LIBRARY_SRC = $(call rwildcard,src/lib,*.sh) +LIBRARY = $(addprefix $(BUILDDIR)/,$(patsubst src/%,%,$(patsubst %.in,%,$(LIBRARY_SRC)))) MAKEPKG_CONFIGS=$(wildcard config/makepkg/*) PACMAN_CONFIGS=$(wildcard config/pacman/*) SETARCH_ALIASES = $(wildcard config/setarch-aliases.d/*) MANS = $(addprefix $(BUILDDIR)/,$(patsubst %.asciidoc,%,$(wildcard doc/man/*.asciidoc))) -GENERATED_CONFIGS = \ - pacman-extra-i486.conf \ - pacman-extra-i686.conf \ - pacman-extra-pentium4.conf \ - pacman-testing-i486.conf \ - pacman-testing-i686.conf \ - pacman-testing-pentium4.conf \ - pacman-staging-i486.conf \ - pacman-staging-i686.conf \ - pacman-staging-pentium4.conf \ - pacman-staging-with-build-support-i486.conf \ - pacman-staging-with-build-support-i686.conf \ - pacman-staging-with-build-support-pentium4.conf \ - pacman-kde-unstable-i486.conf \ - pacman-kde-unstable-i686.conf \ - pacman-kde-unstable-pentium4.conf \ - pacman-gnome-unstable-i486.conf \ - pacman-gnome-unstable-i686.conf \ - pacman-gnome-unstable-pentium4.conf \ - makepkg-i486.conf \ - makepkg-i686.conf \ - makepkg-pentium4.conf -GENERATED_CONFIGS := $(addprefix $(BUILDDIR)/config/,$(GENERATED_CONFIGS)) +GENERATED_PACMAN_CONFIGS = \ + core-testing-i486.conf \ + core-testing-i686.conf \ + core-testing-pentium4.conf \ + core-staging-i486.conf \ + core-staging-i686.conf \ + core-staging-pentium4.conf \ + core-staging-with-build-support-i486.conf \ + core-staging-with-build-support-i686.conf \ + core-staging-with-build-support-pentium4.conf \ + extra-i486.conf \ + extra-i686.conf \ + extra-pentium4.conf \ + extra-testing-i486.conf \ + extra-testing-i686.conf \ + extra-testing-pentium4.conf \ + extra-staging-i486.conf \ + extra-staging-i686.conf \ + extra-staging-pentium4.conf \ + extra-staging-with-build-support-i486.conf \ + extra-staging-with-build-support-i686.conf \ + extra-staging-with-build-support-pentium4.conf \ + kde-unstable-i486.conf \ + kde-unstable-i686.conf \ + kde-unstable-pentium4.conf \ + gnome-unstable-i486.conf \ + gnome-unstable-i686.conf \ + gnome-unstable-pentium4.conf +GENERATED_MAKEPKG_CONFIGS = \ + i486.conf \ + i686.conf \ + pentium4.conf +GENERATED_PACMAN_CONFIGS := $(addprefix $(BUILDDIR)/pacman.conf.d/,$(GENERATED_PACMAN_CONFIGS)) +GENERATED_MAKEPKG_CONFIGS := $(addprefix $(BUILDDIR)/makepkg.conf.d/,$(GENERATED_MAKEPKG_CONFIGS)) COMMITPKG_LINKS = \ + core-testingpkg \ + core-stagingpkg \ extrapkg \ - testingpkg \ - stagingpkg \ - communitypkg \ - community-testingpkg \ - community-stagingpkg \ + extra-testingpkg \ + extra-stagingpkg \ multilibpkg \ multilib-testingpkg \ multilib-stagingpkg \ @@ -50,24 +66,38 @@ COMMITPKG_LINKS = \ gnome-unstablepkg ARCHBUILD_LINKS = \ + core-testing-i486-build \ + core-testing-i686-build \ + core-testing-pentium4-build \ + core-testing-x86_64-build \ + core-testing-x86_64_v3-build \ + core-staging-i486-build \ + core-staging-i686-build \ + core-staging-pentium4-build \ + core-staging-x86_64-build \ + core-staging-x86_64_v3-build \ + core-staging-x86_64-build \ + core-staging-with-build-support-i486-build \ + core-staging-with-build-support-i686-build \ + core-staging-with-build-support-pentium4-build \ extra-i486-build \ extra-i686-build \ extra-pentium4-build \ extra-x86_64-build \ extra-x86_64_v3-build \ - testing-i486-build \ - testing-i686-build \ - testing-pentium4-build \ - testing-x86_64-build \ - testing-x86_64_v3-build \ - staging-i486-build \ - staging-i686-build \ - staging-pentium4-build \ - staging-x86_64-build \ - staging-x86_64_v3-build \ - staging-with-build-support-i486-build \ - staging-with-build-support-i686-build \ - staging-with-build-support-pentium4-build \ + extra-testing-i486-build \ + extra-testing-i686-build \ + extra-testing-pentium4-build \ + extra-testing-x86_64-build \ + extra-testing-x86_64_v3-build \ + extra-staging-i486-build \ + extra-staging-i686-build \ + extra-staging-pentium4-build \ + extra-staging-x86_64-build \ + extra-staging-x86_64_v3-build \ + extra-staging-with-build-support-i486-build \ + extra-staging-with-build-support-i686-build \ + extra-staging-with-build-support-pentium4-build \ multilib-build \ multilib-testing-build \ multilib-staging-build \ @@ -80,20 +110,14 @@ ARCHBUILD_LINKS = \ gnome-unstable-pentium4-build \ gnome-unstable-x86_64-build -CROSSREPOMOVE_LINKS = \ - extra2community \ - community2extra - COMPLETIONS = $(addprefix $(BUILDDIR)/,$(patsubst %.in,%,$(wildcard contrib/completion/*/*))) -BASHCOMPLETION_LINKS = \ - archco \ - communityco -all: binprogs configfiles completion man +all: binprogs library conf completion man configfiles binprogs: $(BINPROGS) +library: $(LIBRARY) completion: $(COMPLETIONS) -configfiles: $(GENERATED_CONFIGS) +configfiles: $(GENERATED_MAKEPKG_CONFIGS) $(GENERATED_PACMAN_CONFIGS) man: $(MANS) @@ -111,10 +135,12 @@ ifneq ($(wildcard setarch-aliases.d/*),) endif -edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g" +edit = sed \ + -e "s|@pkgdatadir[@]|$(DATADIR)|g" \ + -e "s|@buildtoolver[@]|$(BUILDTOOLVER)|g" GEN_MSG = @echo "GEN $(patsubst $(BUILDDIR)/%,%,$@)" -$(BUILDDIR)/config/makepkg-i486.conf: config/makepkg/x86_64.conf +$(BUILDDIR)/makepkg.conf.d/i486.conf: config/makepkg/x86_64.conf @echo "GEN $(notdir $@)" @mkdir -p $(dir $@) @sed " \ @@ -125,7 +151,7 @@ $(BUILDDIR)/config/makepkg-i486.conf: config/makepkg/x86_64.conf " "$<" > "$@" @sed -i 's/--ultra -20/--ultra -19/' "$@" -$(BUILDDIR)/config/makepkg-i686.conf: config/makepkg/x86_64.conf +$(BUILDDIR)/makepkg.conf.d/i686.conf: config/makepkg/x86_64.conf @echo "GEN $(notdir $@)" @mkdir -p $(dir $@) @sed " \ @@ -134,13 +160,13 @@ $(BUILDDIR)/config/makepkg-i686.conf: config/makepkg/x86_64.conf " "$<" > "$@" @sed -i 's/--ultra -20/--ultra -19/' "$@" -$(BUILDDIR)/config/makepkg-pentium4.conf: $(BUILDDIR)/config/makepkg-i686.conf +$(BUILDDIR)/makepkg.conf.d/pentium4.conf: $(BUILDDIR)/makepkg.conf.d/i686.conf @echo "GEN $(notdir $@)" @mkdir -p $(dir $@) @sed '/^CHOST=/ ! s,\(["=]\)i686\([-" ]\),\1pentium4\2,g' "$<" > "$@" @sed -i 's/--ultra -20/--ultra -19/' "$@" -$(BUILDDIR)/config/pacman-%-i486.conf: config/pacman/%.conf +$(BUILDDIR)/pacman.conf.d/%-i486.conf: config/pacman/%.conf @echo "GEN $(notdir $@)" @mkdir -p $(dir $@) @sed " \ @@ -148,7 +174,7 @@ $(BUILDDIR)/config/pacman-%-i486.conf: config/pacman/%.conf /^Architecture = / s/^.*\$$/Architecture = i486/; \ " "$<" > "$@" -$(BUILDDIR)/config/pacman-%-i686.conf: config/pacman/%.conf +$(BUILDDIR)/pacman.conf.d/%-i686.conf: config/pacman/%.conf @echo "GEN $(notdir $@)" @mkdir -p $(dir $@) @sed " \ @@ -156,7 +182,7 @@ $(BUILDDIR)/config/pacman-%-i686.conf: config/pacman/%.conf /^Architecture = / s/^.*$$/Architecture = i686/ \ " "$<" > "$@" -$(BUILDDIR)/config/pacman-%-pentium4.conf: config/pacman/%.conf +$(BUILDDIR)/pacman.conf.d/%-pentium4.conf: config/pacman/%.conf @echo "GEN $(notdir $@)" @mkdir -p $(dir $@) @sed " \ @@ -165,77 +191,94 @@ $(BUILDDIR)/config/pacman-%-pentium4.conf: config/pacman/%.conf " "$<" > "$@" define buildInScript -$(1)/%: $(2)%.in $(LIBUTILS) +$(1)/%: $(2)%$(3) $$(GEN_MSG) @mkdir -p $$(dir $$@) @$(RM) "$$@" - @{ echo -n 'm4_changequote([[[,]]])'; cat $$<; } | m4 -P --define=m4_devtools_version=$$(BUILDTOOLVER) | $(edit) >$$@ - @chmod $(3) "$$@" - @bash -n "$$@" + @cat $$< | $(edit) >$$@ + @chmod $(4) "$$@" + @bash -O extglob -n "$$@" endef -$(eval $(call buildInScript,build/bin,src/,555)) -$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,444))) +$(eval $(call buildInScript,build/bin,src/,.in,755)) +$(eval $(call buildInScript,build/lib,src/lib/,,644)) +$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,.in,444))) $(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/asciidoc.conf doc/man/include/footer.asciidoc $(GEN_MSG) @mkdir -p $(BUILDDIR)/doc/man - @a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(PREFIX)/share/devtools $< + @a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(DATADIR) $< + +conf: + @install -d $(BUILDDIR)/makepkg.conf.d $(BUILDDIR)/pacman.conf.d + @cp -a $(MAKEPKG_CONFIGS) $(BUILDDIR)/makepkg.conf.d + @cp -a $(PACMAN_CONFIGS) $(BUILDDIR)/pacman.conf.d clean: rm -rf $(BUILDDIR) install: all install -dm0755 $(DESTDIR)$(PREFIX)/bin - install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d + install -dm0755 $(DESTDIR)$(DATADIR)/setarch-aliases.d + install -dm0755 $(DESTDIR)$(DATADIR)/makepkg.conf.d + install -dm0755 $(DESTDIR)$(DATADIR)/pacman.conf.d install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin - for conf in ${MAKEPKG_CONFIGS}; do install -Dm0644 $$conf $(DESTDIR)$(PREFIX)/share/devtools/makepkg-$${conf##*/}; done - for conf in ${PACMAN_CONFIGS}; do install -Dm0644 $$conf $(DESTDIR)$(PREFIX)/share/devtools/pacman-$${conf##*/}; done - for conf in ${GENERATED_CONFIGS}; do install -Dm0644 $$conf $(DESTDIR)$(PREFIX)/share/devtools/$${conf##*/}; done - for a in ${SETARCH_ALIASES}; do install -m0644 $$a -t $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d; done + install -dm0755 $(DESTDIR)$(DATADIR)/lib + cp -ra $(BUILDDIR)/lib/* $(DESTDIR)$(DATADIR)/lib + for conf in $(notdir $(MAKEPKG_CONFIGS)); do install -Dm0644 $(BUILDDIR)/makepkg.conf.d/$$conf $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done + for conf in $(notdir $(GENERATED_MAKEPKG_CONFIGS)); do install -Dm0644 $(BUILDDIR)/makepkg.conf.d/$$conf $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done + for conf in $(notdir $(PACMAN_CONFIGS)); do install -Dm0644 $(BUILDDIR)/pacman.conf.d/$$conf $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done + for conf in $(notdir $(GENERATED_PACMAN_CONFIGS)); do install -Dm0644 $(BUILDDIR)/pacman.conf.d/$$conf $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done + for a in ${SETARCH_ALIASES}; do install -m0644 $$a -t $(DESTDIR)$(DATADIR)/setarch-aliases.d; done for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done - for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides install -Dm0644 $(BUILDDIR)/contrib/completion/bash/devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools - for l in ${BASHCOMPLETION_LINKS}; do ln -sf devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$l; done + for f in $(notdir $(BINPROGS)); do ln -sf devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$f; done install -Dm0644 $(BUILDDIR)/contrib/completion/zsh/_devtools $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools - ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco for manfile in $(MANS); do \ install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \ done; uninstall: for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done - for conf in ${MAKEPKG_CONFIGS}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/makepkg-$${conf##*/}; done - for conf in ${PACMAN_CONFIGS}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/pacman-$${conf##*/}; done - for f in $(notdir $(SETARCH_ALIASES)); do rm -f $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d/$$f; done + for f in $(notdir $(LIBRARY)); do rm -f $(DESTDIR)$(DATADIR)/lib/$$f; done + rm -rf $(DESTDIR)$(DATADIR)/lib + for conf in $(notdir $(MAKEPKG_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done + for conf in $(notdir $(PACMAN_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done + for f in $(notdir $(SETARCH_ALIASES)); do rm -f $(DESTDIR)$(DATADIR)/setarch-aliases.d/$$f; done for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done - for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done - for l in ${BASHCOMPLETION_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$l; done - rm $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools - rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools - rm -f $(DESTDIR)$(PREFIX)/bin/communityco + rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools + for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$f; done + rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides for manfile in $(notdir $(MANS)); do rm -f $(DESTDIR)$(MANDIR)/man$${manfile##*.}/$${manfile}; done; - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d $(DESTDIR)$(PREFIX)/share/devtools + rmdir --ignore-fail-on-non-empty \ + $(DESTDIR)$(DATADIR)/setarch-aliases.d \ + $(DESTDIR)$(DATADIR)/makepkg.conf.d \ + $(DESTDIR)$(DATADIR)/pacman.conf.d \ + $(DESTDIR)$(DATADIR) -TODAY=$(shell date +"%Y%m%d") tag: - @sed -E "s|^V=[0-9]{8}|V=$(TODAY)|" -i Makefile - @git commit --gpg-sign --message "Version $(TODAY)" Makefile - @git tag --sign --message "Version $(TODAY)" $(TODAY) + @echo "current version: v$(V)" + @read -r -p "tag version: v" VERSION && \ + sed -E "s|^V=.+|V=$$VERSION|" -i Makefile && \ + git commit --gpg-sign --message "chore(release): version v$$VERSION" Makefile && \ + git tag --sign --message "Version v$$VERSION" v$$VERSION + +release: dist + glab release create v$(RELEASE) devtools-$(RELEASE).tar.gz* dist: - git archive --format=tar --prefix=devtools32-$(V)/ $(V) | gzip -9 > devtools32-$(V).tar.gz + git archive --format=tar --prefix=devtools32-$(V)/ v$(V) | gzip > devtools32-$(V).tar.gz gpg --detach-sign --use-agent devtools32-$(V).tar.gz upload: scp devtools32-$(V).tar.gz devtools32-$(V).tar.gz.sig sources.archlinux32.org:httpdocs/sources/ -check: $(BINPROGS) $(BUILDDIR)/contrib/completion/bash/devtools config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto +check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto shellcheck $^ -.PHONY: all completion man clean install uninstall dist upload check tag +.PHONY: all binprogs library completion conf man clean install uninstall tag dist upload check .DELETE_ON_ERROR: |