]> git.tdb.fi Git - builder.git/blobdiff - source/sourcepackage.cpp
Utility function for capturing command output
[builder.git] / source / sourcepackage.cpp
index 2371d2cea44dd61415ebc2d8318b9a1642584fba..02e9152a7b3ef52abcf5042bcf41d56516b7ac0a 100644 (file)
@@ -44,21 +44,6 @@ FS::Path SourcePackage::get_out_dir() const
                return source/arch.get_name()/config.get_option("outdir").value;
 }
 
-unsigned SourcePackage::get_install_flags()
-{
-       unsigned flags = 0;
-       for(ComponentList::iterator i=components.begin(); i!=components.end(); ++i)
-               if(i->get_install())
-               {
-                       if(i->get_type()==Component::PROGRAM)
-                               flags |= BIN;
-                       else if(i->get_type()==Component::LIBRARY || i->get_type()==Component::MODULE)
-                               flags |= LIB|INCLUDE;
-               }
-
-       return flags;
-}
-
 LibMode SourcePackage::get_library_mode() const
 {
        const string &mode = config.get_option("staticlibs").value;
@@ -127,11 +112,7 @@ void SourcePackage::do_configure(const StringMap &opts, unsigned flag)
                config.select_last_profile();
 
        if(flag && config.update(opts))
-       {
                builder.get_logger().log("configure", format("Configuration of %s changed", name));
-               if(!builder.get_dry_run())
-                       config.save();
-       }
 
        config.finish();
 
@@ -184,15 +165,18 @@ void SourcePackage::create_build_info()
        const StringList &warnings = builder.get_warnings();
        build_info.warnings.insert(build_info.warnings.begin(), warnings.begin(), warnings.end());
 
-       unsigned flags = get_install_flags();
-
        build_info.incpath.push_back((builder.get_prefix()/"include").str());
        build_info.libpath.push_back((builder.get_prefix()/"lib").str());
 
-       if(flags&INCLUDE)
+       bool export_paths = false;
+       for(ComponentList::const_iterator i=components.begin(); (!export_paths && i!=components.end()); ++i)
+               export_paths = (i->get_type()==Component::LIBRARY);
+
+       if(export_paths)
+       {
                export_binfo.incpath.push_back((builder.get_prefix()/"include").str());
-       if(flags&LIB)
                export_binfo.libpath.push_back((builder.get_prefix()/"lib").str());
+       }
 
        string optimize = config.get_option("optimize").value;
        if(!optimize.empty() && optimize!="0")
@@ -242,6 +226,12 @@ void SourcePackage::create_targets()
        }
 }
 
+void SourcePackage::save_caches()
+{
+       config.save();
+       deps_cache.save();
+}
+
 
 SourcePackage::Loader::Loader(SourcePackage &p):
        DataFile::DerivedObjectLoader<SourcePackage, Package>(p)