Salome HOME
Implementation of building from source files
[tools/install.git] / src / SALOME_InstallWizard.cxx
index 8bfa9ea2f7b3324e609f7c51ee5d9fe2de2f62ff..63941368fdcc842a733692b5d9d0cd8c9322b503 100644 (file)
@@ -3,7 +3,7 @@
 //  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
 //  Project   : SALOME
 //  Module    : Installation Wizard
-//  Copyright : 2002-2007 CEA
+//  Copyright : 2002-2008 CEA
 
 #include "globals.h"
 
@@ -50,6 +50,7 @@
 #else
 #include <unistd.h>
 #include <algo.h>
+#include <sys/utsname.h>
 #endif
 
 #ifdef WNT
@@ -203,29 +204,29 @@ private:
 
 // ================================================================
 /*!
- *  DefineDependeces [ static ]
- *  Defines list of dependancies as string separated by space symbols
+ *  getAllProducts [ static ]
+ *  Defines list of all products as a string separated by space symbols
  */
 // ================================================================
-static QString DefineDependeces(MapProducts& theProductsMap)
+static QString getAllProducts(MapProducts& theProductsMap)
 {
-  QStringList aProducts;
+  QStringList aModules, aPrereqs;
   for ( MapProducts::Iterator mapIter = theProductsMap.begin(); mapIter != theProductsMap.end(); ++mapIter ) {
     QCheckListItem* item = mapIter.key();
     Dependancies dep = mapIter.data();
-    QStringList deps = dep.getDependancies();
-    for (int i = 0; i<(int)deps.count(); i++ ) {
-      if ( !aProducts.contains( deps[i] ) ) {
-       aProducts.append( deps[i] );
-       aProducts.append( deps[i] + "_src" );
+    QString curModule = item->text(0);
+    if ( !aModules.contains( curModule ) && !aPrereqs.contains( curModule ) ) {
+      if ( dep.getType() == "component" ) {
+       aModules.append( curModule );
+       aModules.append( curModule + "_src" );
+      }
+      else {
+       aPrereqs.append( curModule );
+       aPrereqs.append( curModule + "_src" );
       }
-    }
-    if ( !aProducts.contains( item->text(0) ) ) {
-      aProducts.append( item->text(0) );
-      aProducts.append( item->text(0) + "_src" );
     }
   }
-  return aProducts.join(" ");
+  return QStringList(aPrereqs+aModules).join(" ");
 }
 
 // ================================================================
@@ -343,7 +344,7 @@ static bool hasSpace( const QString& dir )
  *  Creates HTML-wrapped title text
  */
 // ================================================================
-QString makeTitle( const QString& text, const QString& separator = " ", bool fl = true )
+static QString makeTitle( const QString& text, const QString& separator = " ", bool fl = true )
 {
   QStringList words = QStringList::split( separator, text );
   if ( fl ) {
@@ -426,7 +427,8 @@ public:
                      .arg( __IW_VERSION_MINOR__ ) \
                      .arg( __IW_VERSION_PATCH__ ) );
     QLabel* copyright = new QLabel( this, "copyright" );
-    copyright->setText( "<b>Copyright</b> &copy; 2004-2007 CEA" );
+    copyright->setText( "<b>Copyright</b> &copy; 2007-2008 CEA/DEN, EDF R&amp;D, OPEN CASCADE<br><br>"
+                       "<b>Copyright</b> &copy; 2003-2007 OPEN CASCADE,<br>EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D,<br>LEG, PRINCIPIA R&amp;D, BUREAU VERITAS");
     QFont font = title->font();
     font.setPointSize( (int)( font.pointSize() * 1.8 ) );
     title->setFont( font );
@@ -453,7 +455,7 @@ public:
     QFontMetrics fm( title->font() );
     int width = (int)( fm.width( tlt ) * 1.5 );
     title->setMinimumWidth( width );
-    setMaximumSize( minimumSize() );
+//     setMaximumSize( minimumSize() );
   }
   void mousePressEvent( QMouseEvent* )
   {
@@ -469,7 +471,9 @@ public:
 // ================================================================
 SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
                                           const QString& aTargetDir,
-                                          const QString& aTmpDir)
+                                          const QString& aTmpDir,
+                                          const bool     aForceSrc,
+                                          const bool     aSingleDir)
      : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ),
        helpWindow( NULL ),
        moreMode( false ),
@@ -482,25 +486,23 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   xmlFileName  = aXmlFileName;
   myTargetPath = aTargetDir;
   myTmpPath    = aTmpDir;
+  forceSrc     = aForceSrc;
+  singleDir    = aSingleDir;
   stateChanged = true;
   binPath = QDir::currentDirPath() + "/Products/BINARIES";
   srcPath = QDir::currentDirPath() + "/Products/SOURCES";
+  oneProdDirName = "PRODUCTS";
   
-  singleBinPlts << "Debian4.0" 
-               << "Debian3.1" 
-               << "Mandriva2006.0" 
-               << "Mandriva2007.0" 
-               << "Mandriva2008.0" 
-               << "Mandriva2006.0_64";
-  commonPlatform = "Debian3.1";
+  commonPlatform = "Debian 3.1";
   
   //
   // get XML filename and current platform
   //
   // ... get current platform
-  curPlatform = currentPlatform();
+  curPlatform = currentPlatform().join(" ");
 //   cout << "curOS = " << curPlatform << endl;
 //   curPlatform = "";
+  refPlatform = "";
   // ... check XML and platform definition
   getXmlAndPlatform();
 
@@ -519,10 +521,11 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   addLogo( pixmap( pxLogo ) );
 
   // set defaults
-  setVersion( "4.0.0" );
+  setVersion( "5.1.0" );
   setCaption( tr( "SALOME %1" ).arg( myVersion ) );
-  setCopyright( tr( "Copyright (C) 2007 CEA" ) );
-  setLicense( tr( "All rights reserved." ) );
+  setCopyright( tr( "<h5>Copyright &copy; 2007-2008 CEA/DEN, EDF R&amp;D, OPEN CASCADE<br></h5>"
+               "<h5>Copyright &copy; 2003-2007 OPEN CASCADE,<br>EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D,<br>LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</h5>" ));
+  setLicense( tr( "<h5>GNU LGPL</h5>" ) );
 
   ___MESSAGE___( "Configuration file : " << xmlFileName.latin1() );
   ___MESSAGE___( "Target directory   : " << myTargetPath.latin1() );
@@ -536,14 +539,12 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
 
   // create instance of class for starting shell script to get available disk space
   diskSpaceProc = new QProcess( this, "procDiskSpace" );
-  connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) );
-
   // create instance of class for starting shell install script
   shellProcess = new QProcess( this, "shellProcess" );
-
+  // create instance of class for starting shell script to modify SALOME *.la files
+  modifyLaProc = new QProcess( this, "modifyLaProc" );
   // create instance of class for starting shell script to check Fortran libraries
   checkFLibProc = new QProcess( this, "checkFLibProc" );
-  connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) );
 
   // create introduction page
   setupIntroPage();
@@ -575,11 +576,19 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   connect( this, SIGNAL( helpClicked() ),  this, SLOT( helpClicked() ) );
   connect( this, SIGNAL( aboutClicked() ), this, SLOT( onAbout() ) );
 
-  // catch signals from launched script
+  // catch signals from launched diskSpaceProc
+  connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) );
+  // catch signals from launched shellProcess
   connect(shellProcess, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) );
   connect(shellProcess, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
   connect(shellProcess, SIGNAL( processExited() ),   this, SLOT( productInstalled() ) );
   connect(shellProcess, SIGNAL( wroteToStdin() ),    this, SLOT( wroteToStdin() ) );
+  // catch signals from launched modifyLaProc
+  connect(modifyLaProc, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) );
+  connect(modifyLaProc, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
+  connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) );
+  // catch signals from launched checkFLibProc
+  connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) );
 
   // create validation thread
   myThread = new ProcessThread( this );
@@ -617,7 +626,7 @@ SALOME_InstallWizard::~SALOME_InstallWizard()
 QString SALOME_InstallWizard::getBasePlatform()
 {
   QString aBasePlt = "";
-  if ( singleBinPlts.contains(curPlatform) )
+  if ( platformsMap.find( curPlatform ) != platformsMap.end() )
     aBasePlt = curPlatform;
   else
     aBasePlt = commonPlatform;
@@ -629,10 +638,10 @@ QString SALOME_InstallWizard::getBasePlatform()
  *  Tries to determine the current user's operating system
  */
 // ================================================================
-QString SALOME_InstallWizard::currentPlatform()
+QStringList SALOME_InstallWizard::currentPlatform()
 {
   // file parsing
-  QString curOS = "";
+  QString platName, platVersion, platArch;
   QString osFileName = "/etc/issue";
   if ( QFile::exists( osFileName ) ) {
     QFile file( osFileName );
@@ -640,35 +649,50 @@ QString SALOME_InstallWizard::currentPlatform()
       QTextStream stream( &file );
       QString str = stream.readLine();
       file.close();
-      // line parsing
-      QString pltName = "", platVersion = "", platBit = "";
-      QRegExp rx( "(.*)[L|l]inux.*release\\s+([\\d.]*)" );
-//       str = "Debian GNU/Linux 3.1 \n \l";
-//       str = "Red Hat Enterprise Linux WS release 4 (Nahant)";
-//       str = "Mandriva Linux release 2006.0 (Official) for x86_64";
-      int pos = rx.search( str );
-      if ( pos == -1 ) {// Debian case
-       rx = QRegExp( "(.*)GNU/Linux\\s+([\\d.]*)" );
-       pos = rx.search( str );
+      // parse line
+      QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" );
+      int pos = regvar.search( str );
+      if ( pos == -1 ) {
+       regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" );
+       pos = regvar.search( str );
       }
-      if ( pos > -1 ) {
-       pltName = rx.cap( 1 );
-       platVersion = rx.cap( 2 );
-       rx = QRegExp( "x86_64" );
-       pos = rx.search( str );
-       if ( pos > -1 )
-         platBit = "_64";
-       curOS = pltName + platVersion + platBit;
+      if ( pos >= 0 ) {
+       QStringList name;
+       for ( int i = 1; i < regvar.numCaptures(); i++ )
+         name.append( regvar.cap( i ) );
+
+       // retrieve platform name
+       platName = QStringList::split( " ", name.join( " " ) ).join( " " );
+       platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace();
+       platName = platName.replace( "Welcome to", "" ).stripWhiteSpace();
+        platName = QStringList::split( " ", platName ).join( " " );
+       // retrieve platform version number
+       platVersion = regvar.cap( regvar.numCaptures() );
+       // retrieve platform 
+       utsname uname_data;
+       uname( &uname_data );
+       if ( QString( uname_data.machine ) == "x86_64" )
+         platArch = "64bit";
       }
     }
   }
-  //   return curOS.remove( " " );
-  QString str( " " );
-  int index = 0;
-  while ( (index = curOS.find( str, index, true)) != -1 )
-    curOS.remove( index, str.length() );
-  return curOS;
+  QStringList vals;
+  if ( !platName.isEmpty() )    vals.append( platName ); 
+  if ( !platVersion.isEmpty() ) vals.append( platVersion ); 
+  if ( !platArch.isEmpty() )    vals.append( platArch ); 
+  return vals;
+}
+// ================================================================
+/*!
+ *  SALOME_InstallWizard::getPlatformBinPath
+ *  Get platform binaries path
+ */
+// ================================================================
+QString SALOME_InstallWizard::getPlatformBinPath( const QString& plt ) const
+{
+  return QDir::cleanDirPath( getBinPath() + "/" + QStringList::split( " ", plt ).join( "_" ) );
 }
+
 // ================================================================
 /*!
  *  SALOME_InstallWizard::getXmlMap
@@ -676,17 +700,18 @@ QString SALOME_InstallWizard::currentPlatform()
  *  corresponding XML files.
  */
 // ================================================================
-MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName )
+MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& aXmlFileName )
 {
   MapXmlFiles xmlMap;
   QStringList xmlList;
-  if ( xmlFileName )
-    xmlList.append( xmlFileName );
+  if ( !aXmlFileName.isEmpty() )
+    xmlList.append( aXmlFileName );
   else {
     QDir dir( QDir::currentDirPath() );
     xmlList = dir.entryList( "*.xml", QDir::Files | QDir::Readable );
   }
-//   cout << xmlList.join(",") << endl;
+  if ( xmlList.remove( "config.xml" ) )
+    xmlList.append( "config.xml" );
   // XML files parsing
   QFile file;
   QDomDocument doc( "xml_doc" );
@@ -715,11 +740,10 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName )
        platforms = elem.attribute( "platforms" ).stripWhiteSpace();
        QStringList platList = QStringList::split( ",", platforms );
        for ( uint j = 0; j < platList.count(); j++ ) {
-         if ( !platList[j].isEmpty() && xmlMap.find( platList[j] ) == xmlMap.end() )
+         QString platform = platList[j].stripWhiteSpace();
+         if ( !platform.isEmpty() && xmlMap.find( platform ) == xmlMap.end() )
            xmlMap[ platList[j] ] = xmlList[i];
        }
-//     if ( !curPlatform.isEmpty() && xmlMap.find( curPlatform ) != xmlMap.end() )
-//       return xmlMap;
       }
     }
   }
@@ -734,13 +758,13 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName )
 void SALOME_InstallWizard::getXmlAndPlatform()
 {
   MapXmlFiles xmlMap;
-  if ( xmlFileName.isNull() ) {
+  if ( xmlFileName.isEmpty() ) {
     xmlMap = getXmlMap();
     if ( !curPlatform.isEmpty() ) {
       // try to get XML file for current platform
       if ( xmlMap.find( curPlatform ) != xmlMap.end() ) {
-       xmlFileName = xmlMap[ getBasePlatform() ];
-       QFileInfo fibp( QDir::cleanDirPath( getBinPath() + "/" + getBasePlatform() ) );
+       xmlFileName = xmlMap[ curPlatform ];
+       QFileInfo fibp( getPlatformBinPath( curPlatform ) );
        if ( !fibp.isDir() ) {
          warnMsg = tr( "Binaries are absent for current platform" );
        }
@@ -754,7 +778,7 @@ void SALOME_InstallWizard::getXmlAndPlatform()
     else {
       // get all supported platforms
       platformsMap = xmlMap;
-      warnMsg = tr( "Install Wizard can't define your Linux platform" );
+      warnMsg = tr( "Installation Wizard can't identify target Linux platform" );
     }
   }
   else {
@@ -768,6 +792,9 @@ void SALOME_InstallWizard::getXmlAndPlatform()
          platformsMap.insert( it.key(), it.data(), true );
        warnMsg = tr( "The given configuration file doesn't support your Linux platform" );
       }
+      else {
+       platformsMap = xmlMap;
+      }
     }
     else {
       // get all supported platforms
@@ -775,7 +802,7 @@ void SALOME_InstallWizard::getXmlAndPlatform()
       MapXmlFiles::Iterator it;
       for ( it = xmlMap.begin(); it != xmlMap.end(); ++it )
        platformsMap.insert( it.key(), it.data(), true );
-      warnMsg = tr( "Install Wizard can't define your Linux platform" );
+      warnMsg = tr( "Installation Wizard can't define your Linux platform" );
     }
   }
 }
@@ -1387,7 +1414,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
     if ( installType == Binaries ) { // 'Binary' installation type
       // check binaries directory
       QFileInfo fib( QDir::cleanDirPath( getBinPath() ) );
-      if ( !fib.exists() ) {
+      if ( !fib.isDir() ) {
        QMessageBox::warning( this,
                              tr( "Warning" ),
                              tr( "The directory %1 doesn't exist.\n"
@@ -1407,13 +1434,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
       }
       else {
        // Supported platform case
-       QString aPlatform = curPlatform;
-       if ( curPlatform != getBasePlatform() ) {
-         refPlatform = getBasePlatform();
-         xmlFileName = platformsMap[ refPlatform ];
-         aPlatform = getPlatform();
-       }
-       QFileInfo fibp( QDir::cleanDirPath( getBinPath() + "/" + aPlatform ) );
+       QFileInfo fibp( getPlatformBinPath( curPlatform ) );
        if ( !fibp.isDir() ) {
          warnLab->setText( tr( "Binaries are absent for current platform." ) );
          this->setAppropriate( platformsPage, true );
@@ -1422,7 +1443,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
 
       // check sources directory
       QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
-      if ( !fis.exists() )
+      if ( !fis.isDir() )
        if ( QMessageBox::warning( this,
                                   tr( "Warning" ),
                                   tr( "The directory %1 doesn't exist.\n"
@@ -1436,7 +1457,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
     else { // 'Source' or 'Compile' installation type
       // check sources directory
       QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
-      if ( !fis.exists() ) {
+      if ( !fis.isDir() ) {
        QMessageBox::warning( this,
                              tr( "Warning" ),
                              tr( "The directory %1 doesn't exist.\n"
@@ -1446,6 +1467,15 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
                              QMessageBox::NoButton );
        return false;
       }
+      else if ( !QDir( fis.filePath(), "*.tar.gz" ).count() ) {
+       QMessageBox::warning( this,
+                             tr( "Warning" ),
+                             tr( "The directory %1 doesn't contain source archives.\n" ).arg( fis.absFilePath() ),
+                             QMessageBox::Ok,
+                             QMessageBox::NoButton, 
+                             QMessageBox::NoButton );
+       return false;
+      }
       if ( platformsMap.find( curPlatform ) == platformsMap.end() ) {
        QString aMsg = warnMsg + ".";
        if ( installType == Compile )
@@ -1467,6 +1497,29 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
                            QMessageBox::NoButton );
       return false;
     }
+    else if ( installType == Binaries ) {
+      QString aPlatform = platBtnGrp->selected()->name();
+      QFileInfo fib( getPlatformBinPath( aPlatform ) );
+      if ( !fib.isDir() ) {
+       QMessageBox::warning( this,
+                             tr( "Warning" ),
+                             tr( "The directory %1 doesn't exist.\n"
+                                 "This directory must contains binary archives.\n" ).arg( fib.absFilePath() ),
+                             QMessageBox::Ok,
+                             QMessageBox::NoButton, 
+                             QMessageBox::NoButton );
+       return false;
+      }
+      else if ( QDir( fib.filePath(), "*.tar.gz" ).count() == 0 ) {
+       QMessageBox::warning( this,
+                             tr( "Warning" ),
+                             tr( "The directory %1 doesn't contain binary archives.\n" ).arg( fib.absFilePath() ),
+                             QMessageBox::Ok,
+                             QMessageBox::NoButton, 
+                             QMessageBox::NoButton );
+       return false;
+      }
+    }
   }
 
   else if ( aPage == dirPage ) {
@@ -1486,7 +1539,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle )
       return false;
     }
     QFileInfo fi( QDir::cleanDirPath( targetDir ) );
-    if ( !fi.exists() ) {
+    if ( !fi.isDir() ) {
       bool toCreate =
        QMessageBox::warning( this,
                              tr( "Warning" ),
@@ -1724,6 +1777,79 @@ void SALOME_InstallWizard::updateAvailableSpace()
     availableSize->setText( diskSpaceProc->readLineStdout() + " KB");
 }
 // ================================================================
+/*!
+ *  SALOME_InstallWizard::runModifyLaFiles
+ *  Run the modification of SALOME *.la files
+ */
+// ================================================================
+void SALOME_InstallWizard::runModifyLaFiles()
+{
+  modifyLaProc->clearArguments();
+  // ... update status label
+  statusLab->setText( tr( "Modification of *.la files of SALOME modules..." ) );
+  // set process arguments
+  modifyLaProc->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) );
+  modifyLaProc->addArgument( "modifyLaFiles.sh" );
+  modifyLaProc->addArgument( "modify_la_files" );
+  modifyLaProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) );
+  // ... run script
+  if ( !modifyLaProc->start() )
+    ___MESSAGE___( "Error: process could not start!" );
+}
+// ================================================================
+/*!
+ *  SALOME_InstallWizard::checkModifyLaResult
+ *  Slot to take result of modification SALOME *.la files
+ */
+// ================================================================
+void SALOME_InstallWizard::checkModifyLaResult()
+{
+  if ( modifyLaProc->normalExit() && modifyLaProc->exitStatus() == 1 )
+    runCheckFLib();
+  else {
+    // abort of the current installation
+    abort();
+    statusLab->setText( tr( "Installation has been aborted" ) );
+    QMessageBox::critical( this,
+                          tr( "Error" ),
+                          tr( "Modification of *.la SALOME files has not been completed."),
+                          QMessageBox::Ok,
+                          QMessageBox::NoButton,
+                          QMessageBox::NoButton );
+    // enable <Next> button
+    setNextEnabled( true );
+    nextButton()->setText( tr( "&Start" ) );
+    setAboutInfo( nextButton(), tr( "Start installation process" ) );
+    // reconnect Next button - to use it as Start button
+    disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) );
+    disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+    connect(    this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+    // enable <Back> button
+    setBackEnabled( true );
+  }
+}
+// ================================================================
+/*!
+ *  SALOME_InstallWizard::runCheckFLib
+ *  Run the Fortran libraries checking
+ */
+// ================================================================
+void SALOME_InstallWizard::runCheckFLib()
+{
+  // Check Fortran libraries
+  checkFLibProc->clearArguments();
+  // ... update status label
+  statusLab->setText( tr( "Check Fortran libraries..." ) );
+  // ... search "not found" libraries
+  checkFLibProc->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) );
+  checkFLibProc->addArgument( "checkFortran.sh" );
+  checkFLibProc->addArgument( "find_libraries" );
+  checkFLibProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) );
+  // ... run script
+  if ( !checkFLibProc->start() )
+    ___MESSAGE___( "Error: process could not start!" );
+}
+// ================================================================
 /*!
  *  SALOME_InstallWizard::checkFLibResult
  *  Slot to take result of Fortran libraries checking
@@ -1835,8 +1961,10 @@ void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item )
     return;
   // get all prerequisites
   QStringList dependOn = productsMap[ item ].getDependancies();
-  // install MED without GUI case
-  if ( installGuiBtn->state() != QButton::On && item->text(0) == "MED" ) {
+  // install SALOME without GUI case
+  if ( installGuiBtn->state() != QButton::On && 
+       woGuiModules.find( item->text(0) ) != woGuiModules.end() && 
+       woGuiModules[item->text(0)] == True ) {
     dependOn.remove( "GUI" );
   }
   // setting prerequisites
@@ -1850,6 +1978,7 @@ void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item )
          itProd.key()->setOn( true );
          itProd.key()->setEnabled( false );
        }
+       break;
       }
     }
   }
@@ -1873,12 +2002,6 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item )
   for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
     if ( itProd.data().getType() == productsMap[ item ].getType() ) {
       QStringList dependOn = itProd.data().getDependancies();
-      // install MED without GUI case
-      if ( installGuiBtn->state() != QButton::On && 
-          itProd.data().getName() == "MED" && 
-          itemName != "KERNEL" ) {
-       continue;
-      }
       for ( int i = 0; i < (int)dependOn.count(); i++ ) {
        if ( dependOn[ i ] == itemName ) {
          if ( itProd.key()->isOn() ) {
@@ -1906,6 +2029,7 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item )
              for ( int k = 0; k < (int)prereqsList.count(); k++ ) {
                if ( prereqsList[ k ] == itProd1.data().getName() ) {
                  nbDependents++;
+                 break;
                }
              }
            }
@@ -1915,6 +2039,7 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item )
            itProd1.key()->setOn( false );
          }
        }
+       break;
       }
     }
   }
@@ -1948,7 +2073,7 @@ void SALOME_InstallWizard::launchScript()
     progressView->setStatus( prodProc, Processing );
     progressView->ensureVisible( prodProc );
     
-    QCheckListItem* item;
+    QCheckListItem* item = 0;
     // fill in script parameters
     shellProcess->clearArguments();
     // ... script name
@@ -1961,11 +2086,10 @@ void SALOME_InstallWizard::launchScript()
       shellProcess->addArgument( extraProducts[ prodProc ] );
 
     // ... get folder with binaries
-    QString binDir = QDir::cleanDirPath( getBinPath() );
     QString OS = getPlatform();
-    if ( refPlatform.isEmpty() && singleBinPlts.contains(curPlatform) == 0 )
+    if ( refPlatform.isEmpty() && platformsMap.find( curPlatform ) == platformsMap.end() )
       OS = commonPlatform;
-    binDir += "/" + OS;
+    QString binDir = getPlatformBinPath( OS );
     // ... temp folder
     QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
     //if( !tempFolder->isEnabled() )
@@ -1997,7 +2121,7 @@ void SALOME_InstallWizard::launchScript()
     QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
     shellProcess->addArgument( QFileInfo( tgtFolder ).absFilePath() );
     // ... list of all products
-    QString depproducts = DefineDependeces(productsMap);
+    QString depproducts = getAllProducts(productsMap);
     depproducts.prepend( QStringList( extraProducts.keys() ).join(" ") + " " );
     ___MESSAGE___( "Dependancies"<< depproducts.latin1() );
     shellProcess->addArgument( depproducts );
@@ -2017,29 +2141,31 @@ void SALOME_InstallWizard::launchScript()
       shellProcess->addArgument( "FALSE" );
     // ... binaries directory
     shellProcess->addArgument( binDir );
-    // ... install MED with GUI or not?
-    if ( prodProc == "MED" ) {
-      if ( installGuiBtn->state() != QButton::On && prodProc == "MED" )
-       shellProcess->addArgument( "FALSE" );
-      else
+    // ... install SALOME with GUI or not?
+    if ( woGuiModules.find( prodProc ) != woGuiModules.end() )
+      ( installGuiBtn->state() != QButton::On && woGuiModules[ prodProc ] == True ) ? 
+       shellProcess->addArgument( "FALSE" ) : 
        shellProcess->addArgument( "TRUE" );
-    }
     // ... single installation directory for SALOME modules, if this option was selected
     if ( oneModDirBtn->isChecked() ) {
       MapProducts::Iterator mapIter;
       for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
-       if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" )
-         shellProcess->addArgument( "SALOME" );
+       if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" ) {
+         shellProcess->addArgument( "TRUE" );
+         break;
+       }
     }
     // ... single installation directory for prerequisites, if this option was selected
     if ( oneProdDirBtn->isChecked() ) {
       if ( prodProc == "DebianLibsForSalome" )
-       shellProcess->addArgument( "PRODUCTS" );
+       shellProcess->addArgument( oneProdDirName );
       else {
        MapProducts::Iterator mapIter;
        for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
-         if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" )
-           shellProcess->addArgument( "PRODUCTS" );
+         if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" ) {
+           shellProcess->addArgument( oneProdDirName );
+           break;
+         }
       }
     }
     
@@ -2054,7 +2180,7 @@ void SALOME_InstallWizard::launchScript()
   // all products are installed successfully
   MapProducts::Iterator mapIter;
   ___MESSAGE___( "starting pick-up environment" );
-  QString depproducts = QUOTE( DefineDependeces(productsMap).prepend( QStringList( extraProducts.keys() ).join(" ") + " " ) );
+  QString depproducts = QUOTE( getAllProducts(productsMap).prepend( QStringList( extraProducts.keys() ).join(" ") + " " ) );
   for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
     QCheckListItem* item = mapIter.key();
     Dependancies dep = mapIter.data();
@@ -2077,24 +2203,17 @@ void SALOME_InstallWizard::launchScript()
       }
     }
   }
-  
+
   if ( installType == Binaries ) {
-    // Check Fortran libraries
-    // ... update status label
-    statusLab->setText( tr( "Check Fortran libraries..." ) );
-    // ... search "not found" libraries
-    checkFLibProc->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) );
-    checkFLibProc->addArgument( "checkFortran.sh" );
-    checkFLibProc->addArgument( "find_libraries" );
-    checkFLibProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) );
-    // ... run script
-    if ( !checkFLibProc->start() ) {
-      ___MESSAGE___( "Error: process could not start!" );
-    }
+    if ( oneModDirBtn->isChecked() )
+      runModifyLaFiles();
+    else
+      runCheckFLib();
   }
-  else
+  else {
     // Update GUI and check installation errors
     completeInstallation();
+  }
   
 }
 // ================================================================
@@ -2156,8 +2275,8 @@ void SALOME_InstallWizard::onInstallGuiBtn()
       }
       else {
        QString itemName = itProd.data().getName();
-       if ( itemName != "KERNEL" && itemName != "MED" && 
-            itemName != "SAMPLES" && itemName != "DOCUMENTATION" ) {
+       if ( woGuiModules.find( itemName ) == woGuiModules.end() || 
+            woGuiModules[ itemName ] == False ) {
          itProd.key()->setOn( false );
          itProd.key()->setEnabled( false );
        }
@@ -2325,7 +2444,7 @@ void SALOME_InstallWizard::clean(bool rmDir)
   QString script = "cd ./config_files/; remove_tmp.sh '";
   script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME;
   script += "' ";
-  script += QUOTE(DefineDependeces(productsMap));
+  script += QUOTE(getAllProducts(productsMap));
   script += " > /dev/null";
   ___MESSAGE___( "script = " << script.latin1() );
   if ( system( script.latin1() ) ) {
@@ -2364,7 +2483,10 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
   if ( aPage == typePage ) {
     // installation type page
     if ( buttonGrp->id( buttonGrp->selected() ) == -1 )
-      binBtn->animateClick(); // set default installation type
+      // set default installation type
+      forceSrc ? srcCompileBtn->animateClick() : binBtn->animateClick();
+    else
+      buttonGrp->selected()->animateClick();
   }
   else if ( aPage == platformsPage ) {
     // installation platforms page
@@ -2374,16 +2496,14 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
        QString plat = it.key();
        QRadioButton* rb = ( (QRadioButton*) platBtnGrp->child( plat ) );
        if ( installType == Binaries ) {
-         QFileInfo fib( QDir::cleanDirPath( getBinPath() + "/" + plat ) );
-         rb->setEnabled( fib.exists() );
+         QFileInfo fib( getPlatformBinPath( plat ) );
+         rb->setEnabled( true/*fib.isDir()*/ );
          if ( platBtnGrp->id( platBtnGrp->selected() ) == -1 && plat == getBasePlatform() )
            rb->animateClick();
        }
-       else {
-         QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
-         rb->setEnabled( fis.exists() );
-       }
-       rb->setChecked( rb->isChecked() && rb->isEnabled() );
+//     rb->setChecked( rb->isChecked() && rb->isEnabled() );
+       if ( rb->isChecked() && rb->isEnabled() )
+         rb->animateClick();
       }
       setNextEnabled( platformsPage, platBtnGrp->id( platBtnGrp->selected() ) != -1 );
     }
@@ -2405,6 +2525,16 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
       if ( tempFolder->text().isEmpty() )
        parser->setTempDir( tempFolder );
       parser->readXmlFile( xmlFileName );
+      // create a map of SALOME modules names, that can support installation without GUI mode
+      if ( woGuiModules.isEmpty() ) {
+       MapProducts::Iterator mapIter;
+       for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); mapIter++ ) {
+         Dependancies dep = mapIter.data();
+         if ( dep.getType() == "component" && dep.supportWoGuiMode() != NotDefined )
+           woGuiModules[ dep.getName() ] = dep.supportWoGuiMode();
+       }
+      }
+  
       // update required size for each product
       updateSizeColumn();
       // take into account command line parameters
@@ -2496,19 +2626,20 @@ void SALOME_InstallWizard::onButtonGroup( int rbIndex )
     installType = InstallationType( rbIndex );
     // management of the <Remove source and tmp files> check-box
     removeSrcBtn->setEnabled( installType == Compile );
-    oneModDirBtn->setEnabled( installType == Binaries || installType == Compile );
+    oneModDirBtn->setEnabled( installType == Binaries /*|| installType == Compile*/ );
     oneProdDirBtn->setEnabled( installType == Binaries || installType == Compile );
+    refPlatform = "";
+    xmlFileName = getXmlFile( curPlatform );
   }
   else if ( aPage == platformsPage ) {
     refPlatform = platBtnGrp->find( rbIndex )->name();
-    xmlFileName = platformsMap[ refPlatform ];
-//     cout << xmlFileName << endl;
+    xmlFileName = getXmlFile( refPlatform );
     setNextEnabled( platformsPage, true );
   }
   if ( prevType != installType || 
        ( indexOf( platformsPage ) != -1 ? prevPlat != getPlatform() : false ) ) {
     stateChanged = true;
-    oneModDirBtn->setChecked( false );
+    oneModDirBtn->setChecked( installType == Binaries && singleDir );
     oneProdDirBtn->setChecked( false );
   }
 }
@@ -2580,6 +2711,7 @@ void SALOME_InstallWizard::onStart()
   if ( nextButton()->text() == tr( "&Stop" ) ) {
     statusLab->setText( tr( "Aborting installation..." ) );
     shellProcess->kill();
+    modifyLaProc->kill();
     while( shellProcess->isRunning() );
     statusLab->setText( tr( "Installation has been aborted by user" ) );
     return;
@@ -2840,6 +2972,8 @@ void SALOME_InstallWizard::tryTerminate()
 void SALOME_InstallWizard::onCancel()
 {
   shellProcess->kill();
+  modifyLaProc->kill();
+  checkFLibProc->kill();
   reject();
 }
 // ================================================================
@@ -2918,11 +3052,12 @@ void SALOME_InstallWizard::wroteToStdin( )
 void SALOME_InstallWizard::readFromStdout( )
 {
   ___MESSAGE___( "Something was sent to stdout" );
-  while ( shellProcess->canReadLineStdout() ) {
-    installInfo->append( QString( shellProcess->readLineStdout() ) );
+  QProcess* theProcess = ( QProcess* )sender();
+  while ( theProcess->canReadLineStdout() ) {
+    installInfo->append( QString( theProcess->readLineStdout() ) );
     installInfo->scrollToBottom();
   }
-  QString str( shellProcess->readStdout() );
+  QString str( theProcess->readStdout() );
   if ( !str.isEmpty() ) {
     installInfo->append( str );
     installInfo->scrollToBottom();
@@ -2940,12 +3075,13 @@ void SALOME_InstallWizard::readFromStdout( )
 void SALOME_InstallWizard::readFromStderr( )
 {
   ___MESSAGE___( "Something was sent to stderr" );
-  while ( shellProcess->canReadLineStderr() ) {
-    installInfo->append( OUTLINE_TEXT( QString( shellProcess->readLineStderr() ) ) );
+  QProcess* theProcess = ( QProcess* )sender();
+  while ( theProcess->canReadLineStderr() ) {
+    installInfo->append( OUTLINE_TEXT( QString( theProcess->readLineStderr() ) ) );
     installInfo->scrollToBottom();
     hasErrors = true;
   }
-  QString str( shellProcess->readStderr() );
+  QString str( theProcess->readStderr() );
   if ( !str.isEmpty() ) {
     installInfo->append( OUTLINE_TEXT( str ) );
     installInfo->scrollToBottom();