diff --git a/reactos/boot/bootdata/bootcd/bootcd.rbuild b/reactos/boot/bootdata/bootcd/bootcd.rbuild index 03071dd9451..0cadb1b56a9 100644 --- a/reactos/boot/bootdata/bootcd/bootcd.rbuild +++ b/reactos/boot/bootdata/bootcd/bootcd.rbuild @@ -1,4 +1,5 @@ - + + isoboot diff --git a/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild b/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild index 9b95c1eeeb7..2ca7398f23c 100644 --- a/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild +++ b/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild @@ -1,4 +1,5 @@ - + + isobtrt diff --git a/reactos/boot/bootdata/livecd/livecd.rbuild b/reactos/boot/bootdata/livecd/livecd.rbuild index 57f2644b19c..9c95cc54d56 100644 --- a/reactos/boot/bootdata/livecd/livecd.rbuild +++ b/reactos/boot/bootdata/livecd/livecd.rbuild @@ -1,4 +1,5 @@ - + + isoboot diff --git a/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild b/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild index e744acd63a2..9ed5e2954ba 100644 --- a/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild +++ b/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild @@ -1,4 +1,5 @@ - - + + isobtrt + \ No newline at end of file diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index a1590f94ead..3c0dd0e2ee6 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -3480,10 +3480,16 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget () vSourceFiles.push_back ( srcunattend ); // bootsector - const Module* bootModule; - bootModule = module.project.LocateModule ( module.type == IsoRegTest - ? "isobtrt" - : "isoboot" ); + const Module* bootModule = module.bootSector->bootSectorModule; + + if (!bootModule) + { + throw InvalidOperationException ( module.node.location.c_str(), + 0, + "Invalid bootsector. module '%s' requires ", + module.name.c_str ()); + } + const FileLocation *isoboot = bootModule->output; vSourceFiles.push_back ( *isoboot ); @@ -3497,13 +3503,11 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget () vSourceFiles.push_back ( reactosDff ); - string IsoName; - - if (module.type == IsoRegTest) - IsoName = "ReactOS-RegTest.iso"; - else - IsoName = "ReactOS.iso"; - + /* + We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule. + Iso/LiveIso outputs are generated in code base root + */ + string IsoName = module.output->name; string sourceFiles = v2s ( backend, vSourceFiles, 5 ); @@ -3667,15 +3671,24 @@ MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget () string IsoName; - const Module* bootModule; - bootModule = module.project.LocateModule ( module.name == "livecdregtest" - ? "isobtrt" - : "isoboot" ); + // bootsector + const Module* bootModule = module.bootSector->bootSectorModule; + + if (!bootModule) + { + throw InvalidOperationException ( module.node.location.c_str(), + 0, + "Invalid bootsector. module '%s' requires ", + module.name.c_str ()); + } + const FileLocation *isoboot = bootModule->output; - if (module.name == "livecdregtest") - IsoName = "ReactOS-LiveCD-RegTest.iso"; - else - IsoName = "ReactOS-LiveCD.iso"; + + /* + We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule. + Iso/LiveIso outputs are generated in code base root + */ + IsoName = module.output->name; string reactosDirectory = "reactos"; string livecdReactosNoFixup = livecdDirectory + sSep + reactosDirectory; diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index b2b4958f7f1..3db06f192f4 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -242,12 +242,15 @@ Module::Module ( const Project& project, node (moduleNode), importLibrary (NULL), metadata (NULL), + bootSector (NULL), bootstrap (NULL), autoRegister(NULL), linkerScript (NULL), pch (NULL), cplusplus (false), - host (HostDefault) + host (HostDefault), + output (NULL), + install (NULL) { if ( node.name != "module" ) throw InvalidOperationException ( __FILE__, @@ -417,13 +420,31 @@ Module::Module ( const Project& project, att->value, &moduleNode ); } - else + + att = moduleNode.GetAttribute ( "output", false ); + if ( att != NULL ) + { + if (output != NULL) + { + printf ( "%s: WARNING: 'installname' overrides 'output' also defined for this module.\n", + moduleNode.location.c_str() ); + } + else + { + output = new FileLocation ( GetTargetDirectoryTree (), + modulePath, + att->value, + &moduleNode ); + } + } + + /* If no one has set the output file for this module set it automatically */ + if (output == NULL) { - install = NULL; output = new FileLocation ( GetTargetDirectoryTree (), - modulePath, - name + extension, - &moduleNode ); + modulePath, + name + extension, + &moduleNode ); } att = moduleNode.GetAttribute ( "allowwarnings", false ); @@ -520,6 +541,8 @@ Module::~Module () delete bootstrap; if ( importLibrary ) delete importLibrary; + if ( bootSector ) + delete bootSector; if ( dependency ) delete dependency; if ( autoRegister ) @@ -743,6 +766,17 @@ Module::ProcessXMLSubElement ( const XMLElement& e, dependencies.push_back ( new Dependency ( e, *this ) ); subs_invalid = true; } + else if ( e.name == "bootsector" ) + { + if ( parseContext.ifData ) + { + throw XMLInvalidBuildFileException ( + e.location, + " is not a valid sub-element of " ); + } + bootSector = new Bootsector ( e, this ); + subs_invalid = true; + } else if ( e.name == "importlibrary" ) { if ( parseContext.ifData ) @@ -1592,6 +1626,57 @@ Dependency::ProcessXML() } } +Bootsector::Bootsector ( const XMLElement& _node, + const Module* _module ) + : node (_node), + module (_module), + bootSectorModule (NULL) +{ + if ( !IsSupportedModuleType ( module->type ) ) + { + throw XMLInvalidBuildFileException ( + node.location, + " is not applicable for this module type." ); + } + + bootSectorModule = module->project.LocateModule ( node.value ); + if ( bootSectorModule == NULL ) + { + throw XMLInvalidBuildFileException ( + node.location, + "module '%s' depend on non-existant module '%s'", + module->name.c_str(), + node.value.c_str() ); + } + + if (bootSectorModule->type != BootSector) + { + throw XMLInvalidBuildFileException ( + node.location, + "module '%s' is referencing non BootSector module '%s'", + module->name.c_str(), + node.value.c_str() ); + } +} + +void +Bootsector::ProcessXML() +{ +} + +bool +Bootsector::IsSupportedModuleType ( ModuleType type ) +{ + if ( type == Iso || + type == LiveIso || + type == IsoRegTest || + type == LiveIsoRegTest ) + { + return true; + } + + return false; +} Metadata::Metadata ( const XMLElement& _node, const Module& _module ) diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index cac006be0b6..480ef4c345d 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -102,6 +102,7 @@ class AutoRegister; class SourceFileTest; class Metadata; +class Bootsector; typedef std::map directory_map; @@ -352,6 +353,7 @@ public: ModuleType type; ImportLibrary* importLibrary; Metadata* metadata; + Bootsector* bootSector; bool mangledSymbols; bool underscoreSymbols; bool isUnicode; @@ -548,6 +550,21 @@ public: void ProcessXML(); }; +class Bootsector +{ +public: + const XMLElement& node; + const Module* module; + const Module* bootSectorModule; + + Bootsector ( const XMLElement& _node, + const Module* _module ); + + void ProcessXML(); +private: + bool IsSupportedModuleType ( ModuleType type ); +}; + class Metadata { public: