Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finally forget on atpull'%atclone' and long atclone'' ice – configure'' ice #334

Merged
merged 1 commit into from
Jul 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | <div align="justify" style="text-align: justify;">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`).</div> |
| `run-atpull` | <div align="justify" style="text-align: justify;">Always run the atpull hook (when updating), not only when there are new commits to be downloaded.</div> |
| `nocd` | <div align="justify" style="text-align: justify;">Don't switch the current directory into the plugin's directory when evaluating the above ice-mods `atinit''`,`atload''`, etc.</div> |
| `configure` | <div align="justify" style="text-align: justify;">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.</div> |
| [**`make`**](https://zdharma-continuum.github.io/zinit/wiki/Installing-with-make) | <div align="justify" style="text-align: justify;">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'!'`.</div> |
| `countdown` | <div align="justify" style="text-align: justify;">Causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0 to be displayed before executing `atclone''`,`atpull''` and `make` ices</div> |
| `reset` | <div align="justify" style="text-align: justify;">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 *`.</div> |
Expand Down
56 changes: 56 additions & 0 deletions zinit-install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]] && \
Expand Down
6 changes: 5 additions & 1 deletion zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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|\
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down