Skip to contentSkip to conversation

package/attr: fix building out-of-tree

PATCH New Yann E. MORIN 2 participants 4 messages May 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/attr: fix building out-of-tree

From: "Yann E. MORIN" <[email protected]>

This needs touching a m4 macro, so requires autoreconf.

But since this is not a true autotools-package, autoreconf whines about missing macros. So we have to explicitly pass '-I m4'.

But since this is not a true autotools-package, the build then fails with missing definition for _() as the configure scripts gets confused. So, we just call autoconf, not autoreconf.

This means we have to provide our own hook. Ideally, this would be a post-patch hook, but post-patch hooks are run before dependencies, so host-autoconf is not built at that point. So this has to be a pre-configure hook.

---
 package/attr/attr-002-fix-build-out-of-tree.patch | 19 +++++++++++++++++++
 package/attr/attr.mk                              | 16 ++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 package/attr/attr-002-fix-build-out-of-tree.patch
package/attr/attr-002-fix-build-out-of-tree.patch new file +19 -0
new file mode 100644
index 0000000..f21ed1a
@@ -0,0 +1,19 @@
+configure: fix building out of tree
+
+Do not expect that builddir == srcdir when scanning the VERSION file.
+
+Reported-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+
+diff -durN attr-2.4.46.old/m4/package_globals.m4 attr-2.4.46/m4/package_globals.m4
+--- attr-2.4.46.old/m4/package_globals.m4	2010-01-22 23:55:11.000000000 +0100
++++ attr-2.4.46/m4/package_globals.m4	2013-05-23 00:15:30.124341001 +0200
+@@ -24,7 +24,7 @@
+ 
+     AC_PROG_CC
+ 
+-    . ./VERSION
++    . "${srcdir}/VERSION"
+     pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
+     AC_SUBST(pkg_version)
+     pkg_release=$PKG_BUILD
package/attr/attr.mk +16 -0
index 288052d..5933e6a 100644
@@ -10,6 +10,22 @@ ATTR_SITE = http://download.savannah.gnu.org/releases/attr
 ATTR_INSTALL_STAGING = YES
 ATTR_CONF_OPT = --enable-gettext=no
 
+# Since we touch the m4 macros, we need to re-autoconf.
+# But since this is not a real autotools package, we can't use
+# AUTORECONF=YES, so we have to provide our own hook for that.
+# Also, there is no need to run that before all calls to
+# ./configure, but since post-patch hooks are run before
+# dependencies, this can't be a post-patch hook, and has to be
+# a pre-configure hook... :-(
+ATTR_DEPENDENCIES += host-autoconf
+define ATTR_REAUTOCONF
+	@$(call MESSAGE,"Re-autoconf")
+	( cd $(@D); \
+	  autoconf -I m4 -Wall --force -v \
+	)
+endef
+ATTR_PRE_CONFIGURE_HOOKS += ATTR_REAUTOCONF
+
 # While the configuration system uses autoconf, the Makefiles are
 # hand-written and do not use automake. Therefore, we have to hack
 # around their deficiencies by passing installation paths.
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 package/attr: fix building out-of-tree

Dear Yann E. MORIN,

Quoted 10 lines · Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

This needs touching a m4 macro, so requires autoreconf.

But since this is not a true autotools-package, autoreconf whines about missing macros. So we have to explicitly pass '-I m4'.

But since this is not a true autotools-package, the build then fails with missing definition for _() as the configure scripts gets confused. So, we just call autoconf, not autoreconf.

If it's not a true autotools-package, then it shouldn't be using the autotools-package infrastructure, I'd say.

And making a change to the source code at the configure step (such as autoconf or autoreconf) is fundamentally going into the wrong direction with regard to out-of-tree support. All steps until configure are done only once, on the source tree, and then all steps starting from the configure step are done for both the target build and the host build.

Therefore, autoreconf/autoconf should not be part of the configure step anymore. I'm sending an e-mail about that in a moment.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/attr: fix building out-of-tree

Yann,

Quoted 19 lines · Thomas Petazzoni
Quoted 8 lines

This needs touching a m4 macro, so requires autoreconf.

But since this is not a true autotools-package, autoreconf whines about missing macros. So we have to explicitly pass '-I m4'.

But since this is not a true autotools-package, the build then fails with missing definition for _() as the configure scripts gets confused. So, we just call autoconf, not autoreconf.

If it's not a true autotools-package, then it shouldn't be using the autotools-package infrastructure, I'd say.

And making a change to the source code at the configure step (such as autoconf or autoreconf) is fundamentally going into the wrong direction with regard to out-of-tree support. All steps until configure are done only once, on the source tree, and then all steps starting from the configure step are done for both the target build and the host build.

Quoted 2 lines

Therefore, autoreconf/autoconf should not be part of the configure step anymore. I'm sending an e-mail about that in a moment.

Also, since this package doesn't use automake, most likely its Makefiles are not out-of-tree capable, so in this case, there's no point in fixing the configure script to be out-of-tree capable if the rest of the build process isn't. Unless of course the entire package is fixed to support out-of-tree, but I believe 'attr' is a very small package which is not really worth fixing first. There will be many more bigger packages that would be more useful to fix for out-of-tree builds, I believe.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH 1/1 package/attr: fix building out-of-tree

Thomas, All,

On 2013-05-23 13:25 +0200, Thomas Petazzoni spake thusly:

Quoted 20 lines · Thomas Petazzoni
Quoted 19 lines
Quoted 8 lines

This needs touching a m4 macro, so requires autoreconf.

But since this is not a true autotools-package, autoreconf whines about missing macros. So we have to explicitly pass '-I m4'.

But since this is not a true autotools-package, the build then fails with missing definition for _() as the configure scripts gets confused. So, we just call autoconf, not autoreconf.

If it's not a true autotools-package, then it shouldn't be using the autotools-package infrastructure, I'd say.

And making a change to the source code at the configure step (such as autoconf or autoreconf) is fundamentally going into the wrong direction with regard to out-of-tree support. All steps until configure are done only once, on the source tree, and then all steps starting from the configure step are done for both the target build and the host build.

Quoted 7 lines
Quoted 2 lines

Therefore, autoreconf/autoconf should not be part of the configure step anymore. I'm sending an e-mail about that in a moment.

Also, since this package doesn't use automake, most likely its Makefiles are not out-of-tree capable, so in this case, there's no point in fixing the configure script to be out-of-tree capable if the rest of the build process isn't.

Indeed. I'll look at making it a generic-package instead, which will fix OOT at the same time (since generic-package will be not-OOT capable by default).

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'