From patchwork Thu Aug 23 08:14:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Perrad X-Patchwork-Id: 179554 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 639A22C0096 for ; Thu, 23 Aug 2012 18:14:59 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 65686A052D; Thu, 23 Aug 2012 08:14:57 +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 1M2uxSaHm3Hy; Thu, 23 Aug 2012 08:14:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id C3007A0511; Thu, 23 Aug 2012 08:14:44 +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 C61278F791 for ; Thu, 23 Aug 2012 08:14:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B6D728F699 for ; Thu, 23 Aug 2012 08:14:36 +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 k4nXKI59qanE for ; Thu, 23 Aug 2012 08:14:35 +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 1EF198F6A1 for ; Thu, 23 Aug 2012 08:14:34 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id x43so476859wey.16 for ; Thu, 23 Aug 2012 01:14:34 -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=2ESPkmb0cT8wEDhfN6R1ELKScm1amkvz3VohbDYnqis=; b=XyEW/ZnUUflQHbcah4meUPFFX6dO0mkLmaOlkJDB0K8AJYJNcA8xlbBiJR3GuNQKd0 xVkPVJzcCLeq7iqjzaEcDnVz6kOnWDeLFPnqT38UZf0ubqGKKPzlKhfDsBlzSKMJnieS dSU4BgMKhrlBnC0YsdSLG/73SM0SZh5pfLTYoR11RfMdxdbfekIipEdHYu9JLMITf9ZN qZ1YxwVU7xSRPe4HTyjBY5P+ZuIXY5mz+lm9fuhrYoZwv9AqC2rbvz1xlvr7DX9Af8ST MwnjamMX3XkVEe5zcngAaldJCHz2BZuYONvUMxjp3BjKjceQGRfMYQ55U9OIYYPeigVs 26mw== Received: by 10.180.100.133 with SMTP id ey5mr2029276wib.4.1345709674698; Thu, 23 Aug 2012 01:14:34 -0700 (PDT) Received: from xubuntu-12.04 (113.120.86.79.rev.sfr.net. [79.86.120.113]) by mx.google.com with ESMTPS id q4sm43651163wix.9.2012.08.23.01.14.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Aug 2012 01:14:33 -0700 (PDT) From: Francois Perrad To: buildroot@busybox.net Date: Thu, 23 Aug 2012 10:14:14 +0200 Message-Id: <1345709660-25443-3-git-send-email-francois.perrad@gadz.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345709660-25443-1-git-send-email-francois.perrad@gadz.org> References: <1345709660-25443-1-git-send-email-francois.perrad@gadz.org> Subject: [Buildroot] [PATCH 3/9] cpanminus: new package 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 --- package/Config.in | 5 +++++ package/cpanminus/Config.in | 24 ++++++++++++++++++++++++ package/cpanminus/cpanminus.mk | 37 +++++++++++++++++++++++++++++++++++++ package/perl/perl.mk | 12 ++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 package/cpanminus/Config.in create mode 100644 package/cpanminus/cpanminus.mk diff --git a/package/Config.in b/package/Config.in index 00a79ab..48d25fc 100644 --- a/package/Config.in +++ b/package/Config.in @@ -263,6 +263,11 @@ source "package/xavante/Config.in" endmenu endif source "package/perl/Config.in" +if BR2_PACKAGE_PERL +menu "Perl libraries/modules" +source "package/cpanminus/Config.in" +endmenu +endif source "package/microperl/Config.in" source "package/php/Config.in" source "package/python/Config.in" diff --git a/package/cpanminus/Config.in b/package/cpanminus/Config.in new file mode 100644 index 0000000..9db7b2e --- /dev/null +++ b/package/cpanminus/Config.in @@ -0,0 +1,24 @@ +config BR2_PACKAGE_CPANMINUS + bool "cpanminus" + help + cpanminus is a script to get, unpack, build and install Perl modules + from CPAN. + + Why? It's dependency free, requires zero configuration, and stands + alone. When running, it requires only 10MB of RAM. + + http://github.com/miyagawa/cpanminus + +if BR2_PACKAGE_CPANMINUS + +config BR2_PACKAGE_CPANMINUS_MODULES + string "Perl modules from CPAN" + help + List of space-separated Perl modules to install from CPAN. + + Examples: Try::Tiny Dancer YAML Moo + + Install the listed modules and their dependencies. + cpanm run on host, so you cannot use it for XS modules. + +endif diff --git a/package/cpanminus/cpanminus.mk b/package/cpanminus/cpanminus.mk new file mode 100644 index 0000000..b55dd3f --- /dev/null +++ b/package/cpanminus/cpanminus.mk @@ -0,0 +1,37 @@ +############################################################# +# +# cpanminus +# +############################################################# + +CPANMINUS_VERSION = 1.5017 +CPANMINUS_SITE = http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA +CPANMINUS_SOURCE = App-cpanminus-$(CPANMINUS_VERSION).tar.gz +CPANMINUS_DEPENDENCIES = host-perl host-cpanminus +CPANMINUS_MODS = $(call qstrip,$(BR2_PACKAGE_CPANMINUS_MODULES)) + +define HOST_CPANMINUS_CONFIGURE_CMDS + cd $(@D); $(HOST_DIR)/usr/bin/perl$(PERL_VERSION) Makefile.PL +endef + +define HOST_CPANMINUS_INSTALL_CMDS + $(MAKE) -C $(@D) install +endef + +define CPANMINUS_INSTALL_TARGET_CMDS + for i in $(CPANMINUS_MODS); do \ + cd $(@D); $(HOST_DIR)/usr/bin/cpanm -L $(TARGET_DIR)/usr/local $$i; \ + done + # show XS modules + find $(TARGET_DIR)/usr/local/lib/perl5 -name *.so -print + # remove XS modules + rm -Rf $(TARGET_DIR)/usr/local/lib/perl5/$(shell $(HOST_DIR)/usr/bin/perl$(PERL_VERSION) -MConfig -e "print Config->{archname}") + # fix shebang + touch $(TARGET_DIR)/usr/local/bin/dummy + for i in $(TARGET_DIR)/usr/local/bin/*; do \ + $(SED) 's/$(subst /,\/,$(HOST_DIR))//' $$i; \ + done +endef + +$(eval $(generic-package)) +$(eval $(host-generic-package)) diff --git a/package/perl/perl.mk b/package/perl/perl.mk index 5161654..38aae08 100644 --- a/package/perl/perl.mk +++ b/package/perl/perl.mk @@ -45,6 +45,7 @@ define PERL_CONFIGURE_CMDS -Dlibc=$(TARGET_HOST)/usr/$(GNU_TARGET_NAME)/sysroot/lib/libc.so \ -Duseshrplib \ -Dprefix=/usr \ + -Dsitelib=/usr/local/lib/perl5 \ -Uoptimize \ $(PERL_USE_DEVEL) \ $(call qstrip,$(BR2_PACKAGE_PERL_CUSTOM_CONFIGURE)) @@ -69,8 +70,19 @@ define PERL_CONFIGURE_CMDS $(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h endef +# example of hack for XS module (cpanminus handles only pure Perl modules) +#define PERL_HACK_4_XS_MODULES +# cd $(@D)/cpan; tar xfz $(BUILDROOT_DL_DIR)/HTML-Parser-3.69.tar.gz +#endef + +PERL_PRE_CONFIGURE_HOOKS += PERL_HACK_4_XS_MODULES + define PERL_BUILD_CMDS $(MAKE) -C $(@D) all +# example of hack for XS module +# cd $(@D); \ +# $(HOST_DIR)/usr/bin/perl$(PERL_VERSION) -Ilib make_ext.pl MAKE="$(MAKE)" LIBPERL_A=libperl.a LINKTYPE=dynamic \ +# HTML-Parser-3.69 endef define PERL_INSTALL_STAGING_CMDS