Accept ROS_INSTALL environment variable
Modified: branches/xmlbuildsystem/reactos/Makefile
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/tests/functiontest.cpp
_____
Modified: branches/xmlbuildsystem/reactos/Makefile
--- branches/xmlbuildsystem/reactos/Makefile 2005-04-05 19:42:40 UTC
(rev 14519)
+++ branches/xmlbuildsystem/reactos/Makefile 2005-04-05 20:24:26 UTC
(rev 14520)
@@ -178,6 +178,13 @@
endif
OUTPUT_ := $(OUTPUT)$(SEP)
+ifneq ($(ROS_INSTALL),)
+ INSTALL := $(ROS_INSTALL)
+else
+ INSTALL := reactos
+endif
+INSTALL_ := $(INSTALL)$(SEP)
+
$(INTERMEDIATE):
${mkdir} $@
@@ -186,6 +193,7 @@
${mkdir} $@
endif
+
NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
KERNEL32_MC = lib$(SEP)kernel32$(SEP)kernel32.mc
BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
2005-04-05 19:42:40 UTC (rev 14519)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
2005-04-05 20:24:26 UTC (rev 14520)
@@ -120,6 +120,28 @@
}
string
+Directory::GetEnvironmentVariable ( const string& name )
+{
+ char* value = getenv ( name.c_str () );
+ if ( value != NULL && strlen ( value ) > 0 )
+ return ssprintf ( "%s",
+ value );
+ else
+ return "";
+}
+
+string
+Directory::GetEnvironmentVariablePathOrDefault ( const string& name,
+ const string&
defaultValue )
+{
+ const string& environmentVariableValue = GetEnvironmentVariable
( name );
+ if ( environmentVariableValue.length () > 0 )
+ return NormalizeFilename ( environmentVariableValue );
+ else
+ return defaultValue;
+}
+
+string
Directory::GetIntermediatePath ()
{
return "obj-i386";
@@ -131,12 +153,20 @@
return "output-i386";
}
+string
+Directory::GetInstallPath ()
+{
+ return GetEnvironmentVariablePathOrDefault ( "ROS_INSTALL",
+ "reactos" );
+}
+
void
Directory::ResolveVariablesInPath ( char* buf,
string path )
{
string s = ReplaceVariable ( "$(INTERMEDIATE)",
GetIntermediatePath (), path );
s = ReplaceVariable ( "$(OUTPUT)", GetOutputPath (), s );
+ s = ReplaceVariable ( "$(INSTALL)", GetInstallPath (), s );
strcpy ( buf, s.c_str () );
}
@@ -181,7 +211,8 @@
MingwBackend::MingwBackend ( Project& project, bool verbose )
: Backend ( project, verbose ),
intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ),
- outputDirectory ( new Directory ( "$(OUTPUT)" ) )
+ outputDirectory ( new Directory ( "$(OUTPUT)" ) ),
+ installDirectory ( new Directory ( "$(INSTALL)" ) )
{
}
@@ -189,6 +220,7 @@
{
delete intermediateDirectory;
delete outputDirectory;
+ delete installDirectory;
}
string
@@ -514,15 +546,10 @@
printf ( "Creating directories..." );
intermediateDirectory->GenerateTree ( "", verbose );
outputDirectory->GenerateTree ( "", verbose );
+ installDirectory->GenerateTree ( "", verbose );
printf ( "done\n" );
}
-string
-FixupTargetFilename ( const string& targetFilename )
-{
- return NormalizeFilename ( targetFilename );
-}
-
void
MingwBackend::DetectPipeSupport ()
{
@@ -551,9 +578,6 @@
printf ( "detected\n" );
else
printf ( "not detected\n" );
-
- // TODO FIXME - eventually check for ROS_USE_PCH env var and
- // allow that to override use_pch if true
}
void
@@ -583,30 +607,25 @@
printf ( "detected\n" );
else
printf ( "not detected\n" );
-
- // TODO FIXME - eventually check for ROS_USE_PCH env var and
- // allow that to override use_pch if true
}
void
MingwBackend::GetNonModuleInstallTargetFiles (
- string installDirectory,
vector<string>& out ) const
{
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 targetFilenameNoFixup = installfile.base + SSEP +
installfile.newname;
string targetFilename =
MingwModuleHandler::PassThruCacheDirectory (
NormalizeFilename ( targetFilenameNoFixup ),
- outputDirectory );
+ installDirectory );
out.push_back ( targetFilename );
}
}
void
MingwBackend::GetModuleInstallTargetFiles (
- string installDirectory,
vector<string>& out ) const
{
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
@@ -614,10 +633,10 @@
const Module& module = *ProjectNode.modules[i];
if ( module.installName.length () > 0 )
{
- string targetFilenameNoFixup = installDirectory
+ SSEP + module.installBase + SSEP + module.installName;
+ string targetFilenameNoFixup =
module.installBase + SSEP + module.installName;
string targetFilename =
MingwModuleHandler::PassThruCacheDirectory (
NormalizeFilename (
targetFilenameNoFixup ),
- outputDirectory );
+ installDirectory );
out.push_back ( targetFilename );
}
}
@@ -625,27 +644,23 @@
void
MingwBackend::GetInstallTargetFiles (
- string installDirectory,
vector<string>& out ) const
{
- GetNonModuleInstallTargetFiles ( installDirectory,
- out );
- GetModuleInstallTargetFiles ( installDirectory,
- out );
+ GetNonModuleInstallTargetFiles ( out );
+ GetModuleInstallTargetFiles ( out );
}
void
-MingwBackend::OutputInstallTarget ( const string& installDirectory,
- const string& sourceFilename,
+MingwBackend::OutputInstallTarget ( const string& sourceFilename,
const string& targetFilename,
const string& targetDirectory )
{
string normalizedTargetFilename =
MingwModuleHandler::PassThruCacheDirectory (
- NormalizeFilename ( installDirectory + SSEP +
targetDirectory + SSEP + targetFilename ),
- outputDirectory );
+ NormalizeFilename ( targetDirectory + SSEP +
targetFilename ),
+ installDirectory );
string normalizedTargetDirectory =
MingwModuleHandler::PassThruCacheDirectory (
- NormalizeFilename ( installDirectory + SSEP +
targetDirectory ),
- outputDirectory );
+ NormalizeFilename ( targetDirectory ),
+ installDirectory );
fprintf ( fMakefile,
"%s: %s %s\n",
normalizedTargetFilename.c_str (),
@@ -660,20 +675,19 @@
}
void
-MingwBackend::OutputNonModuleInstallTargets ( const string&
installDirectory )
+MingwBackend::OutputNonModuleInstallTargets ()
{
for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ )
{
const InstallFile& installfile =
*ProjectNode.installfiles[i];
- OutputInstallTarget ( installDirectory,
- installfile.GetPath (),
+ OutputInstallTarget ( installfile.GetPath (),
installfile.newname,
installfile.base );
}
}
void
-MingwBackend::OutputModuleInstallTargets ( const string&
installDirectory )
+MingwBackend::OutputModuleInstallTargets ()
{
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{
@@ -683,8 +697,7 @@
string sourceFilename =
MingwModuleHandler::PassThruCacheDirectory (
NormalizeFilename ( module.GetPath () ),
outputDirectory );
- OutputInstallTarget ( installDirectory,
- sourceFilename,
+ OutputInstallTarget ( sourceFilename,
module.installName,
module.installBase );
}
@@ -702,11 +715,12 @@
}
string
-MingwBackend::GetRegistryTargetFiles ( const string& installDirectory )
+MingwBackend::GetRegistryTargetFiles ()
{
- string system32ConfigDirectory =
MingwModuleHandler::PassThruCacheDirectory (
- NormalizeFilename ( installDirectory + SSEP + "system32"
+ SSEP "config" ),
- outputDirectory );
+ string system32ConfigDirectory = NormalizeFilename (
+ MingwModuleHandler::PassThruCacheDirectory (
+ "system32" SSEP "config" SSEP,
+ installDirectory ) );
return system32ConfigDirectory + SSEP "default " +
system32ConfigDirectory + SSEP "sam " +
system32ConfigDirectory + SSEP "security " +
@@ -715,14 +729,15 @@
}
void
-MingwBackend::OutputRegistryInstallTarget ( const string&
installDirectory )
+MingwBackend::OutputRegistryInstallTarget ()
{
- string system32ConfigDirectory =
MingwModuleHandler::PassThruCacheDirectory (
- NormalizeFilename ( installDirectory + SSEP + "system32"
+ SSEP "config" ),
- outputDirectory );
+ string system32ConfigDirectory = NormalizeFilename (
+ MingwModuleHandler::PassThruCacheDirectory (
+ "system32" SSEP "config" SSEP,
+ installDirectory ) );
string registrySourceFiles = GetRegistrySourceFiles ();
- string registryTargetFiles = GetRegistryTargetFiles (
installDirectory );
+ string registryTargetFiles = GetRegistryTargetFiles ();
fprintf ( fMakefile,
"install_registry: %s\n",
registryTargetFiles.c_str () );
@@ -743,22 +758,16 @@
void
MingwBackend::GenerateInstallTarget ()
{
- string installDirectoryNoFixup = "reactos";
- string installDirectory =
MingwModuleHandler::PassThruCacheDirectory (
- NormalizeFilename ( installDirectoryNoFixup ),
- outputDirectory );
vector<string> vInstallTargetFiles;
- GetInstallTargetFiles ( installDirectoryNoFixup,
- vInstallTargetFiles );
+ GetInstallTargetFiles ( vInstallTargetFiles );
string installTargetFiles = v2s ( vInstallTargetFiles, 5 );
fprintf ( fMakefile,
- "install: %s %s install_registry\n",
- installDirectory.c_str (),
+ "install: %s install_registry\n",
installTargetFiles.c_str () );
- OutputNonModuleInstallTargets ( installDirectoryNoFixup );
- OutputModuleInstallTargets ( installDirectoryNoFixup );
- OutputRegistryInstallTarget ( installDirectoryNoFixup );
+ OutputNonModuleInstallTargets ();
+ OutputModuleInstallTargets ();
+ OutputRegistryInstallTarget ();
fprintf ( fMakefile,
"\n" );
}
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
2005-04-05 19:42:40 UTC (rev 14519)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h
2005-04-05 20:24:26 UTC (rev 14520)
@@ -31,8 +31,12 @@
std::string ReplaceVariable ( std::string name,
std::string value,
std::string path );
+ std::string GetEnvironmentVariable ( const std::string& name );
+ std::string GetEnvironmentVariablePathOrDefault ( const
std::string& name,
+ const
std::string& defaultValue );
std::string GetIntermediatePath ();
std::string GetOutputPath ();
+ std::string GetInstallPath ();
void ResolveVariablesInPath ( char* buf,
std::string path );
bool CreateDirectory ( std::string path );
@@ -50,6 +54,7 @@
bool usePipe;
Directory* intermediateDirectory;
Directory* outputDirectory;
+ Directory* installDirectory;
private:
void CreateMakefile ();
void CloseMakefile () const;
@@ -75,26 +80,20 @@
std::string GetInstallDirectories ( const std::string&
installDirectory );
void GetNonModuleInstallFiles ( std::vector<std::string>& out )
const;
void GetInstallFiles ( std::vector<std::string>& out ) const;
- void GetNonModuleInstallTargetFiles ( std::string
installDirectory,
- std::vector<std::string>&
out ) const;
- void GetModuleInstallTargetFiles ( std::string installDirectory,
- std::vector<std::string>& out
) const;
- void GetInstallTargetFiles ( std::string installDirectory,
- std::vector<std::string>& out )
const;
- void OutputInstallTarget ( const std::string& installDirectory,
- const std::string& sourceFilename,
+ void GetNonModuleInstallTargetFiles ( std::vector<std::string>&
out ) const;
+ void GetModuleInstallTargetFiles ( std::vector<std::string>& out
) const;
+ void GetInstallTargetFiles ( std::vector<std::string>& out )
const;
+ void OutputInstallTarget ( const std::string& sourceFilename,
const std::string& targetFilename,
const std::string& targetDirectory );
- void OutputNonModuleInstallTargets ( const std::string&
installDirectory );
- void OutputModuleInstallTargets ( const std::string&
installDirectory );
+ void OutputNonModuleInstallTargets ();
+ void OutputModuleInstallTargets ();
std::string GetRegistrySourceFiles ();
- std::string GetRegistryTargetFiles ( const std::string&
installDirectory );
- void OutputRegistryInstallTarget ( const std::string&
installDirectory );
+ std::string GetRegistryTargetFiles ();
+ void OutputRegistryInstallTarget ();
void GenerateInstallTarget ();
FILE* fMakefile;
bool use_pch;
};
-std::string FixupTargetFilename ( const std::string& targetFilename );
-
#endif /* MINGW_H */
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
---
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp 2005-04-05 19:42:40 UTC (rev 14519)
+++
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp 2005-04-05 20:24:26 UTC (rev 14520)
@@ -119,7 +119,7 @@
string_list* pclean_files )
{
string target = PassThruCacheDirectory (
- FixupTargetFilename ( module.GetPath () ),
+ NormalizeFilename ( module.GetPath () ),
backend->outputDirectory );
if ( pclean_files )
{
@@ -135,7 +135,7 @@
string_list* pclean_files )
{
string target = PassThruCacheDirectory (
- FixupTargetFilename ( module.GetDependencyPath () ),
+ NormalizeFilename ( module.GetDependencyPath () ),
backend->outputDirectory );
if ( pclean_files )
{
@@ -1402,11 +1402,11 @@
invoke_targets[i].c_str () );
fprintf ( fMakefile,
": %s\n",
- FixupTargetFilename (
invoke.invokeModule->GetPath () ).c_str () );
+ NormalizeFilename (
invoke.invokeModule->GetPath () ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" );
fprintf ( fMakefile,
"\t%s %s\n\n",
- FixupTargetFilename (
invoke.invokeModule->GetPath () ).c_str (),
+ NormalizeFilename (
invoke.invokeModule->GetPath () ).c_str (),
invoke.GetParameters ().c_str () );
}
}
@@ -1932,7 +1932,7 @@
string extension = GetExtension ( file.name );
if ( extension == ".rc" || extension == ".RC" )
{
- string resource = FixupTargetFilename (
file.name );
+ string resource = NormalizeFilename ( file.name
);
fprintf ( fMakefile, "\t$(ECHO_BIN2RES)\n" );
fprintf ( fMakefile, "\t@:echo ${bin2res} -f -x
%s\n",
resource.c_str () );
@@ -2272,7 +2272,7 @@
{
const Module& m = *module.project.modules[i];
if ( m.bootstrap != NULL )
- out.push_back ( FixupTargetFilename ( m.GetPath
() ) );
+ out.push_back ( NormalizeFilename ( m.GetPath ()
) );
}
}
@@ -2299,13 +2299,13 @@
MingwIsoModuleHandler::GenerateIsoModuleTarget ()
{
string bootcdDirectory = "cd";
- string isoboot = FixupTargetFilename (
"boot/freeldr/bootsect/isoboot.o" );
+ string isoboot = NormalizeFilename (
"boot/freeldr/bootsect/isoboot.o" );
string bootcdReactosNoFixup = bootcdDirectory + "/reactos";
string bootcdReactos = PassThruCacheDirectory (
NormalizeFilename ( bootcdReactosNoFixup ),
backend->outputDirectory );
CLEAN_FILE ( bootcdReactos );
- string reactosInf = ros_temp + FixupTargetFilename (
bootcdReactosNoFixup + "/reactos.inf" );
+ string reactosInf = ros_temp + NormalizeFilename (
bootcdReactosNoFixup + "/reactos.inf" );
string reactosDff = NormalizeFilename (
"bootdata/packages/reactos.dff" );
string cdDirectories = GetCdDirectories ( bootcdDirectory );
vector<string> vCdFiles;
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/functiontest.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/functiontest.cpp
2005-04-05 19:42:40 UTC (rev 14519)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/functiontest.cpp
2005-04-05 20:24:26 UTC (rev 14520)
@@ -4,6 +4,6 @@
void FunctionTest::Run ()
{
- string fixedupFilename = FixupTargetFilename ( "." SSEP "dir1"
SSEP "dir2" SSEP ".." SSEP "filename.txt" );
+ string fixedupFilename = NormalizeFilename ( "." SSEP "dir1"
SSEP "dir2" SSEP ".." SSEP "filename.txt" );
ARE_EQUAL ( "dir1" SSEP "filename.txt", fixedupFilename );
}