From baac266cdf1cd035c7cc50000209e70160efb715 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 14 May 2021 16:29:25 +0530 Subject: Rewrite pre-inst-env in scheme. Scheme code is more readable than arcane bash. * pre-inst-env.in: Rewrite in scheme. --- pre-inst-env.in | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'pre-inst-env.in') diff --git a/pre-inst-env.in b/pre-inst-env.in index 4e73d75..7b58d09 100644 --- a/pre-inst-env.in +++ b/pre-inst-env.in @@ -1,28 +1,33 @@ -#! /bin/sh +#! @GUILE@ -s +-*- scheme -*- +!# +;;; ccwl --- Concise Common Workflow Language +;;; Copyright © 2021 Arun Isaac +;;; +;;; This file is part of ccwl. +;;; +;;; ccwl is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; ccwl is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with ccwl. If not, see . -# ccwl --- Concise Common Workflow Language -# Copyright © 2021 Arun Isaac -# -# This file is part of ccwl. -# -# ccwl is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# ccwl is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -# License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ccwl. If not, see . +(import (ice-9 match)) -abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd -P`" -abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd -P`" +(define (prepend-path-env! name . values) + (setenv name (string-append (string-join values ":" 'suffix) + (getenv name)))) -GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" -GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" -export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH +(prepend-path-env! "GUILE_LOAD_PATH" "@abs_top_builddir@" "@abs_top_srcdir@") +(prepend-path-env! "GUILE_LOAD_COMPILED_PATH" "@abs_top_builddir@") -exec "$@" +(match (command-line) + ((pre-inst-env command args ...) + (apply execlp command command args))) -- cgit v1.2.3