Partial 'make install' implementation

svn path=/branches/xmlbuildsystem/; revision=14483
This commit is contained in:
Casper Hornstrup 2005-04-03 19:25:58 +00:00
parent dff399ada6
commit de09c8d285
14 changed files with 320 additions and 21 deletions

View file

@ -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 @@ else
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 @@ ifeq ($(HALFVERBOSEECHO),yes)
ECHO_REGTESTS=@echo [REGTESTS] $@
ECHO_TEST =@echo [TEST] $@
else
ECHO_CP =
ECHO_MKDIR =
ECHO_BUILDNO =
ECHO_INVOKE =

View file

@ -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>

View file

@ -1 +1,2 @@
<cdfile base="reactos">services</cdfile>
<installfile base="system32/drivers/etc">services</installfile>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -20,6 +20,28 @@ using std::map;
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 @@ MingwBackend::Process ()
GenerateGlobalVariables ();
GenerateXmlBuildFilesMacro ();
ProcessModules ();
GenerateInstallTarget ();
GenerateDirectories ();
CheckAutomaticDependencies ();
CloseMakefile ();
@ -590,3 +613,85 @@ MingwBackend::DetectPCHSupport ()
// 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" );
}

View file

@ -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 @@ private:
void DetectPipeSupport ();
void DetectPCHSupport ();
void ProcessModules ();
std::string GetNonModuleInstallDirectories ( const std::string& installDirectory );
std::string GetInstallDirectories ( const std::string& installDirectory );
void GetNonModuleInstallFiles ( std::vector<std::string>& out ) const;
void GetInstallFiles ( std::vector<std::string>& out ) const;
void OutputInstallfileCopyCommands ( const std::string& installDirectory );
void GenerateInstallTarget ();
FILE* fMakefile;
bool use_pch;
Directory *int_directories, *out_directories;

View file

@ -40,26 +40,6 @@ PrefixFilename (
return out;
}
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 )
{
@ -1570,6 +1550,7 @@ MingwModuleHandler::GetDefinitionDependencies (
}
}
MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ )
: MingwModuleHandler ( module_ )
{
@ -2205,6 +2186,8 @@ MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (
{
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 (),
@ -2221,7 +2204,11 @@ MingwIsoModuleHandler::OutputCdfileCopyCommands (
{
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 (),

View file

@ -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()
{
}

View file

@ -24,6 +24,8 @@ Project::~Project ()
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 @@ Project::ProcessXML ( const string& path )
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 @@ Project::ProcessXMLSubElement ( const XMLElement& e,
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 );

View file

@ -58,6 +58,7 @@ class Property;
class AutomaticDependency;
class Bootstrap;
class CDFile;
class InstallFile;
class PchFile;
class StubbedComponent;
class StubbedSymbol;
@ -89,6 +90,7 @@ public:
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 @@ public:
};
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:

View file

@ -117,6 +117,7 @@ RBUILD_COMMON_SOURCES = \
define.cpp \
exception.cpp \
include.cpp \
installfile.cpp \
linkerflag.cpp \
module.cpp \
project.cpp \
@ -209,6 +210,10 @@ $(RBUILD_INT_)include.o: $(RBUILD_BASE_)include.cpp $(RBUILD_INT)
$(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 $@

View file

@ -341,6 +341,24 @@ Elements:
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.