Skip to content

Commit caa7f9b

Browse files
authored
fix: support csh as well as tcsh (#211)
1 parent 201824a commit caa7f9b

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

meson.build

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,28 @@ if get_option('install_examples')
195195
endif
196196

197197
# install environment setup files
198-
configure_file(
199-
input: 'meson' / 'this_iguana.sh.in',
200-
output: 'this_iguana.sh',
201-
install: get_option('z_install_envfile'),
202-
install_dir: get_option('bindir'),
203-
configuration: {
204-
'ld_path': host_machine.system() != 'darwin' ? 'LD_LIBRARY_PATH' : 'DYLD_LIBRARY_PATH',
205-
'python': get_option('bind_python') ? 'true' : 'false',
206-
'libdir': get_option('libdir'),
207-
},
208-
)
209-
configure_file(
210-
input: 'meson' / 'this_iguana.tcsh.in',
211-
output: 'this_iguana.tcsh',
212-
install: get_option('z_install_envfile'),
213-
install_dir: get_option('bindir'),
214-
configuration: {},
215-
)
198+
if get_option('z_install_envfile')
199+
configure_file(
200+
input: 'meson' / 'this_iguana.sh.in',
201+
output: 'this_iguana.sh',
202+
install: true,
203+
install_dir: get_option('bindir'),
204+
configuration: {
205+
'ld_path': host_machine.system() != 'darwin' ? 'LD_LIBRARY_PATH' : 'DYLD_LIBRARY_PATH',
206+
'python': get_option('bind_python') ? 'true' : 'false',
207+
'libdir': get_option('libdir'),
208+
},
209+
)
210+
foreach shell : ['csh', 'tcsh']
211+
configure_file(
212+
input: 'meson' / 'this_iguana.csh.in',
213+
output: 'this_iguana.' + shell,
214+
install: true,
215+
install_dir: get_option('bindir'),
216+
configuration: {'shell': shell},
217+
)
218+
endforeach
219+
endif
216220

217221
# generate modulefile
218222
if(get_option('z_generate_modulefile'))
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env tcsh
1+
#!/usr/bin/env @shell@
22
set user_command = ($_)
3-
set IGUANA_TCSH_ENV_FILE=`readlink -f $user_command[2]`
3+
set IGUANA_CSH_ENV_FILE=`readlink -f $user_command[2]`
44
unset user_command
5-
echo 'Creating `tcsh` sub-shell for iguana environment.'
5+
echo 'Creating `@shell@` sub-shell for iguana environment.'
66
echo ''
77
echo 'NOTE: using iguana with this sub-shell is not well-tested; please report'
88
echo ' any problems or consider using `bash` or `zsh` and sourcing'
@@ -13,6 +13,6 @@ echo ' should be set to enable merging, e.g. in your `~/.cshrc` file:'
1313
echo ' set history=10000'
1414
echo ' set savehist=(10000 merge)'
1515
echo ''
16-
bash -c "source `dirname $IGUANA_TCSH_ENV_FILE`/this_iguana.sh && exec tcsh"
17-
echo 'Exited iguana `tcsh` sub-shell.'
18-
unset IGUANA_TCSH_ENV_FILE
16+
bash -c "source `dirname $IGUANA_CSH_ENV_FILE`/this_iguana.sh && exec @shell@"
17+
echo 'Exited iguana `@shell@` sub-shell.'
18+
unset IGUANA_CSH_ENV_FILE

0 commit comments

Comments
 (0)