[Cmake] Patch: Unix Makefile staged install

Maitland Bottoms bottoms at debian . org
Wed, 19 Dec 2001 16:13:32 -0500


--/W6e0jwRb2
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

Hi,

This patch gives cmake the ability to do staged installs, as I
described them in some of my earlier posts to this list.

Submitted for your examination and consideration for inclusion into
the cmake CVS and future releases.

-Maitland


--/W6e0jwRb2
Content-Type: text/plain
Content-Description: Unix Makefile install target patch
Content-Disposition: inline;
	filename="staged-install.diff"
Content-Transfer-Encoding: 7bit

--- cmake-0.98.orig/Source/cmUnixMakefileGenerator.cxx
+++ cmake-0.98/Source/cmUnixMakefileGenerator.cxx
@@ -1274,13 +1274,13 @@
     if (l->second.GetInstallPath() != "")
       {
       // first make the directories for each target 
-      fout << "\t at if [ ! -d " << prefix << l->second.GetInstallPath() << 
+      fout << "\t at if [ ! -d $(DESTDIR)" << prefix << l->second.GetInstallPath() << 
 	" ] ; then \\\n";
-      fout << "\t   echo \"Making directory " << prefix 
+      fout << "\t   echo \"Making directory $(DESTDIR)" << prefix 
 	   << l->second.GetInstallPath() << " \"; \\\n";
-      fout << "\t   mkdir -p " << prefix << l->second.GetInstallPath() 
+      fout << "\t   mkdir -p $(DESTDIR)" << prefix << l->second.GetInstallPath() 
 	   << "; \\\n";
-      fout << "\t   chmod 755 " <<  prefix << l->second.GetInstallPath() 
+      fout << "\t   chmod 755 $(DESTDIR)" <<  prefix << l->second.GetInstallPath() 
 	   << "; \\\n";
       fout << "\t else true; \\\n";
       fout << "\t fi\n";
@@ -1291,26 +1291,26 @@
 	  fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib" 
                << l->first;
           fout << ".a";
-	  fout << " " << prefix << l->second.GetInstallPath() << "\n";
+	  fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
 	  break;
 	case cmTarget::SHARED_LIBRARY:
 	  fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib" 
                << l->first;
           fout << m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
-	  fout << " " << prefix << l->second.GetInstallPath() << "\n";
+	  fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
 	  break;
 	case cmTarget::MODULE_LIBRARY:
 	  fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib" 
                << l->first;
           fout << m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
-	  fout << " " << prefix << l->second.GetInstallPath() << "\n";
+	  fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
 	  break;
 	case cmTarget::WIN32_EXECUTABLE:
 	case cmTarget::EXECUTABLE:
           fout << "\t$(INSTALL_PROGRAM) " << m_ExecutableOutputPath 
                << l->first
                << cmSystemTools::GetExecutableExtension()
-	       << " " << prefix << l->second.GetInstallPath() << "\n";
+	       << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
 	  break;
 	case cmTarget::INSTALL_FILES:
 	  {
@@ -1331,7 +1331,7 @@
               fout << "\t   $(INSTALL_DATA) ";
               }
 	    fout << *i
-		 << " " << prefix << l->second.GetInstallPath() << "; \\\n";
+		 << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
 	    fout << "\t elif [ -f $(CMAKE_CURRENT_SOURCE)/" << *i << " ] ; then \\\n";
             // avoid using install-sh to install install-sh
             // does not work on windows....
@@ -1344,7 +1344,7 @@
               fout << "\t   $(INSTALL_DATA) ";
               }
 	    fout << "$(CMAKE_CURRENT_SOURCE)/" << *i 
-		 << " " << prefix << l->second.GetInstallPath() << "; \\\n";
+		 << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
 	    fout << "\telse \\\n";
 	    fout << "\t   echo \" ERROR!!! Unable to find: " << *i 
 		 << " \"; \\\n";	 
@@ -1371,7 +1371,7 @@
               fout << "\t   $(INSTALL_PROGRAM) ";
               }
 	    fout << *i
-		 << " " << prefix << l->second.GetInstallPath() << "; \\\n";
+		 << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
 	    fout << "\t elif [ -f $(CMAKE_CURRENT_SOURCE)/" << *i << " ] ; then \\\n";
             // avoid using install-sh to install install-sh
             // does not work on windows....
@@ -1384,7 +1384,7 @@
               fout << "\t   $(INSTALL_PROGRAM) ";
               }
 	    fout << "$(CMAKE_CURRENT_SOURCE)/" << *i 
-		 << " " << prefix << l->second.GetInstallPath() << "; \\\n";
+		 << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
 	    fout << "\telse \\\n";
 	    fout << "\t   echo \" ERROR!!! Unable to find: " << *i 
 		 << " \"; \\\n";	 

--/W6e0jwRb2--