From: Mikko Rasa Date: Sat, 22 Sep 2007 11:41:32 +0000 (+0000) Subject: Adapt to changes in msppath X-Git-Tag: 0.9~20 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=4d0d003b022943d8a0e39ba19078bab8d32d8857;p=builder.git Adapt to changes in msppath Some more output for -vvv Add binary package for ODE --- diff --git a/builderrc b/builderrc index a39a877..0947330 100644 --- a/builderrc +++ b/builderrc @@ -35,6 +35,14 @@ binary_package "fmod4" need_path true; }; +binary_package "ode" +{ + build_info + { + library "ode"; + }; +}; + binary_package "xlib" { build_info diff --git a/source/analyzer.cpp b/source/analyzer.cpp index 0db55c7..f694edb 100644 --- a/source/analyzer.cpp +++ b/source/analyzer.cpp @@ -9,6 +9,7 @@ Distributed under the LGPL #include #include #include +#include #include "analyzer.h" #include "builder.h" #include "install.h" @@ -70,7 +71,7 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth) if(full_paths) fn=tgt.get_name(); else - fn=Path::Path(tgt.get_name())[-1]; + fn=basename(tgt.get_name()); row.push_back(string(depth*2, ' ')+fn); const Package *pkg=tgt.get_package(); diff --git a/source/archive.cpp b/source/archive.cpp index a7b86c7..70d6363 100644 --- a/source/archive.cpp +++ b/source/archive.cpp @@ -31,9 +31,9 @@ Archive::Archive(Builder &b, const StaticLibrary &lib): if(dynamic_cast(*i)) argv.push_back((*i)->get_name()); - Path::Path lpath=lib.get_name(); + Path lpath=lib.get_name(); if(!builder.get_dry_run()) - Path::mkpath(lpath.subpath(0, lpath.size()-1), 0755); + mkpath(lpath.subpath(0, lpath.size()-1), 0755); announce(comp.get_package().get_name(), tool, relative(lpath, comp.get_package().get_source()).str()); diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp index c2c1886..aaeb3e5 100644 --- a/source/binarypackage.cpp +++ b/source/binarypackage.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include #include "binarypackage.h" #include "builder.h" @@ -23,7 +24,7 @@ BinaryPackage::BinaryPackage(Builder &b, const string &n): Sets the path where the package files were installed. This is only useful if the package doesn't use pkg-config. */ -void BinaryPackage::set_path(const Msp::Path::Path &p) +void BinaryPackage::set_path(const Msp::Path &p) { path=builder.get_cwd()/p; } @@ -47,6 +48,8 @@ BinaryPackage *BinaryPackage::from_pkgconfig(Builder &builder, const string &nam argv.push_back("--cflags"); argv.push_back("--libs"); argv.push_back(name); + if(builder.get_verbose()>=4) + cout<<"Running "<second; native_arch.set_tool("CC", "gcc"); @@ -124,7 +124,7 @@ Builder::Builder(int argc, char **argv): const char *home=getenv("HOME"); if(home) - load_build_file((Path::Path(home)/".builderrc").str()); + load_build_file((Path(home)/".builderrc").str()); } /** @@ -145,6 +145,8 @@ Package *Builder::get_package(const string &n) argv.push_back("pkg-config"); argv.push_back("--variable=source"); argv.push_back(n); + if(verbose>=4) + cout<<"Running "< Builder::reg; -Builder::Loader::Loader(Builder &b, const Path::Path &s): +Builder::Loader::Loader(Builder &b, const Path &s): bld(b), src(s) { diff --git a/source/builder.h b/source/builder.h index 7036efd..42ddcc4 100644 --- a/source/builder.h +++ b/source/builder.h @@ -41,7 +41,7 @@ public: const TargetMap &get_targets() const { return targets; } Target *get_header(const std::string &, const std::string &, const std::string &, const StringList &); Target *get_library(const std::string &, const std::string &, const StringList &, LibMode); - const Msp::Path::Path &get_cwd() const { return cwd; } + const Msp::Path &get_cwd() const { return cwd; } const Architecture &get_architecture(const std::string &) const; void apply_profile_template(Config &, const std::string &) const; void add_target(Target *); @@ -54,10 +54,10 @@ private: class Loader: public Msp::DataFile::Loader { public: - Loader(Builder &, const Msp::Path::Path &); + Loader(Builder &, const Msp::Path &); private: Builder &bld; - Msp::Path::Path src; + Msp::Path src; void architecture(const std::string &); void binpkg(const std::string &); @@ -81,7 +81,7 @@ private: StringList cmdline_targets; StringMap cmdline_options; - Msp::Path::Path cwd; + Msp::Path cwd; PackageMap packages; SourcePackage *main_pkg; @@ -110,10 +110,10 @@ private: bool build_all; bool create_makefile; - int load_build_file(const Msp::Path::Path &); + int load_build_file(const Msp::Path &); int create_targets(); - Target *get_header(const Msp::Path::Path &); - Target *get_library(const std::string &, const std::string &, const Msp::Path::Path &, LibMode); + Target *get_header(const Msp::Path &); + Target *get_library(const std::string &, const std::string &, const Msp::Path &, LibMode); void update_hash(std::string &, const std::string &); int do_build(); int do_clean(); diff --git a/source/compile.cpp b/source/compile.cpp index 61b17ad..44d4d62 100644 --- a/source/compile.cpp +++ b/source/compile.cpp @@ -22,9 +22,9 @@ Compile::Compile(Builder &b, const ObjectFile &obj): const Component &comp=obj.get_component(); const TargetList &deps=obj.get_depends(); - Path::Path spath=deps.front()->get_name(); + Path spath=deps.front()->get_name(); - string ext=Path::splitext(spath.str()).ext; + string ext=splitext(spath.str()).ext; const char *tool=0; if(ext==".cpp" || ext==".cc") tool="CXX"; @@ -42,13 +42,13 @@ Compile::Compile(Builder &b, const ObjectFile &obj): for(list::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i) argv.push_back("-D"+*i); - Path::Path opath=obj.get_name(); + Path opath=obj.get_name(); argv.push_back("-o"); argv.push_back(opath.str()); argv.push_back(spath.str()); if(!builder.get_dry_run()) - Path::mkpath(opath.subpath(0, opath.size()-1), 0755); + mkpath(opath.subpath(0, opath.size()-1), 0755); announce(comp.get_package().get_name(), tool, relative(opath, comp.get_package().get_source()).str()); diff --git a/source/component.cpp b/source/component.cpp index 07cd6ea..f4e8fc2 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -81,7 +81,7 @@ void Component::create_targets() const for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i) { string basename=(*i)[-1]; - string ext=Path::splitext(basename).ext; + string ext=splitext(basename).ext; if((ext==".cpp" || ext==".c") && build_exe) { SourceFile *src=new SourceFile(builder, this, i->str()); @@ -146,8 +146,7 @@ PathList Component::collect_source_files() const PathList files; for(PathList::const_iterator i=sources.begin(); i!=sources.end(); ++i) { - struct stat st; - stat(*i, st); + struct stat st=stat(*i); if(S_ISDIR(st.st_mode)) { list sfiles=list_files(*i); diff --git a/source/config.cpp b/source/config.cpp index 0e8e6c2..482ceb8 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -171,7 +171,7 @@ void Config::finish() void Config::save() const { - Path::Path fn=package.get_source()/".options.cache"; + Path fn=package.get_source()/".options.cache"; OptionMap::const_iterator i=options.find("profile"); if(i!=options.end()) @@ -201,7 +201,7 @@ bool Config::set_option(const string &opt, const string &val) void Config::load() { - Path::Path fn=package.get_source()/".options.cache"; + Path fn=package.get_source()/".options.cache"; OptionMap::iterator i=options.find("profile"); if(i!=options.end()) @@ -210,9 +210,7 @@ void Config::load() ifstream in(fn.str().c_str()); if(!in) return; - struct stat st; - Path::stat(fn, st); - mtime=Time::TimeStamp::from_unixtime(st.st_mtime); + mtime=Time::TimeStamp::from_unixtime(stat(fn).st_mtime); DataFile::Parser parser(in, fn.str()); Loader loader(*this); diff --git a/source/copy.cpp b/source/copy.cpp index eea40fc..bdcd0a9 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -16,7 +16,7 @@ Distributed under the LGPL using namespace std; using namespace Msp; -Copy::Copy(Builder &b, const Package &pkg, const Path::Path &s, const Path::Path &d): +Copy::Copy(Builder &b, const Package &pkg, const Path &s, const Path &d): InternalAction(b), src(s), dest(d) @@ -38,15 +38,21 @@ Copy::Worker::Worker(Copy &c): void Copy::Worker::main() { - Path::mkpath(copy.dest.subpath(0, copy.dest.size()-1), 0755); + mkpath(copy.dest.subpath(0, copy.dest.size()-1), 0755); - // Remove old file. Not doing this would cause Bad Stuff when installing libraries. - if(unlink(copy.dest.str().c_str())<0 && errno!=ENOENT) + try { - int err=errno; - cerr<<"Can't unlink "<get_component()); } else - builder.problem(comp.get_package().get_name(), format("Couldn't find library %s for %s", *i, Path::basename(name))); + builder.problem(comp.get_package().get_name(), format("Couldn't find library %s for %s", *i, basename(name))); } } diff --git a/source/install.cpp b/source/install.cpp index 2cdd1aa..c26024a 100644 --- a/source/install.cpp +++ b/source/install.cpp @@ -33,9 +33,9 @@ void Install::check_rebuild() { Target *dep=depends.front(); if(dep->get_mtime()>mtime) - mark_rebuild(Path::basename(dep->get_name())+" has changed"); + mark_rebuild(basename(dep->get_name())+" has changed"); else if(dep->get_rebuild()) - mark_rebuild(Path::basename(dep->get_name())+" needs rebuilding"); + mark_rebuild(basename(dep->get_name())+" needs rebuilding"); } } @@ -48,7 +48,7 @@ string Install::generate_target_name(const Target &tgt) { const SourcePackage *spkg=dynamic_cast(tgt.get_package()); - Path::Path base=spkg->get_prefix(); + Path base=spkg->get_prefix(); string tgtname=tgt.get_name().substr(tgt.get_name().rfind('/')+1); string mid; diff --git a/source/link.cpp b/source/link.cpp index 88ee97a..14a7d46 100644 --- a/source/link.cpp +++ b/source/link.cpp @@ -59,9 +59,9 @@ Link::Link(Builder &b, const Executable &exe): argv.push_back("-l"+syslib->get_libname()); } - Path::Path epath=exe.get_name(); + Path epath=exe.get_name(); if(!builder.get_dry_run()) - Path::mkpath(epath.subpath(0, epath.size()-1), 0755); + mkpath(epath.subpath(0, epath.size()-1), 0755); announce(comp.get_package().get_name(), tool, relative(epath, comp.get_package().get_source()).str()); diff --git a/source/misc.h b/source/misc.h index edbf314..692ad6f 100644 --- a/source/misc.h +++ b/source/misc.h @@ -21,7 +21,7 @@ enum LibMode }; typedef std::list StringList; -typedef std::list PathList; +typedef std::list PathList; typedef std::map StringMap; std::string run_command(const StringList &); diff --git a/source/objectfile.cpp b/source/objectfile.cpp index 809e70d..c0a233f 100644 --- a/source/objectfile.cpp +++ b/source/objectfile.cpp @@ -94,5 +94,5 @@ void ObjectFile::add_depend(Target *tgt) string ObjectFile::generate_target_name(const Component &comp, const string &src) { - return (comp.get_package().get_temp_dir()/comp.get_name()/(Path::splitext(src.substr(src.rfind('/')+1)).base+".o")).str(); + return (comp.get_package().get_temp_dir()/comp.get_name()/(splitext(basename(src)).base+".o")).str(); } diff --git a/source/sourcefile.cpp b/source/sourcefile.cpp index 718a09c..f05d203 100644 --- a/source/sourcefile.cpp +++ b/source/sourcefile.cpp @@ -6,6 +6,7 @@ Distributed under the LGPL */ #include +#include #include #include "builder.h" #include "component.h" @@ -35,6 +36,9 @@ void SourceFile::find_depends() ifstream in(name.c_str()); if(!in) return; + if(builder.get_verbose()>=4) + cout<<"Reading includes from "<]"); string line; diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index caedaf6..cfe4be3 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -19,7 +19,7 @@ using namespace Msp; /** Creates a buildable package. */ -SourcePackage::SourcePackage(Builder &b, const string &n, const Path::Path &s): +SourcePackage::SourcePackage(Builder &b, const string &n, const Path &s): Package(b, n), source(s), config(*this), @@ -28,12 +28,12 @@ SourcePackage::SourcePackage(Builder &b, const string &n, const Path::Path &s): tar_files.push_back(source/"Build"); } -Msp::Path::Path SourcePackage::get_temp_dir() const +Msp::Path SourcePackage::get_temp_dir() const { return source/config.get_option("tempdir").value/config.get_option("profile").value; } -Msp::Path::Path SourcePackage::get_out_dir() const +Msp::Path SourcePackage::get_out_dir() const { return source/config.get_option("outdir").value; } @@ -194,9 +194,9 @@ void SourcePackage::create_build_info() unsigned flags=get_install_flags(); if(flags&INCLUDE) - export_binfo.incpath.push_back((Path::Path(config.get_option("prefix").value)/"include").str()); + export_binfo.incpath.push_back((Path(config.get_option("prefix").value)/"include").str()); if(flags&LIB) - export_binfo.libpath.push_back((Path::Path(config.get_option("prefix").value)/"lib").str()); + export_binfo.libpath.push_back((Path(config.get_option("prefix").value)/"lib").str()); string optimize=config.get_option("optimize").value; if(lexical_cast(optimize)) diff --git a/source/sourcepackage.h b/source/sourcepackage.h index 3e30790..f47f259 100644 --- a/source/sourcepackage.h +++ b/source/sourcepackage.h @@ -50,15 +50,15 @@ public: void tar_file(const std::string &); }; - SourcePackage(Builder &, const std::string &, const Msp::Path::Path &); - void set_path(const Msp::Path::Path &); + SourcePackage(Builder &, const std::string &, const Msp::Path &); + void set_path(const Msp::Path &); const std::string &get_name() const { return name; } const std::string &get_version() const { return version; } const std::string &get_description() const { return description; } - const Msp::Path::Path &get_source() const { return source; } - Msp::Path::Path get_temp_dir() const; - Msp::Path::Path get_out_dir() const; - Msp::Path::Path get_prefix() const { return config.get_option("prefix").value; } + const Msp::Path &get_source() const { return source; } + Msp::Path get_temp_dir() const; + Msp::Path get_out_dir() const; + Msp::Path get_prefix() const { return config.get_option("prefix").value; } const ComponentList &get_components() const { return components; } const Config &get_config() const { return config; } const BuildInfo &get_build_info() const { return build_info; } @@ -73,7 +73,7 @@ private: std::string version; std::string description; - Msp::Path::Path source; + Msp::Path source; PackageList base_reqs; FeatureList features; BuildInfo build_info; diff --git a/source/systemlibrary.cpp b/source/systemlibrary.cpp index 1df7b66..0af4910 100644 --- a/source/systemlibrary.cpp +++ b/source/systemlibrary.cpp @@ -14,7 +14,7 @@ using namespace Msp; SystemLibrary::SystemLibrary(Builder &b, const string &n): Target(b, 0, n) { - libname=Path::splitext(Path::basename(n)).base; + libname=splitext(basename(n)).base; if(!libname.compare(0, 3, "lib")) libname.erase(0, 3); } diff --git a/source/tar.cpp b/source/tar.cpp index 532b4a7..da57925 100644 --- a/source/tar.cpp +++ b/source/tar.cpp @@ -37,8 +37,8 @@ Tar::Worker::Worker(Tar &t): void Tar::Worker::main() { - const Path::Path &pkg_src=tar.tarball.get_package()->get_source(); - Path::Path basedir=Path::splitext(Path::basename(tar.tarball.get_name())).base; + const Path &pkg_src=tar.tarball.get_package()->get_source(); + Path basedir=splitext(basename(tar.tarball.get_name())).base; ofstream out(tar.tarball.get_name().c_str()); const TargetList &deps=tar.tarball.get_depends(); @@ -57,8 +57,7 @@ void Tar::Worker::main() memcpy(buf, rel_path.data(), rel_path.size()); - struct stat st; - Path::stat((*i)->get_name(), st); + struct stat st=stat((*i)->get_name()); store_number(buf+100, st.st_mode, 7); store_number(buf+108, st.st_uid, 7); store_number(buf+116, st.st_gid, 7); diff --git a/source/target.cpp b/source/target.cpp index fa63ac4..b094e94 100644 --- a/source/target.cpp +++ b/source/target.cpp @@ -106,7 +106,7 @@ Target::Target(Builder &b, const Package *p, const string &n): builder.add_target(this); struct stat st; - if(!Path::stat(name, st)) + if(!stat(name, st)) mtime=Time::TimeStamp::from_unixtime(st.st_mtime); } @@ -133,9 +133,9 @@ void Target::check_rebuild() for(TargetList::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i) { if((*i)->get_mtime()>mtime) - mark_rebuild(Path::basename((*i)->get_name())+" has changed"); + mark_rebuild(basename((*i)->get_name())+" has changed"); else if((*i)->get_rebuild()) - mark_rebuild(Path::basename((*i)->get_name())+" needs rebuilding"); + mark_rebuild(basename((*i)->get_name())+" needs rebuilding"); } } diff --git a/source/virtualtarget.cpp b/source/virtualtarget.cpp index 9263317..3f0081c 100644 --- a/source/virtualtarget.cpp +++ b/source/virtualtarget.cpp @@ -17,7 +17,7 @@ void VirtualTarget::check_rebuild() { for(TargetList::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i) if((*i)->get_rebuild()) - mark_rebuild(Msp::Path::basename((*i)->get_name())+" needs rebuilding"); + mark_rebuild(Msp::basename((*i)->get_name())+" needs rebuilding"); } /**