Skip to content

Commit

Permalink
fix: support csh as well as tcsh (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks authored May 16, 2024
1 parent 201824a commit caa7f9b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
40 changes: 22 additions & 18 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,28 @@ if get_option('install_examples')
endif

# install environment setup files
configure_file(
input: 'meson' / 'this_iguana.sh.in',
output: 'this_iguana.sh',
install: get_option('z_install_envfile'),
install_dir: get_option('bindir'),
configuration: {
'ld_path': host_machine.system() != 'darwin' ? 'LD_LIBRARY_PATH' : 'DYLD_LIBRARY_PATH',
'python': get_option('bind_python') ? 'true' : 'false',
'libdir': get_option('libdir'),
},
)
configure_file(
input: 'meson' / 'this_iguana.tcsh.in',
output: 'this_iguana.tcsh',
install: get_option('z_install_envfile'),
install_dir: get_option('bindir'),
configuration: {},
)
if get_option('z_install_envfile')
configure_file(
input: 'meson' / 'this_iguana.sh.in',
output: 'this_iguana.sh',
install: true,
install_dir: get_option('bindir'),
configuration: {
'ld_path': host_machine.system() != 'darwin' ? 'LD_LIBRARY_PATH' : 'DYLD_LIBRARY_PATH',
'python': get_option('bind_python') ? 'true' : 'false',
'libdir': get_option('libdir'),
},
)
foreach shell : ['csh', 'tcsh']
configure_file(
input: 'meson' / 'this_iguana.csh.in',
output: 'this_iguana.' + shell,
install: true,
install_dir: get_option('bindir'),
configuration: {'shell': shell},
)
endforeach
endif

# generate modulefile
if(get_option('z_generate_modulefile'))
Expand Down
12 changes: 6 additions & 6 deletions meson/this_iguana.tcsh.in → meson/this_iguana.csh.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env tcsh
#!/usr/bin/env @shell@
set user_command = ($_)
set IGUANA_TCSH_ENV_FILE=`readlink -f $user_command[2]`
set IGUANA_CSH_ENV_FILE=`readlink -f $user_command[2]`
unset user_command
echo 'Creating `tcsh` sub-shell for iguana environment.'
echo 'Creating `@shell@` sub-shell for iguana environment.'
echo ''
echo 'NOTE: using iguana with this sub-shell is not well-tested; please report'
echo ' any problems or consider using `bash` or `zsh` and sourcing'
Expand All @@ -13,6 +13,6 @@ echo ' should be set to enable merging, e.g. in your `~/.cshrc` file:'
echo ' set history=10000'
echo ' set savehist=(10000 merge)'
echo ''
bash -c "source `dirname $IGUANA_TCSH_ENV_FILE`/this_iguana.sh && exec tcsh"
echo 'Exited iguana `tcsh` sub-shell.'
unset IGUANA_TCSH_ENV_FILE
bash -c "source `dirname $IGUANA_CSH_ENV_FILE`/this_iguana.sh && exec @shell@"
echo 'Exited iguana `@shell@` sub-shell.'
unset IGUANA_CSH_ENV_FILE

0 comments on commit caa7f9b

Please sign in to comment.