From 2024b1e1f9afac6a4e8b91c7355820b5e8edf54e Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Wed, 6 Apr 2016 13:16:27 +0200 Subject: [PATCH] Shebangs added to compiled moonscript files. - If an alternate installation directory is specified by hand, however, no shebang will be added, because that file is likely to be used as a module or some other sort of loadable code. - This is mostly a temporary workaround, because we need to be more specific about what files need to receive a shebang and what other files do not. auto[$target] could do the distinction, though, but additional variables could be preferable. --- build/moon.zsh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build/moon.zsh b/build/moon.zsh index 2bb7e4d..7de30f7 100644 --- a/build/moon.zsh +++ b/build/moon.zsh @@ -17,14 +17,13 @@ function moon.build { if [[ -n "${S}" ]]; then write " ${S}" write "\t@echo '$(MOON "${target}")'" -# write "\t@echo '$(SED "${basename}")'" -# write -n "\t${Q}sed -e '" -# write -n "s&@LIBDIR@&\$(LIBDIR)&;" -# write -n "s&@BINDIR@&\$(BINDIR)&;" -# write -n "s&@SHAREDIR@&\$(SHAREDIR)&;" -# write "' '${basename}.in' > '${basename}'" - write "\t${Q}moonc -p $S > '${target}'" -# write "\t${Q}chmod +x '${basename}'" + if [[ -z "${install[$target]}" ]]; then + write "\t${Q}echo '#!/usr/bin/env lua' > '${target}'" + write "\t${Q}moonc -p $S >> '${target}'" + else + write "\t${Q}moonc -p $S > '${target}'" + write "\t${Q}chmod +x '${basename}'" + fi fi write "\n"