]> git.tdb.fi Git - builder.git/commitdiff
Rename Install to InstalledFile
authorMikko Rasa <tdb@tdb.fi>
Fri, 13 Apr 2012 16:54:47 +0000 (19:54 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:49 +0000 (00:08 +0300)
source/analyzer.cpp
source/binary.cpp
source/builder.cpp
source/component.cpp
source/copy.cpp
source/copy.h
source/install.cpp [deleted file]
source/install.h [deleted file]
source/installedfile.cpp [new file with mode: 0644]
source/installedfile.h [new file with mode: 0644]
source/objectfile.cpp

index b0646463669fd07c8c87f9e86a1f3e124bddf5e0..70f5f2076f3a68de00f74479f5f36f2565edee14 100644 (file)
@@ -2,7 +2,6 @@
 #include <msp/io/print.h>
 #include "analyzer.h"
 #include "builder.h"
-#include "install.h"
 #include "objectfile.h"
 #include "package.h"
 #include "sourcefile.h"
index 4728cd19e2ee410698d0b6c86ad8fb29d1b0da79..d73c59450f97501bcab4d32554fc33f9ef8724ce 100644 (file)
@@ -3,11 +3,10 @@
 #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;
index b6f29f845108b300c30218c80d7a66dde8af5f14..9c8e27be0aaa6cb3506d53ea22828c6dbc75f22d 100644 (file)
@@ -22,7 +22,7 @@
 #include "gnucxxcompiler.h"
 #include "gnulinker.h"
 #include "header.h"
-#include "install.h"
+#include "installedfile.h"
 #include "misc.h"
 #include "package.h"
 #include "pkgconfig.h"
@@ -507,7 +507,7 @@ int Builder::create_targets()
                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));
                }
        }
 
index a7dfc34f7fff6091035e4c38cc2ec5c1fa150d45..2780070f4543e897bf33fff5c66b679793dcb614 100644 (file)
@@ -10,7 +10,6 @@
 #include "executable.h"
 #include "file.h"
 #include "header.h"
-#include "install.h"
 #include "objectfile.h"
 #include "sharedlibrary.h"
 #include "sourcepackage.h"
index b5ac403c4d4eb72e42567122bb656d576287bb5a..b756e0c037412012a828075735a7b6fb8eb3b679 100644 (file)
@@ -7,7 +7,7 @@
 #include <msp/io/print.h>
 #include "builder.h"
 #include "copy.h"
-#include "install.h"
+#include "installedfile.h"
 
 using namespace std;
 using namespace Msp;
@@ -20,20 +20,20 @@ Target *Copy::create_target(const list<Target *> &sources, const string &arg) co
 {
        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();
index 6150fadfefa660c287d8f2a850da098489f51893..3aa10a9a94ef42674d7acd83e8c27dcef71a6a23 100644 (file)
@@ -6,10 +6,10 @@
 #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
 {
@@ -20,10 +20,10 @@ private:
        class Worker: public InternalTask::Worker
        {
        private:
-               const Install &target;
+               const InstalledFile &target;
 
        public:
-               Worker(const Install &);
+               Worker(const InstalledFile &);
        private:
                virtual void main();
        };
diff --git a/source/install.cpp b/source/install.cpp
deleted file mode 100644 (file)
index 7c39ed6..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#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;
-}
diff --git a/source/install.h b/source/install.h
deleted file mode 100644 (file)
index 2eb88d4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#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
diff --git a/source/installedfile.cpp b/source/installedfile.cpp
new file mode 100644 (file)
index 0000000..2a96066
--- /dev/null
@@ -0,0 +1,88 @@
+#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;
+}
diff --git a/source/installedfile.h b/source/installedfile.h
new file mode 100644 (file)
index 0000000..6c6a933
--- /dev/null
@@ -0,0 +1,28 @@
+#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
index 8068bc6ed02f62277984215dd74c5b07d52b5d62..e020c1b02981b391cb0172a03e7b98d49a189313 100644 (file)
@@ -2,7 +2,6 @@
 #include <msp/fs/utils.h>
 #include "builder.h"
 #include "component.h"
-#include "install.h"
 #include "objectfile.h"
 #include "sourcefile.h"
 #include "sourcepackage.h"
@@ -39,7 +38,7 @@ void ObjectFile::find_depends()
 
 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)