From f540600448ac4337c34524d1e55fbf3a29b57ada Mon Sep 17 00:00:00 2001 From: Marc Piulachs Date: Tue, 6 May 2008 14:24:16 +0000 Subject: [PATCH] -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 --- reactos/media/media.rbuild | 3 ++ reactos/media/vgafonts/vgafonts.rbuild | 12 +++++ .../rbuild/backend/mingw/modulehandler.cpp | 44 ++++++++++++++----- .../rbuild/backend/mingw/modulehandler.h | 8 ++++ reactos/tools/rbuild/bootstrap.cpp | 1 + reactos/tools/rbuild/module.cpp | 8 ++++ reactos/tools/rbuild/rbuild.h | 1 + 7 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 reactos/media/vgafonts/vgafonts.rbuild diff --git a/reactos/media/media.rbuild b/reactos/media/media.rbuild index 5c69b2d2fb3..67385721031 100644 --- a/reactos/media/media.rbuild +++ b/reactos/media/media.rbuild @@ -13,4 +13,7 @@ + + + diff --git a/reactos/media/vgafonts/vgafonts.rbuild b/reactos/media/vgafonts/vgafonts.rbuild new file mode 100644 index 00000000000..5cf7a39762b --- /dev/null +++ b/reactos/media/vgafonts/vgafonts.rbuild @@ -0,0 +1,12 @@ + + + + + 437-8x8.bin + 737-8x8.bin + 775-8x8.bin + 850-8x8.bin + 852-8x8.bin + 865-8x8.bin + 866-8x8.bin + \ 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 5692cc1a80d..aebc7bb10d6 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -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_ ) diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 102cf80ae58..987343b9186 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -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: diff --git a/reactos/tools/rbuild/bootstrap.cpp b/reactos/tools/rbuild/bootstrap.cpp index fdd68bc7aa6..f286bfdb3aa 100644 --- a/reactos/tools/rbuild/bootstrap.cpp +++ b/reactos/tools/rbuild/bootstrap.cpp @@ -54,6 +54,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type ) case BootSector: case BootLoader: case BootProgram: + case Cabinet: return true; case BuildTool: case StaticLibrary: diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index d852224d245..6ab6c4940e7 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -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; diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index e9f7f205125..1b6adba0832 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -303,6 +303,7 @@ enum ModuleType RpcProxy, HostStaticLibrary, TypeDontCare, + Cabinet }; enum HostType -- 2.17.1