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

Make location of redoconf scripts definable #35

Open
wants to merge 1 commit into
base: main
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
12 changes: 6 additions & 6 deletions redoconf/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ if [ -e "configure" ] || [ -e "rc.sh" ]; then
exit 99
fi

S="$(dirname "$0")"
: ${REDOCONF:="$S/redoconf"}
rm -f src Makefile
echo "$S" >src
printf "%s\n%s\n" "$S" "$REDOCONF" >src

# Don't regenerate these files unless they're missing. Otherwise redo
# will treat it as a changed dependency and rebuild a bunch of files
# unnecessarily.
[ -e redoconf.rc ] || cat >redoconf.rc <<-EOF
# Automatically generated by $0
read -r S <src
. "\$S/redoconf/rc.sh"
{ read -r S ; read -r REDOCONF ; } <src
. "\$REDOCONF/rc.sh"
EOF

# Instead of a symlink, we could make this a script like redoconf.rc,
# except then we would have to redi-ifchange default.do.sh, which would
# greatly increase the number of calls to redo-ifchange in the fast path.
# That turns out to slow things down quite a bit. So let redo follow
# the symlink and note the dependency internally, which is faster.
[ -e default.do ] || ln -sf "$S/redoconf/default.do.sh" default.do
[ -e default.do ] || ln -sf "$REDOCONF/default.do.sh" default.do

cat >Makefile <<'EOF'
# A wrapper for people who like to type 'make' instead of 'redo'
Expand All @@ -41,7 +41,7 @@ EOF

# Don't include rc.sh here, because that might call redo-ifchange,
# and we're not ready for that yet.
. "$S/redoconf/utils.sh"
. "$REDOCONF/utils.sh"

usage() {
exec >&2
Expand Down
3 changes: 1 addition & 2 deletions redoconf/default.do.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This script starts with $PWD=output dir, $S=input dir.
read -r S <src
REDOCONF="$S/redoconf"
{ read -r S ; read -r REDOCONF ; } <src
if [ ! -d "$S" ] || [ ! -f "$REDOCONF/default.do.sh" ]; then
echo "default.do.sh: \$S is not set correctly." >&2
exit 99
Expand Down
1 change: 0 additions & 1 deletion redoconf/rc.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This script starts with $PWD=output dir, $S=input dir.
REDOCONF="$S/redoconf"
if [ ! -d "$S" ] || [ ! -f "$REDOCONF/default.do.sh" ]; then
echo "default.do.sh: \$S is not set correctly." >&2
exit 99
Expand Down