Skip to content

Commit

Permalink
move zsh version conversion from configure and make to init/zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Jan 5, 2024
1 parent 410c5cb commit 3e63f7b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ SYS_LD_PRELOAD := @SYS_LD_PRELOAD@
SYS_LUA_PATH := @SYS_LUA_PATH@
SYS_LUA_CPATH := @SYS_LUA_CPATH@
CASE_INDEPENDENT_SORTING := @CASE_INDEPENDENT_SORTING@
MY_ZSH_VERSION := @MY_ZSH_VERSION@
ZSH_SITE_FUNCTIONS_DIRS := @ZSH_SITE_FUNCTIONS_DIRS@
ZSH_FPATH := @ZSH_FPATH@
SPIDER_CACHE_DESCRIPT_FN := @SPIDER_CACHE_DESCRIPT_FN@
Expand Down Expand Up @@ -287,6 +288,7 @@ __installMe:
-e 's|@basename@|$(BASENAME)|g' \
-e 's|@support_ksh@|$(SUPPORT_KSH)|g' \
-e 's|@zsh_fpath@|$(ZSH_FPATH)|g' \
-e 's|@my_zsh_version@|$(MY_ZSH_VERSION)|g' \
-e 's|@cached_loads@|$(CACHED_LOADS)|g' \
-e 's|@avail_extensions@|$(LMOD_AVAIL_EXTENSIONS)|g' \
-e 's|@ps@|$(PS)|g' \
Expand Down
15 changes: 12 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ ac_header_c_list=
ac_subst_vars='LTLIBOBJS
LIBOBJS
ZSH_FPATH
MY_ZSH_VERSION
ZSH
ZSH_SITE_FUNCTIONS_DIRS
HAVE_LUA_TERM
Expand Down Expand Up @@ -5620,12 +5621,20 @@ EOF
fi
if test -n "$PATH_TO_ZSH" ; then
cat > conftest.zsh << 'EOF'
echo $ZSH_VERSION
EOF
chmod +x conftest.zsh
MY_ZSH_VERSION=`$PATH_TO_ZSH -f ./conftest.zsh 2> /dev/null`
rm conftest.zsh
fi
if test -n "$PATH_TO_ZSH" ; then
cat > conftest.zsh << 'EOF'
ZV='${ZSH_VERSION)'
funcPath=$(echo $FPATH | sed -e "s|/$ZSH_VERSION/|/$ZV/|")
echo $funcPath
echo $FPATH
EOF
chmod +x conftest.zsh
Expand Down
16 changes: 12 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1050,13 +1050,21 @@ EOF
rm conftest.zsh
fi

AC_SUBST(ZSH_FPATH)
AC_SUBST(MY_ZSH_VERSION)
if test -n "$PATH_TO_ZSH" ; then
cat > conftest.zsh << 'EOF'
echo $ZSH_VERSION
EOF
chmod +x conftest.zsh
MY_ZSH_VERSION=`$PATH_TO_ZSH -f ./conftest.zsh 2> /dev/null`
rm conftest.zsh
fi


AC_SUBST(ZSH_FPATH)
if test -n "$PATH_TO_ZSH" ; then
cat > conftest.zsh << 'EOF'
ZV='${ZSH_VERSION)'
funcPath=$(echo $FPATH | sed -e "s|/$ZSH_VERSION/|/$ZV/|")
echo $funcPath
echo $FPATH
EOF

chmod +x conftest.zsh
Expand Down
9 changes: 8 additions & 1 deletion init/bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ fi
SUPPORT_KSH="@support_ksh@"
if [ $SUPPORT_KSH = yes -o -n "${KSH_VERSION+x}" ]; then
if [ -z "${__LMOD_SET_FPATH+x}" ]; then
export FPATH=$(@PKGV@/libexec/addto --append FPATH @zsh_fpath@ @PKGV@/init/ksh_funcs)
zv='${ZSH_VERSION}'
my_zsh_version=@my_zsh_version@
zsh_fpath=@zsh_fpath@
zsh_fpath=$(echo $zsh_fpath | sed -e "s|/$my_zsh_version/|/$zv/|g" )
export FPATH=$(@PKGV@/libexec/addto --append FPATH $zsh_fpath @PKGV@/init/ksh_funcs)
export __LMOD_SET_FPATH=1
unset zv
unset my_zsh_version
unset zsh_fpath
fi
fi
unset SUPPORT_KSH
Expand Down

0 comments on commit 3e63f7b

Please sign in to comment.