Skip to contentSkip to conversation

pkg-perl: add patch_subdir_makefile function

PATCH New Francois Perrad 2 participants 3 messages Oct 13, 2018 – Oct 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pkg-perl: add patch_subdir_makefile function

based on an initial work of Christopher McCrory <[email protected]>

---
 package/pkg-perl.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
package/pkg-perl.mk +15 -0
index 07348bd5d..a78c1cd95 100644
@@ -22,6 +22,21 @@
 PERL_ARCHNAME = $(ARCH)-linux
 PERL_RUN = PERL5LIB= PERL_USE_UNSAFE_INC=1 $(HOST_DIR)/bin/perl
 
+# Some arguments to Makefile.PL do not get propagated to subdirectories
+# similar to:
+# https://rt.cpan.org/Public/Bug/Display.html?id=28632
+define patch_subdir_makefile
+	$(SED) "s:^AR = .*:AR = $(TARGET_AR):g" $(1)
+	$(SED) "s:^FULL_AR = .*:FULL_AR = $(TARGET_AR):g" $(1)
+	$(SED) "s:^CC = .*:CC = $(TARGET_CC):g" $(1)
+	$(SED) "s:^CCFLAGS = .*:CCFLAGS = $(TARGET_CFLAGS):g" $(1)
+	$(SED) "s:^LD = .*:LD = $(TARGET_CC):g" $(1)
+	$(SED) "s:^LDDLFLAGS = .*:LDDLFLAGS = -shared $(TARGET_LDFLAGS):g" $(1)
+	$(SED) "s:^LDLFLAGS = .*:LDLFLAGS = $(TARGET_LDFLAGS):g" $(1)
+	$(SED) "s:^DESTDIR = .*:DESTDIR = $(TARGET_DIR):g" $(1)
+	$(SED) "s:^PERL_INC = .*:PERL_INC = $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE:g" $(1)
+endef
+
 ################################################################################
 # inner-perl-package -- defines how the configuration, compilation and
 # installation of a perl package should be done, implements a
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 perl-netaddr-ip: fix build of the XS version

thank to the function patch_subdir_makefile

---
 package/perl-netaddr-ip/perl-netaddr-ip.mk | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
package/perl-netaddr-ip/perl-netaddr-ip.mk +10 -2
index a1f02c691..cd552d174 100644
@@ -10,8 +10,16 @@ PERL_NETADDR_IP_SITE = $(BR2_CPAN_MIRROR)/authors/id/M/MI/MIKER
 PERL_NETADDR_IP_LICENSE = Artistic or GPL-1.0+
 PERL_NETADDR_IP_LICENSE_FILES = Artistic Copying
 
-# we always build the Pure Perl version.
-# the build of the native part of NetAddr::IP::Util is buggy.
+define PERL_NETADDR_IP_PATCH_GENERATED_MAKEFILE
+	$(call patch_subdir_makefile,$(@D)/Lite/Makefile)
+	$(call patch_subdir_makefile,$(@D)/Lite/Util/Makefile)
+endef
+
+PERL_NETADDR_IP_POST_CONFIGURE_HOOKS += PERL_NETADDR_IP_PATCH_GENERATED_MAKEFILE
+
+ifeq ($(BR2_STATIC_LIBS),y)
+# build only the Pure Perl version.
 PERL_NETADDR_IP_CONF_OPTS = -noxs
+endif
 
 $(eval $(perl-package))
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/2 pkg-perl: add patch_subdir_makefile function

In reply to Francois Perrad

Hello,

Quoted 3 lines · Francois Perrad

based on an initial work of Christopher McCrory <[email protected]>

Thanks for working on this. In the review of
https://patchwork.ozlabs.org/patch/959634/, I was asking:

"""
This problem was reported at
https://rt.cpan.org/Public/Bug/Display.html?id=28632, and apparently fixed in 2013, at least for the "LD" variable. Why are we still seeing this issue ?
"""

Any idea ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com