diff options
Diffstat (limited to 'patches')
| -rw-r--r-- | patches/irssi/0001-perl-cross-compilation-use-staging-dir.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/patches/irssi/0001-perl-cross-compilation-use-staging-dir.patch b/patches/irssi/0001-perl-cross-compilation-use-staging-dir.patch new file mode 100644 index 0000000..765233d --- /dev/null +++ b/patches/irssi/0001-perl-cross-compilation-use-staging-dir.patch @@ -0,0 +1,86 @@ +Use the target perl from $STAGING_DIR when cross-compiling the perl plugin + +When cross-compiling (e.g. from Buildroot), the perl found by configure is a +host perl and ExtUtils::Embed reports host paths (/usr/lib/<host>/perl/...), +which the cross compiler rejects as "unsafe header/library path", so perl +support was silently disabled. + +When $cross_compiling = yes and $STAGING_DIR is set (Buildroot exports it), +derive the perl flags from the target perl installation found in +$STAGING_DIR/usr/lib/perl5/*/*/CORE (ccflags/ldflags/lddlflags/libs and the +INSTALL* dirs are read from its Config_heavy.pl), and pass staging-rooted +PERL_LIB/PERL_ARCHLIB/PERL_INC plus LD/LDDLFLAGS and target-rooted INSTALL* +to the MakeMaker-generated Makefiles of the perl XS subdirectories, so that +both the build and "make install DESTDIR=..." use the right paths. + +--- a/configure.ac ++++ b/configure.ac +@@ -442,6 +442,40 @@ + ;; + esac + ++ dnl * When cross-compiling (e.g. from Buildroot), $perlpath is a host ++ dnl * perl and ExtUtils::Embed reports paths of the *host* perl ++ dnl * installation, which the cross compiler rejects as "unsafe ++ dnl * header/library path". Buildroot exports STAGING_DIR pointing at ++ dnl * the target sysroot: use the target perl installation found there ++ dnl * instead, and override the MakeMaker variables of the perl XS ++ dnl * subdirectories with staging-rooted paths (and target-rooted ++ dnl * INSTALL* dirs, so that "make install DESTDIR=..." lands in the ++ dnl * target rootfs). ++ if test "x$cross_compiling" = "xyes" && test -n "$STAGING_DIR"; then ++ perl_core= ++ for d in "$STAGING_DIR"/usr/lib/perl5/*/*/CORE; do ++ if test -d "$d"; then perl_core="$d"; fi ++ done ++ if test -n "$perl_core"; then ++ perl_archlib=`dirname "$perl_core"` ++ perl_privlib=`dirname "$perl_archlib"` ++ perl_ccflags=`grep "^ccflags=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_ldflags=`grep "^ldflags=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_lddlflags=`grep "^lddlflags=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_libs=`grep "^libs=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_installprivlib=`grep "^installprivlib=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_installarchlib=`grep "^installarchlib=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_installsitelib=`grep "^installsitelib=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ perl_installsitearch=`grep "^installsitearch=" "$perl_archlib/Config_heavy.pl" | cut -d= -f2- | tr -d "\\047"` ++ PERL_CFLAGS="$perl_ccflags -I$perl_core" ++ PERL_LDFLAGS="-Wl,-E $perl_ldflags -L$perl_core -lperl $perl_libs" ++ PERL_CROSS_MAKE_PARAMS="LD=\"$CC\" LDDLFLAGS=\"$perl_lddlflags -fPIC\" PERL_LIB=$perl_privlib PERL_ARCHLIB=$perl_archlib PERL_INC=$perl_core INSTALLPRIVLIB=$perl_installprivlib INSTALLARCHLIB=$perl_installarchlib INSTALLSITELIB=$perl_installsitelib INSTALLSITEARCH=$perl_installsitearch" ++ AC_MSG_NOTICE([cross-compiling: using target perl from $perl_core]) ++ else ++ perl_check_error="target perl not found in \$STAGING_DIR/usr/lib/perl5" ++ fi ++ fi ++ + dnl * check that perl's ldflags actually work + echo "#include <EXTERN.h>" > conftest.c + echo "#include <perl.h>" >> conftest.c +@@ -538,6 +572,7 @@ + AC_SUBST(PERL_MM_OPT) + AC_SUBST(PERL_MM_PARAMS) + AC_SUBST(PERL_STATIC_LIBS) ++ AC_SUBST(PERL_CROSS_MAKE_PARAMS) + fi + fi + +--- a/src/perl/Makefile.am ++++ b/src/perl/Makefile.am +@@ -143,14 +143,14 @@ + if [ ! -f Makefile ]; then \ + $(am_v_pl__show_gen)$(perlpath) Makefile.PL $(PERL_MM_PARAMS) $(am_v_pl__hide_gen); \ + fi && \ +- ($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \ +- $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \ ++ ($(MAKE) CC="$(CC)" $(PERL_CROSS_MAKE_PARAMS) CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \ ++ $(MAKE) CC="$(CC)" $(PERL_CROSS_MAKE_PARAMS) CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \ + cd ..; \ + done + + install-exec-local: + for dir in $(perl_dirs); do \ +- cd $$dir && $(MAKE) install && cd ..; \ ++ cd $$dir && $(MAKE) $(PERL_CROSS_MAKE_PARAMS) install && cd ..; \ + done + + clean-generic: |
