Partial 'make install' implementation Modified: branches/xmlbuildsystem/reactos/Makefile Modified: branches/xmlbuildsystem/reactos/media/directory.xml Modified: branches/xmlbuildsystem/reactos/media/drivers/etc/etc.xml Added: branches/xmlbuildsystem/reactos/media/fonts/fonts.xml Added: branches/xmlbuildsystem/reactos/media/inf/inf.xml Modified: branches/xmlbuildsystem/reactos/media/nls/nls.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 Added: branches/xmlbuildsystem/reactos/tools/rbuild/installfile.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt _____
Modified: branches/xmlbuildsystem/reactos/Makefile --- branches/xmlbuildsystem/reactos/Makefile 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/Makefile 2005-04-03 19:25:58 UTC (rev 14483) @@ -21,6 +21,11 @@
# a path separator at the end. The variable defaults to the current # directory. # +# ROS_INSTALL +# This variable controls where to install output files to when using +# 'make install'. N.B. Don't put a path separator at the end. The variable +# defaults to .\reactos. +# # ROS_BUILDMAP # This variable controls if map files are to be generated for executable # output files. Map files have the extension .map. The value can be either @@ -63,6 +68,7 @@ endif endif ifeq ($(HALFVERBOSEECHO),yes) + ECHO_CP =@echo [COPY] $@ ECHO_MKDIR =@echo [MKDIR] $@ ECHO_BUILDNO =@echo [BUILDNO] $@ ECHO_INVOKE =@echo [INVOKE] $< @@ -87,6 +93,7 @@ ECHO_REGTESTS=@echo [REGTESTS] $@ ECHO_TEST =@echo [TEST] $@ else + ECHO_CP = ECHO_MKDIR = ECHO_BUILDNO = ECHO_INVOKE = _____
Modified: branches/xmlbuildsystem/reactos/media/directory.xml --- branches/xmlbuildsystem/reactos/media/directory.xml 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/media/directory.xml 2005-04-03 19:25:58 UTC (rev 14483) @@ -1,6 +1,12 @@
<directory name="drivers"> <xi:include href="drivers/directory.xml" /> </directory> +<directory name="fonts"> + <xi:include href="fonts/fonts.xml" /> +</directory> +<directory name="inf"> + <xi:include href="inf/inf.xml" /> +</directory> <directory name="nls"> <xi:include href="nls/nls.xml" /> </directory> _____
Modified: branches/xmlbuildsystem/reactos/media/drivers/etc/etc.xml --- branches/xmlbuildsystem/reactos/media/drivers/etc/etc.xml 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/media/drivers/etc/etc.xml 2005-04-03 19:25:58 UTC (rev 14483) @@ -1 +1,2 @@
<cdfile base="reactos">services</cdfile> +<installfile base="system32/drivers/etc">services</installfile> _____
Added: branches/xmlbuildsystem/reactos/media/fonts/fonts.xml --- branches/xmlbuildsystem/reactos/media/fonts/fonts.xml 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/media/fonts/fonts.xml 2005-04-03 19:25:58 UTC (rev 14483) @@ -0,0 +1,28 @@
+<installfile base="media/fonts">c0419bt_.ttf</installfile> +<installfile base="media/fonts">c0582bt_.ttf</installfile> +<installfile base="media/fonts">c0583bt_.ttf</installfile> +<installfile base="media/fonts">c0611bt_.ttf</installfile> +<installfile base="media/fonts">c0632bt_.ttf</installfile> +<installfile base="media/fonts">c0633bt_.ttf</installfile> +<installfile base="media/fonts">c0648bt_.ttf</installfile> +<installfile base="media/fonts">c0649bt_.ttf</installfile> +<installfile base="media/fonts">cour.ttf</installfile> +<installfile base="media/fonts">courb.ttf</installfile> +<installfile base="media/fonts">courbi.ttf</installfile> +<installfile base="media/fonts">helb____.ttf</installfile> +<installfile base="media/fonts">TGMarlett.ttf</installfile> +<installfile base="media/fonts">timr____.ttf</installfile> +<installfile base="media/fonts">UTB_____.ttf</installfile> +<installfile base="media/fonts">UTBI____.ttf</installfile> +<installfile base="media/fonts">UTI_____.ttf</installfile> +<installfile base="media/fonts">UTRG____.ttf</installfile> +<installfile base="media/fonts">Vera.ttf</installfile> +<installfile base="media/fonts">VeraBd.ttf</installfile> +<installfile base="media/fonts">VeraBI.ttf</installfile> +<installfile base="media/fonts">VeraIt.ttf</installfile> +<installfile base="media/fonts">VeraMoBd.ttf</installfile> +<installfile base="media/fonts">VeraMoBI.ttf</installfile> +<installfile base="media/fonts">VeraMoIt.ttf</installfile> +<installfile base="media/fonts">VeraMono.ttf</installfile> +<installfile base="media/fonts">VeraSe.ttf</installfile> +<installfile base="media/fonts">VeraSeBd.ttf</installfile> _____
Added: branches/xmlbuildsystem/reactos/media/inf/inf.xml --- branches/xmlbuildsystem/reactos/media/inf/inf.xml 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/media/inf/inf.xml 2005-04-03 19:25:58 UTC (rev 14483) @@ -0,0 +1,4 @@
+<installfile base="system32/inf">layout.inf</installfile> +<installfile base="system32/inf">NET_NIC.inf</installfile> +<installfile base="system32/inf">scsi.inf</installfile> +<installfile base="system32/inf">syssetup.inf</installfile> _____
Modified: branches/xmlbuildsystem/reactos/media/nls/nls.xml --- branches/xmlbuildsystem/reactos/media/nls/nls.xml 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/media/nls/nls.xml 2005-04-03 19:25:58 UTC (rev 14483) @@ -1,3 +1,59 @@
<cdfile base="reactos">c_437.nls</cdfile> <cdfile base="reactos">c_1252.nls</cdfile> <cdfile base="reactos">l_intl.nls</cdfile> + +<installfile base="system32">c_037.nls</installfile> +<installfile base="system32">c_037.nls</installfile> +<installfile base="system32">c_10000.nls</installfile> +<installfile base="system32">c_10006.nls</installfile> +<installfile base="system32">c_10007.nls</installfile> +<installfile base="system32">c_10029.nls</installfile> +<installfile base="system32">c_1006.nls</installfile> +<installfile base="system32">c_10079.nls</installfile> +<installfile base="system32">c_10081.nls</installfile> +<installfile base="system32">c_1026.nls</installfile> +<installfile base="system32">c_1250.nls</installfile> +<installfile base="system32">c_1251.nls</installfile> +<installfile base="system32" newname="ansi.nls">c_1252.nls</installfile> +<installfile base="system32">c_1253.nls</installfile> +<installfile base="system32">c_1254.nls</installfile> +<installfile base="system32">c_1255.nls</installfile> +<installfile base="system32">c_1256.nls</installfile> +<installfile base="system32">c_1257.nls</installfile> +<installfile base="system32">c_1258.nls</installfile> +<installfile base="system32">c_20866.nls</installfile> +<installfile base="system32">c_28591.nls</installfile> +<installfile base="system32">c_28592.nls</installfile> +<installfile base="system32">c_28593.nls</installfile> +<installfile base="system32">c_28594.nls</installfile> +<installfile base="system32">c_28595.nls</installfile> +<installfile base="system32">c_28596.nls</installfile> +<installfile base="system32">c_28597.nls</installfile> +<installfile base="system32">c_28598.nls</installfile> +<installfile base="system32">c_28599.nls</installfile> +<installfile base="system32">c_424.nls</installfile> +<installfile base="system32" newname="oem.nls">c_437.nls</installfile> +<installfile base="system32">c_500.nls</installfile> +<installfile base="system32">c_737.nls</installfile> +<installfile base="system32">c_775.nls</installfile> +<installfile base="system32">c_850.nls</installfile> +<installfile base="system32">c_852.nls</installfile> +<installfile base="system32">c_855.nls</installfile> +<installfile base="system32">c_856.nls</installfile> +<installfile base="system32">c_857.nls</installfile> +<installfile base="system32">c_860.nls</installfile> +<installfile base="system32">c_861.nls</installfile> +<installfile base="system32">c_862.nls</installfile> +<installfile base="system32">c_863.nls</installfile> +<installfile base="system32">c_864.nls</installfile> +<installfile base="system32">c_865.nls</installfile> +<installfile base="system32">c_866.nls</installfile> +<installfile base="system32">c_869.nls</installfile> +<installfile base="system32">c_874.nls</installfile> +<installfile base="system32">c_875.nls</installfile> +<installfile base="system32">c_878.nls</installfile> +<installfile base="system32">c_932.nls</installfile> +<installfile base="system32">c_936.nls</installfile> +<installfile base="system32">c_949.nls</installfile> +<installfile base="system32">c_950.nls</installfile> +<installfile base="system32" newname="casemap.nls">l_intl.nls</installfile> _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-04-03 19:25:58 UTC (rev 14483) @@ -20,6 +20,28 @@
typedef set<string> set_string; typedef map<string,Directory*> directory_map;
+ +string +v2s ( const string_list& v, int wrap_at ) +{ + if ( !v.size() ) + return ""; + string s; + int wrap_count = 0; + for ( size_t i = 0; i < v.size(); i++ ) + { + if ( !v[i].size() ) + continue; + if ( wrap_at > 0 && wrap_count++ == wrap_at ) + s += " \\n\t\t"; + else if ( s.size() ) + s += " "; + s += v[i]; + } + return s; +} + + class Directory { public: @@ -262,6 +284,7 @@ GenerateGlobalVariables (); GenerateXmlBuildFilesMacro (); ProcessModules (); + GenerateInstallTarget (); GenerateDirectories (); CheckAutomaticDependencies (); CloseMakefile (); @@ -590,3 +613,85 @@ // TODO FIXME - eventually check for ROS_USE_PCH env var and // allow that to override use_pch if true } + +string +MingwBackend::GetNonModuleInstallDirectories ( const string& installDirectory ) +{ + string directories; + for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ ) + { + const InstallFile& installfile = *ProjectNode.installfiles[i]; + string targetDirectory ( installDirectory + SSEP + installfile.base ); + if ( directories.size () > 0 ) + directories += " "; + directories += MingwModuleHandler::PassThruCacheDirectory ( + FixupTargetFilename ( targetDirectory ), + true ); + } + return directories; +} + +string +MingwBackend::GetInstallDirectories ( const string& installDirectory ) +{ + return GetNonModuleInstallDirectories ( installDirectory ); +} + +void +MingwBackend::GetNonModuleInstallFiles ( + vector<string>& out ) const +{ + for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ ) + { + const InstallFile& installfile = *ProjectNode.installfiles[i]; + out.push_back ( NormalizeFilename ( installfile.GetPath () ) ); + } +} + +void +MingwBackend::GetInstallFiles ( + vector<string>& out ) const +{ + GetNonModuleInstallFiles ( out ); +} + +void +MingwBackend::OutputInstallfileCopyCommands ( const string& installDirectory ) +{ + for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ ) + { + const InstallFile& installfile = *ProjectNode.installfiles[i]; + string targetFilenameNoFixup = installDirectory + SSEP + installfile.base + SSEP + installfile.newname; + string targetFilename = MingwModuleHandler::PassThruCacheDirectory ( + FixupTargetFilename ( targetFilenameNoFixup ), + true ); + fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, + "\t${cp} %s %s\n", + installfile.GetPath ().c_str (), + targetFilename.c_str () ); + } +} + +void +MingwBackend::GenerateInstallTarget () +{ + string installDirectoryNoFixup = "reactos"; + string installDirectory = MingwModuleHandler::PassThruCacheDirectory ( + FixupTargetFilename ( installDirectoryNoFixup ), + true ); + string installDirectories = GetInstallDirectories ( installDirectoryNoFixup ); + vector<string> vInstallFiles; + GetInstallFiles ( vInstallFiles ); + string installFiles = v2s ( vInstallFiles, 5 ); + + fprintf ( fMakefile, + "install: all %s %s %s\n", + installDirectory.c_str (), + installDirectories.c_str (), + installFiles.c_str () ); + OutputInstallfileCopyCommands ( installDirectoryNoFixup ); + fprintf ( fMakefile, + "\n" ); +} _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-04-03 19:25:58 UTC (rev 14483) @@ -12,6 +12,9 @@
class Directory; class MingwModuleHandler;
+extern std::string +v2s ( const string_list& v, int wrap_at ); + class MingwBackend : public Backend { public: @@ -41,6 +44,12 @@ void DetectPipeSupport (); void DetectPCHSupport (); void ProcessModules (); + std::string GetNonModuleInstallDirectories ( const std::string& installDirectory ); + std::string GetInstallDirectories ( const std::string& installDirectory ); + void GetNonModuleInstallFiles ( std::vectorstd::string& out ) const; + void GetInstallFiles ( std::vectorstd::string& out ) const; + void OutputInstallfileCopyCommands ( const std::string& installDirectory ); + void GenerateInstallTarget (); FILE* fMakefile; bool use_pch; Directory *int_directories, *out_directories; _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-04-03 19:25:58 UTC (rev 14483) @@ -41,26 +41,6 @@
}
string -v2s ( const string_list& v, int wrap_at ) -{ - if ( !v.size() ) - return ""; - string s; - int wrap_count = 0; - for ( size_t i = 0; i < v.size(); i++ ) - { - if ( !v[i].size() ) - continue; - if ( wrap_at > 0 && wrap_count++ == wrap_at ) - s += " \\n\t\t"; - else if ( s.size() ) - s += " "; - s += v[i]; - } - return s; -} - -string GetTargetMacro ( const Module& module, bool with_dollar ) { string s ( module.name ); @@ -1570,6 +1550,7 @@ } }
+ MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ ) : MingwModuleHandler ( module_ ) { @@ -2206,6 +2187,8 @@ string targetFilenameNoFixup ( bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd ); string targetFilename ( GetTargetMacro ( module ) ); fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, "\t${cp} %s %s\n", m.GetPath ().c_str (), targetFilename.c_str () ); @@ -2221,8 +2204,12 @@ { const CDFile& cdfile = *module.project.cdfiles[i]; string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd; - string targetFilename = GetTargetMacro(module); + string targetFilename = MingwModuleHandler::PassThruCacheDirectory ( + FixupTargetFilename ( targetFilenameNoFixup ), + true ); fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, "\t${cp} %s %s\n", cdfile.GetPath ().c_str (), targetFilename.c_str () ); _____
Added: branches/xmlbuildsystem/reactos/tools/rbuild/installfile.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/installfile.cpp 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/installfile.cpp 2005-04-03 19:25:58 UTC (rev 14483) @@ -0,0 +1,42 @@
+#include "pch.h" +#include <assert.h> + +#include "rbuild.h" + +using std::string; + +InstallFile::InstallFile ( const Project& project_, + const XMLElement& installfileNode, + const string& path ) + : project ( project_ ), + node ( installfileNode ) +{ + const XMLAttribute* att = node.GetAttribute ( "base", false ); + if ( att != NULL ) + base = att->value; + else + base = ""; + + att = node.GetAttribute ( "newname", false ); + if ( att != NULL ) + newname = att->value; + else + newname = node.value; + name = node.value; + this->path = path; +} + +InstallFile::~InstallFile () +{ +} + +string +InstallFile::GetPath () const +{ + return path + SSEP + name; +} + +void +InstallFile::ProcessXML() +{ +} _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-04-03 19:25:58 UTC (rev 14483) @@ -24,6 +24,8 @@
delete linkerFlags[i]; for ( i = 0; i < cdfiles.size (); i++ ) delete cdfiles[i]; + for ( i = 0; i < installfiles.size (); i++ ) + delete installfiles[i]; delete head; }
@@ -220,6 +222,8 @@ non_if_data.ProcessXML (); for ( i = 0; i < cdfiles.size (); i++ ) cdfiles[i]->ProcessXML (); + for ( i = 0; i < installfiles.size (); i++ ) + installfiles[i]->ProcessXML (); }
void @@ -251,6 +255,12 @@ cdfiles.push_back ( cdfile ); subs_invalid = true; } + else if ( e.name == "installfile" ) + { + InstallFile* installfile = new InstallFile ( *this, e, path ); + installfiles.push_back ( installfile ); + subs_invalid = true; + } else if ( e.name == "directory" ) { const XMLAttribute* att = e.GetAttribute ( "name", true ); _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-04-03 19:25:58 UTC (rev 14483) @@ -58,6 +58,7 @@
class AutomaticDependency; class Bootstrap; class CDFile; +class InstallFile; class PchFile; class StubbedComponent; class StubbedSymbol; @@ -89,6 +90,7 @@ std::vector<Module*> modules; std::vector<LinkerFlag*> linkerFlags; std::vector<CDFile*> cdfiles; + std::vector<InstallFile*> installfiles; IfableData non_if_data;
Project ( const std::string& filename ); @@ -518,6 +520,25 @@ };
+class InstallFile +{ +public: + const Project& project; + const XMLElement& node; + std::string name; + std::string base; + std::string newname; + std::string path; + + InstallFile ( const Project& project, + const XMLElement& bootstrapNode, + const std::string& path ); + ~InstallFile (); + void ProcessXML (); + std::string GetPath () const; +}; + + class PchFile { public: _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.mak 2005-04-03 19:25:58 UTC (rev 14483) @@ -117,6 +117,7 @@
define.cpp \ exception.cpp \ include.cpp \ + installfile.cpp \ linkerflag.cpp \ module.cpp \ project.cpp \ @@ -209,6 +210,10 @@ $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+$(RBUILD_INT_)installfile.o: $(RBUILD_BASE_)installfile.cpp $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_INT_)linkerflag.o: $(RBUILD_BASE_)linkerflag.cpp $(RBUILD_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt 2005-04-03 19:15:14 UTC (rev 14482) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt 2005-04-03 19:25:58 UTC (rev 14483) @@ -341,6 +341,24 @@
None.
+Installfile element +------------------- +An installfile element specifies the name of a file that is to be installed when using 'make install'. + +Syntax: + <installfile base="reactos" newname="ReadMe.txt">ReadMe.txt</installfile> + +Attributes: + base - Put file in this directory within the install directory. This attribute is optional. + newname - Name of file within the install directory. This attribute is optional. + +Value: + Name of file. + +Elements: + None. + + Invoke element -------------- An invoke element specifies the name of a module which is to be executed before the current module is processed.