[libclc] 115/291: Fixed ninja build issues relating to use of $(DESTDIR)

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit 7836a02cecbd5a383c5287c67127099528beb0ff
Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Wed Jan 29 20:03:26 2014 +0000

    Fixed ninja build issues relating to use of $(DESTDIR)
    
    We use ${DESTDIR} syntax now instead of $(DESTDIR) because that syntax
    works both is the shell (at least it does for bash) and for make (at
    least it does for GNU Make)
    
    Patch By: Dan Liew
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@200414 91177308-0d34-0410-b5e6-96231b3b80d8
---
 build/ninja_syntax.py | 16 ++++++++++++----
 configure.py          |  6 +++---
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/build/ninja_syntax.py b/build/ninja_syntax.py
index 6e8a87c..7d9f592 100644
--- a/build/ninja_syntax.py
+++ b/build/ninja_syntax.py
@@ -8,6 +8,7 @@ use Python.
 """
 
 import textwrap
+import re
 
 class Writer(object):
     def __init__(self, output, width=78):
@@ -31,7 +32,7 @@ class Writer(object):
     def rule(self, name, command, description=None, depfile=None,
              generator=False):
         self._line('rule %s' % name)
-        self.variable('command', command, indent=1)
+        self.variable('command', escape(command), indent=1)
         if description:
             self.variable('description', description, indent=1)
         if depfile:
@@ -103,8 +104,15 @@ class Writer(object):
 
 
 def escape(string):
-    """Escape a string such that it can be embedded into a Ninja file without
-    further interpretation."""
+    """Escape a string such that Makefile and shell variables are
+       correctly escaped for use in a Ninja file.
+    """
     assert '\n' not in string, 'Ninja syntax does not allow newlines'
     # We only have one special metacharacter: '$'.
-    return string.replace('$', '$$')
+
+    # We should leave $in and $out untouched.
+    # Just look for makefile/shell style substitutions
+    return re.sub(r'(\$[{(][a-z_]+[})])',
+                  r'$\1',
+                  string,
+                  flags=re.IGNORECASE)
diff --git a/configure.py b/configure.py
index 8a49397..525fdbe 100755
--- a/configure.py
+++ b/configure.py
@@ -220,15 +220,15 @@ for target in targets:
     b.default(builtins_bc)
 
 
-install_cmd = ' && '.join(['mkdir -p $(DESTDIR)/%(dst)s && cp -r %(src)s $(DESTDIR)/%(dst)s' % 
+install_cmd = ' && '.join(['mkdir -p ${DESTDIR}/%(dst)s && cp -r %(src)s ${DESTDIR}/%(dst)s' %
                            {'src': file,
                             'dst': libexecdir}
                            for (file, dest) in install_files_bc])
-install_cmd = ' && '.join(['%(old)s && mkdir -p $(DESTDIR)/%(dst)s && cp -r %(srcdir)s/generic/include/clc $(DESTDIR)/%(dst)s' %
+install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r %(srcdir)s/generic/include/clc ${DESTDIR}/%(dst)s' %
                            {'old': install_cmd,
                             'dst': includedir,
                             'srcdir': srcdir}])
-install_cmd = ' && '.join(['%(old)s && mkdir -p $(DESTDIR)/%(dst)s && cp -r libclc.pc $(DESTDIR)/%(dst)s' %
+install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r libclc.pc ${DESTDIR}/%(dst)s' %
                            {'old': install_cmd, 
                             'dst': pkgconfigdir}])
   

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list