From 5006279d7b92e578ecfa8a04186f675c6b9f1eea Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 4 Sep 2009 21:15:21 +0000 Subject: [PATCH] Change the default value of the cpu option to "none" since there's no actual autodetection 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 | 5 +++++ source/copy.cpp | 14 +++++++------- source/sourcepackage.cpp | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/source/archive.cpp b/source/archive.cpp index 8b36391..55b1f46 100644 --- a/source/archive.cpp +++ b/source/archive.cpp @@ -6,6 +6,7 @@ Distributed under the LGPL */ #include +#include #include #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()); diff --git a/source/copy.cpp b/source/copy.cpp index 4cb42b7..010d541 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -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; diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index 751f1b2..54de8f6 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -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); } -- 2.45.2