[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    Automake.am - Directory variables naming issue - patch
From:       Lorenzo Delana <ldelana () libero ! it>
Date:       2001-06-27 13:34:55
[Download RAW message or body]

Patch file:	automake_dir_var_name.patch
Affected files:	kdevelop/kdevelop/cproject.{h,cpp}
CVS Sync:	Jun 27 14:33
Branch:		KDEVELOP_1_4
Generated by:	Lorenzo Delana <ldelana@libero.it>
Generated with:	patch -u --new-file <cvs_file> <patched_file>
Short Descr.:	apply nameing convention for automake directory variables
Long Descr.:	(from automake manual)
/** How derived variables are named (...from GNU automake manual)
	 * Sometimes a Makefile variable name is derived from some text the user
	 * supplies. For instance program names are rewritten into Makefile macro
	 * names. Automake canonicalizes this text, so that it does not have to
	 * follow Makefile variable naming rules. All characters in the name except
	 * for letters, numbers, and the underscore are turned into underscores when
	 * making macro references. E.g., if your program is named sniff-glue, the
	 * derived variable name would be sniff_glue_SOURCES, not 
sniff-glue_SOURCES. */
Backward Compatibility:	all (y have to touch bugged Makefile.am to let 
KDevelop recreate it)
Test rule:	create a project, add a folder with name "test-one.org" and create 
into it a class "test", then try....

to apply this patch, from outside source tree of kdevelop:

	patch -p0 < automake_dir_var_name.patch

Note: CVS Sync in the report, refers to my CVS snapshot that I have used to 
make the patch.

bye
Lore
["automake_dir_var_name.patch" (text/x-c++)]

--- /usr/src4/kdevelop/kdevelop/cproject.h	Wed Jun 27 14:33:54 2001
+++ kdevelop/kdevelop/cproject.h	Wed Jun 27 15:22:54 2001
@@ -525,6 +525,17 @@
   QString getDir(const QString& rel_name);
   QString getName(const QString& rel_name);
 
+protected: // Protected methods
+  /** How derived variables are named (...from GNU automake manual)
+   * Sometimes a Makefile variable name is derived from some text the user
+   * supplies. For instance program names are rewritten into Makefile macro
+   * names. Automake canonicalizes this text, so that it does not have to
+   * follow Makefile variable naming rules. All characters in the name except
+   * for letters, numbers, and the underscore are turned into underscores when
+   * making macro references. E.g., if your program is named sniff-glue, the
+   * derived variable name would be sniff_glue_SOURCES, not sniff-glue_SOURCES. */	
+  QString canonicalDirName(QString dir_name);
+
 private: // Protected attributes
 
   /** The actual project file. */
--- /usr/src4/kdevelop/kdevelop/cproject.cpp	Wed Jun 27 14:33:53 2001
+++ kdevelop/kdevelop/cproject.cpp	Wed Jun 27 15:22:53 2001
@@ -852,13 +852,13 @@
             stream << "\nINCLUDES = $(all_includes)\n\n";
 
           if (QFileInfo(getProjectDir() + "am_edit").exists() \
                ||QFileInfo(getProjectDir() + "admin/am_edit").exists())
-            stream << "lib" << dir.dirName() << "_a_METASOURCES = AUTO\n\n";
+            stream << "lib" << canonicalDirName(dir.dirName()) << "_a_METASOURCES = \
AUTO\n\n";  else
             if (QFileInfo(getProjectDir() + "automoc").exists())
-              stream << "lib" << dir.dirName() << "_a_METASOURCES = \
USE_AUTOMOC\n\n"; +              stream << "lib" << canonicalDirName(dir.dirName()) \
<< "_a_METASOURCES = USE_AUTOMOC\n\n";  
           stream << "noinst_LIBRARIES = lib" << dir.dirName() << ".a\n\n";
-          stream << "lib" << dir.dirName() << "_a_SOURCES = " << sources << "\n";
+          stream << "lib" << canonicalDirName(dir.dirName()) << "_a_SOURCES = " << \
sources << "\n";  if(isQt2Project())
             // am_edit used only for qt apps requires this switch in Makefile.am´s \
to use tr instead of i18n and other specific stuff  stream << "KDE_OPTIONS = \
qtonly\n"; @@ -1910,4 +1910,14 @@
 {
   CKDevelop* gkdevelop = dynamic_cast<CKDevelop*>(qApp->mainWidget());
   return gkdevelop?gkdevelop->getProject():0L;
+}
+
+QString CProject::canonicalDirName(QString dir_name)
+{
+  QString canonical_dir_name = dir_name;
+	
+  // replaces all character, except for [A-Za-z0-9_] class, with underscore
+  canonical_dir_name.replace(QRegExp("[^A-Za-z0-9_]"), "_");
+	
+  return canonical_dir_name;
 }


-
to unsubscribe from this list send an email to kdevelop-devel-request@kdevelop.org \
with the following body: unsubscribe »your-email-address«



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic