-
Notifications
You must be signed in to change notification settings - Fork 2
/
zredis_compile
executable file
·34 lines (29 loc) · 1.24 KB
/
zredis_compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
setopt localoptions localtraps
trap 'return 1' INT TERM
# Get CPPFLAGS, CFLAGS, LDFLAGS
local cppf cf ldf cfgopts
zstyle -s ":plugin:zredis" cppflags cppf || cppf="-I/usr/local/include"
zstyle -s ":plugin:zredis" cflags cf || cf="-Wall -O2 -g"
zstyle -s ":plugin:zredis" ldflags ldf || ldf="-L/usr/local/lib"
zstyle -s ":plugin:zredis" configure_opts cfgopts || cfgopts=""
autoload is-at-least
builtin print -n "${fg_bold[magenta]}zshell${reset_color}/${fg_bold[yellow]}zredis${reset_color} is building"
(
local build=1
zmodload zsh/system && { zsystem flock -t 1 "${ZREDIS_REPO_DIR}/module/configure.ac" || build=0; }
if (( build )); then
print "..."
builtin cd "${ZREDIS_REPO_DIR}/module"
command touch Src/zshell/{zredis,zgdbm}.c
is-at-least zsh-5.6.1-dev-1 && local macro="-DZREDIS_ZSH_262_DEV_1=1" || local macro="-DZREDIS_ZSH_262_DEV_1=0"
CPPFLAGS="$cppf" CFLAGS="$cf${macro:+ $macro}" LDFLAGS="$ldf" ./configure --enable-gdbm ${=cfgopts}
command make clean
command make
local ts="$EPOCHSECONDS"
[[ -z "$ts" ]] && ts=$( date +%s )
builtin echo "$ts" >! "${ZREDIS_REPO_DIR}/module/COMPILED_AT"
else
print " on other terminal..."
fi
)
# vim:ft=zsh