Bug 71003

Summary: Cannot translate project due to srcdir != builddir.
Product: [Applications] kdevelop Reporter: Pupeno <pupeno>
Component: generalAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal CC: elendil
Priority: NOR    
Version: 3.0.0b1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch for translation problems

Description Pupeno 2003-12-22 00:24:41 UTC
Version:           3.0.0b1 (using KDE 3.1.4)
Compiler:          gcc version 3.3.2 (Ark Linux 1.0 3.3.2-1ark)
OS:          Linux (i686) release 2.4.23-2ark

If you try to make messages and merge with the new project layout of KDevelop, you get the following errors (because srcdir != builddir):
*cd /home/pupeno/src/delme/debug && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k -j1 package-messages 
*gmake -f admin/Makefile.common package-messages 
*gmake[1]: Entering directory `/home/pupeno/src/delme/debug' 
*gmake[1]: admin/Makefile.common: No such file or directory 
*gmake[1]: *** No rule to make target `admin/Makefile.common'. 
*gmake[1]: Failed to remake makefile `admin/Makefile.common'. 
*gmake[1]: *** No rule to make target `package-messages'. 
*gmake[1]: Leaving directory `/home/pupeno/src/delme/debug' 
*gmake: *** [package-messages] Error 2 
**** Exited with status: 2 ***

that is because the makefile on debug can't find admin/Makefile.common
If I hack it to look for ../admin/Makefile.common, I get other errors, so, I think this needs a real solution, the errors I get, for example are: 
*cd /home/pupeno/src/delme/debug && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k -j1 package-messages 
*gmake -f ../admin/Makefile.common package-messages 
*gmake[1]: Entering directory `/home/pupeno/src/delme/debug' 
*gmake[1]: Leaving directory `/home/pupeno/src/delme/debug' 
*gmake -C po merge 
*gmake[1]: Entering directory `/home/pupeno/src/delme/debug/po' 
*gmake -f /home/pupeno/src/delme/admin/Makefile.common package-merge POFILES="es.po" PACKAGE=delme 
*gmake[2]: Entering directory `/home/pupeno/src/delme/debug/po' 
*msgmerge: error while opening "es.po" for reading: No such file or directory 
*gmake[2]: Leaving directory `/home/pupeno/src/delme/debug/po' 
*gmake[1]: Leaving directory `/home/pupeno/src/delme/debug/po' 
**** Success ***

Thanks.
Comment 1 Amilcar do Carmo Lucas 2004-01-09 15:55:29 UTC
*** Bug 71644 has been marked as a duplicate of this bug. ***
Comment 2 Amilcar do Carmo Lucas 2004-01-09 18:43:54 UTC
Subject: kdevelop

CVS commit by aclu: 

Partly fix "Cannot translate project due to srcdir != builddir" 71003
http://bugs.kde.org/show_bug.cgi?id=71003

Please read kdevelop/languages/cpp/app_templates/kapp/README and test it.

CCMAIL: 71003@bugs.kde.org


  M +1 -1      Makefile.am   1.92
  M +1 -1      parts/appwizard/common/kde-Makefile.am   1.2


--- kdevelop/parts/appwizard/common/kde-Makefile.am  #1.1.1.1:1.2
@@ -13,5 +13,5 @@
 
 package-messages:
-        $(MAKE) -f admin/Makefile.common package-messages
+        $(MAKE) -f $(top_srcdir)/admin/Makefile.common package-messages
         $(MAKE) -C po merge
 

--- kdevelop/Makefile.am  #1.91:1.92
@@ -25,5 +25,5 @@
 
 package-messages:
-        $(MAKE) -f admin/Makefile.common package-messages
+        $(MAKE) -f $(top_srcdir)/admin/Makefile.common package-messages
         $(MAKE) -C po merge
 


Comment 3 Frans Pop 2004-01-09 20:28:41 UTC
Subject: Re:  Cannot translate project due to srcdir != builddir.

On Friday 09 January 2004 18:43, you wrote:
>
> Please read kdevelop/languages/cpp/app_templates/kapp/README and test it.
>

Could you please also take a look at http://bugs.kde.org/show_bug.cgi?id=71625 
as it is related and I don't think a test of Make Massages and Merge will 
work completely until that is fixed as well.

Will test both fixes after your reply.

Thanks for fixing this (and also 71633).

P.S. I already have the patched gettext.

Comment 4 Pupeno 2004-01-19 05:48:54 UTC
Note that with that patch, the problem that gives the error:

gmake[1]: Entering directory `/home/pupeno/src/ScoreReadingTrainer/ScoreReadingTrainer/debug/po' 
*gmake -f /home/pupeno/src/ScoreReadingTrainer/ScoreReadingTrainer/admin/Makefile.common package-merge POFILES="es.po" PACKAGE=ScoreReadingTrainer 
*gmake[2]: Entering directory `/home/pupeno/src/ScoreReadingTrainer/ScoreReadingTrainer/debug/po' 
*msgmerge: error while opening "es.po" for reading: No such file or directory 
*gmake[2]: Leaving directory `/home/pupeno/src/ScoreReadingTrainer/ScoreReadingTrainer/debug/po'

remains.

Thanks
Comment 5 Frans Pop 2004-01-25 02:17:22 UTC
Created attachment 4339 [details]
Patch for translation problems

Hi. Sorry for my late reaction to the patch, but I noticed the same problem as
Pupeno reported and had little time until now to properly test it.

The good news: attached is a patch that fixes both 'Project/Add Translation'
and 'Build/Make Messages & Merge'.
The patch has been tested on Debian Woody with KDE 3.1.4 and the kdevelop
Debian source package from http://people.debian.org/~njordan/stable
(kdevelop3_3.0-01cvs from CVS 06-01-2004) using the "Simple KDE Application"
project template.

I am not sure it is the best way to fix both, but I hope it will at least give
those who really know what they're doing a pointer in the right direction.
Below I have listed the reasons for the different patches.

1. buildtools/autotools/addtranslationdlg.cpp
Problem here was that a make was called in <projectDir>/po, but when Build
configuration is debug there is no makefile in that directory.
So the make has to be called from <buildDir>/po.
The 'force-reedit' works fine because it changes internally to <projectDir>/po
for most of it's actual work.

2. parts/appwizard/common/kde-Makefile.am
This patch is slightly different from the patch proposed earlier.
'make-messages' has to work in the <projectDir> tree, taking the source from
<projectDir>/src and writing the .pot file to <projectDir>/po.

3. parts/appwizard/common/admin/am_edit
The '$(MAKE) -C po merge' form 'make messages' again needs to work in the
<projectDir>/po directory, merging the .pot file into the .po files.

I had to make one final change to make all this work in Debian and that was to
change the location of the kde.pot file in admin/cvs.sh to
/usr/include/kde/kde.pot (see http://bugs.kde.org/show_bug.cgi?id=71625).
However, this may be a Debian packaging problem, so I am going to close 71625
and report it to bugs.debian.org.

After executing 'Project/Add Translation' and 'Build/Make Messages & Merge'
followed by 'Build/Build Project' the result was a good .gmo file in the
debug/po directory.

Possibly these patches should also be applied in the admin/am_edit and
Makefile.am for kdevelop itself, but I'll leave that to you...

P.S.
I have also tested the patch for http://bugs.kde.org/show_bug.cgi?id=71633.
That works great. Thanks!
Comment 6 Amilcar do Carmo Lucas 2004-01-25 18:04:06 UTC
Thanks for the patch, looks good. I'll give it a try!
Comment 7 Amilcar do Carmo Lucas 2004-01-25 21:22:24 UTC
Subject: kdevelop

CVS commit by aclu: 

This patch fixes:
Bug 71003 : Cannot translate project due to srcdir != builddir.
Bug 73467: Incomplete make clean for parts/appwizard/common

1. buildtools/autotools/addtranslationdlg.cpp
Problem here was that a make was called in <projectDir>/po, but when Build
configuration is debug there is no makefile in that directory.
So the make has to be called from <buildDir>/po.
The 'force-reedit' works fine because it changes internally to <projectDir>/po
for most of it's actual work.

2. parts/appwizard/common/kde-Makefile.am
This patch is slightly different from the patch proposed earlier.
'make-messages' has to work in the <projectDir> tree, taking the source from
<projectDir>/src and writing the .pot file to <projectDir>/po.

3. parts/appwizard/common/admin/am_edit
The '$(MAKE) -C po merge' form 'make messages' again needs to work in the
<projectDir>/po directory, merging the .pot file into the .po files.

4. parts/appwizard/common/Makefile.am
'make clean' does not remove the *.tar.gz files created in the parts/appwizard/common directory.

To make this patch work you need to:
cd parts/appwizard/common 
make clean

Thanks to Frans Pop <aragorn  IN tiscali.nl> for the patch.

CCMAIL: 71003-done@bugs.kde.org
CCMAIL: 73467-done@bugs.kde.org


  M +1 -0      buildtools/autotools/addtranslationdlg.cpp   1.8
  M +2 -0      parts/appwizard/common/Makefile.am   1.14
  M +1 -1      parts/appwizard/common/kde-Makefile.am   1.3
  M +2 -2      parts/appwizard/common/admin/am_edit   1.6


--- kdevelop/buildtools/autotools/addtranslationdlg.cpp  #1.7:1.8
@@ -100,4 +100,5 @@ void AddTranslationDialog::accept()
     f.close();
 
+    dir = m_part->buildDirectory() + "/po";
     m_part->startMakeCommand(dir, QString::fromLatin1("force-reedit"));
 

--- kdevelop/parts/appwizard/common/admin/am_edit  #1.5:1.6
@@ -1612,5 +1612,5 @@
 
   if (!$lang) {
-    appendLines("merge:\n\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common package-merge POFILES=\"\${POFILES}\" PACKAGE=\${PACKAGE}\n\n");
+    appendLines("merge:\n\t\$(MAKE) -C \$(top_srcdir)/po -f \$(top_srcdir)/admin/Makefile.common package-merge POFILES=\"\${POFILES}\" PACKAGE=\${PACKAGE}\n\n");
   }
  

--- kdevelop/parts/appwizard/common/Makefile.am  #1.13:1.14
@@ -1,2 +1,4 @@
+CLEANFILES = *.tar.gz
+
 admin.tar.gz:
         $(TAR) -cf admin.tar -C $(srcdir) admin

--- kdevelop/parts/appwizard/common/kde-Makefile.am  #1.2:1.3
@@ -13,5 +13,5 @@
 
 package-messages:
-        $(MAKE) -f $(top_srcdir)/admin/Makefile.common package-messages
+        cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
         $(MAKE) -C po merge
 


Comment 8 Manuel Fierlbeck 2004-07-25 21:59:43 UTC
Patch #3 for am_edit has not been applied in app templates for kdevelop-3.0.92, meaning that the package-merge step will fail. I looked in $KDEDIR/share/apps/kdevappwizard/template-common/admin.tar.gz#admin/am_edit in order to repair a kdevproject that had this bug. kde-Makefile.am is OK.