From patchwork Wed Feb 12 08:14:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Perrad X-Patchwork-Id: 319571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 5D23E2C0082 for ; Wed, 12 Feb 2014 19:14:58 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9F4AF8B8FE; Wed, 12 Feb 2014 08:14:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RUBUE0SclMl6; Wed, 12 Feb 2014 08:14:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 070A68B1F7; Wed, 12 Feb 2014 08:14:55 +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 2A1781C26EE for ; Wed, 12 Feb 2014 08:14:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 26F578AC9F for ; Wed, 12 Feb 2014 08:14:54 +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 6WaWIbOSR1sI for ; Wed, 12 Feb 2014 08:14:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by whitealder.osuosl.org (Postfix) with ESMTPS id C51CF8AC1F for ; Wed, 12 Feb 2014 08:14:52 +0000 (UTC) Received: by mail-ee0-f48.google.com with SMTP id t10so4116623eei.7 for ; Wed, 12 Feb 2014 00:14:51 -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=V+8i8P7mnRVwgIjV050TLLreyIoQbe84WvHdZuw5aEY=; b=QEwOdl41TRXFQ3A+gC85+hsCprVP3B4NmcSTO9stQqLzRfXhfvclgxczm0zFO/I7ok 33kX11oqgvIiwnm4HPmcz73RmanKcghe5gYQ0GFTmXd7S5yTULvdBzJIXYePRpL8uVb1 gqCw1HYlCMIx1cgl3177MST9/dDSiUma+f9BN8273VbMIaOHvmRKJ5vfGYVu3OIoG3Ag dTHpcOoCVJrFHofjrppi0niF8dpziy3JAzlfkIlsh3f6x8XEv9mpMjZqTy2DsB0Pp8mx irwTJLH7ejB5EQX8nB30q/gH+KbxNDOX7DJeId7YJofIA+nYLnP/rMuw1c4+YzECeuPy nDfA== X-Received: by 10.14.1.68 with SMTP id 44mr2424194eec.0.1392192891133; Wed, 12 Feb 2014 00:14:51 -0800 (PST) Received: from ubuntu.localdomain (94.166.87.79.rev.sfr.net. [79.87.166.94]) by mx.google.com with ESMTPSA id f45sm77782852eeg.5.2014.02.12.00.14.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Feb 2014 00:14:50 -0800 (PST) From: Francois Perrad To: buildroot@busybox.net Date: Wed, 12 Feb 2014 09:14:26 +0100 Message-Id: <1392192871-426-2-git-send-email-francois.perrad@gadz.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392192871-426-1-git-send-email-francois.perrad@gadz.org> References: <1392192871-426-1-git-send-email-francois.perrad@gadz.org> Subject: [Buildroot] [pkg-perl infra V9 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 Acked-by: Arnout Vandecappelle (Essensium/Mind) --- Config.in | 11 ++++ package/Makefile.in | 4 +- package/pkg-perl.mk | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 package/pkg-perl.mk diff --git a/Config.in b/Config.in index bcfefc7..c0b44d7 100644 --- a/Config.in +++ b/Config.in @@ -225,6 +225,17 @@ config BR2_LUAROCKS_MIRROR See http://luarocks.org +config BR2_CPAN_MIRROR + string "CPAN mirror (Perl packages)" + default "http://search.cpan.org/CPAN" + help + CPAN (Comprehensive Perl Archive Network) is a repository + of Perl packages. It 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)