From patchwork Tue Feb 11 10:56:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Perrad X-Patchwork-Id: 319223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 61A592C00AE for ; Tue, 11 Feb 2014 21:57:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B7BAB8B50B; Tue, 11 Feb 2014 10:57:41 +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 Ksc3F2zDmv4L; Tue, 11 Feb 2014 10:57:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 8017C8B4D2; Tue, 11 Feb 2014 10:57:36 +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 909831C27A6 for ; Tue, 11 Feb 2014 10:57:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 865E78B6BD for ; Tue, 11 Feb 2014 10:57:35 +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 1-5k6ikO2eOx for ; Tue, 11 Feb 2014 10:57:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by whitealder.osuosl.org (Postfix) with ESMTPS id C3CC489D68 for ; Tue, 11 Feb 2014 10:57:31 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id f8so4017378wiw.1 for ; Tue, 11 Feb 2014 02:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w8v9dXTITw3NwoLi70+wgMEIFBhaDk8H37kPab5zuo4=; b=SDJwZdZUo0I3qJkJnZ2+yF739RdsrPagevhIyWxzb1FHUIsgwrvEfUinDf+F8M8alY QkkefAMQZ+4xSpaYW2yFWVfLRExeLUF1KtYM0f+K7CxhvJq7WGEW2WQL084gQb94z3Is N+OXlFnoVHc0Nx3cVZ8Z9hMDkdFC0R+suWNTrvnFNl0McKOaSoJKx5kmc5rTrMxnT4Ti PM6E+coL9MdzAsab9re41Mxy+SEkDM5GHI+2wSeUGEZnnz93N8UqacXxAhE4EShky3XW rzYuqFJQ/k72bcPsNkZvhrqONV0IQt+0gxDVUjD8h2oWlisQo/DPt8e02sKmuJktJz8g k8fQ== X-Received: by 10.194.71.47 with SMTP id r15mr26292321wju.19.1392116250046; Tue, 11 Feb 2014 02:57:30 -0800 (PST) Received: from ubuntu.localdomain (94.166.87.79.rev.sfr.net. [79.87.166.94]) by mx.google.com with ESMTPSA id n3sm45023250wix.10.2014.02.11.02.57.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Feb 2014 02:57:29 -0800 (PST) From: Francois Perrad To: buildroot@busybox.net Date: Tue, 11 Feb 2014 11:56:40 +0100 Message-Id: <1392116205-12810-2-git-send-email-francois.perrad@gadz.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392116205-12810-1-git-send-email-francois.perrad@gadz.org> References: <1392116205-12810-1-git-send-email-francois.perrad@gadz.org> Subject: [Buildroot] [pkg-perl infra V7 1/6] pkg-perl: new infrastructure 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 Signed-off-by: Francois Perrad --- Config.in | 10 +++ package/Makefile.in | 4 +- package/pkg-perl.mk | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 package/pkg-perl.mk diff --git a/Config.in b/Config.in index bcfefc7..be3e202 100644 --- a/Config.in +++ b/Config.in @@ -225,6 +225,16 @@ config BR2_LUAROCKS_MIRROR See http://luarocks.org +config BR2_CPAN_MIRROR + string "CPAN mirror" + default "http://search.cpan.org/CPAN" + help + CPAN has multiple software mirrors scattered around the world. + This option allows you to select a mirror. + + The list of mirrors is available at: + http://search.cpan.org/mirror + endmenu config BR2_JLEVEL diff --git a/package/Makefile.in b/package/Makefile.in index eea7043..454f614 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -206,7 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH) HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \ sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p') -export PERL5LIB := $(HOST_DIR)/usr/lib/perl +HOST_PERL_ARCHNAME := $(shell perl -MConfig -e "print Config->{archname}") +export PERL5LIB := $(HOST_DIR)/usr/lib/perl5/$(HOST_PERL_ARCHNAME):$(HOST_DIR)/usr/lib/perl5 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \ AR="$(TARGET_AR)" \ @@ -359,5 +360,6 @@ include package/pkg-download.mk include package/pkg-autotools.mk include package/pkg-cmake.mk include package/pkg-luarocks.mk +include package/pkg-perl.mk include package/pkg-python.mk include package/pkg-generic.mk diff --git a/package/pkg-perl.mk b/package/pkg-perl.mk new file mode 100644 index 0000000..fdf1580 --- /dev/null +++ b/package/pkg-perl.mk @@ -0,0 +1,181 @@ +################################################################################ +# Perl package infrastructure +# +# This file implements an infrastructure that eases development of +# package .mk files for Perl packages. +# +# See the Buildroot documentation for details on the usage of this +# infrastructure +# +# In terms of implementation, this perl infrastructure requires +# the .mk file to only specify metadata information about the +# package: name, version, download URL, etc. +# +# We still allow the package .mk file to override what the different +# steps are doing, if needed. For example, if _BUILD_CMDS is +# already defined, it is used as the list of commands to perform to +# build the package, instead of the default perl behaviour. The +# package can also define some post operation hooks. +# +################################################################################ + +PERL_ARCHNAME = $(ARCH)-linux + +################################################################################ +# inner-perl-package -- defines how the configuration, compilation and +# installation of a perl package should be done, implements a +# few hooks to tune the build process for perl specifities and +# calls the generic package infrastructure to generate the necessary +# make targets +# +# argument 1 is the lowercase package name +# argument 2 is the uppercase package name, including an HOST_ prefix +# for host packages +# argument 3 is the uppercase package name, without the HOST_ prefix +# for host packages +# argument 4 is the type (target or host) +################################################################################ + +define inner-perl-package + +# +# Configure step. Only define it if not already defined by the package +# .mk file. And take care of the differences between host and target +# packages. +# +ifndef $(2)_CONFIGURE_CMDS +ifeq ($(4),target) + +# Configure package for target +define $(2)_CONFIGURE_CMDS + cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + perl Build.PL \ + --config ar="$(TARGET_AR)" \ + --config full_ar="$(TARGET_AR)" \ + --config cc="$(TARGET_CC)" \ + --config ccflags="$(TARGET_CFLAGS)" \ + --config ld="$(TARGET_CC)" \ + --config lddlflags="-shared $(TARGET_LDFLAGS)" \ + --config ldflags="$(TARGET_LDFLAGS)" \ + --include_dirs $$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE \ + --destdir $$(TARGET_DIR) \ + --installdirs vendor \ + --install_path lib=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \ + --install_path arch=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$(PERL_ARCHNAME) \ + --install_path bin=/usr/bin \ + --install_path script=/usr/bin \ + --install_path bindoc=/usr/share/man/man1 \ + --install_path libdoc=/usr/share/man/man3 \ + $$($(2)_CONF_OPT); \ + else \ + PERL_AUTOINSTALL=--skipdeps \ + perl Makefile.PL \ + AR="$(TARGET_AR)" \ + FULL_AR="$(TARGET_AR)" \ + CC="$(TARGET_CC)" \ + CCFLAGS="$(TARGET_CFLAGS)" \ + LD="$(TARGET_CC)" \ + LDDLFLAGS="-shared $(TARGET_LDFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + DESTDIR=$$(TARGET_DIR) \ + INSTALLDIRS=vendor \ + INSTALLVENDORLIB=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \ + INSTALLVENDORARCH=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$(PERL_ARCHNAME) \ + INSTALLVENDORBIN=/usr/bin \ + INSTALLVENDORSCRIPT=/usr/bin \ + INSTALLVENDORMAN1DIR=/usr/share/man/man1 \ + INSTALLVENDORMAN3DIR=/usr/share/man/man3 \ + $$($(2)_CONF_OPT); \ + fi +endef +else + +# Configure package for host +define $(2)_CONFIGURE_CMDS + cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + perl Build.PL \ + --install_base $$(HOST_DIR)/usr \ + --installdirs vendor \ + $$($(2)_CONF_OPT); \ + else \ + PERL_AUTOINSTALL=--skipdeps \ + perl Makefile.PL \ + INSTALL_BASE=$$(HOST_DIR)/usr \ + INSTALLDIRS=vendor \ + $$($(2)_CONF_OPT); \ + fi +endef +endif +endif + +# +# Build step. Only define it if not already defined by the package .mk +# file. And take care of the differences between host and target +# packages. +# +ifndef $(2)_BUILD_CMDS +ifeq ($(4),target) + +# Build package for target +define $(2)_BUILD_CMDS + cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + perl Build $$($(2)_BUILD_OPT) build; \ + else \ + $(MAKE1) \ + PERL_INC=$$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE \ + $$($(2)_BUILD_OPT) pure_all; \ + fi +endef +else + +# Build package for host +define $(2)_BUILD_CMDS + cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + perl Build $$($(2)_BUILD_OPT) build; \ + else \ + $(MAKE1) $$($(2)_BUILD_OPT) pure_all; \ + fi +endef +endif +endif + +# +# Host installation step. Only define it if not already defined by the +# package .mk file. +# +ifndef $(2)_INSTALL_CMDS +define $(2)_INSTALL_CMDS + cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + perl Build $$($(2)_INSTALL_TARGET_OPT) install; \ + else \ + $(MAKE1) $$($(2)_INSTALL_TARGET_OPT) pure_install; \ + fi +endef +endif + +# +# Target installation step. Only define it if not already defined by +# the package .mk file. +# +ifndef $(2)_INSTALL_TARGET_CMDS +define $(2)_INSTALL_TARGET_CMDS + cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + perl Build $$($(2)_INSTALL_TARGET_OPT) install; \ + else \ + $(MAKE1) $$($(2)_INSTALL_TARGET_OPT) pure_install; \ + fi +endef +endif + +# Call the generic package infrastructure to generate the necessary +# make targets +$(call inner-generic-package,$(1),$(2),$(3),$(4)) + +endef + +################################################################################ +# perl-package -- the target generator macro for Perl packages +################################################################################ + +perl-package = $(call inner-perl-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) +host-perl-package = $(call inner-perl-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)