]> git.tdb.fi Git - builder.git/commitdiff
Change the default value of the cpu option to "none" since there's no actual autodete...
authorMikko Rasa <tdb@tdb.fi>
Fri, 4 Sep 2009 21:15:21 +0000 (21:15 +0000)
committerMikko Rasa <tdb@tdb.fi>
Fri, 4 Sep 2009 21:15:21 +0000 (21:15 +0000)
Remove target in Archive action since ar doesn't truncate the file
Check for target existence in Copy action to avoid unnecessary exceptions

source/archive.cpp
source/copy.cpp
source/sourcepackage.cpp

index 8b36391aece95ba911537fbd5f6dfba93dfaea2d..55b1f4615efe053bf1cf6dc68f915163929aae9d 100644 (file)
@@ -6,6 +6,7 @@ Distributed under the LGPL
 */
 
 #include <msp/fs/dir.h>
+#include <msp/fs/stat.h>
 #include <msp/fs/utils.h>
 #include "archive.h"
 #include "builder.h"
@@ -36,7 +37,11 @@ Archive::Archive(Builder &b, const StaticLibrary &lib):
 
        FS::Path lpath=lib.get_path();
        if(!builder.get_dry_run())
+       {
                FS::mkpath(FS::dirname(lpath), 0755);
+               if(FS::exists(lib.get_path()))
+                       FS::unlink(lib.get_path());
+       }
 
        announce(comp.get_package().get_name(), tool, relative(lpath, work_dir).str());
 
index 4cb42b707be686f59bd2725f089272f63b4e07d4..010d54113d74a859e9eb6e8416ca0e11e501790b 100644 (file)
@@ -42,14 +42,14 @@ void Copy::Worker::main()
 {
        FS::mkpath(FS::dirname(copy.dest), 0755);
 
-       try
-       {
-               // Remove old file.  Not doing this would cause Bad Stuff when installing libraries.
-               unlink(copy.dest);
-       }
-       catch(const SystemError &e)
+       // Remove old file.  Not doing this would cause Bad Stuff when installing libraries.
+       if(FS::exists(copy.dest))
        {
-               if(e.get_error_code()!=ENOENT)
+               try
+               {
+                       unlink(copy.dest);
+               }
+               catch(const Exception &e)
                {
                        IO::print(IO::cerr, "%s\n", e.what());
                        done=error=true;
index 751f1b2c4dcfa4d15a157d7f20b9fdd4c1845cdc..54de8f6a7cf076c178c95440d70ba4cb614d1c67 100644 (file)
@@ -135,7 +135,7 @@ void SourcePackage::init_config()
        config.add_option("optimize",   "0",       "Apply compiler optimizations");
        config.add_option("strip",      "0",       "Strip symbols from programs");
        config.add_option("debug",      "0",       "Produce debugging symbols");
-       config.add_option("cpu",        "auto",    "CPU type to optimize for");
+       config.add_option("cpu",        "none",    "CPU type to optimize for");
        config.add_option("staticlibs", "local",   "Use static libraries");
 
        for(FeatureList::iterator i=features.begin(); i!=features.end(); ++i)
@@ -181,7 +181,7 @@ void SourcePackage::create_build_info()
                build_info.cflags.push_back("-O"+optimize);
                build_info.ldflags.push_back("-O"+optimize);
                string cpu=config.get_option("cpu").value;
-               if(cpu!="auto")
+               if(cpu!="none")
                        build_info.cflags.push_back("-march="+cpu);
        }