steffen: server/perl-kolab Makefile.am, 1.2, 1.3 Makefile.cvs, 1.1, 1.2 configure, 1.2, 1.3 perl-kolab.spec.in, 1.10, 1.11
cvs at intevation.de
cvs at intevation.de
Fri Jul 15 03:01:35 CEST 2005
Author: steffen
Update of /kolabrepository/server/perl-kolab
In directory doto:/tmp/cvs-serv18587
Modified Files:
Makefile.am Makefile.cvs configure perl-kolab.spec.in
Log Message:
updated auto-perl + applied patch from Marcus
Index: Makefile.am
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am 30 Jun 2005 01:43:55 -0000 1.2
+++ Makefile.am 15 Jul 2005 01:01:33 -0000 1.3
@@ -21,11 +21,9 @@
# own Variables and default values:
-localstatedir_ARG = ${prefix}/var
-localstatedir_ARG_HELP = localstatedir default:
+dist_ARG = dist_conf/kolab
+dist_ARG_HELP = dist_conf file
# for including the ../dist_conf/kolab file
-{
- `cat ./dist_conf/kolab`
-}
+#include "dist_conf/$(dist)"
Index: Makefile.cvs
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Makefile.cvs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.cvs 8 Jun 2005 12:44:35 -0000 1.1
+++ Makefile.cvs 15 Jul 2005 01:01:33 -0000 1.2
@@ -12,7 +12,7 @@
all:
test -d $(KOLABRPMSRC)/$(RPMNAME) || mkdir $(KOLABRPMSRC)/$(RPMNAME)
- ./configure --prefix=/kolab \
+ ./configure --prefix=/kolab --dist=kolab \
&& make dist && mv $(RPMNAME)-$(VERSION).tar.gz $(KOLABRPMSRC)/$(RPMNAME)
cp $(RPMNAME).spec $(KOLABRPMSRC)/$(RPMNAME)/
cd $(KOLABRPMSRC)/$(RPMNAME) && $(RPM) -ba $(RPMNAME).spec --define 'kolab_version CVS'
Index: configure
===================================================================
RCS file: /kolabrepository/server/perl-kolab/configure,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- configure 30 Jun 2005 11:12:09 -0000 1.2
+++ configure 15 Jul 2005 01:01:33 -0000 1.3
@@ -126,7 +126,7 @@
BEGIN { import Autoperl::Logger; }
BEGIN { import Autoperl::Packager; }
-# Generated by autoperl 1.25
+# Generated by autoperl 1.26
unless (defined $ap::CONFIG_H) {
$ap::CONFIG_H = 1;
@@ -137,6 +137,7 @@
'author' => 'Mark Heily <devel at heily.com>',
'program' => 'autoperl',
'ovr_custom' => 'default',
+ 'crap' => 'good',
'infodir' => '/usr/local/info',
'cc' => '/usr/bin/perl -c',
'sysconfdir' => '/usr/local/etc',
@@ -147,9 +148,8 @@
'autoperl' => '$(TOPDIR)/configure --autoperl',
'localedir' => '/usr/local/locale',
'install' => '$(TOPDIR)/configure --autoperl install -p',
- 'version' => '1.25',
+ 'version' => '1.26',
'includedir' => '/usr/local/lib/site_perl',
- 'statedir' => '/var/lib',
'datadir' => '/usr/local/share',
'sbindir' => '/usr/local/sbin',
'libdir' => '/usr/local/lib',
@@ -157,7 +157,8 @@
'def_custom' => 'default',
'ld' => '$(TOPDIR)/configure --autoperl link',
'destdir' => '',
- 'prefix' => '/usr/local'
+ 'prefix' => '/usr/local',
+ 'localstatedir' => '/usr/local/var'
);
# Allow references to $ap::foo
@@ -168,6 +169,7 @@
$ap::{author} = sub { 'Mark Heily <devel at heily.com>' };
$ap::{program} = sub { 'autoperl' };
$ap::{ovr_custom} = sub { 'default' };
+$ap::{crap} = sub { 'good' };
$ap::{infodir} = sub { '/usr/local/info' };
$ap::{cc} = sub { '/usr/bin/perl -c' };
$ap::{sysconfdir} = sub { '/usr/local/etc' };
@@ -178,9 +180,8 @@
$ap::{autoperl} = sub { '$(TOPDIR)/configure --autoperl' };
$ap::{localedir} = sub { '/usr/local/locale' };
$ap::{install} = sub { '$(TOPDIR)/configure --autoperl install -p' };
-$ap::{version} = sub { '1.25' };
+$ap::{version} = sub { '1.26' };
$ap::{includedir} = sub { '/usr/local/lib/site_perl' };
-$ap::{statedir} = sub { '/var/lib' };
$ap::{datadir} = sub { '/usr/local/share' };
$ap::{sbindir} = sub { '/usr/local/sbin' };
$ap::{libdir} = sub { '/usr/local/lib' };
@@ -189,6 +190,7 @@
$ap::{ld} = sub { '$(TOPDIR)/configure --autoperl link' };
$ap::{destdir} = sub { '' };
$ap::{prefix} = sub { '/usr/local' };
+$ap::{localstatedir} = sub { '/usr/local/var' };
# Allow references to $ap::config{foo} or $ap::config->{foo}
@@ -225,13 +227,14 @@
our $log = new Autoperl::Logger;
our $ap = new Autoperl();
- # Parse Makefile.am
- $ap->{mk}->parse_all();
-
# Parse command line options
unshift @ARGV, $original_action if defined $original_action;
$ap->get_options();
+ # Parse Makefile.am
+ $ap->{mk}->parse_all();
+
+
# FIXME-WORKAROUND for $ap->{program}
# this is ugly
$ap->{program} = $ap->{mk}->{program};
@@ -758,22 +761,27 @@
my $target = $mk->{curdir} . '/Makefile';
my ($basename,$topdir) = ("","");
+ # Get the subdirectory relative to topdir
+ my $subdir = $mk->{curdir};
+ $subdir =~ s/^$ap->{mk}->{curdir}//;
+ $subdir =~ s/^\///;
+
# Get basename and topdir
$target =~ /.*\//;
$basename = $&;
$basename = "" unless defined $basename;
$basename = "" if $basename =~ m|^\./?$|;
if ($basename) {
- $topdir = $basename;
+ $topdir = $subdir;
$topdir =~ s/[a-zA-Z0-9\-\_\.]+/\.\./g;
}
- notice("writing $target..");
+ notice("writing ".($subdir ? "$subdir/" : '')."Makefile..");
open ( MKFILE, ">$target" ) or die $!;
print MKFILE "# Generated by\n#\n# ./configure --" . join("\n#" . ' 'x16 . '--' , at ARGV) . "\n#\n";
- foreach my $id ( keys %{ $ap } ) {
+ foreach my $id ( sort( keys %{ $ap }) ) {
next if ref($ap->{$id});
next if $id =~ /^_/; # don't print internal structures
@@ -781,13 +789,14 @@
$uc_id =~ tr/a-z/A-Z/;
my $val = $ap->{$id};
+ unless ($id eq 'topdir') {
$val = '$$DESTDIR' . $val if $id =~ /dir$/;
+ }
die "null values for $id not permitted" unless defined $val;
print MKFILE $uc_id . " = $val\n";
}
-print MKFILE "TOPDIR = " . $ap->{topdir}. "\n";
-print MKFILE "DISTDIR = ${topdir}\$(PROGRAM)-\$(VERSION)/${basename}\n";
+print MKFILE "DISTDIR = \$(TOPDIR)/\$(PROGRAM)-\$(VERSION)/${subdir}\n";
Autoperl::Generator::write_makefile($mk,*MKFILE);
close(MKFILE);
@@ -835,7 +844,8 @@
libdir => '${prefix}/lib',
docdir => '${prefix}/share/doc',
localedir => '${prefix}/locale',
- statedir => '/var/lib',
+ localstatedir => '${prefix}/var',
+ sharedstatedir => '${prefix}/com',
# Build flags
static => 0,
@@ -950,6 +960,7 @@
use Carp;
use Data::Dumper;
BEGIN { import Autoperl::Logger; }
+use Cwd;
use subs qw(raise);
@@ -1003,6 +1014,9 @@
# Variables defined in Makefile.am
my $self = +{
+ # Absolute pathname of the directory containing Makefile.am
+ curdir => undef,
+
# Global variables from configure.in
# TODO- reorganize this crap
program => 'mtest-comment-parsery-program',
@@ -1084,6 +1098,81 @@
return $self;
}
+# Parser for cpp-compatible directives
+sub cpp_parser($$$)
+{
+ my ($mk, $lines, $idx_ref) = @_;
+ my $idx = $$idx_ref;
+
+ if ($lines->[$idx] =~ /^\s*\#include\s*\"(.*?)\"/) {
+ my $target = $mk->{curdir} . '/' . $1;
+
+ # Expand custom arguments inside the target spec
+ foreach my $key (keys %{$mk->{custom_arg}}) {
+ $target =~ s/\$[\{\(]$key[\}\)]/$mk->{custom_arg}->{$key}/g;
+ }
+
+ # Read the file
+ open(my $fd1, "<$target") or die "Makefile.am:$idx: $!: $target";
+ my @include = <$fd1>;
+ close($fd1);
+
+ # Insert the contents into the buffer
+ splice @{$lines}, $idx, 1, @include;
+ $$idx_ref -= 2;
+ return 0;
+ }
+
+ return 1;
+
+ #XXX-DEADWOOD-XXX This will be finished someday but is buggy
+
+ # KLUDGE - ugly
+ if ($lines->[$idx] =~ /^\s*\#endif\s*$/) {
+ splice @{$lines}, $idx, 1;
+ $$idx_ref -= 2;
+ return 0;
+ }
+
+ # Process '#if' statement
+ if ($lines->[$idx] =~ /^\s*\#if\s*(.*)$/) {
+ my $cond = $1;
+ my ($lhs,$op,$rhs) = split /\s+/, $cond, 3;
+
+ # Test the truth value of the condition
+ my $truth = 0;
+ my $lval = $mk->get_variable($lhs);
+ if ($op eq '==') {
+ $truth = $lval eq $rhs ? 1 : 0;
+ } elsif ($op eq '!=') {
+ $truth = $lval ne $rhs ? 1 : 0;
+ } else {
+ die "unsupported operator: $op";
+ }
+
+ # Remove the #if line from the output
+ splice @{$lines}, $idx, 1;
+
+ # Remove the section if the condition is false
+ my $endline;
+ do {
+ $endline = $lines->[$idx];
+ if ( not $truth ) {
+ splice @{$lines}, $idx, 1;
+ } else {
+ $idx++;
+ $$idx_ref++;
+ }
+ die 'XXX-TODO: support else, elif'
+ if $endline and $endline =~ /^\s*\#(else|elif)/;
+ } until (not defined $endline or $endline =~ /^\s\#endif\s*$/);
+ $$idx_ref -= 2;
+ return 0;
+ }
+
+ 1;
+}
+
sub parse_makefile_am($$)
{
my ($mk,$input) = @_;
@@ -1094,7 +1183,7 @@
# Get the current directory
$input =~ /(.*)\//;
my $curdir = $1;;
-$curdir = '.' unless defined $curdir;
+$curdir = getcwd unless defined $curdir;
$curdir =~ s|^\./||;
$mk->{curdir} = $curdir;
debug("curdir = $curdir");
@@ -1105,7 +1194,7 @@
$mk->parse_aplocal_inc("$curdir/aplocal.inc");
# Slurp the entire file into @lines
-open ( my $infile, "<./$input") or raise "$input: $!";
+open ( my $infile, "<$input") or raise "$input: $!";
my @lines = <$infile>;
close ($infile);
@@ -1118,6 +1207,10 @@
debug("stage1, $lineno: $s");
#====================================================
+ # Parser for cpp-compatible directives
+ $mk->cpp_parser(\@lines, \$lineno) or next;
+
+ #====================================================
# Parser for inline perl code
my $left_curly = '{';
my $right_curly = '}';
@@ -1165,8 +1258,12 @@
};
$lineno++;
- while ($lineno <= $#lines and $lines[$lineno] =~ /^\t/) {
+ while ($lineno <= $#lines and $lines[$lineno] =~ /^\s*\t/) {
chomp ( my $s = $lines[$lineno]);
+
+ # Replace any leading whitespace with a single tab
+ $s =~ s/^\s+/\t/;
+
# DEADWOOD-Strip comments
#$s =~ s/(?!\\)(#.*?)(\\?)$//;
#$s .= "\\" if $2;
@@ -1211,7 +1308,8 @@
$mk->{top}->{lc $token} = $value;
} elsif ($token =~ /_ARG$/) {
my $arg = $`;
- $mk->{top}->{custom_arg}->{$arg} = $value;
+ $mk->{top}->{custom_arg}->{$arg} = $value
+ unless exists $mk->{top}->{custom_arg}->{$arg};
} elsif ($token =~ /_ARG_HELP$/) {
my $arg = $`;
$mk->{top}->{help_string}->{$arg} = $value;
@@ -1307,7 +1405,7 @@
} else {
# FIXME this should never happen but breaks on innocent whitespace
- warn "$input:$lineno: unhandled parser path ";
+ die "$input:$lineno: unhandled parser path";
}
}
}
@@ -1503,6 +1601,19 @@
}
+# Given a variable name, return the corresponding value
+sub get_variable($$)
+{
+ my ($self, $key) = @_;
+ if (exists $self->{custom_arg}->{$key} ) {
+ return $self->{custom_arg}->{$key};
+ } elsif ( exists $self->{vars}->{$key} ) {
+ return $self->{vars}->{$key};
+ } else {
+ return '';
+ }
+}
+
############ Flattening routines
sub get_all_vars($)
@@ -1511,9 +1622,21 @@
my $s = "";
- foreach my $key (keys %{$self->{vars}}) {
- $s .= $key . ' := ' . $self->{vars}->{$key} . "\n";
+ # Serialize a hash
+ sub serialize($) {
+ my $substr = '';
+ my ($hashref,$s_ref) = @_;
+ foreach my $key (sort (keys %{$hashref})) {
+ my $proper_key = $key;
+ $proper_key =~ tr/-/_/;
+ $substr .= $proper_key . ' := ' . $hashref->{$key} . "\n";
+ }
+ return $substr;
}
+
+ $s .= serialize($self->{vars});
+ $s .= serialize($self->{custom_arg});
+
return $s;
}
@@ -2029,7 +2152,7 @@
libdir
docdir
localedir
- statedir
+ localstatedir
sysconfdir
destdir
);
@@ -2040,8 +2163,6 @@
my ($ap,$mk) = @_;
my $outfile = $mk->{curdir} . '/config.h';
- notice("writing $outfile..");
-
# Generate a 'cfg' object to be included in the binary
my $cfg;
foreach my $key (INSTALL_PATHS, qw(program author version)) {
@@ -2145,14 +2266,13 @@
# Generate all variable definitions
my $subdirs = join(' ',@{$mk->{subdirs}});
-print MOUT "SUBDIRS = $subdirs\n" if $subdirs;
if ($mk->get_all_vars()) {
- #print MOUT "\n\n#---- User defined variables ----\n\n";
print MOUT $mk->get_all_vars() . "\n";
}
+print MOUT "# Internal Autoperl variables -- don't use these\n";
+print MOUT "SUBDIRS = $subdirs\n" if $subdirs;
print MOUT "APLOCAL = \$(PERL) -e 'do \"config.h\"; do \"aplocal.inc\";' -e \n";
-
# ----------- BEGIN targets -------------
my @recursive_targets = qw(all install dist clean test uninstall);
@@ -2416,8 +2536,9 @@
if grep /post_make_dist/, @{$mk->{hooks}};
# Create the tarball and clean up
-if ( $curdir eq '.' ) {
- print MOUT "\ttar zcvf ".$mk->{top}->{program}."-".$mk->{version}.".tar.gz $buildd\n";
+if ( $curdir eq $mk->{top}->{curdir} ) {
+ my $prog_id = $mk->{top}->{program}."-".$mk->{version};
+ print MOUT "\ttar zcvf ${prog_id}.tar.gz ${prog_id}\n";
print MOUT "\trm -rf $buildd\n";
}
print MOUT "\n";
@@ -2734,7 +2855,7 @@
use File::Compare;
use File::Spec::Functions ':ALL';
-# Generated by autoperl 1.25
+# Generated by autoperl 1.26
unless (defined $ap::CONFIG_H) {
$ap::CONFIG_H = 1;
@@ -2745,6 +2866,7 @@
'author' => 'Mark Heily <devel at heily.com>',
'program' => 'autoperl',
'ovr_custom' => 'default',
+ 'crap' => 'good',
'infodir' => '/usr/local/info',
'cc' => '/usr/bin/perl -c',
'sysconfdir' => '/usr/local/etc',
@@ -2755,9 +2877,8 @@
'autoperl' => '$(TOPDIR)/configure --autoperl',
'localedir' => '/usr/local/locale',
'install' => '$(TOPDIR)/configure --autoperl install -p',
- 'version' => '1.25',
+ 'version' => '1.26',
'includedir' => '/usr/local/lib/site_perl',
- 'statedir' => '/var/lib',
'datadir' => '/usr/local/share',
'sbindir' => '/usr/local/sbin',
'libdir' => '/usr/local/lib',
@@ -2765,7 +2886,8 @@
'def_custom' => 'default',
'ld' => '$(TOPDIR)/configure --autoperl link',
'destdir' => '',
- 'prefix' => '/usr/local'
+ 'prefix' => '/usr/local',
+ 'localstatedir' => '/usr/local/var'
);
# Allow references to $ap::foo
@@ -2776,6 +2898,7 @@
$ap::{author} = sub { 'Mark Heily <devel at heily.com>' };
$ap::{program} = sub { 'autoperl' };
$ap::{ovr_custom} = sub { 'default' };
+$ap::{crap} = sub { 'good' };
$ap::{infodir} = sub { '/usr/local/info' };
$ap::{cc} = sub { '/usr/bin/perl -c' };
$ap::{sysconfdir} = sub { '/usr/local/etc' };
@@ -2786,9 +2909,8 @@
$ap::{autoperl} = sub { '$(TOPDIR)/configure --autoperl' };
$ap::{localedir} = sub { '/usr/local/locale' };
$ap::{install} = sub { '$(TOPDIR)/configure --autoperl install -p' };
-$ap::{version} = sub { '1.25' };
+$ap::{version} = sub { '1.26' };
$ap::{includedir} = sub { '/usr/local/lib/site_perl' };
-$ap::{statedir} = sub { '/var/lib' };
$ap::{datadir} = sub { '/usr/local/share' };
$ap::{sbindir} = sub { '/usr/local/sbin' };
$ap::{libdir} = sub { '/usr/local/lib' };
@@ -2797,6 +2919,7 @@
$ap::{ld} = sub { '$(TOPDIR)/configure --autoperl link' };
$ap::{destdir} = sub { '' };
$ap::{prefix} = sub { '/usr/local' };
+$ap::{localstatedir} = sub { '/usr/local/var' };
# Allow references to $ap::config{foo} or $ap::config->{foo}
Index: perl-kolab.spec.in
===================================================================
RCS file: /kolabrepository/server/perl-kolab/perl-kolab.spec.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- perl-kolab.spec.in 14 Jul 2005 21:39:49 -0000 1.10
+++ perl-kolab.spec.in 15 Jul 2005 01:01:33 -0000 1.11
@@ -60,7 +60,8 @@
%build
%{configure} --prefix=@l_prefix@ \
- --includedir=%{perl_sitearch}
+ --includedir=%{perl_sitearch} \
+ --dist=kolab
make
%install
More information about the commits
mailing list