diff --git a/README.md b/README.md index 6d6bbfad2..f2103b153 100644 --- a/README.md +++ b/README.md @@ -752,6 +752,7 @@ You may safely assume a given ice works with both plugins and snippets unless ex | [**`atload`**](https://zdharma-continuum.github.io/zinit/wiki/atload-and-other-at-ices) |
Run command after loading, within plugin's directory. Can be also used with snippets. Passed code can be preceded with `!`, it will then be investigated (if using `load`, not `light`).
| | `run-atpull` |
Always run the atpull hook (when updating), not only when there are new commits to be downloaded.
| | `nocd` |
Don't switch the current directory into the plugin's directory when evaluating the above ice-mods `atinit''`,`atload''`, etc.
| +| `configure` |
Runs `./configure` script and by default changes the installation directory by passing `--prefix=$ZPFX` to the script. Runs before `make''` and after `make'!'`, you can pass `'!'` too to this ice (i.e.: `configure'!'`) to make it execute earlier – before `make'!'` and after `make'!!'`. If `#` given in the ice value then also executes script `./autogen.sh` first before running `./configure`. The script is run anyway if there is no `configure` script.
| | [**`make`**](https://zdharma-continuum.github.io/zinit/wiki/Installing-with-make) |
Run `make` command after cloning/updating and executing `mv`, `cp`, `atpull`, `atclone` Ice mods. Can obtain argument, e.g. `make"install PREFIX=/opt"`. If the value starts with `!` then `make` is ran before `atclone`/`atpull`, e.g. `make'!'`.
| | `countdown` |
Causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0 to be displayed before executing `atclone''`,`atpull''` and `make` ices
| | `reset` |
Invokes `git reset --hard HEAD` for plugins or `svn revert` for SVN snippets before pulling any new changes. This way `git` or `svn` will not report conflicts if some changes were done in e.g.: `atclone''` ice. For file snippets and `gh-r` plugins it invokes `rm -rf *`.
| diff --git a/zinit-install.zsh b/zinit-install.zsh index 619754053..5ca602377 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -2160,6 +2160,62 @@ zimv() { ZINIT[-r/--reset-opt-hook-has-been-run]=1 } } # ]]] +# FUNCTION: ∞zinit-configure-e-hook [[[ +# The !-version of configure'' ice. Runs in between +# of make'!!' and make'!'. Configure naturally runs +# before make. +∞zinit-configure-e-hook() { + ∞zinit-configure-base-hook "$@" "!" +} # ]]] +# FUNCTION: ∞zinit-configure-hook [[[ +# The non-! version of configure'' ice. Runs in between +# of make'!' and make''. Configure script naturally runs +# before make. +∞zinit-configure-hook() { + ∞zinit-configure-base-hook "$@" +} # ]]] +# FUNCTION: ∞zinit-configure-base-hook [[[ +# A base common implementation of configure'', as all +# the starting steps are rigid and the same in all +# hooks, hence the idea. TODO: use in make'' and other +# places. +∞zinit-configure-base-hook() { + [[ "$1" = plugin ]] && \ + local dir="${5#%}" hook="$6" subtype="$7" ex="$8" || \ + local dir="${4#%}" hook="$5" subtype="$6" ex="$7" + + local configure=${ICE[configure]} + @zinit-substitute configure + + (( ${+ICE[configure]} )) || return 0 + if [[ $ex = "!" ]]; then + [[ $configure[1,2] == *\!* ]] || return 0 + else + [[ $configure[1,2] != *\!* ]] || return 0 + fi + + if [[ $configure[1,2] == *\#* ]]; then + if [[ -f $dir/autogen.sh ]]; then + m {pre}Running {cmd}./autogen.sh{…} + chmod +x $dir/autogen.sh + .zinit-countdown ./autogen.sh && \ + ( cd -q "$dir"; ./autogen.sh ) + else + m {ehi}WARNING:{error}: No {cmd}autogen.sh{error} on disk while {obj2}\#\ + {error}flag given to the {ice}configure{apo}\'\'{error} ice, skipping{…} + fi + else + if [[ -f $dir/autogen.sh && ! -f $dir/configure ]]; then + m {pre}Running {cmd}./autogen.sh{pre}, because no {cmd}configure{pre} found{…} + .zinit-countdown ./autogen.sh && \ + ( cd -q "$dir"; ./autogen.sh ) + fi + fi + m {pre}Running {cmd}./configure {opt}--prefix{meta}={b}{dir}$ZPFX{nb}{…} + configure=${configure##(\!\#|\#\!|\!|\#)} + .zinit-countdown ./configure && \ + ( cd -q "$dir"; ./configure --prefix=$ZPFX ${(@s; ;)configure} ) +} # ]]] # FUNCTION: ∞zinit-make-ee-hook [[[ ∞zinit-make-ee-hook() { [[ "$1" = plugin ]] && \ diff --git a/zinit.zsh b/zinit.zsh index d3b6b5e19..39cedeb5f 100644 --- a/zinit.zsh +++ b/zinit.zsh @@ -75,7 +75,7 @@ reset-prompt|wrap|reset|sh|\!sh|bash|\!bash|ksh|\!ksh|csh|\ \!csh|aliases|countdown|ps-on-unload|ps-on-update|trigger-load|\ light-mode|is-snippet|atdelete|pack|git|verbose|on-update-of|\ subscribe|extract|param|opts|autoload|subst|install|pullopts|\ -debug|null|binary|link" +debug|null|binary|link|configure" ZINIT[nval-ice-list]="blockf|silent|lucid|trackbinds|cloneonly|nocd|run-atpull|\ nocompletions|sh|\!sh|bash|\!bash|ksh|\!ksh|csh|\!csh|\ aliases|countdown|light-mode|is-snippet|git|verbose|cloneopts|\ @@ -3210,7 +3210,9 @@ if [[ -e ${${ZINIT[BIN_DIR]}}/zmodules/Src/zdharma/zplugin.so ]] { @zinit-register-hook "cp''" hook:no-e-\!atpull-pre ∞zinit-cp-hook @zinit-register-hook "compile-plugin" hook:no-e-\!atpull-pre ∞zinit-compile-plugin-hook # no-e-!atpull-post. +@zinit-register-hook "configure'!'" hook:no-e-\!atpull-post ∞zinit-configure-e-hook @zinit-register-hook "make'!'" hook:no-e-\!atpull-post ∞zinit-make-e-hook +@zinit-register-hook "configure''" hook:no-e-\!atpull-post ∞zinit-configure-hook @zinit-register-hook "atpull" hook:no-e-\!atpull-post ∞zinit-atpull-hook @zinit-register-hook "make''" hook:no-e-\!atpull-post ∞zinit-make-hook # atpull-post. @@ -3224,7 +3226,9 @@ if [[ -e ${${ZINIT[BIN_DIR]}}/zmodules/Src/zdharma/zplugin.so ]] { @zinit-register-hook "cp''" hook:\!atclone-pre ∞zinit-cp-hook @zinit-register-hook "compile-plugin" hook:\!atclone-pre ∞zinit-compile-plugin-hook # !atclone-post. +@zinit-register-hook "configure'!'" hook:\!atclone-post ∞zinit-configure-e-hook @zinit-register-hook "make'!'" hook:\!atclone-post ∞zinit-make-e-hook +@zinit-register-hook "configure''" hook:\!atclone-post ∞zinit-configure-hook @zinit-register-hook "atclone" hook:\!atclone-post ∞zinit-atclone-hook @zinit-register-hook "make''" hook:\!atclone-post ∞zinit-make-hook # atclone-post.