mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
feat: add configure"" ice (#334)
### configure ice
The new `configure''` ice is a facade for the following code.
```zsh
atclone'./configure --prefix=$PWD'
atpull'%atclone'
```
### Example:
Without the `configure` ice:
```zsh
zi for \
as'null' \
atclone'autoreconf -iv && ./configure --prefix=$PWD' \
atpull'%atclone' \
lbin'!**/stow' \
make'PREFIX=$PWD install' \
nocompile \
@aspiers/stow
```
With the `configure` ice:
```zsh
zi for \
as'null' \
configure'#' \
lbin'!**/stow' \
make'PREFIX=$PWD install' \
nocompile \
@aspiers/stow
```
Additionally, passing `#` as the ice value will look for and run `autogen.sh` prior to running `./configure`.
This commit is contained in:
parent
35d9a7da2c
commit
40a46c6d22
|
|
@ -752,6 +752,7 @@ ### Command Execution After Cloning, Updating or Loading
|
|||
| [**`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> |
|
||||
|
|
|
|||
|
|
@ -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 ]] && \
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue