summaryrefslogtreecommitdiff
blob: d5da07bc980b0544d332ceaf5880f51d9261a974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Clang/LLVM is installed in an "odd" location (/usr/lib/llvm/<ver>/bin/)
which is added to PATH.  Since we cannot know <ver> upfront, it's wrong
to hardcode the PATH at the time of installation else we'd break after a
Clang update.  Since Clang is the primary compiler on Darwin, just
extract the relevant path on each invocation.

--- a/engine/SCons/Platform/posix.py
+++ b/engine/SCons/Platform/posix.py
@@ -87,9 +87,15 @@
     pspawn = piped_env_spawn
     # Note that this means that 'escape' is no longer used
 
+    with open('@GENTOO_PORTAGE_EPREFIX@/etc/profile.env', 'r') as f:
+        for l in f:
+            if "export PATH=" in l:
+                path = l.split('=')[1].strip("'")
+                break
+
     if 'ENV' not in env:
         env['ENV']        = {}
-    env['ENV']['PATH']    = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
+    env['ENV']['PATH']    = path
     env['OBJPREFIX']      = ''
     env['OBJSUFFIX']      = '.o'
     env['SHOBJPREFIX']    = '$OBJPREFIX'
@@ -104,7 +110,7 @@
     env['LIBSUFFIXES']    = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ]
     env['PSPAWN']         = pspawn
     env['SPAWN']          = spawn
-    env['SHELL']          = 'sh'
+    env['SHELL']          = '@GENTOO_PORTAGE_EPREFIX@/bin/sh'
     env['ESCAPE']         = escape
     env['TEMPFILE']       = TempFileMunge
     env['TEMPFILEPREFIX'] = '@'