From 96e132661ec82c9347f9155d3f30cd99ea8eca47 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 5 May 2009 19:44:22 +0000 Subject: [PATCH] Deprecate the install_headers statement Use the headers component name as install location --- source/component.cpp | 28 ++++++++++++++++++++++++++-- source/component.h | 5 +++-- source/install.cpp | 6 +++++- source/sourcepackage.cpp | 6 ++---- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/source/component.cpp b/source/component.cpp index dd33941..338b44f 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -5,6 +5,7 @@ Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include #include #include @@ -109,7 +110,7 @@ void Component::create_targets() const hdr=new Header(builder, this, i->str()); // Install headers if requested - if(!install_headers.empty()) + if(type==HEADERS && install) inst_tgts.push_back(hdr); } } @@ -174,7 +175,7 @@ Component::Loader::Loader(Component &c): { add("source", &Loader::source); add("install", &Component::install); - add("install_headers", &Component::install_headers); + add("install_headers", &Loader::install_headers); add("build_info", &Loader::build_info); add("require", &Loader::require); add("modular", &Loader::modular); @@ -182,6 +183,17 @@ Component::Loader::Loader(Component &c): add("default", &Component::deflt); } +void Component::Loader::finish() +{ + if(!inst_hdr.empty()) + { + Component hdrcomp(comp.pkg, HEADERS, inst_hdr); + hdrcomp.sources=comp.sources; + hdrcomp.install=true; + const_cast(comp.pkg.get_components()).push_back(hdrcomp); + } +} + void Component::Loader::source(const string &s) { comp.sources.push_back(comp.pkg.get_source()/s); @@ -216,6 +228,18 @@ void Component::Loader::host(const string &n) throw Msp::Exception("Unknown component"); } +void Component::Loader::install_headers(const string &p) +{ + cout<(&tgt)) - mid="include/"+hdr->get_component()->get_install_headers(); + { + if(hdr->get_component()->get_type()!=Component::HEADERS) + throw Exception("Header install from non-header component?"); + mid="include/"+hdr->get_component()->get_name(); + } else if(dynamic_cast(&tgt)) mid="bin"; else if(const SharedLibrary *shlib=dynamic_cast(&tgt)) diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index 4edb702..432575f 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -43,17 +43,15 @@ 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; + else if(i->get_type()==Component::HEADERS) + flags|=INCLUDE; } - if(!i->get_install_headers().empty()) - flags|=INCLUDE; - } return flags; } -- 2.43.0