* Build cabman and zlib * Add iso module type Modified: branches/xmlbuildsystem/reactos/ReactOS.xml Modified: branches/xmlbuildsystem/reactos/lib/directory.xml Added: branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml Added: branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/tools.xml _____
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml --- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -50,4 +50,7 @@
<directory name="subsys"> <xi:include href="subsys/directory.xml" /> </directory> + + <module name="bootcd" type="iso"> + </module> </project> _____
Modified: branches/xmlbuildsystem/reactos/lib/directory.xml --- branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -100,3 +100,6 @@
<directory name="ws2_32"> <xi:include href="ws2_32/ws2_32.xml" /> </directory> +<directory name="zlib"> + <xi:include href="zlib/zlib.xml" /> +</directory> _____
Added: branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml --- branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -0,0 +1,17 @@
+<module name="zlib" type="staticlibrary"> + <include base="zlib">.</include> + <file>adler32.c</file> + <file>compress.c</file> + <file>crc32.c</file> + <file>gzio.c</file> + <file>uncompr.c</file> + <file>deflate.c</file> + <file>trees.c</file> + <file>zutil.c</file> + <file>inflate.c</file> + <file>infblock.c</file> + <file>inftrees.c</file> + <file>infcodes.c</file> + <file>infutil.c</file> + <file>inffast.c</file> +</module> _____
Added: branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml --- branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -0,0 +1,10 @@
+<module name="cabman" type="buildtool"> + <include base="cabman">.</include> + <include base="zlib">.</include> + <library>zlib</library> + <file>cabinet.cxx</file> + <file>dfp.cxx</file> + <file>main.cxx</file> + <file>mszip.cxx</file> + <file>raw.cxx</file> +</module> _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 15:27:06 UTC (rev 13214) @@ -48,14 +48,14 @@
}
void -MingwBackend::CloseMakefile () +MingwBackend::CloseMakefile () const { if (fMakefile) fclose ( fMakefile ); }
void -MingwBackend::GenerateHeader () +MingwBackend::GenerateHeader () const { fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); } @@ -101,7 +101,7 @@ const vector<Property*>& properties, const vector<Include*>& includes, const vector<Define*>& defines, - const vector<If*>& ifs ) + const vector<If*>& ifs ) const { size_t i;
@@ -144,7 +144,7 @@ }
string -MingwBackend::GenerateProjectLFLAGS () +MingwBackend::GenerateProjectLFLAGS () const { string lflags; for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ ) @@ -158,15 +158,17 @@ }
void -MingwBackend::GenerateGlobalVariables () +MingwBackend::GenerateGlobalVariables () const { #ifdef WIN32 fprintf ( fMakefile, "host_gcc = gcc\n" ); + fprintf ( fMakefile, "host_gpp = g++\n" ); fprintf ( fMakefile, "host_ld = ld\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); fprintf ( fMakefile, "host_objcopy = objcopy\n" ); fprintf ( fMakefile, "rm = del /f /q\n" ); fprintf ( fMakefile, "gcc = gcc\n" ); + fprintf ( fMakefile, "gpp = g++\n" ); fprintf ( fMakefile, "ld = ld\n" ); fprintf ( fMakefile, "ar = ar\n" ); fprintf ( fMakefile, "objcopy = objcopy\n" ); @@ -174,11 +176,13 @@ fprintf ( fMakefile, "windres = windres\n" ); #else fprintf ( fMakefile, "host_gcc = gcc\n" ); + fprintf ( fMakefile, "host_gpp = g++\n" ); fprintf ( fMakefile, "host_ld = ld\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); fprintf ( fMakefile, "host_objcopy = objcopy\n" ); fprintf ( fMakefile, "rm = rm -f\n" ); fprintf ( fMakefile, "gcc = mingw32-gcc\n" ); + fprintf ( fMakefile, "gpp = mingw32-g++\n" ); fprintf ( fMakefile, "ld = mingw32-ld\n" ); fprintf ( fMakefile, "ar = mingw32-ar\n" ); fprintf ( fMakefile, "objcopy = mingw32-objcopy\n" ); @@ -204,14 +208,24 @@ fprintf ( fMakefile, ".PHONY: clean\n\n" ); }
+bool +MingwBackend::IncludeInAllTarget ( const Module& module ) const +{ + if ( module.type == ObjectLibrary ) + return false; + if ( module.type == Iso ) + return false; + return true; +} + void -MingwBackend::GenerateAllTarget () +MingwBackend::GenerateAllTarget () const { fprintf ( fMakefile, "all:" ); for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; - if ( module.type != ObjectLibrary ) + if ( IncludeInAllTarget ( module ) ) { fprintf ( fMakefile, " %s", @@ -222,7 +236,7 @@ }
void -MingwBackend::ProcessModule ( Module& module ) +MingwBackend::ProcessModule ( Module& module ) const { MingwModuleHandler* h = MingwModuleHandler::LookupHandler ( module.node.location, _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-22 15:27:06 UTC (rev 13214) @@ -10,10 +10,10 @@
MingwBackend ( Project& project ); virtual void Process (); private: - void ProcessModule ( Module& module ); + void ProcessModule ( Module& module ) const; void CreateMakefile (); - void CloseMakefile (); - void GenerateHeader (); + void CloseMakefile () const; + void GenerateHeader () const; void GenerateProjectCFlagsMacro ( const char* assignmentOperation, const std::vector<Include*>& includes, const std::vector<Define*>& defines ) const; @@ -21,11 +21,12 @@ const std::vector<Property*>& properties, const std::vector<Include*>& includes, const std::vector<Define*>& defines, - const std::vector<If*>& ifs ); - std::string GenerateProjectLFLAGS (); - void GenerateDirectoryTargets (); - void GenerateGlobalVariables (); - void GenerateAllTarget (); + const std::vector<If*>& ifs ) const; + std::string GenerateProjectLFLAGS () const; + void GenerateDirectoryTargets () const; + void GenerateGlobalVariables () const; + bool IncludeInAllTarget ( const Module& module ) const; + void GenerateAllTarget () const; FILE* fMakefile; };
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-22 15:27:06 UTC (rev 13214) @@ -83,18 +83,6 @@
}
string -MingwModuleHandler::GetExtension ( const string& filename ) const -{ - size_t index = filename.find_last_of ( '/' ); - if (index == string::npos) index = 0; - string tmp = filename.substr( index, filename.size() - index ); - size_t ext_index = tmp.find_last_of( '.' ); - if (ext_index != string::npos) - return filename.substr ( index + ext_index, filename.size() ); - return ""; -} - -string MingwModuleHandler::GetBasename ( const string& filename ) const { size_t index = filename.find_last_of ( '.' ); @@ -722,6 +710,7 @@ MingwModuleHandler::GenerateCommands ( const Module& module, const string& sourceFilename, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -735,6 +724,14 @@ cflagsMacro ); return; } + else if ( extension == ".cxx" || extension == ".CXX" ) + { + GenerateGccCommand ( module, + sourceFilename, + cppc, + cflagsMacro ); + return; + } else if ( extension == ".s" || extension == ".S" ) { GenerateGccAssemblerCommand ( module, @@ -848,6 +845,7 @@ const vector<File*>& files, const vector<If*>& ifs, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -860,6 +858,7 @@ GenerateCommands ( module, sourceFilename, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -873,6 +872,7 @@ ifs[i]->files, ifs[i]->ifs, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -882,6 +882,7 @@ void MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -890,6 +891,7 @@ module.files, module.ifs, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -956,6 +958,7 @@ MingwModuleHandler::GenerateMacrosAndTargets ( const Module& module, const string& cc, + const string& cppc, const string& ar, const string* cflags ) const { @@ -995,6 +998,7 @@ string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro ); GenerateObjectFileTargets ( module, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -1017,7 +1021,7 @@ void MingwModuleHandler::GenerateMacrosAndTargetsHost ( const Module& module ) const { - GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_ar}", NULL ); + GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_gpp}", "${host_ar}", NULL ); }
void @@ -1031,7 +1035,7 @@ MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module, const string* clags ) const { - GenerateMacrosAndTargets ( module, "${gcc}", "${ar}", clags ); + GenerateMacrosAndTargets ( module, "${gcc}", "${gpp}", "${ar}", clags ); }
string @@ -1251,17 +1255,27 @@ { string target ( FixupTargetFilename ( module.GetPath () ) ); string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module );
GenerateMacrosAndTargetsHost ( module );
- fprintf ( fMakefile, "%s: %s\n", + string linker; + if ( module.HasFileWithExtensions ( ".cxx", ".CXX" ) ) + linker = "${host_gpp}"; + else + linker = "${host_gcc}"; + + fprintf ( fMakefile, "%s: %s %s\n", target.c_str (), - archiveFilename.c_str () ); + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); fprintf ( fMakefile, - "\t${host_gcc} %s -o %s %s\n\n", + "\t%s %s -o %s %s %s\n\n", + linker.c_str (), GetLinkerMacro ( module ).c_str (), target.c_str (), - archiveFilename.c_str () ); + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); }
@@ -1718,3 +1732,30 @@ "\t${rm} %s\n", junk_tmp.c_str () ); } + + +static MingwIsoModuleHandler isomodule_handler; + +MingwIsoModuleHandler::MingwIsoModuleHandler () + : MingwModuleHandler ( Iso ) +{ +} + +void +MingwIsoModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateIsoModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) +{ + string target ( FixupTargetFilename ( module.GetPath ()) ); + + fprintf ( fMakefile, "%s: all\n", + target.c_str () ); + fprintf ( fMakefile, + "\t\n" ); +} _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-22 15:27:06 UTC (rev 13214) @@ -22,7 +22,6 @@
const std::string &PassThruCacheDirectory ( const std::string &f ) const; std::string GetWorkingDirectory () const; std::string GetDirectory (const std::string& filename ) const; - std::string GetExtension ( const std::string& filename ) const; std::string GetBasename ( const std::string& filename ) const; std::string ReplaceExtension ( const std::string& filename, const std::string& newExtension ) const; @@ -114,6 +113,7 @@ void GenerateCommands ( const Module& module, const std::string& sourceFilename, const std::string& cc, + const std::string& cppc, const std::string& cflagsMacro, const std::string& nasmflagsMacro, const std::string& windresflagsMacro ) const; @@ -121,11 +121,13 @@ const std::vector<File*>& files, const std::vector<If*>& ifs, const std::string& cc, + const std::string& cppc, const std::string& cflagsMacro, const std::string& nasmflagsMacro, const std::string& windresflagsMacro ) const; void GenerateObjectFileTargets ( const Module& module, const std::string& cc, + const std::string& cppc, const std::string& cflagsMacro, const std::string& nasmflagsMacro, const std::string& windresflagsMacro ) const; @@ -137,6 +139,7 @@ const std::string& objs_macro ) const; void GenerateMacrosAndTargets ( const Module& module, const std::string& cc, + const std::string& cppc, const std::string& ar, const std::string* clags ) const; std::string GetPreconditionDependenciesName ( const Module& module ) const; @@ -244,4 +247,14 @@ void GenerateBootLoaderModuleTarget ( const Module& module ); };
+ +class MingwIsoModuleHandler : public MingwModuleHandler +{ +public: + MingwIsoModuleHandler (); + virtual void Process ( const Module& module ); +private: + void GenerateIsoModuleTarget ( const Module& module ); +}; + #endif /* MINGW_MODULEHANDLER_H */ _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 15:27:06 UTC (rev 13214) @@ -20,6 +20,18 @@
}
string +GetExtension ( const string& filename ) +{ + size_t index = filename.find_last_of ( '/' ); + if (index == string::npos) index = 0; + string tmp = filename.substr( index, filename.size() - index ); + size_t ext_index = tmp.find_last_of( '.' ); + if (ext_index != string::npos) + return filename.substr ( index + ext_index, filename.size() ); + return ""; +} + +string NormalizeFilename ( const string& filename ) { Path path; @@ -253,6 +265,8 @@ return Win32GUI; if ( attribute.value == "bootloader" ) return BootLoader; + if ( attribute.value == "iso" ) + return Iso; throw InvalidAttributeValueException ( location, attribute.name, attribute.value ); @@ -279,6 +293,8 @@ case KernelModeDriver: case BootLoader: return ".sys"; + case Iso: + return ".iso"; } throw InvalidOperationException ( __FILE__, __LINE__ ); @@ -356,7 +372,21 @@ index ); }
+bool +Module::HasFileWithExtensions ( const std::string& extension1, + const std::string& extension2 ) const +{ + for ( size_t i = 0; i < files.size (); i++ ) + { + File& file = *files[i]; + string extension = GetExtension ( file.name ); + if ( extension == extension1 || extension == extension2 ) + return true; + } + return false; +}
+ File::File ( const string& _name, bool _first ) : name(_name), first(_first) { _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 15:27:06 UTC (rev 13214) @@ -79,7 +79,8 @@
NativeDLL, Win32DLL, Win32GUI, - BootLoader + BootLoader, + Iso };
@@ -117,6 +118,8 @@ std::string GetPathWithPrefix ( const std::string& prefix ) const; std::string GetTargets () const; std::string GetInvocationTarget ( const int index ) const; + bool HasFileWithExtensions ( const std::string& extension1, + const std::string& extension2 ) const; void ProcessXML(); private: std::string GetDefaultModuleExtension () const; @@ -340,6 +343,9 @@ FixSeparator ( const std::string& s );
extern std::string +GetExtension ( const std::string& filename ); + +extern std::string NormalizeFilename ( const std::string& filename );
#endif /* __RBUILD_H */ _____
Modified: branches/xmlbuildsystem/reactos/tools/tools.xml --- branches/xmlbuildsystem/reactos/tools/tools.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/tools.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -1,6 +1,9 @@
<directory name="bin2res"> <xi:include href="bin2res/bin2res.xml" /> </directory> +<directory name="cabman"> + <xi:include href="cabman/cabman.xml" /> +</directory> <module name="buildno" type="buildtool"> <include base="buildno">.</include> <file>buildno.c</file>