Support 'make livecd'
authorCasper Hornstrup <chorns@users.sourceforge.net>
Tue, 19 Apr 2005 20:52:49 +0000 (20:52 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Tue, 19 Apr 2005 20:52:49 +0000 (20:52 +0000)
svn path=/branches/xmlbuildsystem/; revision=14705

reactos/ReactOS.xml
reactos/tools/rbuild/backend/mingw/mingw.cpp
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 12437ee..19136ea 100644 (file)
@@ -62,4 +62,8 @@
 \r
        <module name="bootcd" type="iso">\r
        </module>\r
+\r
+       <module name="livecd" type="liveiso">\r
+       </module>\r
+\r
 </project>\r
index 935d696..239882a 100644 (file)
@@ -434,6 +434,8 @@ MingwBackend::IncludeInAllTarget ( const Module& module ) const
                return false;\r
        if ( module.type == Iso )\r
                return false;\r
+       if ( module.type == LiveIso )\r
+               return false;\r
        if ( module.type == Test )\r
                return false;\r
        return true;\r
index 5d1b43b..0f14cd8 100644 (file)
@@ -195,6 +195,9 @@ MingwModuleHandler::InstanciateHandler (
                case Iso:\r
                        handler = new MingwIsoModuleHandler ( module );\r
                        break;\r
+               case LiveIso:\r
+                       handler = new MingwLiveIsoModuleHandler ( module );\r
+                       break;\r
                case Test:\r
                        handler = new MingwTestModuleHandler ( module );\r
                        break;\r
@@ -2538,7 +2541,7 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ()
                backend->outputDirectory );\r
        string bootcdReactosNoFixup = bootcdDirectory + SSEP "reactos";\r
        string bootcdReactos = PassThruCacheDirectory (\r
-               NormalizeFilename ( bootcdReactosNoFixup ),\r
+               NormalizeFilename ( bootcdReactosNoFixup ) + SSEP,\r
                backend->outputDirectory );\r
        CLEAN_FILE ( bootcdReactos );\r
        string reactosInf = PassThruCacheDirectory (\r
@@ -2584,6 +2587,158 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ()
 }\r
 \r
 \r
+MingwLiveIsoModuleHandler::MingwLiveIsoModuleHandler (\r
+       const Module& module_ )\r
+\r
+       : MingwModuleHandler ( module_ )\r
+{\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::Process ()\r
+{\r
+       GenerateLiveIsoModuleTarget ();\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::CreateDirectory ( const string& directory )\r
+{\r
+       string normalizedDirectory = MingwModuleHandler::PassThruCacheDirectory (\r
+               NormalizeFilename ( directory ) + SSEP,\r
+               backend->outputDirectory );\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::OutputCopyCommand ( const string& sourceFilename,\r
+                                                  const string& targetFilename,\r
+                                                  const string& targetDirectory )\r
+{\r
+       string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
+               NormalizeFilename ( targetDirectory + SSEP + targetFilename ),\r
+               backend->outputDirectory );\r
+       fprintf ( fMakefile,\r
+                 "\t$(ECHO_CP)\n" );\r
+       fprintf ( fMakefile,\r
+                 "\t${cp} %s %s 1>$(NUL)\n",\r
+                 sourceFilename.c_str (),\r
+                 normalizedTargetFilename.c_str () );\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory,\r
+                                                         string& reactosDirectory )\r
+{\r
+       for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
+       {\r
+               const Module& m = *module.project.modules[i];\r
+               if ( m.installName.length () > 0 )\r
+               {\r
+                       string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (\r
+                               NormalizeFilename ( m.GetPath () ),\r
+                               backend->outputDirectory );\r
+                       OutputCopyCommand ( sourceFilename,\r
+                                       m.installName,\r
+                                       livecdDirectory + SSEP + reactosDirectory + SSEP + m.installBase );\r
+               }\r
+       }\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::OutputNonModuleCopyCommands ( string& livecdDirectory,\r
+                                                            string& reactosDirectory )\r
+{\r
+       for ( size_t i = 0; i < module.project.installfiles.size (); i++ )\r
+       {\r
+               const InstallFile& installfile = *module.project.installfiles[i];\r
+               OutputCopyCommand ( installfile.GetPath (),\r
+                               installfile.newname,\r
+                               livecdDirectory + SSEP + reactosDirectory + SSEP + installfile.base );\r
+       }\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string& livecdDirectory )\r
+{\r
+       CreateDirectory ( livecdDirectory + SSEP "Profiles" );\r
+       CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users") ;\r
+       CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users" SSEP "Desktop" );\r
+       CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" );\r
+       CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "Desktop" );\r
+       CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "My Documents" );\r
+\r
+       string livecdIni = "bootdata" SSEP "livecd.ini";\r
+       OutputCopyCommand ( livecdIni,\r
+                        "freeldr.ini",\r
+                        livecdDirectory );\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::OutputLoaderCommands ( string& livecdDirectory )\r
+{\r
+       string setupldr = PassThruCacheDirectory (\r
+               NormalizeFilename ( "boot" SSEP "freeldr" SSEP "freeldr" SSEP "setupldr.sys" ),\r
+               backend->outputDirectory );\r
+       CreateDirectory ( livecdDirectory + SSEP "loader" );\r
+       OutputCopyCommand ( setupldr,\r
+                        "setupldr.sys",\r
+                        livecdDirectory + SSEP + "loader" );\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::OutputRegistryCommands ( string& livecdDirectory )\r
+{\r
+       string system32ConfigDirectory = NormalizeFilename (\r
+               MingwModuleHandler::PassThruCacheDirectory (\r
+               livecdDirectory + SSEP "system32" SSEP "config" SSEP,\r
+               backend->outputDirectory ) );\r
+       fprintf ( fMakefile,\r
+                 "\t$(ECHO_MKHIVE)\n" );\r
+       fprintf ( fMakefile,\r
+                 "\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP "livecd.inf bootdata" SSEP "hiveinst.inf\n",\r
+                 system32ConfigDirectory.c_str () );\r
+}\r
+\r
+void\r
+MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget ()\r
+{\r
+       string livecdDirectory = "livecd";\r
+       string livecd = PassThruCacheDirectory (\r
+               NormalizeFilename ( livecdDirectory + SSEP ),\r
+               backend->outputDirectory );\r
+       string isoboot = PassThruCacheDirectory (\r
+               NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ),\r
+               backend->outputDirectory );\r
+       string reactosDirectory = "reactos";\r
+       string livecdReactosNoFixup = livecdDirectory + SSEP + reactosDirectory;\r
+       string livecdReactos = NormalizeFilename ( PassThruCacheDirectory (\r
+               NormalizeFilename ( livecdReactosNoFixup + SSEP ),\r
+               backend->outputDirectory ) );\r
+       CLEAN_FILE ( livecdReactos );\r
+\r
+       fprintf ( fMakefile, ".PHONY: %s\n\n",\r
+                 module.name.c_str ());\r
+       fprintf ( fMakefile,\r
+                 "%s: all %s %s $(MKHIVE_TARGET) $(CDMAKE_TARGET)\n",\r
+                 module.name.c_str (),\r
+                 isoboot.c_str (),\r
+                 livecdReactos.c_str () );\r
+       OutputModuleCopyCommands ( livecdDirectory,\r
+                                  reactosDirectory );\r
+       OutputNonModuleCopyCommands ( livecdDirectory,\r
+                                     reactosDirectory );\r
+       OutputProfilesDirectoryCommands ( livecdDirectory );\r
+       OutputLoaderCommands ( livecdDirectory );\r
+       OutputRegistryCommands ( livecdDirectory );\r
+       fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );\r
+       fprintf ( fMakefile,\r
+                 "\t$(Q)$(CDMAKE_TARGET) -v -m -j -b %s %s REACTOS ReactOS-LiveCD.iso\n",\r
+                 isoboot.c_str (),\r
+                 livecd.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\n" );\r
+}\r
+\r
+\r
 MingwTestModuleHandler::MingwTestModuleHandler (\r
        const Module& module_ )\r
 \r
index 6cb6748..fe80ae7 100644 (file)
@@ -345,6 +345,28 @@ private:
 };\r
 \r
 \r
+class MingwLiveIsoModuleHandler : public MingwModuleHandler\r
+{\r
+public:\r
+       MingwLiveIsoModuleHandler ( const Module& module );\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
+       virtual void Process ();\r
+private:\r
+       void GenerateLiveIsoModuleTarget ();\r
+       void CreateDirectory ( const std::string& directory );\r
+       void OutputCopyCommand ( const std::string& sourceFilename,\r
+                                const std::string& targetFilename,\r
+                                const std::string& targetDirectory );\r
+       void OutputModuleCopyCommands ( std::string& livecdDirectory,\r
+                                       std::string& livecdReactos );\r
+       void OutputNonModuleCopyCommands ( std::string& livecdDirectory,\r
+                                          std::string& livecdReactos );\r
+       void OutputProfilesDirectoryCommands ( std::string& livecdDirectory );\r
+       void OutputLoaderCommands ( std::string& livecdDirectory );\r
+       void OutputRegistryCommands ( std::string& livecdDirectory );\r
+};\r
+\r
+\r
 class MingwTestModuleHandler : public MingwModuleHandler\r
 {\r
 public:\r
index cf3639f..ff51059 100644 (file)
@@ -39,6 +39,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
                case StaticLibrary:\r
                case ObjectLibrary:\r
                case Iso:\r
+               case LiveIso:\r
                case Test:\r
                case RpcServer:\r
                case RpcClient:\r
index efdd7ae..2260fa2 100644 (file)
@@ -462,6 +462,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
                return BootSector;\r
        if ( attribute.value == "iso" )\r
                return Iso;\r
+       if ( attribute.value == "liveiso" )\r
+               return LiveIso;\r
        if ( attribute.value == "test" )\r
                return Test;\r
        if ( attribute.value == "rpcserver" )\r
@@ -499,6 +501,7 @@ Module::GetDefaultModuleExtension () const
                case BootSector:\r
                        return ".o";\r
                case Iso:\r
+               case LiveIso:\r
                        return ".iso";\r
                case Test:\r
                        return ".exe";\r
@@ -539,6 +542,7 @@ Module::GetDefaultModuleEntrypoint () const
                case BootLoader:\r
                case BootSector:\r
                case Iso:\r
+               case LiveIso:\r
                case RpcServer:\r
                case RpcClient:\r
                        return "";\r
@@ -575,6 +579,7 @@ Module::GetDefaultModuleBaseaddress () const
                case BootLoader:\r
                case BootSector:\r
                case Iso:\r
+               case LiveIso:\r
                case RpcServer:\r
                case RpcClient:\r
                        return "";\r
index c461c28..f14cc2d 100644 (file)
@@ -137,6 +137,7 @@ enum ModuleType
        BootLoader,\r
        BootSector,\r
        Iso,\r
+       LiveIso,\r
        Test,\r
        RpcServer,\r
        RpcClient\r