diff options
Diffstat (limited to 'buildtools/autotools/autoprojectpart.cpp')
-rw-r--r-- | buildtools/autotools/autoprojectpart.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/buildtools/autotools/autoprojectpart.cpp b/buildtools/autotools/autoprojectpart.cpp index 5e282acf..21df4fd8 100644 --- a/buildtools/autotools/autoprojectpart.cpp +++ b/buildtools/autotools/autoprojectpart.cpp @@ -38,6 +38,7 @@ #include <kdialogbase.h> #include <kiconloader.h> #include <klocale.h> +#include <kstandarddirs.h> #include <kmessagebox.h> #include <kparts/part.h> #include <tdeversion.h> @@ -144,6 +145,13 @@ AutoProjectPart::AutoProjectPart(TQObject *parent, const char *name, const TQStr action->setWhatsThis(i18n("<b>Run automake && friends</b><p>Executes<br><b>make -f Makefile.cvs</b><br><b>./configure</b><br>commands from the project directory.")); action->setGroup("autotools"); + action = new KAction( i18n("Update admin module"), 0, + this, TQT_SLOT(slotUpdateAdminDirectory()), + actionCollection(), "build_updateadmin" ); + action->setToolTip(i18n("Update admin module")); + action->setWhatsThis(i18n("<b>Update admin module</b><p>Recreates the project admin directory using the version present on the local system.")); + action->setGroup("autotools"); + action = new KAction( i18n("Install"), 0, this, TQT_SLOT(slotInstall()), actionCollection(), "build_install" ); @@ -1019,9 +1027,78 @@ TQString AutoProjectPart::makefileCvsCommand() const dircmd += KProcess::quote(topsourceDirectory()); dircmd += " && "; + TQString admin_directory_update_command = updateAdminDirectoryCommand(); + TQString libtool_update_cmdline = makefileCopySystemLibtoolCommand(); + + if (admin_directory_update_command != "") { + return admin_directory_update_command + " && " + libtool_update_cmdline + " && " + dircmd + cmdline; + } + else { + if (libtool_update_cmdline != "") { + return libtool_update_cmdline + " && " + dircmd + cmdline; + } + else { + return dircmd + cmdline; + } + } +} + +TQString AutoProjectPart::makefileCopySystemLibtoolCommand() const +{ + TQString cmdline = "[ ! -f /usr/share/libtool/ltmain.sh ] || cp -f /usr/share/libtool/ltmain.sh admin/ltmain.sh &&" + "[ ! -f /usr/share/libtool/config/ltmain.sh ] || cp -f /usr/share/libtool/config/ltmain.sh admin/ltmain.sh &&" + "cp -f /usr/share/aclocal/libtool.m4 admin/libtool.m4.in"; + + int prio = DomUtil::readIntEntry(*projectDom(), "/kdevautoproject/make/prio"); + TQString nice; + kdDebug(9020) << "makefileCopySystemLibtoolCommand() nice = " << prio<< endl; + if (prio != 0) { + nice = TQString("nice -n%1 ").arg(prio); + } + + cmdline.prepend(nice); + cmdline.prepend(makeEnvironment()); + + TQString dircmd = "cd "; + dircmd += KProcess::quote(topsourceDirectory()); + dircmd += " && "; + return dircmd + cmdline; } +TQString AutoProjectPart::updateAdminDirectoryCommand() const +{ + TQString source; + TQString dest; + TQString option; + bool process; + + // Find the admin tarball + KStandardDirs dirs; + dirs.addResourceType("apptemplates", KStandardDirs::kde_default("data") + "kdevappwizard/template-common/"); + source = dirs.findResource("apptemplates", "admin.tar.gz"); + if (source != "") { + TQString cmdline = "rm -rf admin && tar -xzvf "; + cmdline.append(source); + TQString dircmd = "cd "; + dircmd += KProcess::quote(topsourceDirectory()); + dircmd += " && "; + return dircmd + cmdline; + } + else { + return TQString::null; + } +} + +void AutoProjectPart::slotUpdateAdminDirectory() +{ + TQString cmdline = updateAdminDirectoryCommand(); + if ( cmdline.isNull() ) + return; + + makeFrontend()->queueCommand(projectDirectory(), cmdline); +} + void AutoProjectPart::slotMakefilecvs() { TQString cmdline = makefileCvsCommand(); |