From: Casper Hornstrup Date: Wed, 2 Mar 2005 21:24:02 +0000 (+0000) Subject: Add bootstrap tag to specify that files are to be copied to the CD X-Git-Tag: backups/xmlbuildsystem@15601~217 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=7f24916383b56c76e22c18d5e7e217293fa8f5c1 Add bootstrap tag to specify that files are to be copied to the CD svn path=/branches/xmlbuildsystem/; revision=13797 --- diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 54f25a6fba6..5d9ab57426b 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -1873,7 +1873,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& mod { static string ros_junk ( "$(ROS_TEMPORARY)" ); string targetName ( module.GetTargetName () ); - string target ( FixupTargetFilename (module.GetPath ()) ); + string target ( FixupTargetFilename ( module.GetPath () ) ); string workingDirectory = GetWorkingDirectory (); string junk_tmp = ros_junk + module.name + ".junk.tmp"; string objectsMacro = GetObjectsMacro ( module ); @@ -1951,6 +1951,44 @@ MingwIsoModuleHandler::Process ( const Module& module ) GenerateInvocations ( module ); } +void +MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( const string bootcdDirectory, + const Module& module ) const +{ + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string targetFilenameNoFixup = bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd; + string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) ); + fprintf ( fMakefile, + "\t${cp} %s %s\n", + m.GetPath ().c_str (), + targetFilename.c_str () ); + } + } +} + +string +MingwIsoModuleHandler::GetCdDirectories ( const string bootcdDirectory, + const Module& module ) const +{ + string directories; + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string targetDirecctory = bootcdDirectory + SSEP + m.bootstrap->base; + if ( directories.size () > 0 ) + directories += " "; + directories += FixupTargetFilename ( targetDirecctory ); + } + } + return directories; +} + void MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) { @@ -1961,6 +1999,8 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) PassThruCacheDirectory ( bootcdReactos + SSEP ); string reactosInf = FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" ); string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" ); + string cdDirectories = bootcdReactos + " " + GetCdDirectories ( bootcdDirectory, + module ); fprintf ( fMakefile, ".PHONY: %s\n\n", module.name.c_str ()); @@ -1968,7 +2008,7 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) "%s: all %s %s\n", module.name.c_str (), isoboot.c_str (), - bootcdReactos.c_str () ); + cdDirectories.c_str () ); fprintf ( fMakefile, "\t${cabman} /C %s /L %s /I\n", reactosDff.c_str (), @@ -1981,6 +2021,8 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) fprintf ( fMakefile, "\t- ${rm} %s\n", reactosInf.c_str () ); + OutputBootstrapfileCopyCommands ( bootcdDirectory, + module ); fprintf ( fMakefile, "\t${cdmake} -v -m -b %s %s REACTOS ReactOS.iso\n", isoboot.c_str (), diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 717921bf019..5a4feca9128 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -291,6 +291,10 @@ public: virtual void Process ( const Module& module ); private: void GenerateIsoModuleTarget ( const Module& module ); + std::string GetCdDirectories ( const std::string bootcdDirectory, + const Module& module ) const; + void OutputBootstrapfileCopyCommands ( const std::string bootcdDirectory, + const Module& module ) const; }; #endif /* MINGW_MODULEHANDLER_H */ diff --git a/reactos/tools/rbuild/bootstrap.cpp b/reactos/tools/rbuild/bootstrap.cpp new file mode 100644 index 00000000000..b96a1f7f049 --- /dev/null +++ b/reactos/tools/rbuild/bootstrap.cpp @@ -0,0 +1,74 @@ +#include "pch.h" +#include + +#include "rbuild.h" + +using std::string; + +Bootstrap::Bootstrap ( const Project& project_, + const Module* module_, + const XMLElement& bootstrapNode ) + : project(project_), + module(module_), + node(bootstrapNode) +{ + Initialize(); +} + +Bootstrap::~Bootstrap () +{ +} + +bool +Bootstrap::IsSupportedModuleType ( ModuleType type ) +{ + switch ( type ) + { + case Kernel: + case KernelModeDLL: + case NativeDLL: + case NativeCUI: + case Win32DLL: + case Win32CUI: + case Win32GUI: + case KernelModeDriver: + return true; + case BuildTool: + case StaticLibrary: + case ObjectLibrary: + case BootLoader: + case BootSector: + case Iso: + return false; + } + throw InvalidOperationException ( __FILE__, + __LINE__ ); +} + +void +Bootstrap::Initialize () +{ + if ( !IsSupportedModuleType ( module->type ) ) + { + throw InvalidBuildFileException ( + node.location, + " is not applicable for this module type." ); + } + + const XMLAttribute* att = node.GetAttribute ( "base", false ); + if ( att != NULL ) + base = att->value; + else + base = ""; + + att = node.GetAttribute ( "nameoncd", false ); + if ( att != NULL ) + nameoncd = att->value; + else + nameoncd = module->GetTargetName (); +} + +void +Bootstrap::ProcessXML() +{ +} diff --git a/reactos/tools/rbuild/linkerflag.cpp b/reactos/tools/rbuild/linkerflag.cpp index 6ef22c93cb5..f2abab3c736 100644 --- a/reactos/tools/rbuild/linkerflag.cpp +++ b/reactos/tools/rbuild/linkerflag.cpp @@ -30,14 +30,14 @@ LinkerFlag::~LinkerFlag () } void -LinkerFlag::Initialize() +LinkerFlag::Initialize () { } void -LinkerFlag::ProcessXML() +LinkerFlag::ProcessXML () { - if (node.value.size () == 0) + if ( node.value.size () == 0 ) { throw InvalidBuildFileException ( node.location, diff --git a/reactos/tools/rbuild/makefile b/reactos/tools/rbuild/makefile index 3dedb3c7baa..5a0fb31cbf8 100644 --- a/reactos/tools/rbuild/makefile +++ b/reactos/tools/rbuild/makefile @@ -21,6 +21,7 @@ RBUILD_BACKEND_BASE_SOURCES = \ RBUILD_BASE_SOURCES = \ $(RBUILD_BACKEND_BASE_SOURCES) \ automaticdependency.cpp \ + bootstrap.cpp \ compilerflag.cpp \ define.cpp \ exception.cpp \ diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 47157e49bfb..1ee50a5cc1f 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -55,7 +55,8 @@ Module::Module ( const Project& project, const string& modulePath ) : project (project), node (moduleNode), - importLibrary (NULL) + importLibrary (NULL), + bootstrap (NULL) { if ( node.name != "module" ) throw Exception ( "internal tool error: Module created with non- node" ); @@ -261,6 +262,11 @@ Module::ProcessXMLSubElement ( const XMLElement& e, e.location, " is not a valid sub-element of " ); } + else if ( e.name == "bootstrap" ) + { + bootstrap = new Bootstrap ( project, this, e ); + subs_invalid = true; + } if ( subs_invalid && e.subElements.size() > 0 ) throw InvalidBuildFileException ( e.location, diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 99d624f3635..4d8572aec46 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -51,6 +51,7 @@ class CompilerFlag; class LinkerFlag; class Property; class AutomaticDependency; +class Bootstrap; class SourceFileTest; @@ -127,6 +128,7 @@ public: ModuleType type; ImportLibrary* importLibrary; bool mangledSymbols; + Bootstrap* bootstrap; std::vector files; std::vector libraries; std::vector includes; @@ -450,6 +452,26 @@ private: }; +class Bootstrap +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string base; + std::string nameoncd; + + Bootstrap ( const Project& project, + const Module* module, + const XMLElement& bootstrapNode ); + ~Bootstrap (); + void ProcessXML(); +private: + bool IsSupportedModuleType ( ModuleType type ); + void Initialize(); +}; + + extern std::string FixSeparator ( const std::string& s ); diff --git a/reactos/tools/rbuild/rbuild.txt b/reactos/tools/rbuild/rbuild.txt index 121622c34b9..a5dcc762e81 100644 --- a/reactos/tools/rbuild/rbuild.txt +++ b/reactos/tools/rbuild/rbuild.txt @@ -123,7 +123,7 @@ Value: None. Elements: - define, dependency, directory, file, if, importlibrary, include, invoke, library, property. + bootstrap, define, dependency, directory, file, if, importlibrary, include, invoke, library, property. Module types @@ -143,6 +143,24 @@ The module type determines the actions that is to be carried out to process the iso - Builds a bootable CD. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type. +Bootstrap element +----------------- +A bootstrap element specifies that the generated file should be put on the bootable CD as a bootstrap file. + +Syntax: + + +Attributes: + base - Put file in this directory on the bootable CD. This attribute is optional. + nameoncd - Name of file on the bootable CD. This attribute is optional. + +Value: + None. + +Elements: + None. + + Define element -------------- A define element specifies the name and (optionally) value of a define for the C/C++ compiler and resource compiler.