-Add a new module type 'cabinet' to handle .cab files generation

-Remove harcoded vgafonts.cab instructions from rbuild and move them to its own rbuild file

svn path=/trunk/; revision=33321
This commit is contained in:
Marc Piulachs 2008-05-06 14:24:16 +00:00
parent c3644e01e9
commit f540600448
7 changed files with 65 additions and 12 deletions

View file

@ -13,4 +13,7 @@
<directory name="nls">
<xi:include href="nls/nls.rbuild" />
</directory>
<directory name="vgafonts">
<xi:include href="vgafonts/vgafonts.rbuild" />
</directory>
</group>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="vgafonts" type="cabinet">
<bootstrap installbase="$(CDOUTPUT)" />
<file>437-8x8.bin</file>
<file>737-8x8.bin</file>
<file>775-8x8.bin</file>
<file>850-8x8.bin</file>
<file>852-8x8.bin</file>
<file>865-8x8.bin</file>
<file>866-8x8.bin</file>
</module>

View file

@ -244,6 +244,9 @@ MingwModuleHandler::InstanciateHandler (
case IdlHeader:
handler = new MingwIdlHeaderModuleHandler ( module );
break;
case Cabinet:
handler = new MingwCabinetModuleHandler ( module );
break;
case EmbeddedTypeLib:
handler = new MingwEmbeddedTypeLibModuleHandler ( module );
break;
@ -1357,6 +1360,7 @@ Rule gppHostRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)
"\t$(ECHO_CC)\n"
"\t${host_gpp} -c $< -o $@ $($(module_name)_CFLAGS)$(compiler_flags)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o", NULL );
Rule emptyRule ( "", NULL );
void
MingwModuleHandler::GenerateGccCommand (
@ -1479,6 +1483,7 @@ MingwModuleHandler::GenerateCommands (
{ HostFalse, TypeDontCare, ".cc", &gppRule },
{ HostFalse, TypeDontCare, ".cpp", &gppRule },
{ HostFalse, TypeDontCare, ".cxx", &gppRule },
{ HostFalse, Cabinet, ".*", &emptyRule }
};
size_t i;
Rule *customRule = NULL;
@ -1489,7 +1494,7 @@ MingwModuleHandler::GenerateCommands (
continue;
if ( rules[i].type != TypeDontCare && rules[i].type != module.type )
continue;
if ( rules[i].extension != extension )
if ( rules[i].extension != extension && rules[i].extension != ".*")
continue;
customRule = rules[i].rule;
break;
@ -3484,12 +3489,6 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ()
FileLocation reactosInf ( bootcdReactos.directory,
bootcdReactos.relative_path,
"reactos.inf" );
FileLocation vgafontsCab( bootcdReactos.directory,
bootcdReactos.relative_path,
"vgafonts.cab");
FileLocation vgafontsDir( SourceDirectory,
"media" + sSep + "vgafonts",
"" );
vSourceFiles.push_back ( reactosDff );
@ -3518,11 +3517,6 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ()
sourceFiles.c_str (),
cdFiles.c_str (),
cdDirectories.c_str () );
fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" );
fprintf ( fMakefile,
"\t$(Q)$(CABMAN_TARGET) -M raw -S %s %s\\*.bin\n", // Escape the asterisk for Make
backend->GetFullName ( vgafontsCab ).c_str (),
backend->GetFullName ( vgafontsDir ).c_str ());
fprintf ( fMakefile,
"\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n",
backend->GetFullName ( reactosDff ).c_str (),
@ -3828,6 +3822,32 @@ MingwIdlHeaderModuleHandler::Process ()
GenerateRules ();
}
MingwCabinetModuleHandler::MingwCabinetModuleHandler (
const Module& module_ )
: MingwModuleHandler ( module_ )
{
}
void
MingwCabinetModuleHandler::Process ()
{
string targetMacro ( GetTargetMacro (module) );
GenerateRules ();
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: | %s\n",
targetMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" );
fprintf ( fMakefile,
"\t$(Q)$(CABMAN_TARGET) -M raw -S %s $(%s_SOURCES)\n", // Escape the asterisk for Make
targetMacro.c_str (),
module.name.c_str());
}
MingwElfExecutableModuleHandler::MingwElfExecutableModuleHandler (
const Module& module_ )

View file

@ -486,6 +486,14 @@ public:
virtual void Process ();
};
class MingwCabinetModuleHandler : public MingwModuleHandler
{
public:
MingwCabinetModuleHandler ( const Module& module );
virtual HostType DefaultHost() { return HostFalse; }
virtual void Process ();
};
class MingwEmbeddedTypeLibModuleHandler : public MingwModuleHandler
{
public:

View file

@ -54,6 +54,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
case BootSector:
case BootLoader:
case BootProgram:
case Cabinet:
return true;
case BuildTool:
case StaticLibrary:

View file

@ -939,6 +939,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return EmbeddedTypeLib;
if ( attribute.value == "elfexecutable" )
return ElfExecutable;
if ( attribute.value == "cabinet" )
return Cabinet;
throw InvalidAttributeValueException ( location,
attribute.name,
attribute.value );
@ -970,6 +972,7 @@ Module::GetTargetDirectoryTree () const
case LiveIsoRegTest:
case EmbeddedTypeLib:
case ElfExecutable:
case Cabinet:
return OutputDirectory;
case StaticLibrary:
case HostStaticLibrary:
@ -1019,6 +1022,8 @@ Module::GetDefaultModuleExtension () const
case KernelModeDriver:
case BootLoader:
return ".sys";
case Cabinet:
return ".cab";
case BootSector:
return ".o";
case Iso:
@ -1092,6 +1097,7 @@ Module::GetDefaultModuleEntrypoint () const
case IdlHeader:
case ElfExecutable:
case EmbeddedTypeLib:
case Cabinet:
return "";
case TypeDontCare:
break;
@ -1140,6 +1146,7 @@ Module::GetDefaultModuleBaseaddress () const
case BootProgram:
case IdlHeader:
case EmbeddedTypeLib:
case Cabinet:
return "";
case TypeDontCare:
break;
@ -1189,6 +1196,7 @@ Module::IsDLL () const
case IdlHeader:
case EmbeddedTypeLib:
case ElfExecutable:
case Cabinet:
return false;
case TypeDontCare:
break;

View file

@ -303,6 +303,7 @@ enum ModuleType
RpcProxy,
HostStaticLibrary,
TypeDontCare,
Cabinet
};
enum HostType