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

A new ice build'' that's a shorthand for: null configure'' make'' #548

Closed
wants to merge 2 commits into from
Closed
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 @@ -750,6 +750,7 @@ You may safely assume a given ice works with both plugins and snippets unless ex
| `atload` | 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`). |
| `atpull` | Run command after updating (**only if new commits are waiting for download**), within plugin's directory. If starts with "!" then command will be ran before `mv` & `cp` ices and before `git pull` or `svn update`. Otherwise it is ran after them. Can be `atpull'%atclone'`, to repeat `atclone` Ice-mod. |
| `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. Also, when there exist another build-system related files, then it is run if no `configure` script is found. Currently supported systems are: CMake, scons and meson, checked-for/run in this order |
| `build` | Shorthand for `configure'--prefix=$ZPFX' make'install'`. Its argumens are passed to `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 |
| `cp` | Copy file after cloning or after update (then, only if new commits were downloaded). Example: `cp "docker-c* -> dcompose"`. Ran after `mv`. |
| `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'!'`. |
Expand Down
7 changes: 7 additions & 0 deletions tests/ices.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,11 @@
assert __init__.py is_not_value_in $COMPS
}

@test 'build-ice' {
run zinit as"null" id-as"test/build-ice" \
atclone'print "all_:\n\ttouch flag_file">>Makefile' build"all_" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---build-ice/flag_file" is_file
}

# vim:ft=zsh:sw=2:sts=2:et:foldmarker=\ {,}:foldmethod=marker
16 changes: 13 additions & 3 deletions zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fi
ZINIT[ice-list]="\
\!bash|\!csh|\!ksh|\!sh|\
aliases|as|atclone|atdelete|atinit|atload|atpull|autoload|\
bash|binary|bindmap|blockf|bpick|\
bash|binary|bindmap|blockf|bpick|build|\
cloneonly|cloneopts|compile|completions|configure|countdown|cp|csh|\
debug|depth|\
extract|\
Expand All @@ -96,15 +96,15 @@ wait|wrap"
ZINIT[nval-ice-list]="\
\!bash|\!csh|\!ksh|\!sh|\
aliases|\
bash|binary|blockf|\
bash|binary|blockf|build|\
cloneonly|cloneopts|countdown|csh|\
debug|\
git|\
is-snippet|\
ksh|\
light-mode|lucid|\
make|\
nocd|nocompile|nocompletions|notify|null|\
nocd|nocompile|nocompletions|notify|null|nonull|\
pullopts|\
reset|run-atpull|\
sh|silent|\
Expand Down Expand Up @@ -2265,6 +2265,16 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
[[ ${ZINIT_ICES[as]} = program ]] && ZINIT_ICES[as]=command
[[ -n ${ZINIT_ICES[on-update-of]} ]] && ZINIT_ICES[subscribe]="${ZINIT_ICES[subscribe]:-${ZINIT_ICES[on-update-of]}}"
[[ -n ${ZINIT_ICES[pick]} ]] && ZINIT_ICES[pick]="${ZINIT_ICES[pick]//\$ZPFX/${ZPFX%/}}"
(( $+ZINIT_ICES[env] )) && ZINIT_ICES[param]=$ZINIT_ICES[env]
# Build ice given? If yes, then enable null'', configure'' and make'' ices
if (( $+ZINIT_ICES[build] )); then
# Set null'' if not requested otherwise
(( $+INIT_ICES[nonull] )) || ZINIT_ICES[null]=
# Preserve any args for configure ice
ZINIT_ICES[configure]=${ZINIT_ICES[configure]:---prefix=$ZPFX}
# By default, if build'' is empty, then use 'install' target to make
ZINIT_ICES[make]=${ZINIT_ICES[build]:-install}
fi
return retval
} # ]]]
# FUNCTION: .zinit-pack-ice [[[
Expand Down