install true;
};
- source_tarball
+ source_archive
{
source "bootstrap.sh";
source "Readme.txt";
Target *world = new VirtualTarget(builder, "world");
world->add_dependency(*new VirtualTarget(builder, "default"));
world->add_dependency(*new VirtualTarget(builder, "install"));
- world->add_dependency(*new VirtualTarget(builder, "tarballs"));
+ world->add_dependency(*new VirtualTarget(builder, "archives"));
}
BuildGraph::~BuildGraph()
InstallMap install_map;
std::list<std::string> problems;
-public:
Component(SourcePackage &, const std::string &);
+public:
virtual ~Component() { }
const SourcePackage &get_package() const { return package; }
--- /dev/null
+#include <algorithm>
+#include "builder.h"
+#include "file.h"
+#include "sourcearchivecomponent.h"
+#include "sourcepackage.h"
+#include "tool.h"
+
+using namespace std;
+
+SourceArchiveComponent::SourceArchiveComponent(SourcePackage &p):
+ Component(p, p.get_name()+"-source")
+{ }
+
+void SourceArchiveComponent::create_targets() const
+{
+ Builder &builder = package.get_builder();
+
+ list<Target *> files;
+ files.insert(files.begin(), &package.get_build_file());
+
+ SourceList source_filenames = collect_source_files();
+ for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
+ {
+ FileTarget *file = builder.get_vfs().get_target(*i);
+ if(!file)
+ file = new File(builder, package, *i);
+ files.push_back(file);
+ }
+
+ BuildGraph &build_graph = builder.get_build_graph();
+ const BuildGraph::TargetMap &targets = build_graph.get_targets();
+ for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
+ if(i->second->get_package()==&package && !i->second->is_buildable())
+ if(find(files.begin(), files.end(), i->second)==files.end())
+ files.push_back(i->second);
+
+ const Toolchain &toolchain = builder.get_toolchain();
+ string archive_name = package.get_name()+"-"+package.get_version()+"-source";
+ Target *result = toolchain.get_tool("TAR").create_target(files, archive_name);
+ build_graph.get_target("archives")->add_dependency(*result);
+}
--- /dev/null
+#ifndef TARBALLCOMPONENT_H_
+#define TARBALLCOMPONENT_H_
+
+#include "component.h"
+
+class SourceArchiveComponent: public Component
+{
+public:
+ SourceArchiveComponent(SourcePackage &);
+
+ virtual void create_targets() const;
+};
+
+#endif
#include "file.h"
#include "installcomponent.h"
#include "pkgconfigfile.h"
-#include "tarballcomponent.h"
-#include "tool.h"
+#include "sourcearchivecomponent.h"
#include "sourcegenerator.h"
#include "sourcepackage.h"
+#include "tool.h"
using namespace std;
using namespace Msp;
build_file = builder.get_vfs().get_target(f);
if(!build_file)
build_file = new File(builder, *this, f);
- source_tarball = new TarballComponent(*this, "@src");
- components.push_back(source_tarball);
+ source_archive = new SourceArchiveComponent(*this);
+ components.push_back(source_archive);
}
SourcePackage::~SourcePackage()
add("install", &Loader::component<InstallComponent>);
add("interface_version", &Loader::interface_version);
add("datapack", &Loader::component<DataPackComponent>);
- add("source_tarball", &Loader::source_tarball);
+ add("source_archive", &Loader::source_archive);
+ add("source_tarball", &Loader::source_archive);
add("tarball", &Loader::tarball);
add("version", &Loader::version);
}
{
/* Make sure the source tarball is last in the list so targets from all
other components wil be created first */
- ComponentList::iterator i = find(obj.components.begin(), obj.components.end(), obj.source_tarball);
+ ComponentList::iterator i = find(obj.components.begin(), obj.components.end(), obj.source_archive);
if(i!=obj.components.end())
obj.components.splice(obj.components.end(), obj.components, i);
}
obj.version = v;
}
-void SourcePackage::Loader::source_tarball()
+void SourcePackage::Loader::source_archive()
{
- load_sub(*obj.source_tarball);
+ load_sub(*obj.source_archive);
}
-void SourcePackage::Loader::tarball(const string &n)
+void SourcePackage::Loader::tarball(const string &)
{
- TarballComponent trbl(obj, n);
- load_sub(trbl);
+ IO::print("%s: Deprecated tarball component ignored\n", get_source());
}
void SourcePackage::Loader::version(const string &v)
class Builder;
class BuildType;
class FileTarget;
-class TarballComponent;
+class SourceArchiveComponent;
/**
A package that can be built by Builder.
void generate(const std::string &);
void if_feature(const std::string &);
void interface_version(const std::string &);
- void source_tarball();
+ void source_archive();
void tarball(const std::string &);
void version(const std::string &);
};
FeatureList features;
BuildInfo build_info;
ComponentList components;
- TarballComponent *source_tarball;
+ SourceArchiveComponent *source_archive;
Config config;
mutable Cache cache;
+++ /dev/null
-#include <algorithm>
-#include "builder.h"
-#include "file.h"
-#include "sourcepackage.h"
-#include "tarballcomponent.h"
-#include "tool.h"
-
-using namespace std;
-
-TarballComponent::TarballComponent(SourcePackage &p, const string &n):
- Component(p, n)
-{ }
-
-void TarballComponent::create_targets() const
-{
- Builder &builder = package.get_builder();
-
- list<Target *> files;
- SourceList source_filenames = collect_source_files();
- for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
- {
- FileTarget *file = builder.get_vfs().get_target(*i);
- if(!file)
- file = new File(builder, package, *i);
- files.push_back(file);
- }
-
- BuildGraph &build_graph = builder.get_build_graph();
-
- string tarname = name;
- if(name=="@src")
- {
- tarname = package.get_name()+"-"+package.get_version();
- files.insert(files.begin(), &package.get_build_file());
-
- const BuildGraph::TargetMap &targets = build_graph.get_targets();
- for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
- if(i->second->get_package()==&package && !i->second->is_buildable())
- if(find(files.begin(), files.end(), i->second)==files.end())
- files.push_back(i->second);
- }
-
- const Toolchain &toolchain = builder.get_toolchain();
- Target *result = toolchain.get_tool("TAR").create_target(files, tarname);
- build_graph.get_target("tarballs")->add_dependency(*result);
-}
+++ /dev/null
-#ifndef TARBALLCOMPONENT_H_
-#define TARBALLCOMPONENT_H_
-
-#include "component.h"
-
-class TarballComponent: public Component
-{
-public:
- TarballComponent(SourcePackage &, const std::string &);
-
- virtual void create_targets() const;
-};
-
-#endif