diff mbox series

[1/1] autotools.bbclass: Copy gettext/po/Makefile.in.in to all po/Makefile.in.in

Message ID ec444128381202080ec89649e127d0e6ae6cbdf5.1747817251.git.liezhi.yang@windriver.com
State New
Headers show
Series [1/1] autotools.bbclass: Copy gettext/po/Makefile.in.in to all po/Makefile.in.in | expand

Commit Message

Robert Yang May 21, 2025, 8:50 a.m. UTC
From: Robert Yang <liezhi.yang@windriver.com>

The previous code only copied to ${S}/po/Makefile.in.in, but there might be
other po/Makefile.in.in in ${S}, for example:
* bison:
  runtime-po/Makefile.in.in
  gnulib-po/Makefile.in.in

* gawk:
  extension/po/Makefile.in.in

* fontconfig
  po-conf/Makefile.in.in

* There might be more recipes in oe-core, and more recipes from other layers.

The build would be failed after upgrade gettext to 0.24.1 since gettext changed
the way to include Makevars, so we have to fix the recipes one by one, such as:
do_configure:prepend() {
    cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/runtime-po/
    cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/gnulib-po/
}

Even if we don't upgrade gettext to 0.24.1, have different po/Makefile.in.in in
the same ${S} is a kind of bug, this patch can fix the issues.

The fix way is:
Find all possible po/Makefile.in.in, if it is the same as ${S}/po/Makefile.in.in,
then override it with ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes-recipe/autotools.bbclass | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

Gyorgy Sarvari May 21, 2025, 8:55 a.m. UTC | #1
On 5/21/25 10:50, Robert Yang via lists.openembedded.org wrote:
> From: Robert Yang <liezhi.yang@windriver.com>
>
> The previous code only copied to ${S}/po/Makefile.in.in, but there might be
> other po/Makefile.in.in in ${S}, for example:
> * bison:
>   runtime-po/Makefile.in.in
>   gnulib-po/Makefile.in.in
>
> * gawk:
>   extension/po/Makefile.in.in
>
> * fontconfig
>   po-conf/Makefile.in.in
>
> * There might be more recipes in oe-core, and more recipes from other layers.
>
> The build would be failed after upgrade gettext to 0.24.1 since gettext changed
> the way to include Makevars, so we have to fix the recipes one by one, such as:
> do_configure:prepend() {
>     cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/runtime-po/
>     cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/gnulib-po/
> }
>
> Even if we don't upgrade gettext to 0.24.1, have different po/Makefile.in.in in
> the same ${S} is a kind of bug, this patch can fix the issues.
>
> The fix way is:
> Find all possible po/Makefile.in.in, if it is the same as ${S}/po/Makefile.in.in,
> then override it with ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in.
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/classes-recipe/autotools.bbclass | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/autotools.bbclass b/meta/classes-recipe/autotools.bbclass
> index 948f8c183a..d4138bfc57 100644
> --- a/meta/classes-recipe/autotools.bbclass
> +++ b/meta/classes-recipe/autotools.bbclass
> @@ -188,8 +188,28 @@ autotools_do_configure() {
>  		elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
>  			# We'd call gettextize here if it wasn't so broken...
>  			cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
> +			# Find all possible po/Makefile.in.in, if it is the same as
> +			# po/Makefile.in.in, then override it with
> +			# ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in.
>  			if [ -d ${S}/po/ ]; then
> -				cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/
> +				makefile_in_in_top=${S}/po/Makefile.in.in
> +				need_copy=$makefile_in_in_top
> +				if [ -f $makefile_in_in_top ]; then
> +					makefile_in_ins="$(find ${S} -name Makefile.in.in)"
> +					for makefile_in_in in $makefile_in_ins; do
> +						if [ $makefile_in_in != $makefile_in_in_top ]; then
> +							diff="$(diff ${S}/po/Makefile.in.in $makefile_in_in)"
> +							if [ -z $difff ]; then
There seems to be an extra f (difff vs diff)
> +								need_copy="$need_copy $makefile_in_in"
> +							fi
> +						fi
> +					done
> +				fi
> +				for makefile in $need_copy; do
> +					cmd="cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in $makefile"
> +					bbnote "Running $cmd"
> +					$cmd
> +				done
>  				if [ ! -e ${S}/po/remove-potcdate.sed ]; then
>  					cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sed ${S}/po/
>  				fi
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#217006): https://lists.openembedded.org/g/openembedded-core/message/217006
> Mute This Topic: https://lists.openembedded.org/mt/113225997/6084445
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Robert Yang May 21, 2025, 9:26 a.m. UTC | #2
On 5/21/25 16:55, Gyorgy Sarvari wrote:
> 
> 
> On 5/21/25 10:50, Robert Yang via lists.openembedded.org wrote:
>> From: Robert Yang <liezhi.yang@windriver.com>
>>
>> The previous code only copied to ${S}/po/Makefile.in.in, but there might be
>> other po/Makefile.in.in in ${S}, for example:
>> * bison:
>>    runtime-po/Makefile.in.in
>>    gnulib-po/Makefile.in.in
>>
>> * gawk:
>>    extension/po/Makefile.in.in
>>
>> * fontconfig
>>    po-conf/Makefile.in.in
>>
>> * There might be more recipes in oe-core, and more recipes from other layers.
>>
>> The build would be failed after upgrade gettext to 0.24.1 since gettext changed
>> the way to include Makevars, so we have to fix the recipes one by one, such as:
>> do_configure:prepend() {
>>      cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/runtime-po/
>>      cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/gnulib-po/
>> }
>>
>> Even if we don't upgrade gettext to 0.24.1, have different po/Makefile.in.in in
>> the same ${S} is a kind of bug, this patch can fix the issues.
>>
>> The fix way is:
>> Find all possible po/Makefile.in.in, if it is the same as ${S}/po/Makefile.in.in,
>> then override it with ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in.
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   meta/classes-recipe/autotools.bbclass | 22 +++++++++++++++++++++-
>>   1 file changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes-recipe/autotools.bbclass b/meta/classes-recipe/autotools.bbclass
>> index 948f8c183a..d4138bfc57 100644
>> --- a/meta/classes-recipe/autotools.bbclass
>> +++ b/meta/classes-recipe/autotools.bbclass
>> @@ -188,8 +188,28 @@ autotools_do_configure() {
>>   		elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
>>   			# We'd call gettextize here if it wasn't so broken...
>>   			cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
>> +			# Find all possible po/Makefile.in.in, if it is the same as
>> +			# po/Makefile.in.in, then override it with
>> +			# ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in.
>>   			if [ -d ${S}/po/ ]; then
>> -				cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/
>> +				makefile_in_in_top=${S}/po/Makefile.in.in
>> +				need_copy=$makefile_in_in_top
>> +				if [ -f $makefile_in_in_top ]; then
>> +					makefile_in_ins="$(find ${S} -name Makefile.in.in)"
>> +					for makefile_in_in in $makefile_in_ins; do
>> +						if [ $makefile_in_in != $makefile_in_in_top ]; then
>> +							diff="$(diff ${S}/po/Makefile.in.in $makefile_in_in)"
>> +							if [ -z $difff ]; then
> There seems to be an extra f (difff vs diff)

Yes, you're right! It's strange that my world built well with this typo. I've 
fixed it locally and re-do the world build. Will update the patch if the build 
works well.

// Robert

>> +								need_copy="$need_copy $makefile_in_in"
>> +							fi
>> +						fi
>> +					done
>> +				fi
>> +				for makefile in $need_copy; do
>> +					cmd="cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in $makefile"
>> +					bbnote "Running $cmd"
>> +					$cmd
>> +				done
>>   				if [ ! -e ${S}/po/remove-potcdate.sed ]; then
>>   					cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sed ${S}/po/
>>   				fi
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#217006): https://lists.openembedded.org/g/openembedded-core/message/217006
>> Mute This Topic: https://lists.openembedded.org/mt/113225997/6084445
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [skandigraun@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>
Ross Burton May 21, 2025, 10:21 a.m. UTC | #3
On 21 May 2025, at 09:50, Robert Yang via lists.openembedded.org <liezhi.yang=windriver.com@lists.openembedded.org> wrote:
> The previous code only copied to ${S}/po/Makefile.in.in, but there might be
> other po/Makefile.in.in in ${S}, for example:

I’ve made it my life’s work over the last few years to slowly remove all the crazy from autotools.bbclass so I have a counter-proposal: what if gettextize works now?

If there’s a new gettext release we need to integrate, then it’s absolutely worth investigating to see if the tooling now works out of the box.  Unfortunately what the breakage actually is has been lost beyond a comment saying that it’s “broken”.

Ross
Robert Yang May 21, 2025, 11:56 a.m. UTC | #4
On 5/21/25 18:21, Ross Burton wrote:
> On 21 May 2025, at 09:50, Robert Yang via lists.openembedded.org <liezhi.yang=windriver.com@lists.openembedded.org> wrote:
>> The previous code only copied to ${S}/po/Makefile.in.in, but there might be
>> other po/Makefile.in.in in ${S}, for example:
> 
> I’ve made it my life’s work over the last few years to slowly remove all the crazy from autotools.bbclass so I have a counter-proposal: what if gettextize works now?

I will try gettextize.

> 
> If there’s a new gettext release we need to integrate, then it’s absolutely worth investigating to see if the tooling now works out of the box.  Unfortunately what the breakage actually is has been lost beyond a comment saying that it’s “broken”.

Before 0.24.1, they way to include Makevars is the following line in 
po/Makefile.in.in:

# Makevars gets inserted here. (Don't remove this line!)


After 0.24.1, the above line doesn't work, and the new way is:

# Include the customization of this po/ directory.
include $(srcdir)/Makevars

So po/Makefile.in.in from older gettext doesn't work any more, and will get the 
errors like:

make[2]: *** No rule to make target '/config.status', needed by 'Makefile'.  Stop.

This is because it doesn't include Makevars which makes it misses var 
definitions such as top_builddir.

// Robert



> 
> Ross
diff mbox series

Patch

diff --git a/meta/classes-recipe/autotools.bbclass b/meta/classes-recipe/autotools.bbclass
index 948f8c183a..d4138bfc57 100644
--- a/meta/classes-recipe/autotools.bbclass
+++ b/meta/classes-recipe/autotools.bbclass
@@ -188,8 +188,28 @@  autotools_do_configure() {
 		elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
 			# We'd call gettextize here if it wasn't so broken...
 			cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
+			# Find all possible po/Makefile.in.in, if it is the same as
+			# po/Makefile.in.in, then override it with
+			# ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in.
 			if [ -d ${S}/po/ ]; then
-				cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/
+				makefile_in_in_top=${S}/po/Makefile.in.in
+				need_copy=$makefile_in_in_top
+				if [ -f $makefile_in_in_top ]; then
+					makefile_in_ins="$(find ${S} -name Makefile.in.in)"
+					for makefile_in_in in $makefile_in_ins; do
+						if [ $makefile_in_in != $makefile_in_in_top ]; then
+							diff="$(diff ${S}/po/Makefile.in.in $makefile_in_in)"
+							if [ -z $difff ]; then
+								need_copy="$need_copy $makefile_in_in"
+							fi
+						fi
+					done
+				fi
+				for makefile in $need_copy; do
+					cmd="cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in $makefile"
+					bbnote "Running $cmd"
+					$cmd
+				done
 				if [ ! -e ${S}/po/remove-potcdate.sed ]; then
 					cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sed ${S}/po/
 				fi