From 785b67a27ea11486582e8251dd9c942ffb107ea4 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Mon, 2 Jan 2017 22:55:17 -0700 Subject: [PATCH] perlmod: global knob to disable comment stripping modules Certain strings are misinterpreted as comments by perlmod.mk and removed when they shouldn't be (in particular, perl-cgi). Enable this whenever you have sufficient flash space. Globally, CONFIG_PERL_NOCOMMENT=y (default) causes comments to be stripped as before. However, a package (like perl-cgi) can override this with PKG_LEAVE_COMMENTS=1. Signed-off-by: Philip Prindeville --- lang/perl/Config.in | 11 +++++++++++ lang/perl/Makefile | 5 +++-- lang/perl/perlmod.mk | 10 +++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lang/perl/Config.in b/lang/perl/Config.in index 14aedc285..65a3a47d7 100644 --- a/lang/perl/Config.in +++ b/lang/perl/Config.in @@ -17,4 +17,15 @@ config PERL_TESTS Test support is still in development. Some tests will fail, others are just missing completely. +config PERL_NOCOMMENT + bool "Strip comments and pod sections from modules" + default y + help + Remove comments and pod sections for all perl packages. + + This will descrease the size of perl libraries moderately. + + Stripping occasionally gets confused and mangles valid code, + so disable this option if you're not pressed for space. + endmenu diff --git a/lang/perl/Makefile b/lang/perl/Makefile index 7c7f10d4e..278c56c57 100644 --- a/lang/perl/Makefile +++ b/lang/perl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=perl PKG_VERSION:=5.22.1 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \ http://www.cpan.org/src/5.0 \ @@ -24,7 +24,8 @@ PKG_MD5SUM:=19295bbb775a3c36123161b9bf4892f1 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl PKG_LICENSE_FILES:=Copying Artistic README -PKG_MAINTAINER:=Marcel Denia +PKG_MAINTAINER:=Marcel Denia , \ + Philip Prindeville # Build settings PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION) diff --git a/lang/perl/perlmod.mk b/lang/perl/perlmod.mk index c64942fed..73fae5d3d 100644 --- a/lang/perl/perlmod.mk +++ b/lang/perl/perlmod.mk @@ -129,9 +129,7 @@ define perlmod/Install/NoStrip endef -define perlmod/Install - $(call perlmod/Install/NoStrip,$(1),$(2),$(3)) - +define perlmod/_DoStrip @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)" find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \ xargs -r sed -i \ @@ -141,6 +139,12 @@ define perlmod/Install -e '/^#[^!"'"'"']/d' endef +define perlmod/Install + $(call perlmod/Install/NoStrip,$(1),$(2),$(3)) + + $(if $(CONFIG_PERL_NOCOMMENT),$(if $(PKG_LEAVE_COMMENTS),,$(call perlmod/_DoStrip,$(1),$(2),$(3)))) +endef + # You probably don't want to use this directly. Look at perlmod/InstallTests define perlmod/_InstallTests $(INSTALL_DIR) $(strip $(1))