All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Perrad <fperrad@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v8 08/11] perl: add option "custom install"
Date: Tue, 25 Sep 2012 19:18:24 +0200	[thread overview]
Message-ID: <1348593508-14254-8-git-send-email-francois.perrad@gadz.org> (raw)
In-Reply-To: <1348593508-14254-1-git-send-email-francois.perrad@gadz.org>

allows same behaviour (and footprint) as microperl

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/cpanminus/Config.in |    4 ++++
 package/perl/Config.in      |   16 +++++++++++++++
 package/perl/perl.mk        |   47 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/package/cpanminus/Config.in b/package/cpanminus/Config.in
index 3b57ffd..d6ada47 100644
--- a/package/cpanminus/Config.in
+++ b/package/cpanminus/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_CPANMINUS
 	bool "cpanminus"
+	depends on !BR2_PACKAGE_PERL_CUSTOM_INSTALL
 	help
 	  cpanminus is a script to get, unpack, build and install Perl modules
 	  from CPAN.
@@ -9,6 +10,9 @@ config BR2_PACKAGE_CPANMINUS
 
 	  http://github.com/miyagawa/cpanminus
 
+comment "cpanminus requires a fully installed perl"
+	depends on BR2_PACKAGE_PERL_CUSTOM_INSTALL
+
 if BR2_PACKAGE_CPANMINUS
 
 config BR2_PACKAGE_CPANMINUS_MIRROR
diff --git a/package/perl/Config.in b/package/perl/Config.in
index 8d8430d..ec0c60d 100644
--- a/package/perl/Config.in
+++ b/package/perl/Config.in
@@ -16,6 +16,22 @@ config BR2_PACKAGE_PERL_ONLY_MINIPERL
 	  Install only miniperl (without dynamic module loader)
 	  Usually used to bootstrap a full Perl (@INC contains only .).
 
+config BR2_PACKAGE_PERL_CUSTOM_INSTALL
+	bool "custom install"
+	help
+	  Don't use the full install target
+	  Install only a selection of modules (like microperl).
+
+config BR2_PACKAGE_PERL_MODULES
+	string "additional modules"
+	depends on BR2_PACKAGE_PERL_CUSTOM_INSTALL
+	help
+	  List of space-separated perl modules to copy to the rootfs.
+
+	  Examples: constant.pm Getopt/Std.pm Time/Local.pm
+
+	  Module dependencies are not automatic so check your needs.
+
 endif
 
 if BR2_PACKAGE_PERL && !BR2_PACKAGE_PERL_ONLY_MINIPERL
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
index 71762e1..fbe7ba9 100644
--- a/package/perl/perl.mk
+++ b/package/perl/perl.mk
@@ -96,12 +96,59 @@ define PERL_INSTALL_STAGING_CMDS
 		-C $(@D) install.perl
 endef
 
+PERL_RUN_PERL=$(PERL_QEMU_USER_MODE) $(@D)/perl -Ilib
+PERL_ARCHNAME=$(shell $(PERL_RUN_PERL) -MConfig -e "print Config->{archname}")
+PERL_LIB=$(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)
+PERL_ARCHLIB=$(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)
+PERL_MODS = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
+# Minimal set of modules required for 'perl -V' to work
+PERL_ARCH_MODS = Config.pm Config_git.pl Config_heavy.pl
+PERL_BASE_MODS = strict.pm vars.pm warnings.pm warnings/register.pm
+
+define PERL_INSTALL_MODULES
+	for i in $(PERL_ARCH_MODS); do \
+		$(INSTALL) -m 0644 -D $(@D)/lib/$$i $(PERL_ARCHLIB)/$$i; \
+	done
+	for i in $(PERL_BASE_MODS); do \
+		$(INSTALL) -m 0644 -D $(@D)/lib/$$i $(PERL_LIB)/$$i; \
+	done
+	for i in $(PERL_MODS); do \
+		j=`echo $$i|cut -d : -f 1` ; \
+		if [ -d $(@D)/lib/$$j ] ; then \
+			cp -af $(@D)/lib/$$j $(PERL_LIB) ; \
+		fi ; \
+		if [ -f $(@D)/lib/$$i ] ; then \
+			$(INSTALL) -m 0644 -D $(@D)/lib/$$i $(PERL_LIB)/$$i; \
+		fi ; \
+	done
+	# Remove test files
+	find $(PERL_LIB) -type f -name *.t -exec rm -f {} \;
+endef
+
+ifeq ($(BR2_PACKAGE_PERL_ONLY_MINIPERL),y)
+define PERL_INSTALL_INTERPRETER
+	$(INSTALL) -m 0755 -D $(@D)/miniperl $(TARGET_DIR)/usr/bin/miniperl
+endef
+else
+define PERL_INSTALL_INTERPRETER
+	$(INSTALL) -m 0755 -D $(@D)/perl $(TARGET_DIR)/usr/bin/perl
+	$(INSTALL) -m 0755 -D $(@D)/libperl.so $(PERL_ARCHLIB)/CORE/libperl.so
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_PERL_CUSTOM_INSTALL),y)
+define PERL_INSTALL_TARGET_CMDS
+	$(PERL_INSTALL_INTERPRETER)
+	$(PERL_INSTALL_MODULES)
+endef
+else
 define PERL_INSTALL_TARGET_CMDS
 	$(MAKE) INSTALL_DEPENDENCE= \
 		INSTALLFLAGS="-p $(PERL_INSTALL_ONLY_MINIPERL)"\
 		DESTDIR="$(TARGET_DIR)" \
 		-C $(@D) install.perl
 endef
+endif
 
 define PERL_CLEAN_CMDS
 	-$(MAKE) -C $(@D) clean
-- 
1.7.9.5

  parent reply	other threads:[~2012-09-25 17:18 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25 17:18 [Buildroot] [PATCH v8 01/11] host-qemu: new package Francois Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 02/11] perl: " Francois Perrad
2012-10-04 20:40   ` Thomas Petazzoni
2012-10-06 13:29     ` François Perrad
2012-10-04 21:18   ` Thomas Petazzoni
2012-10-06 13:33     ` François Perrad
2012-10-06 17:18       ` Thomas Petazzoni
2012-10-06 19:37         ` François Perrad
2012-10-08 16:57           ` François Perrad
2012-10-06 12:12   ` Arnout Vandecappelle
2012-10-06 13:34     ` François Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 03/11] perl: add an option for miniperl Francois Perrad
2012-10-04 20:41   ` Thomas Petazzoni
2012-10-06 12:17     ` Arnout Vandecappelle
2012-10-06 13:38       ` François Perrad
2012-10-06 14:58         ` Arnout Vandecappelle
2012-10-06 12:15   ` Arnout Vandecappelle
2012-09-25 17:18 ` [Buildroot] [PATCH v8 04/11] perl: add DB_File Francois Perrad
2012-10-06 12:23   ` Arnout Vandecappelle
2012-10-06 13:40     ` François Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 05/11] gdbm: new package Francois Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 06/11] perl: add GDBM_File Francois Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 07/11] cpanminus: new package Francois Perrad
2012-10-04 20:46   ` Thomas Petazzoni
2012-10-06 13:43     ` François Perrad
2012-10-04 21:01   ` Thomas Petazzoni
2012-10-05  8:12     ` François Perrad
2012-10-06 13:44     ` François Perrad
2012-10-06 12:29   ` Arnout Vandecappelle
2012-09-25 17:18 ` Francois Perrad [this message]
2012-09-25 17:18 ` [Buildroot] [PATCH v8 09/11] perl: relax microperl dependencies Francois Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 10/11] microperl: mark as DEPRECATED Francois Perrad
2012-09-25 17:18 ` [Buildroot] [PATCH v8 11/11] microperl: remove it Francois Perrad
2012-09-25 21:15 ` [Buildroot] [PATCH v8 01/11] host-qemu: new package Arnout Vandecappelle
2012-09-26  7:33   ` Thomas Petazzoni
2012-10-04 20:33 ` Thomas Petazzoni
2012-10-04 22:09   ` Frank Hunleth
2012-10-05  7:19     ` Thomas Petazzoni
2012-10-06 12:37       ` Arnout Vandecappelle
2012-10-06 13:51   ` François Perrad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348593508-14254-8-git-send-email-francois.perrad@gadz.org \
    --to=fperrad@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.