From 3d91eac15d8f7997ad0bee5c04a05ac7364d1bb4 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Tue, 7 Apr 2015 10:23:36 +0200 Subject: [PATCH] .in scripts are somewhat better handled. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Also, this build.zsh itself builds itself more nicely, with nice building messages and stuff. - It also fixes the problem of on-system scripts that were… well… kind of ignored. Yeah, I’m not working very seriously on this… --- Makefile | 8 +++++++- build.zsh => build.zsh.in | 6 +++++- build/script.zsh | 9 +++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) rename build.zsh => build.zsh.in (98%) mode change 100755 => 100644 diff --git a/Makefile b/Makefile index 137e233..e055275 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,11 @@ Q := @ all: build.zsh build/binary.zsh build/library.zsh build/ofile.zsh build/script.zsh build/sharedlib.zsh build/staticlib.zsh -build.zsh: +build.zsh: build.zsh.in + @echo ' [SED] build.zsh' + $(Q)sed -e 's&@LIBDIR@&$(LIBDIR)&;s&@BINDIR@&$(BINDIR)&;s&@SHAREDIR@&$(SHAREDIR)&;' 'build.zsh.in' > 'build.zsh' + $(Q)chmod +x 'build.zsh' + build.zsh.install: build.zsh @echo ' [IN] $(BINDIR)/build.zsh' @@ -25,6 +29,8 @@ build.zsh.install: build.zsh $(Q)install -m0755 build.zsh $(DESTDIR)$(BINDIR)/build.zsh build.zsh.clean: + @echo ' [RM] build.zsh' + $(Q)rm -f build.zsh build.zsh.uninstall: @echo ' [RM] $(BINDIR)/build.zsh' diff --git a/build.zsh b/build.zsh.in old mode 100755 new mode 100644 similarity index 98% rename from build.zsh rename to build.zsh.in index 5be24ef..d5898b3 --- a/build.zsh +++ b/build.zsh.in @@ -53,6 +53,10 @@ function RM { echo "${fg_bold[white]} [RM] ${fg_bold[white]}$@${reset_color}" } +function SED { + echo "${fg_bold[green]} [SED] ${fg_bold[white]}$@${reset_color}" +} + function DIR { echo "${fg_bold[magenta]} [DIR] ${fg_bold[white]}$@${reset_color}" } @@ -166,7 +170,7 @@ function duplicated { return 1 } -for dir in "@SHAREDIR@/build.zsh" build; do +for dir in "@SHAREDIR@/build.zsh" ./build; do [[ -d "$dir" ]] && { for i in "$dir"/*.zsh; do . "$i" diff --git a/build/script.zsh b/build/script.zsh index 3fe27f4..dc673ce 100644 --- a/build/script.zsh +++ b/build/script.zsh @@ -4,8 +4,13 @@ function script.build { if [[ -e "${target}.in" ]]; then write " ${target}.in" - write "\tcat ${target}.in > ${target}" - write "\tchmod +x ${target}" + write "\t@echo '$(SED "${target}")'" + write -n "\t${Q}sed -e '" + write -n "s&@LIBDIR@&\$(LIBDIR)&;" + write -n "s&@BINDIR@&\$(BINDIR)&;" + write -n "s&@SHAREDIR@&\$(SHAREDIR)&;" + write "' '${target}.in' > '${target}'" + write "\t${Q}chmod +x '${target}'" fi write "\n"