@@ -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"
new file mode 100644
@@ -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
new file mode 100644
@@ -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))
@@ -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