build: fixed the expansions in pkgconfig files
authorAndrew Tridgell <tridge@samba.org>
Sat, 3 Apr 2010 12:26:21 +0000 (23:26 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:24 +0000 (20:27 +1000)
thanks to Jelmer for the hint on this

buildtools/wafsamba/wafsamba.py

index 7a71a2ee2f01669e4e93f7742ac4d6982951a298..2cfbe7a58355e5db96196bdef2a064f8835b5375 100644 (file)
@@ -627,6 +627,7 @@ def subst_at_vars(task):
     # split on the vars
     a = re.split('(@\w+@)', s)
     out = []
+    back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
     for v in a:
         if re.match('@\w+@', v):
             vname = v[1:-1]
@@ -635,7 +636,12 @@ def subst_at_vars(task):
             if not vname in task.env:
                 print "Unknown substitution %s in %s" % (v, task.name)
                 raise
-            v = task.env[vname]
+            v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
+            # now we back substitute the allowed pc vars
+            for (b, m) in back_sub:
+                s = task.env[b]
+                if s == v[0:len(s)]:
+                    v = m + v[len(s):]
         out.append(v)
     contents = ''.join(out)
     f = open(tgt, 'w')