packaged full perl, thanks Peter Colberg (closes #3708)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@11626 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
matteo 2008-07-03 02:32:44 +00:00
parent d9886e6732
commit 61173f388a
15 changed files with 10733 additions and 12 deletions

View File

@ -1,4 +1,4 @@
#
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
@ -9,36 +9,67 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=perl
PKG_VERSION:=5.8.6
PKG_VERSION:=5.10.0
PKG_RELEASE:=1
PKG_MD5SUM:=d2c39b002ebfd2c3c5dba589365c5a71
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \
ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \
ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0
PKG_MD5SUM:=8d4aa4e061fd5bc0c39e4f0a63267880
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_CAT:=zcat
PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
include $(INCLUDE_DIR)/package.mk
define Package/microperl
define Package/perl/Default
SUBMENU:=Perl
SECTION:=lang
CATEGORY:=Languages
TITLE:=A really minimal perl
TITLE:=The Perl intepreter
URL:=http://www.perl.com/
endef
define Package/microperl/description
define Package/perl/Default/description
Perl rocks
endef
define Package/microperl
$(call Package/perl/Default)
TITLE+=(minimal version)
endef
define Package/perl/description
$(call Package/perl/Default/description)
A perl package without operating-specific functions such as readdir.
endef
define Build/Configure
define Build/Template
$(STAMP_CONFIGURED)-$(1): $(STAMP_PREPARED)
-$(MAKE) -C $(PKG_BUILD_DIR) clean
$(call Build/$(1)/Configure)
touch $$@
$(STAMP_BUILT)-$(1): $(STAMP_CONFIGURED)-$(1)
$(call Build/$(1)/Compile)
touch $$@
$(STAMP_BUILT): $(STAMP_BUILT)-$(1)
endef
define Build/Compile
define Build/microperl/Configure
endef
define Build/microperl/Compile
$(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.micro \
CC="$(TARGET_CC)" OPTIMIZE="$(TARGET_CFLAGS)"
mkdir -p $(PKG_INSTALL_DIR)/usr/bin/
$(CP) $(PKG_BUILD_DIR)/microperl $(PKG_INSTALL_DIR)/usr/bin/
endef
define Package/microperl/install
@ -46,5 +77,109 @@ define Package/microperl/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/microperl $(1)/usr/bin/
endef
$(eval $(call BuildPackage,microperl))
include perlmod.mk
define Package/perl
$(call Package/perl/Default)
MAINTAINER:=Peter Colberg <peter@petercolberg.org>
endef
define Build/perl/Configure
@echo
@echo "===> Stage 1: Configure host perl"
@echo
mkdir -p $(PKG_BUILD_DIR)/host-perl
(cd $(PKG_BUILD_DIR)/host-perl && sh ../Configure -der -Dmksymlinks -Uusedl)
@echo
@echo "===> Stage 2: Build host perl binary with static extensions"
@echo
$(MAKE) -C $(PKG_BUILD_DIR)/host-perl
@echo
@echo "===> Stage 3: Configure target perl"
@echo
-$(MAKE) -C $(PKG_BUILD_DIR) clean
sed \
-e 's!%%CC%%!$(TARGET_CC)!g' \
-e 's!%%CFLAGS%%!$(TARGET_CFLAGS) -DUSE_CROSS_COMPILE -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include!g' \
-e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
-e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
-e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
-e 's!%%LDFLAGS%%!-rdynamic -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib!g' \
-e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
-e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
files/config.sh-$(REAL_GNU_TARGET_NAME).in \
> $(PKG_BUILD_DIR)/config.sh
(cd $(PKG_BUILD_DIR) && ./Configure -S)
endef
define Build/perl/Compile
@echo
@echo "===> Stage 4: Build target miniperl binary"
@echo
install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
-rm -f $(PKG_BUILD_DIR)/miniperl
$(MAKE) -C $(PKG_BUILD_DIR) miniperl
mkdir -p $(PKG_BUILD_DIR)/target-bin
install -m 0755 $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/target-bin/
@echo
@echo "===> Stage 5: Build target perl binary"
@echo
-rm -f $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
install -m 0755 $(PKG_BUILD_DIR)/host-perl/miniperl $(PKG_BUILD_DIR)/
touch $(PKG_BUILD_DIR)/miniperl
$(MAKE) -C $(PKG_BUILD_DIR) perl
install -m 0755 $(PKG_BUILD_DIR)/perl $(PKG_BUILD_DIR)/target-bin/
@echo
@echo "===> Stage 6: Build target extensions and utils"
@echo
-rm -f $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
install -m 0755 $(PKG_BUILD_DIR)/host-perl/miniperl $(PKG_BUILD_DIR)/
ln -sf miniperl $(PKG_BUILD_DIR)/perl
touch $(PKG_BUILD_DIR)/miniperl $(PKG_BUILD_DIR)/perl
$(MAKE) -C $(PKG_BUILD_DIR)
@echo
@echo "===> Stage 7: Install Perl into staging dir"
@echo
-rm -f $(PKG_BUILD_DIR)/perl
$(INSTALL_BIN) $(PKG_BUILD_DIR)/host-perl/perl $(PKG_BUILD_DIR)/
(cd $(PKG_BUILD_DIR) && ./perl installperl --destdir=$(STAGING_DIR))
@echo
@echo "===> Stage 8: Install Perl into a temporary root"
@echo
-rm -f $(PKG_BUILD_DIR)/perl
$(INSTALL_BIN) $(PKG_BUILD_DIR)/target-bin/perl $(PKG_BUILD_DIR)
-rm -rf $(PKG_INSTALL_DIR)
mkdir -p $(PKG_INSTALL_DIR)
(cd $(PKG_BUILD_DIR) && host-perl/miniperl installperl --destdir=$(PKG_INSTALL_DIR))
endef
define Package/perl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
ln -f $(1)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin/perl
endef
ifneq ($(CONFIG_PACKAGE_microperl),)
define Build/microperl
$(call Build/Template,microperl)
endef
endif
$(eval $(Build/microperl))
ifneq ($(CONFIG_PACKAGE_perl),)
define Build/perl
$(call Build/Template,perl)
endef
endif
$(eval $(Build/perl))
$(eval $(call BuildPackage,microperl))
$(eval $(call BuildPackage,perl))
-include perlbase.mk

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
#!/bin/sh
#
# Generate perl module package dependencies
#
# Copyright (C) 2007 Peter Colberg <peter@petercolberg.org>
# Licensed under the terms of the GNU General Public License.
#
if [ $# -lt 3 ]; then
echo >&2 "Usage: $(basename $0) STAGING-DIR PERL-BUILD-DIR [FILES...] [DIRECTORIES...]"
exit 1
fi
STAGING_DIR="$1"
PERL_BIN="$STAGING_DIR/usr/bin/perl"
PERL_LIB="$STAGING_DIR/usr/lib/perl5/5.10"
INC_DIR="$(dirname $0)"
shift
"$PERL_BIN" -I"$INC_DIR" -I"$PERL_LIB" - "$@" <<'PERL_SCRIPT'
use strict;
use warnings;
use Module::ScanDeps;
use File::Find;
use Cwd;
our $sitelib = "/usr/lib/perl5/5.10";
sub scandeps {
my $builddir = Cwd::abs_path(shift);
my @scanpaths = @_;
my ($curdir, @pkgdirs, $dir, @deps, %depends, $file);
our ($pkg, %bundles, $path, @files);
@pkgdirs = glob($builddir . "/*/ipkg");
$curdir = getcwd();
@INC = ();
for $dir (@pkgdirs) {
chdir($dir) or die "$dir: $!";
for $pkg (glob("*")) {
chdir($dir . "/" . $pkg . $sitelib) or next;
push @INC, getcwd();
sub wanted {
return unless (-f $_);
s/^\.\///;
$bundles{$_} = $pkg;
}
find({ wanted => \&wanted, no_chdir => 1 }, ".");
}
}
chdir($curdir) or die "$curdir: $!\n";
for $path (@scanpaths) {
sub scan_wanted {
return unless (-f $_ and /\.(pl|pm)$/);
push @files, $_;
}
if (-f $path) {
push @files, $path;
}
elsif (-d $path) {
find({ wanted => \&scan_wanted, no_chdir => 1 }, $path);
}
}
@deps = keys %{scan_deps(files => \@files, recurse => 0)};
for $file (grep { not exists $bundles{$_} } @deps) {
warn "could not resolve dependency: $file\n";
}
%depends = map { $bundles{$_}, 1 } grep { exists $bundles{$_} } @deps;
if (%depends) {
print join(' ', 'perl', sort keys %depends), "\n";
}
}
if (@ARGV > 1) {
scandeps(@ARGV);
}
PERL_SCRIPT

View File

@ -0,0 +1,177 @@
#!/bin/sh
#
# Generate perl base modules package definitions
#
# Copyright (C) 2007 Peter Colberg <peter@petercolberg.org>
# Licensed under the terms of the GNU General Public License.
#
if [ $# -lt 1 ]; then
echo >&2 "Usage: $(basename $0) STAGING-DIR [OUTFILE]"
exit 1
fi
STAGING_DIR="$1"
PERL_BIN="$STAGING_DIR/usr/bin/perl"
PERL_LIB="$STAGING_DIR/usr/lib/perl5/5.10"
INC_DIR="$(dirname $0)"
shift
"$PERL_BIN" -I"$INC_DIR" -I"$PERL_LIB" - "$PERL_LIB" "$@" <<'PERL_SCRIPT'
use strict;
use warnings;
use Module::ScanDeps;
use File::Find;
use File::Basename;
our $skipfiles = 'CORE vmsish.pm auto/sdbm';
our %defmodules = (
'essential' => 'lib.pm vars.pm strict.pm warnings.pm warnings Carp Carp.pm Exporter Exporter.pm locale.pm subs.pm overload.pm constant.pm',
'getoptpl' => 'getopt.pl getopts.pl',
'utf8' => 'utf8_heavy.pl',
'Getopt' => 'newgetopt.pl',
'open' => 'open2.pl open3.pl',
'Config' => 'Config_heavy.pl',
'bytes' => 'bytes_heavy.pl',
);
our %defdepends = (
'DB_File' => 'libdb1-compat',
'GDBM_File' => 'libgdbm',
);
our $prefix = 'perlbase-';
sub template ($) {
$_ = $_[0];
return <<TEMPLATE;
define Package/$$_{package}
SECTION:=lang
CATEGORY:=Languages
URL:=http://www.cpan.org/
MAINTAINER:=Peter Colberg <peter\@petercolberg.org>
TITLE:=$$_{module} perl module
DEPENDS:=$$_{depends}
endef
define Package/$$_{package}/install
\$(call perlmod/Install,\$(1),$$_{files},$$_{exclude})
endef
\$(eval \$(call BuildPackage,$$_{package}))
TEMPLATE
}
sub scandeps ($) {
my $sitedir = shift;
my @result;
my ($mod, $file, @deps, $dep, %depends, $parent, $pkg);
our (%files, %modules);
my (%packages, %excludes);
for $mod (keys %defmodules) {
($pkg = $prefix . $mod) =~ tr/A-Z_/a-z-/;
$modules{$pkg} = $mod;
for $file (split / /, $defmodules{$mod}) {
$files{$file} = $pkg;
}
}
for $file ('pod', 'Pod', split(/ /, $skipfiles)) {
$files{$file} = undef;
}
sub wanted {
s/^\.\///;
return if (/^(\.|auto)$/ or exists $files{$_});
if (/\.pod$/) {
$files{$_} = undef;
}
elsif (exists $files{dirname($_)}) {
$files{$_} = $files{dirname($_)};
}
elsif (m!^(?:auto/)?([^./]+)(?:\.(?:pl|pm)|/|$)!) {
(my $pkg = $prefix . $1) =~ tr/A-Z_/a-z-/;
$modules{$pkg} = $1;
$files{$_} = $pkg;
}
else {
$files{$_} = undef;
}
}
chdir($sitedir);
find({ wanted => \&wanted, no_chdir => 1}, '.');
for $pkg (keys %modules) {
$packages{$pkg} = [];
$excludes{$pkg} = [];
$depends{$pkg} = {};
}
for $file (keys %files) {
$mod = $files{$file};
$parent = $files{dirname($file)};
if (defined ($mod)) {
if (defined ($parent) and not ($parent eq $mod)) {
push @{$packages{$mod}}, $file;
push @{$excludes{$parent}}, $file;
}
elsif (not defined ($parent)) {
push @{$packages{$mod}}, $file;
}
}
elsif (defined ($parent)) {
push @{$excludes{$parent}}, $file;
}
}
for $mod (keys %defdepends) {
($pkg = $prefix . $mod) =~ tr/A-Z_/a-z-/;
for $dep (split / /, $defdepends{$mod}) {
${$depends{$pkg}}{$dep} = 1;
}
}
@INC = ('.');
for $file (grep { -f $_ and defined $files{$_} } keys %files) {
@deps = keys %{scan_deps(files => [ $file ], recurse => 0)};
$pkg = $files{$file};
for $dep (grep { not defined $files{$_} } @deps) {
warn "$file: could not resolve dependency: $dep\n";
}
for $dep (grep { defined $files{$_} } @deps) {
next if ($files{$dep} eq $pkg);
${$depends{$pkg}}{$files{$dep}} = 1;
}
}
for $pkg (sort keys %packages) {
push @result, template({
package => $pkg,
module => $modules{$pkg},
depends => join(' ', 'perl', sort keys %{$depends{$pkg}}),
files => join(' ', sort @{$packages{$pkg}}),
exclude => join(' ', sort @{$excludes{$pkg}}),
});
}
return join('', @result);
}
if (@ARGV > 1) {
open FILE, ">$ARGV[1]" or die "$ARGV[1]: $!\n";
print FILE scandeps($ARGV[0]);
close FILE;
}
else {
print scandeps($ARGV[0] or '.');
}
PERL_SCRIPT

View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# Attempt to strip comments and pod docs from perl modules
#
[ "$#" -gt 0 ] || set .
echo "---> Stripping modules in: $@" >&2
find "$@" -name \*.pm -or -name \*.pl -or -name \*.pod | while read fn; do
echo " $fn" >&2
sed -i -e '/^=\(head\|pod\|item\|over\|back\)/,/^=cut/d; /^=\(head\|pod\|item\|over\|back\)/,$d; /^#$/d; /^#[^!"'"'"']/d' "$fn"
done

View File

@ -0,0 +1,74 @@
--- a/Makefile.micro 2007-12-18 11:47:07.000000000 +0100
+++ b/Makefile.micro 2008-06-30 04:16:09.139721328 +0200
@@ -173,13 +173,7 @@
uxsutils$(_O): $(HE) xsutils.c
$(CC) $(CCFLAGS) -o $@ $(CFLAGS) xsutils.c
-uudmap.h: generate_uudmap$(_X)
- $(RUN) ./generate_uudmap$(_X) >uudmap.h
-
-generate_uudmap$(_O): generate_uudmap.c
- $(CC) $(CCFLAGS) -o $@ $(CFLAGS) generate_uudmap.c
-
-generate_uudmap$(_X): generate_uudmap$(_O)
- $(LD) -o generate_uudmap $(LDFLAGS) generate_uudmap$(_O) $(LIBS)
+uudmap.h:
+ cp uudmap.h-premade uudmap.h
# That's it, folks!
--- a/Makefile.SH 2007-12-18 11:47:07.000000000 +0100
+++ b/Makefile.SH 2008-06-30 04:05:27.362846396 +0200
@@ -357,7 +357,7 @@
h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
-h5 = utf8.h warnings.h
+h5 = utf8.h uudmap.h warnings.h
h = $(h1) $(h2) $(h3) $(h4) $(h5)
c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro.c perl.c
@@ -478,11 +478,8 @@
globals\$(OBJ_EXT): uudmap.h
-uudmap.h: generate_uudmap\$(EXE_EXT)
- \$(RUN) ./generate_uudmap\$(EXE_EXT) >uudmap.h
-
-generate_uudmap\$(EXE_EXT): generate_uudmap\$(OBJ_EXT)
- \$(CC) -o generate_uudmap \$(LDFLAGS) generate_uudmap\$(OBJ_EXT) \$(libs)
+uudmap.h:
+ cp uudmap.h-premade uudmap.h
!GROK!THIS!
$spitshell >>Makefile <<'!NO!SUBS!'
--- a/MANIFEST 2007-12-18 11:47:07.000000000 +0100
+++ b/MANIFEST 2008-06-30 04:04:34.302847693 +0200
@@ -3968,6 +3968,7 @@
utils/xsubpp.PL External subroutine preprocessor
uts/sprintf_wrap.c sprintf wrapper for UTS
uts/strtol_wrap.c strtol wrapper for UTS
+uudmap.h The uuencode decoding map
uupacktool.pl Pack/unpack files to the .packed format
vmesMakefile VM/ESA Makefile
vmesvmesa.c VM/ESA-specific C code for Perl core
--- a/uudmap.h-premade 1970-01-01 01:00:00.000000000 +0100
+++ b/uudmap.h-premade 2008-04-20 13:09:00.880250784 +0200
@@ -0,0 +1,18 @@
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+}

1629
lang/perl/perlbase.mk Normal file

File diff suppressed because it is too large Load Diff

53
lang/perl/perlmod.mk Normal file
View File

@ -0,0 +1,53 @@
# This makefile simplifies perl module builds.
#
# Build environment
PERL_CMD := $(STAGING_DIR)/usr/bin/perl
PERL_LIB := $(STAGING_DIR)/usr/lib/perl5/5.10
# Module install prefix
PERL_SITELIB := /usr/lib/perl5/5.10
define perlmod/Configure
(cd $(PKG_BUILD_DIR); \
PERL5LIB=$(PERL_LIB) \
PERL_MM_USE_DEFAULT=1 \
$(2) \
$(PERL_CMD) Makefile.PL \
$(1) \
PERL_LIB=$(PERL_LIB) \
PERL_ARCHLIB=$(PERL_LIB) \
INSTALLSITELIB=$(PERL_SITELIB) \
INSTALLSITEARCH=$(PERL_SITELIB) \
DESTDIR=$(PKG_INSTALL_DIR) \
);
endef
define perlmod/Compile
PERL5LIB=$(PERL_LIB) \
$(2) \
$(MAKE) -C $(PKG_BUILD_DIR) \
$(1) \
install
endef
define perlmod/Install
$(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB)
(cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \
rsync --relative -rlHp --itemize-changes \
--exclude=\*.pod \
--exclude=.packlist \
$(addprefix --exclude=/,$(strip $(3))) \
--prune-empty-dirs \
$(strip $(2)) $(strip $(1))$(PERL_SITELIB))
chmod -R u+w $(strip $(1))$(PERL_SITELIB)
@echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
xargs -r sed -i \
-e '/^=\(head\|pod\|item\|over\|back\)/,/^=cut/d' \
-e '/^=\(head\|pod\|item\|over\|back\)/,$$$$d' \
-e '/^#$$$$/d' \
-e '/^#[^!"'"'"']/d'
endef