Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline source when srcdir contains white-spaces #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
## DO NOT EDIT - This file generated from build-aux/bootstrap.in
## by inline-source v2016-02-21.11
## by inline-source v2016-10-21.11

# Bootstrap an Autotooled package from checked-out sources.
# Written by Gary V. Vaughan, 2010
Expand Down Expand Up @@ -222,6 +222,7 @@ vc_ignore=
## External Libraries. ##
## ------------------- ##


# Source required external libraries:
# Set a version string for this script.
scriptversion=2016-02-28.16; # UTC
Expand Down Expand Up @@ -2822,7 +2823,7 @@ test extract-trace = "$progname" && func_main "$@"
# End:

# Set a version string for *this* script.
scriptversion=2016-02-28.16; # UTC
scriptversion=2016-10-21.11; # UTC


## ------------------- ##
Expand Down
10 changes: 6 additions & 4 deletions build-aux/bootstrap.in
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,15 @@ vc_ignore=
## External Libraries. ##
## ------------------- ##

inline_source_dir=`echo "$0" |${SED-sed} 's|[^/]*$||'`

# Source required external libraries:
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh"
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser"
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"extract-trace"
. "$inline_source_dir"funclib.sh
. "$inline_source_dir"options-parser
. "$inline_source_dir"extract-trace

# Set a version string for *this* script.
scriptversion=2016-02-28.16; # UTC
scriptversion=2016-10-21.11; # UTC


## ------------------- ##
Expand Down
39 changes: 30 additions & 9 deletions build-aux/inline-source
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
# Please report bugs or propose patches to:
# <https://github.com/gnulib-modules/bootstrap/issues>

inline_source_dir=`echo "$0" |${SED-sed} 's|[^/]*$||'`

# Source required external libraries:
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh"
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser"
. "$inline_source_dir"funclib.sh
. "$inline_source_dir"options-parser

# Set a version string for *this* script.
scriptversion=2016-02-21.11; # UTC
scriptversion=2016-10-21.11; # UTC


## ------ ##
Expand All @@ -35,9 +37,14 @@ scriptversion=2016-02-21.11; # UTC

# Recursively scan through a FILE passed on the command line, replacing
# either of the following:
# . "relative/file"
# . `echo "$0" |edit`"relative/file"
# with the contents of the referenced files.
#
# a) . "relative/file"
# b) . `echo "$0" |edit`"relative/file"
# c) . "$inline_source_dir"/relative/file
#
# with the contents of the referenced files. When the c) option is used,
# '$inline_source_dir' must be explicitly set to script's source directory
# within the source file. See the example few lines above.


## ---------------- ##
Expand Down Expand Up @@ -118,6 +125,11 @@ func_include ()
_G_scriptdir=`echo "$1" |$SED 's|[^/]*$||'`
test -n "$_G_scriptdir" || _G_scriptdir="./"

func_quote_arg unquoted "$progpath"
prog=$func_quote_arg_unquoted_result

export inline_source_dir=$_G_scriptdir

$AWK '
BEGIN { magic = '${_RECURSE_MAGIC-0}'; }

Expand All @@ -129,16 +141,25 @@ func_include ()
next;
}

/^inline_source_dir=.*/ {
next;
}

/^\. "\$inline_source_dir.*/ {
system (sprintf ("env _RECURSE_MAGIC=%d \"'"$prog"'\" %s", magic, $2));
next;
}

/^\. ['\''"].*['\''"]$/ {
file = substr ($2, 2, length ($2) -2);
system (sprintf ("env _RECURSE_MAGIC=%d '$progpath' %s", magic, file));
system (sprintf ("env _RECURSE_MAGIC=%d \"'"$prog"'\" %s", magic, file));
next;
}

/^\. `echo [^`]*`['\''"][^'\''"]*['\''"]$/ {
tail = substr ($0, match ($0, /`['\''"]/));
file = substr (tail, 3, length (tail) -3);
system (sprintf ("env _RECURSE_MAGIC=%d '$progpath' '"$_G_scriptdir"'%s", magic, file));
file = substr (tail, 3, length (tail) -3);
system (sprintf ("env _RECURSE_MAGIC=%d \"'"$prog"'\" '"$_G_scriptdir"'%s", magic, file));
next;
}

Expand Down