Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msteveb/ff4830198312181a8e2c to your computer and use it in GitHub Desktop.
Save msteveb/ff4830198312181a8e2c to your computer and use it in GitHub Desktop.
autosetup fix for top_srcdir
From 38dbeb4a3cf9c7c08b6b54bbf1956018ef55a394 Mon Sep 17 00:00:00 2001
From: Steve Bennett <steveb@workware.net.au>
Date: Sun, 1 Mar 2015 09:50:20 +1000
Subject: [PATCH] @top_srcdir@ should be a relative directory
When substituted in make-template, @top_srcdir@ should be
adjusted like @srcdir@ according to the current output directory.
Reported-by: Baptiste Daroussin <bapt@freebsd.org>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
---
examples/testbed/subdir/Makefile.in | 3 +++
lib/system.tcl | 8 +++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/examples/testbed/subdir/Makefile.in b/examples/testbed/subdir/Makefile.in
index 3f4831b..556c715 100644
--- a/examples/testbed/subdir/Makefile.in
+++ b/examples/testbed/subdir/Makefile.in
@@ -4,3 +4,6 @@ CC = @CC@
# This one is special in that it will be relative
# to where this file is created
srcdir = @srcdir@
+
+# And this will be relative to the top level source directory
+top_srcdir = @top_srcdir@
diff --git a/lib/system.tcl b/lib/system.tcl
index 2712e39..0166616 100644
--- a/lib/system.tcl
+++ b/lib/system.tcl
@@ -109,9 +109,10 @@ proc write-if-changed {file buf {script {}}} {
# Each pattern of the form @define@ is replaced the the corresponding
# define, if it exists, or left unchanged if not.
#
-# The special value @srcdir@ is subsituted with the relative
+# The special value @srcdir@ is substituted with the relative
# path to the source directory from the directory where the output
-# file is created. Use @top_srcdir@ for the absolute path.
+# file is created, while the special value @top_srcdir@ is substituted
+# with the relative path to the top level source directory.
#
# Conditional sections may be specified as follows:
## @if name == value
@@ -153,8 +154,9 @@ proc make-template {template {out {}}} {
# Make sure the directory exists
file mkdir $outdir
- # Set up srcdir to be relative to the target dir
+ # Set up srcdir and top_srcdir to be relative to the target dir
define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir]
+ define top_srcdir [relative-path $::autosetup(srcdir) $outdir]
set mapping {}
foreach {n v} [array get ::define] {
--
1.9.3 (Apple Git-50)
@bapt
Copy link

bapt commented Mar 1, 2015

It works perfectly thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment