-Add a new module type 'cabinet' to handle .cab files generation
authorMarc Piulachs <marc.piulachs@live.com>
Tue, 6 May 2008 14:24:16 +0000 (14:24 +0000)
committerMarc Piulachs <marc.piulachs@live.com>
Tue, 6 May 2008 14:24:16 +0000 (14:24 +0000)
-Remove harcoded vgafonts.cab instructions from rbuild and move them to its own rbuild file

svn path=/trunk/; revision=33321

reactos/media/media.rbuild
reactos/media/vgafonts/vgafonts.rbuild [new file with mode: 0644]
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.h
reactos/tools/rbuild/bootstrap.cpp
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/rbuild.h

index 5c69b2d..6738572 100644 (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>
diff --git a/reactos/media/vgafonts/vgafonts.rbuild b/reactos/media/vgafonts/vgafonts.rbuild
new file mode 100644 (file)
index 0000000..5cf7a39
--- /dev/null
@@ -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>
\ No newline at end of file
index 5692cc1..aebc7bb 100644 (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_ )
 
index 102cf80..987343b 100644 (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:
index fdd68bc..f286bfd 100644 (file)
@@ -54,6 +54,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
                case BootSector:
                case BootLoader:
                case BootProgram:
+               case Cabinet:
                        return true;
                case BuildTool:
                case StaticLibrary:
index d852224..6ab6c49 100644 (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;
index e9f7f20..1b6adba 100644 (file)
@@ -303,6 +303,7 @@ enum ModuleType
        RpcProxy,
        HostStaticLibrary,
        TypeDontCare,
+       Cabinet
 };
 
 enum HostType