diff --git a/reactos/ReactOS.xml b/reactos/ReactOS.xml index ef56c663f06..bdf2f63bfc9 100644 --- a/reactos/ReactOS.xml +++ b/reactos/ReactOS.xml @@ -50,4 +50,7 @@ + + + diff --git a/reactos/lib/directory.xml b/reactos/lib/directory.xml index 967db0357a0..f7616d4e23e 100644 --- a/reactos/lib/directory.xml +++ b/reactos/lib/directory.xml @@ -100,3 +100,6 @@ + + + diff --git a/reactos/lib/zlib/zlib.xml b/reactos/lib/zlib/zlib.xml new file mode 100644 index 00000000000..ac00376e757 --- /dev/null +++ b/reactos/lib/zlib/zlib.xml @@ -0,0 +1,17 @@ + + . + adler32.c + compress.c + crc32.c + gzio.c + uncompr.c + deflate.c + trees.c + zutil.c + inflate.c + infblock.c + inftrees.c + infcodes.c + infutil.c + inffast.c + diff --git a/reactos/tools/cabman/cabman.xml b/reactos/tools/cabman/cabman.xml new file mode 100644 index 00000000000..95d3a1041f1 --- /dev/null +++ b/reactos/tools/cabman/cabman.xml @@ -0,0 +1,10 @@ + + . + . + zlib + cabinet.cxx + dfp.cxx + main.cxx + mszip.cxx + raw.cxx + diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 33036ad8ca2..d5c616dc66d 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -48,14 +48,14 @@ MingwBackend::CreateMakefile () } 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 @@ MingwBackend::GenerateGlobalCFlagsAndProperties ( const vector& properties, const vector& includes, const vector& defines, - const vector& ifs ) + const vector& ifs ) const { size_t i; @@ -144,7 +144,7 @@ MingwBackend::GenerateGlobalCFlagsAndProperties ( } string -MingwBackend::GenerateProjectLFLAGS () +MingwBackend::GenerateProjectLFLAGS () const { string lflags; for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ ) @@ -158,15 +158,17 @@ MingwBackend::GenerateProjectLFLAGS () } 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 @@ MingwBackend::GenerateGlobalVariables () 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 @@ MingwBackend::GenerateGlobalVariables () 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 @@ MingwBackend::GenerateAllTarget () } void -MingwBackend::ProcessModule ( Module& module ) +MingwBackend::ProcessModule ( Module& module ) const { MingwModuleHandler* h = MingwModuleHandler::LookupHandler ( module.node.location, diff --git a/reactos/tools/rbuild/backend/mingw/mingw.h b/reactos/tools/rbuild/backend/mingw/mingw.h index d14b4cffbc9..6b48be2cbef 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.h +++ b/reactos/tools/rbuild/backend/mingw/mingw.h @@ -10,10 +10,10 @@ public: 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& includes, const std::vector& defines ) const; @@ -21,11 +21,12 @@ private: const std::vector& properties, const std::vector& includes, const std::vector& defines, - const std::vector& ifs ); - std::string GenerateProjectLFLAGS (); - void GenerateDirectoryTargets (); - void GenerateGlobalVariables (); - void GenerateAllTarget (); + const std::vector& ifs ) const; + std::string GenerateProjectLFLAGS () const; + void GenerateDirectoryTargets () const; + void GenerateGlobalVariables () const; + bool IncludeInAllTarget ( const Module& module ) const; + void GenerateAllTarget () const; FILE* fMakefile; }; diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 83bc666fe15..4ccb419f5ff 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -82,18 +82,6 @@ MingwModuleHandler::GetDirectory ( const string& filename ) const return filename.substr ( 0, index ); } -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 { @@ -722,6 +710,7 @@ void 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 @@ MingwModuleHandler::GenerateCommands ( const Module& module, 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 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, const vector& files, const vector& ifs, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -860,6 +858,7 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, GenerateCommands ( module, sourceFilename, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -873,6 +872,7 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, ifs[i]->files, ifs[i]->ifs, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -882,6 +882,7 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, 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 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, module.files, module.ifs, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -956,6 +958,7 @@ void MingwModuleHandler::GenerateMacrosAndTargets ( const Module& module, const string& cc, + const string& cppc, const string& ar, const string* cflags ) const { @@ -995,6 +998,7 @@ MingwModuleHandler::GenerateMacrosAndTargets ( string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro ); GenerateObjectFileTargets ( module, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -1017,7 +1021,7 @@ MingwModuleHandler::GenerateMacrosAndTargets ( 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 @@ void 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 @@ MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& modul { 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 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& mod "\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" ); +} diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 591b3adc074..6cd0cd05686 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -22,7 +22,6 @@ protected: 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 @@ private: 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 @@ private: const std::vector& files, const std::vector& 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 @@ private: 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 @@ private: 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 */ diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index fdd1b9c637d..75117582ebf 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -19,6 +19,18 @@ FixSeparator ( const string& s ) return s2; } +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 ) { @@ -253,6 +265,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute ) 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 @@ Module::GetDefaultModuleExtension () const case KernelModeDriver: case BootLoader: return ".sys"; + case Iso: + return ".iso"; } throw InvalidOperationException ( __FILE__, __LINE__ ); @@ -356,6 +372,20 @@ Module::GetInvocationTarget ( const int index ) const 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) diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index e06baf73576..671dd55beb6 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -79,7 +79,8 @@ enum ModuleType NativeDLL, Win32DLL, Win32GUI, - BootLoader + BootLoader, + Iso }; @@ -117,6 +118,8 @@ public: 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; @@ -339,6 +342,9 @@ public: extern std::string FixSeparator ( const std::string& s ); +extern std::string +GetExtension ( const std::string& filename ); + extern std::string NormalizeFilename ( const std::string& filename ); diff --git a/reactos/tools/tools.xml b/reactos/tools/tools.xml index 5d648bebdaa..1c1ca4e71a9 100644 --- a/reactos/tools/tools.xml +++ b/reactos/tools/tools.xml @@ -1,6 +1,9 @@ + + + . buildno.c