From 00bf3e83909df7162343224b6edc659e1d7231d5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 14 Nov 2017 12:37:28 +1300 Subject: Add Makefile targets for Vim plugin dists This is just an experiment to see how well an automated process can make independently distributable versioned tarballs of my Vim plugins. These are not part of the default `all` or `install` target. They create distribution vim-$name-$ver.tar.gz files in vim/dist. --- .gitignore | 1 + Makefile | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- dist/vim-plugin.sh | 18 +++++++++++ 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 dist/vim-plugin.sh diff --git a/.gitignore b/.gitignore index 6d07e894..f9ae6fcc 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,4 @@ gnupg/gpg.conf gnupg/gpg.conf.m4 include/mktd.m4 urxvt/ext/select +vim/dist diff --git a/Makefile b/Makefile index 63d192f8..4d292b46 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,19 @@ lint-sh \ lint-urxvt \ lint-vim \ - lint-xinit + lint-xinit \ + dist-vim-plugin \ + dist-vim-plugin-auto-backupdir \ + dist-vim-plugin-auto-swapdir \ + dist-vim-plugin-auto-undodir \ + dist-vim-plugin-big-file-options \ + dist-vim-plugin-command-typos \ + dist-vim-plugin-copy-linebreak \ + dist-vim-plugin-fixed-join \ + dist-vim-plugin-insert-suspend-hlsearch \ + dist-vim-plugin-mail-mutt \ + dist-vim-plugin-strip-trailing-whitespace \ + dist-vim-plugin-toggle-option-flag .SUFFIXES: .SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh @@ -261,7 +273,8 @@ clean distclean: gnupg/gpg.conf.m4 \ include/mktd.m4 \ man/man8/dotfiles.7df \ - urxvt/ext/select + urxvt/ext/select \ + vim/dist/* .awk: sh bin/shb.sh awk -f < $< > $@ @@ -633,3 +646,77 @@ lint-vim: lint-xinit: check-xinit sh lint/xinit.sh + +dist-vim-plugin: dist-vim-plugin-auto-backupdir \ + dist-vim-plugin-auto-swapdir \ + dist-vim-plugin-auto-undodir \ + dist-vim-plugin-big-file-options \ + dist-vim-plugin-command-typos \ + dist-vim-plugin-copy-linebreak \ + dist-vim-plugin-detect-background \ + dist-vim-plugin-fixed-join \ + dist-vim-plugin-insert-suspend-hlsearch \ + dist-vim-plugin-mail-mutt \ + dist-vim-plugin-strip-trailing-whitespace \ + dist-vim-plugin-toggle-option-flag + +dist-vim-plugin-auto-backupdir: \ + vim/plugin/auto_backupdir.vim \ + vim/doc/auto_backupdir.txt \ + VERSION + sh dist/vim-plugin.sh auto_backupdir +dist-vim-plugin-auto-swapdir: \ + vim/plugin/auto_swapdir.vim \ + vim/doc/auto_swapdir.txt \ + VERSION + sh dist/vim-plugin.sh auto_swapdir +dist-vim-plugin-auto-undodir: \ + vim/plugin/auto_undodir.vim \ + vim/doc/auto_undodir.txt \ + VERSION + sh dist/vim-plugin.sh auto_undodir +dist-vim-plugin-big-file-options: \ + vim/plugin/big_file_options.vim \ + vim/doc/big_file_options.txt \ + VERSION + sh dist/vim-plugin.sh big_file_options +dist-vim-plugin-command-typos: \ + vim/plugin/command_typos.vim \ + vim/doc/command_typos.txt \ + VERSION + sh dist/vim-plugin.sh command_typos +dist-vim-plugin-copy-linebreak: \ + vim/plugin/copy_linebreak.vim \ + vim/doc/copy_linebreak.txt \ + VERSION + sh dist/vim-plugin.sh copy_linebreak +dist-vim-plugin-detect-background: \ + vim/autoload/detect_background.vim \ + vim/doc/detect_background.txt \ + VERSION + sh dist/vim-plugin.sh detect_background +dist-vim-plugin-fixed-join: \ + vim/plugin/fixed_join.vim \ + vim/doc/fixed_join.txt \ + VERSION + sh dist/vim-plugin.sh fixed_join +dist-vim-plugin-insert-suspend-hlsearch: \ + vim/plugin/insert_suspend_hlsearch.vim \ + vim/doc/insert_suspend_hlsearch.txt \ + VERSION + sh dist/vim-plugin.sh insert_suspend_hlsearch +dist-vim-plugin-mail-mutt: \ + vim/plugin/mail_mutt.vim \ + vim/doc/mail_mutt.txt \ + VERSION + sh dist/vim-plugin.sh mail_mutt +dist-vim-plugin-strip-trailing-whitespace: \ + vim/plugin/strip_trailing_whitespace.vim \ + vim/doc/strip_trailing_whitespace.txt \ + VERSION + sh dist/vim-plugin.sh strip_trailing_whitespace +dist-vim-plugin-toggle-option-flag: \ + vim/plugin/toggle_option_flag.vim \ + vim/doc/toggle_option_flag.txt \ + VERSION + sh dist/vim-plugin.sh toggle_option_flag diff --git a/dist/vim-plugin.sh b/dist/vim-plugin.sh new file mode 100644 index 00000000..0f549be4 --- /dev/null +++ b/dist/vim-plugin.sh @@ -0,0 +1,18 @@ +#!/bin/sh +ver=$(awk -Fv 'NR<2&&$0=$NF' VERSION) || exit +mkdir -p -- vim/dist || exit +cd -- vim/dist || exit +for pn ; do + dn=vim-$(printf '%s' "$pn"|sed 's/_/-/g')-$ver + mkdir -p -- "$pn" + for fn in ../*/"$pn".txt ../*/"$pn".vim ; do + [ -e "$fn" ] || continue + sdn=$fn + sdn=${sdn#../} + sdn=${sdn%/*} + mkdir -p -- "$pn"/"$sdn" + cp -- "$fn" "$pn"/"$sdn" + done + tar c "$pn" | gzip > "$dn".tar.gz || exit + rm -r -- "$pn" +done -- cgit v1.2.3