matricks / bam

Bam is a fast and flexible build system. Bam uses Lua to describe the build process. It's takes its inspiration for the script files from scons. While scons focuses on being 100% correct when building, bam makes a few sacrifices to acquire fast full and incremental build times.
http://matricks.github.com/bam
Other
146 stars 47 forks source link

CC, CXX, etc. detection doesn't support absolute paths #95

Closed ilovezfs closed 8 years ago

ilovezfs commented 8 years ago

The new environment variable detection in https://github.com/matricks/bam/commit/2e65531e340957f141173f7378bdbba617fe7a1e doesn't support absolute paths to the compilers. If you do use an absolute path, you end up with this error:

[string "src/tools.lua"]:165: no driver set
bam: script error (-t for more detail)
ilovezfs commented 8 years ago

Also, this looks like a bug to me:

            elseif string.match(os.getenv("CC"), "^clang") then
                print("CL!")
                SetDriversDefault = SetDriversCL

I assume this should be looking for cl, not clang, since you've already checked for clang higher up.

ilovezfs commented 8 years ago

For what it's worth, this patch seems to work (see https://github.com/Homebrew/homebrew-core/pull/2074):

diff --git a/src/tools.lua b/src/tools.lua
index f3b9b10..995d58e 100644
--- a/src/tools.lua
+++ b/src/tools.lua
@@ -5,13 +5,13 @@ function SetDefaultDrivers(settings)
    if _checked_default_drivers == false then
        _checked_default_drivers = true
        if os.getenv("CC") then
-           if string.match(os.getenv("CC"), "^clang") then
+           if string.match(os.getenv("CC"), "/clang") then
                print("CLANG!")
                SetDriversDefault = SetDriversClang
-           elseif string.match(os.getenv("CC"), "^gcc") then
+           elseif string.match(os.getenv("CC"), "/gcc") then
                print("GCC!")
                SetDriversDefault = SetDriversGCC
-           elseif string.match(os.getenv("CC"), "^clang") then
+           elseif string.match(os.getenv("CC"), "/cl") then
                print("CL!")
                SetDriversDefault = SetDriversCL
            end
matricks commented 8 years ago

Fixed with 27b28f0956a78844e73aa94fee7d0187c9b68bbd. Also, going to try to release more regular updates for now on and document whats happening between them.

ilovezfs commented 8 years ago

@matricks cool thank you.