#include <msp/io/print.h>
#include "analyzer.h"
#include "builder.h"
-#include "install.h"
#include "objectfile.h"
#include "package.h"
#include "sourcefile.h"
#include "binary.h"
#include "builder.h"
#include "component.h"
-#include "install.h"
#include "link.h"
#include "objectfile.h"
-#include "package.h"
#include "sharedlibrary.h"
+#include "sourcepackage.h"
#include "staticlibrary.h"
using namespace std;
#include "gnucxxcompiler.h"
#include "gnulinker.h"
#include "header.h"
-#include "install.h"
+#include "installedfile.h"
#include "misc.h"
#include "package.h"
#include "pkgconfig.h"
if(spkg->get_install_flags()&(SourcePackage::LIB|SourcePackage::INCLUDE))
{
PkgConfig *pc = new PkgConfig(*this, *spkg);
- install->add_depend(new Install(*this, *spkg, *pc));
+ install->add_depend(new InstalledFile(*this, *spkg, *pc));
}
}
#include "executable.h"
#include "file.h"
#include "header.h"
-#include "install.h"
#include "objectfile.h"
#include "sharedlibrary.h"
#include "sourcepackage.h"
#include <msp/io/print.h>
#include "builder.h"
#include "copy.h"
-#include "install.h"
+#include "installedfile.h"
using namespace std;
using namespace Msp;
{
FileTarget &file_tgt = dynamic_cast<FileTarget &>(*sources.front());
const SourcePackage &pkg = dynamic_cast<const SourcePackage &>(*file_tgt.get_package());
- Install *inst = new Install(builder, pkg, file_tgt, arg);
+ InstalledFile *inst = new InstalledFile(builder, pkg, file_tgt, arg);
inst->set_tool(*this);
return inst;
}
Task *Copy::run(const Target &target) const
{
- const Install &install = dynamic_cast<const Install &>(target);
+ const InstalledFile &install = dynamic_cast<const InstalledFile &>(target);
Worker *worker = new Worker(install);
return new InternalTask(worker);
}
-Copy::Worker::Worker(const Install &t):
+Copy::Worker::Worker(const InstalledFile &t):
target(t)
{
launch();
#include "internaltask.h"
#include "tool.h"
-class Install;
+class InstalledFile;
/**
-Copies a file to another place. Used by the Install target.
+Copies a file to another place. Used by the InstalledFile target.
*/
class Copy: public Tool
{
class Worker: public InternalTask::Worker
{
private:
- const Install ⌖
+ const InstalledFile ⌖
public:
- Worker(const Install &);
+ Worker(const InstalledFile &);
private:
virtual void main();
};
+++ /dev/null
-#include <msp/fs/utils.h>
-#include "builder.h"
-#include "copy.h"
-#include "executable.h"
-#include "datafile.h"
-#include "header.h"
-#include "install.h"
-#include "package.h"
-#include "pkgconfig.h"
-#include "sharedlibrary.h"
-#include "staticlibrary.h"
-
-using namespace std;
-using namespace Msp;
-
-Install::Install(Builder &b, const SourcePackage &p, FileTarget &s, const std::string &loc):
- FileTarget(b, &p, generate_target_path(s, loc)),
- source(s)
-{
- buildable = true;
- add_depend(&source);
-
- if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&source))
- if(!shlib->get_soname().empty())
- link = FS::dirname(path)/FS::basename(shlib->get_path());
-
- if(!link.empty())
- builder.get_vfs().register_path(link, this);
-}
-
-Target *Install::get_real_target()
-{
- return source.get_real_target();
-}
-
-void Install::check_rebuild()
-{
- if(!mtime)
- mark_rebuild("Does not exist");
- else if(source.get_mtime()>mtime || source.get_size()!=size)
- mark_rebuild(source.get_name()+" has changed");
- else if(source.get_rebuild())
- mark_rebuild(source.get_name()+" needs rebuilding");
-}
-
-FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string &loc)
-{
- if(!tgt.get_package())
- throw invalid_argument("Can't install package-less targets");
-
- FS::Path base = tgt.get_package()->get_builder().get_prefix();
- string tgtname = FS::basename(tgt.get_path());
-
- string mid;
- if(!loc.empty())
- mid = loc;
- else if(const Header *hdr = dynamic_cast<const Header *>(&tgt))
- {
- if(hdr->get_component()->get_type()!=Component::HEADERS)
- throw logic_error("Header install from non-header component?");
- mid = "include/"+hdr->get_component()->get_name();
- }
- else if(dynamic_cast<const Executable *>(&tgt))
- mid = "bin";
- else if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&tgt))
- {
- const Component &comp = shlib->get_component();
- if(comp.get_type()==Component::LIBRARY)
- {
- mid = "lib";
- if(!shlib->get_soname().empty())
- tgtname = shlib->get_soname();
- }
- else if(comp.get_type()==Component::MODULE)
- mid = "lib/"+tgt.get_package()->get_name();
- }
- else if(dynamic_cast<const StaticLibrary *>(&tgt))
- mid = "lib";
- else if(dynamic_cast<const PkgConfig *>(&tgt))
- mid = "lib/pkgconfig";
- else if(dynamic_cast<const ::DataFile *>(&tgt))
- mid = "share/"+tgt.get_package()->get_name();
-
- if(mid.empty())
- throw invalid_argument("Don't know where to install "+tgtname);
-
- return base/mid/tgtname;
-}
+++ /dev/null
-#ifndef INSTALL_H_
-#define INSTALL_H_
-
-#include "sourcepackage.h"
-#include "filetarget.h"
-
-/**
-Represents the installation of a file.
-*/
-class Install: public FileTarget
-{
-private:
- FileTarget &source;
- Msp::FS::Path link;
-
-public:
- Install(Builder &, const SourcePackage &, FileTarget &, const std::string & =std::string());
- virtual const char *get_type() const { return "Install"; }
- FileTarget &get_source() const { return source; }
- const Msp::FS::Path &get_symlink() const { return link; }
- virtual Target *get_real_target();
-private:
- virtual void check_rebuild();
-
- static Msp::FS::Path generate_target_path(const FileTarget &i, const std::string &);
-};
-
-#endif
--- /dev/null
+#include <msp/fs/utils.h>
+#include "builder.h"
+#include "copy.h"
+#include "executable.h"
+#include "datafile.h"
+#include "header.h"
+#include "installedfile.h"
+#include "package.h"
+#include "pkgconfig.h"
+#include "sharedlibrary.h"
+#include "staticlibrary.h"
+
+using namespace std;
+using namespace Msp;
+
+InstalledFile::InstalledFile(Builder &b, const SourcePackage &p, FileTarget &s, const std::string &loc):
+ FileTarget(b, &p, generate_target_path(s, loc)),
+ source(s)
+{
+ buildable = true;
+ add_depend(&source);
+
+ if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&source))
+ if(!shlib->get_soname().empty())
+ link = FS::dirname(path)/FS::basename(shlib->get_path());
+
+ if(!link.empty())
+ builder.get_vfs().register_path(link, this);
+}
+
+Target *InstalledFile::get_real_target()
+{
+ return source.get_real_target();
+}
+
+void InstalledFile::check_rebuild()
+{
+ if(!mtime)
+ mark_rebuild("Does not exist");
+ else if(source.get_mtime()>mtime || source.get_size()!=size)
+ mark_rebuild(source.get_name()+" has changed");
+ else if(source.get_rebuild())
+ mark_rebuild(source.get_name()+" needs rebuilding");
+}
+
+FS::Path InstalledFile::generate_target_path(const FileTarget &tgt, const std::string &loc)
+{
+ if(!tgt.get_package())
+ throw invalid_argument("Can't install package-less targets");
+
+ FS::Path base = tgt.get_package()->get_builder().get_prefix();
+ string tgtname = FS::basename(tgt.get_path());
+
+ string mid;
+ if(!loc.empty())
+ mid = loc;
+ else if(const Header *hdr = dynamic_cast<const Header *>(&tgt))
+ {
+ if(hdr->get_component()->get_type()!=Component::HEADERS)
+ throw logic_error("Header install from non-header component?");
+ mid = "include/"+hdr->get_component()->get_name();
+ }
+ else if(dynamic_cast<const Executable *>(&tgt))
+ mid = "bin";
+ else if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&tgt))
+ {
+ const Component &comp = shlib->get_component();
+ if(comp.get_type()==Component::LIBRARY)
+ {
+ mid = "lib";
+ if(!shlib->get_soname().empty())
+ tgtname = shlib->get_soname();
+ }
+ else if(comp.get_type()==Component::MODULE)
+ mid = "lib/"+tgt.get_package()->get_name();
+ }
+ else if(dynamic_cast<const StaticLibrary *>(&tgt))
+ mid = "lib";
+ else if(dynamic_cast<const PkgConfig *>(&tgt))
+ mid = "lib/pkgconfig";
+ else if(dynamic_cast<const ::DataFile *>(&tgt))
+ mid = "share/"+tgt.get_package()->get_name();
+
+ if(mid.empty())
+ throw invalid_argument("Don't know where to install "+tgtname);
+
+ return base/mid/tgtname;
+}
--- /dev/null
+#ifndef INSTALLEDFILE_H_
+#define INSTALLEDFILE_H_
+
+#include "sourcepackage.h"
+#include "filetarget.h"
+
+/**
+Represents the installation of a file.
+*/
+class InstalledFile: public FileTarget
+{
+private:
+ FileTarget &source;
+ Msp::FS::Path link;
+
+public:
+ InstalledFile(Builder &, const SourcePackage &, FileTarget &, const std::string & =std::string());
+ virtual const char *get_type() const { return "InstalledFile"; }
+ FileTarget &get_source() const { return source; }
+ const Msp::FS::Path &get_symlink() const { return link; }
+ virtual Target *get_real_target();
+private:
+ virtual void check_rebuild();
+
+ static Msp::FS::Path generate_target_path(const FileTarget &i, const std::string &);
+};
+
+#endif
#include <msp/fs/utils.h>
#include "builder.h"
#include "component.h"
-#include "install.h"
#include "objectfile.h"
#include "sourcefile.h"
#include "sourcepackage.h"
void ObjectFile::find_depends(FileTarget *tgt)
{
- Target *rtgt = tgt->get_real_target();
+ FileTarget *rtgt = dynamic_cast<FileTarget *>(tgt->get_real_target());
const Dependencies &tdeps = rtgt->get_depends();
Dependencies deps_to_add;
if(rtgt==tgt)