Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit 51d1c96b authored by Karl Wette's avatar Karl Wette

Generate top-level LALSuite shell-specific user environment scripts

- Safer than trying to get lalsuiterc to work with all shells
- generate_user_env.awk: move to gnuscripts/, add 'source' command
- lalsuite_top.am: top-level for all libraries and LALSuite, builds
  environment scripts and an install-check for them
- lalsuiterc: print deprecation message, still works for [c]sh
Original: 173504e5e12b9b13f64ea03b6175eabca7e85b46
parent d1260616
......@@ -22,4 +22,8 @@ config.status
configure
cscope.*
lalsuite-*.tar.xz
lalsuite-user-env.csh
lalsuite-user-env.fish
lalsuite-user-env.sh
lalsuite-user-env.shell
tags
BUILT_SOURCES =
sysconf_DATA =
MOSTLYCLEANFILES =
EXTRA_DIST =
include $(top_srcdir)/gnuscripts/lalsuite_top.am
ACLOCAL_AMFLAGS = -I gnuscripts
SUBDIRS = @subdirs@
......@@ -21,14 +27,15 @@ cscopelist-subdirs:
sed "s|^|$${subdir}/|" $${subdir}/cscope.files >> $(top_builddir)/cscope.files; \
done
BUILT_SOURCES = $(PACKAGE)rc
sysconf_DATA = $(PACKAGE)rc
MOSTLYCLEANFILES = $(PACKAGE)rc
user_environment = \
`for dir in $(SUBDIRS); do echo "source $(sysconfdir)/$${dir}-user-env;"; done` \
$(END_OF_LIST)
BUILT_SOURCES += $(PACKAGE)rc
sysconf_DATA += $(PACKAGE)rc
MOSTLYCLEANFILES += $(PACKAGE)rc
$(PACKAGE)rc: Makefile
$(AM_V_GEN)echo "# source this file to access $(PACKAGE_NAME)" >$@; \
for dir in $(SUBDIRS); do \
echo "eval \`sh -c \"case \$$0 in *csh) echo source $(sysconfdir)/$${dir}-user-env.csh;; *) echo . $(sysconfdir)/$${dir}-user-env.sh;; esac\"\`" >>$@; \
done
$(AM_V_GEN)echo "echo '$@ is deprecated; source $(sysconfdir)/$(PACKAGE)-user-env.[c]sh instead'; expr \"X\$$0\" : '^X.*csh' >/dev/null && source $(sysconfdir)/$(PACKAGE)-user-env.csh >/dev/null || . $(sysconfdir)/$(PACKAGE)-user-env.sh >/dev/null" >$@
if DOXYGEN
......@@ -52,26 +59,3 @@ uninstall-local:
-rm -rf "$(DESTDIR)$(htmldir)/"
endif
.PHONY: print-build-success
all-local: print-build-success
print-build-success:
@echo "";\
echo "==================================================";\
echo "$(PACKAGE_NAME) has now been successfully built.";\
echo "Now run 'make install' to install $(PACKAGE_NAME).";\
echo "==================================================";\
echo ""
.PHONY: print-install-success
install-exec-local: print-install-success
print-install-success:
@echo "";\
echo "==================================================";\
echo "$(PACKAGE_NAME) has now been successfully installed.";\
echo "To set up your environment, please add the line";\
echo " . $(sysconfdir)/$(PACKAGE)rc";\
echo "to ~/.profile for Bourne shells (e.g. bash), or";\
echo " source $(sysconfdir)/$(PACKAGE)rc";\
echo "to ~/.login for C shells (e.g. tcsh).";\
echo "==================================================";\
echo ""
# Environment script generation
# Author: Karl Wette, 2011--2014
# src[name] holds environment scripts to source, srclen its length
# env[name] holds the value of environment variable 'name'
# set[name,path] is defined if 'path' has already been set in 'name'
# sed[name] holds sed scripts to remove duplicates from 'name'
# input records are separated by semi-colons
BEGIN {
RS = ";"
srclen = 0
}
# first filter out any whitespace-only lines
......@@ -11,9 +17,17 @@ BEGIN {
next
}
# env[name] holds the value of environment variable 'name'
# set[name,path] is defined if 'path' has already been set in 'name'
# sed[name] holds sed scripts to remove duplicates from 'name'
# source an environment script
# syntax: source script
$1 == "source" {
if (NF != 2) {
print "generate_user_env.awk: syntax error in '" $0 "'" >"/dev/stderr"
exit 1
}
src[srclen] = $2
++srclen
next
}
# set an environment variable to a given value
# syntax: set NAME value
......@@ -78,6 +92,12 @@ $1 == "append" {
# output environment variables in both C and Bourne shell syntax
END {
envempty = 1
for (i = 0; i < srclen; ++i) {
envempty = 0
print "csh:source " src[i] ".csh"
print "sh:. " src[i] ".sh"
print "fish:. " src[i] ".fish"
}
for (name in env) {
envempty = 0
if (name == "PATH") {
......
include $(top_srcdir)/gnuscripts/lalsuite_top.am
EXTRA_DIST += README
if HAVE_GIT_REPO
......@@ -8,23 +10,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(SHELL) ./00boot
endif # HAVE_GIT_REPO
BUILT_SOURCES += $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish
sysconf_DATA += $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish
MOSTLYCLEANFILES += $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish $(PACKAGE)-user-env.shell
EXTRA_DIST += generate_user_env.awk
$(PACKAGE)-user-env.shell: Makefile $(srcdir)/generate_user_env.awk
$(AM_V_GEN)if echo "$(user_environment)" | $(AWK) -f $(srcdir)/generate_user_env.awk >$@; then \
exit 0; \
else \
rm -f $@; \
exit 1; \
fi
$(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish: $(PACKAGE)-user-env.shell
$(AM_V_GEN)prefix=`echo "$@" | $(SED) -e 's|.*\.||'`; \
echo "# source this file to access $(PACKAGE_NAME)" >$@; \
$(SED) -n -e "s|[@]SED[@]|$(SED)|g;s|^$$prefix:||p" $< >>$@
EXTRA_DIST += AUTHORS
.PHONY: force-author-generation
......@@ -35,28 +20,3 @@ AUTHORS: force-author-generation
$(AM_V_GEN)export LC_ALL=C; since=c31bce07b892efeab430bfe1ce2bf2c758107776; \
( cd $(srcdir) && cat .AUTHORS && git log --pretty="%aN" $${since}..HEAD -- . 2>/dev/null ) | $(SED) -e '/^UNKNOWN/d' | sort -f -u > $@
endif # HAVE_GIT_REPO
.PHONY: print-build-success
all-local: print-build-success
print-build-success:
@echo "";\
echo "==================================================";\
echo "$(PACKAGE_NAME) has now been successfully built.";\
echo "Now run 'make install' to install $(PACKAGE_NAME).";\
echo "==================================================";\
echo ""
.PHONY: print-install-success
install-exec-local: print-install-success
print-install-success:
@echo "";\
echo "==================================================";\
echo "$(PACKAGE_NAME) has now been successfully installed.";\
echo "To set up your environment, please add the line";\
echo " . $(sysconfdir)/$(PACKAGE)-user-env.sh";\
echo "to ~/.profile for Bourne shells (e.g. bash), or";\
echo " source $(sysconfdir)/$(PACKAGE)-user-env.csh";\
echo "to ~/.login for C shells (e.g. tcsh).";\
echo " source $(sysconfdir)/$(PACKAGE)-user-env.fish";\
echo "to ~/.login for fish shell.";\
echo "==================================================";\
echo ""
BUILT_SOURCES += $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish
sysconf_DATA += $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish
MOSTLYCLEANFILES += $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish $(PACKAGE)-user-env.shell
EXTRA_DIST += gnuscripts/generate_user_env.awk
$(PACKAGE)-user-env.shell: Makefile $(srcdir)/gnuscripts/generate_user_env.awk
$(AM_V_GEN)if echo "$(user_environment)" | $(AWK) -f $(srcdir)/gnuscripts/generate_user_env.awk >$@; then \
exit 0; \
else \
rm -f $@; \
exit 1; \
fi
$(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish: $(PACKAGE)-user-env.shell
$(AM_V_GEN)prefix=`echo "$@" | $(SED) -e 's|.*\.||'`; \
echo "# source this file to access $(PACKAGE_NAME)" >$@; \
$(SED) -n -e "s|[@]SED[@]|$(SED)|g;s|^$$prefix:||p" $< >>$@
installcheck-local: $(PACKAGE)-user-env.csh $(PACKAGE)-user-env.sh $(PACKAGE)-user-env.fish
@echo "Testing $(PACKAGE_NAME) user environment scripts"
@test ! -x /bin/bash || /bin/bash -c '. ./$(PACKAGE)-user-env.sh'
@test ! -x /usr/bin/tcsh || /usr/bin/tcsh -c 'source ./$(PACKAGE)-user-env.csh'
@test ! -x /usr/bin/fish || /usr/bin/fish -c '. ./$(PACKAGE)-user-env.fish'
.PHONY: print-build-success
all-local: print-build-success
print-build-success:
@echo "";\
echo "==================================================";\
echo "$(PACKAGE_NAME) has now been successfully built.";\
echo "Now run 'make install' to install $(PACKAGE_NAME).";\
echo "==================================================";\
echo ""
.PHONY: print-install-success
install-exec-local: print-install-success
print-install-success:
@echo "";\
echo "==================================================";\
echo "$(PACKAGE_NAME) has now been successfully installed.";\
echo "To set up your environment, please add the line";\
echo " . $(sysconfdir)/$(PACKAGE)-user-env.sh";\
echo "to ~/.profile for Bourne shells (e.g. bash), or";\
echo " source $(sysconfdir)/$(PACKAGE)-user-env.csh";\
echo "to ~/.login for C shells (e.g. tcsh), or";\
echo " source $(sysconfdir)/$(PACKAGE)-user-env.fish";\
echo "to ~/.login for fish shell.";\
echo "==================================================";\
echo ""
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
../lal/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/generate_user_env.awk
\ No newline at end of file
../../gnuscripts/lalsuite_top.am
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment