- Removed hard coded bootsector from *Iso module types and express it with rbuild syntax.

- Enabled installname attribute and removed hard coded output file name from *Iso module types. We can now use properties : ReactOS_$(arch).iso > ReactOS_i386.iso

svn path=/trunk/; revision=33603
This commit is contained in:
Marc Piulachs 2008-05-19 20:46:46 +00:00
parent eb2daf17cc
commit e9cfeb1071
7 changed files with 149 additions and 30 deletions

View file

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="bootcd" type="iso">
<module name="bootcd" type="iso" output="ReactOS.iso">
<bootsector>isoboot</bootsector>
</module>

View file

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="bootcdregtest" type="isoregtest">
<module name="bootcdregtest" type="isoregtest" output="ReactOS-RegTest.iso">
<bootsector>isobtrt</bootsector>
</module>

View file

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="livecd" type="liveiso">
<module name="livecd" type="liveiso" output="ReactOS-LiveCD.iso">
<bootsector>isoboot</bootsector>
</module>

View file

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="livecdregtest" type="liveisoregtest">
</module>
<module name="livecdregtest" type="liveisoregtest" output="ReactOS-LiveCD-RegTest.iso">
<bootsector>isobtrt</bootsector>
</module>

View file

@ -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 <bootsector>",
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 <bootsector>",
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;

View file

@ -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,
"<bootsector> is not a valid sub-element of <if>" );
}
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,
"<bootsector> 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 )

View file

@ -102,6 +102,7 @@ class AutoRegister;
class SourceFileTest;
class Metadata;
class Bootsector;
typedef std::map<std::string,Directory*> 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: