From patchwork Sat Oct 6 13:53:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Perrad X-Patchwork-Id: 189707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 027D22C020B for ; Sat, 6 Oct 2012 23:55:21 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4055EA030B; Sat, 6 Oct 2012 13:55:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XeTyuvx0g89V; Sat, 6 Oct 2012 13:55:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 0A762A038A; Sat, 6 Oct 2012 13:54:22 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id E12888F74B for ; Sat, 6 Oct 2012 13:54:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6EFFC84B5B for ; Sat, 6 Oct 2012 13:54:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yb7ina3xvXbz for ; Sat, 6 Oct 2012 13:54:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3989380819 for ; Sat, 6 Oct 2012 13:54:14 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id s43so2291866wey.16 for ; Sat, 06 Oct 2012 06:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=BgCwL29tKkbxqFKWhrLCgY0ajUdW93nKMrLW9Cl1mz8=; b=SnfWOl+qhgx2l6pEq0G308xJsXPBVBacLZAYw7SdjEkG6RoxmQOxUhmXJpXB9URZnA QBhqUmt/EQOlFWzzqk/9C1jvoOn6JdVjCtRsPbUllBoYwCxUKzjf0sq+mC2HfixViudX AI+uNP8VoXjdLZLu7t+wBVzvMuRWbiDbj8Cp1D5zRSsfiRvqfuCHGEHl2yuBWW7NAVKD m3DO2c1npO9rMrizRwpMqR4jSdKkb194w8TvDKqekjrp6Ssw/Du3KiP/NIysLv2KoNH6 PFEibGq11HsYqgjSUXGdUmwTJqRiNPTi38848itz+el1J9yNlbQsh6qapAC3+8jPfvKa LXGQ== Received: by 10.180.90.201 with SMTP id by9mr9599555wib.5.1349531653610; Sat, 06 Oct 2012 06:54:13 -0700 (PDT) Received: from xubuntu-12.04 (95.151.93.79.rev.sfr.net. [79.93.151.95]) by mx.google.com with ESMTPS id cu1sm8327350wib.6.2012.10.06.06.54.12 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 06 Oct 2012 06:54:12 -0700 (PDT) From: Francois Perrad To: buildroot@busybox.net Date: Sat, 6 Oct 2012 15:53:50 +0200 Message-Id: <1349531633-26717-7-git-send-email-francois.perrad@gadz.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349531633-26717-1-git-send-email-francois.perrad@gadz.org> References: <1349531633-26717-1-git-send-email-francois.perrad@gadz.org> Subject: [Buildroot] [PATCH v9 07/10] perl: add option "custom install" X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net allows same behaviour (and footprint) as microperl Signed-off-by: Francois Perrad --- package/cpanminus/Config.in | 4 ++++ package/perl/Config.in | 16 ++++++++++++++++ package/perl/perl.mk | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/package/cpanminus/Config.in b/package/cpanminus/Config.in index b8b39dc..58fcb0c 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. @@ -34,3 +35,6 @@ config BR2_PACKAGE_CPANMINUS_NATIVE_DEPENDENCIES Some XS modules require native libraries. endif + +comment "cpanminus requires a fully installed perl" + depends on BR2_PACKAGE_PERL_CUSTOM_INSTALL diff --git a/package/perl/Config.in b/package/perl/Config.in index 6369243..dcd4b58 100644 --- a/package/perl/Config.in +++ b/package/perl/Config.in @@ -17,6 +17,22 @@ config BR2_PACKAGE_PERL if BR2_PACKAGE_PERL +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. + config BR2_PACKAGE_PERL_DB_FILE bool "DB_File" select BR2_PACKAGE_BERKELEYDB diff --git a/package/perl/perl.mk b/package/perl/perl.mk index 0f12044..1fee4e0 100644 --- a/package/perl/perl.mk +++ b/package/perl/perl.mk @@ -85,12 +85,49 @@ define PERL_INSTALL_STAGING_CMDS -C $(@D) install.perl endef +PERL_RUN_PERL = $(QEMU_USER) $(@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 = $(PERL_LIB)/$(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_CUSTOM_INSTALL),y) +define PERL_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(@D)/perl $(TARGET_DIR)/usr/bin/perl + $(INSTALL) -m 0755 -D $(@D)/libperl.so $(PERL_ARCHLIB)/CORE/libperl.so + $(PERL_INSTALL_MODULES) +endef +else define PERL_INSTALL_TARGET_CMDS $(MAKE) INSTALL_DEPENDENCE= \ INSTALLFLAGS=-p \ DESTDIR="$(TARGET_DIR)" \ -C $(@D) install.perl endef +endif define PERL_CLEAN_CMDS -$(MAKE) -C $(@D) clean