Author: guillem
Date: 2007-07-21 16:25:07 +0000 (Sat, 21 Jul 2007)
New Revision: 881

Added:
   trunk/scripts/Dpkg.pm
Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/debian/dpkg.install
   trunk/m4/perl.m4
   trunk/scripts/Makefile.am
Log:
Move variables automatically modified at build time to a new style perl
module.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2007-07-18 05:02:56 UTC (rev 880)
+++ trunk/ChangeLog     2007-07-21 16:25:07 UTC (rev 881)
@@ -1,3 +1,12 @@
+2007-07-21  Guillem Jover  <[EMAIL PROTECTED]>
+
+       * m4/perl.m4 (DPKG_PROG_PERL): Add support for user overridable
+       PERL_LIBDIR variable, autodetected from the system installation.
+       * scripts/Makefile.am (perllibdir): New variable.
+       (nobase_dist_perllib_DATA): Likewise.
+       (install-data-hook): New target.
+       * scripts/Dpkg.pm: New file.
+
 2007-07-03  Frank Lichtenheld  <[EMAIL PROTECTED]>
 
        * configure.ac: Bump version to 1.14.6~.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2007-07-18 05:02:56 UTC (rev 880)
+++ trunk/debian/changelog      2007-07-21 16:25:07 UTC (rev 881)
@@ -14,6 +14,8 @@
       and remove leftover string from man page split.
     - Split option descriptions so that it gets easier to distinguish.
     - Unify author and copyright information formatting.
+  * Move variables automatically modified at build time to a new style perl
+    module.
 
   [ Updated scripts translations ]
   * French (Frédéric Bothamy, Christian Perrier).

Modified: trunk/debian/dpkg.install
===================================================================
--- trunk/debian/dpkg.install   2007-07-18 05:02:56 UTC (rev 880)
+++ trunk/debian/dpkg.install   2007-07-21 16:25:07 UTC (rev 881)
@@ -35,6 +35,7 @@
 usr/share/man/*/start-stop-daemon.8
 usr/share/man/*/*/update-alternatives.8
 usr/share/man/*/update-alternatives.8
+usr/share/perl5
 var/lib/dpkg/alternatives
 var/lib/dpkg/info
 var/lib/dpkg/parts

Modified: trunk/m4/perl.m4
===================================================================
--- trunk/m4/perl.m4    2007-07-18 05:02:56 UTC (rev 880)
+++ trunk/m4/perl.m4    2007-07-21 16:25:07 UTC (rev 881)
@@ -4,4 +4,6 @@
 AC_DEFUN([DPKG_PROG_PERL],
 [AC_ARG_VAR([PERL], [Perl interpreter])dnl
 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])dnl
+AC_ARG_VAR([PERL_LIBDIR], [Perl library directory])dnl
+PERL_LIBDIR=`$PERL -MConfig -e 'print $Config{vendorlib}'`dnl
 ])# DPKG_PROG_PERL

Added: trunk/scripts/Dpkg.pm
===================================================================
--- trunk/scripts/Dpkg.pm                               (rev 0)
+++ trunk/scripts/Dpkg.pm       2007-07-21 16:25:07 UTC (rev 881)
@@ -0,0 +1,17 @@
+package Dpkg;
+
+use strict;
+use warnings;
+
+use base qw(Exporter);
+our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);
+
+our ($progname) = $0 =~ m:.*/(.*):;
+
+# The following lines are automatically fixed at install time
+our $version = "1.14";
+our $admindir = "/var/lib/dpkg";
+our $dpkglibdir = ".";
+our $pkgdatadir = "..";
+
+1;

Modified: trunk/scripts/Makefile.am
===================================================================
--- trunk/scripts/Makefile.am   2007-07-18 05:02:56 UTC (rev 880)
+++ trunk/scripts/Makefile.am   2007-07-21 16:25:07 UTC (rev 881)
@@ -53,6 +53,9 @@
        $(bin_SCRIPTS) $(sbin_SCRIPTS) $(changelog_SCRIPTS) \
        install-info install-info-stamp
 
+perllibdir = $(PERL_LIBDIR)
+nobase_dist_perllib_DATA = \
+       Dpkg.pm
 
 dist_pkglib_SCRIPTS = \
        controllib.pl \
@@ -94,6 +97,14 @@
        $(mkdir_p) $(DESTDIR)$(sysconfdir)/alternatives
        $(INSTALL_DATA) $(srcdir)/README.alternatives 
$(DESTDIR)$(sysconfdir)/alternatives/README
 
+# Ideally we'd use 'sed -i', but unfortunately that's not portable.
+install-data-hook:
+       cp -p $(DESTDIR)$(perllibdir)/Dpkg.pm \
+             $(DESTDIR)$(perllibdir)/Dpkg.pm.tmp
+       $(do_perl_subst) <$(DESTDIR)$(perllibdir)/Dpkg.pm.tmp \
+                        >$(DESTDIR)$(perllibdir)/Dpkg.pm
+       rm $(DESTDIR)$(perllibdir)/Dpkg.pm.tmp
+
 uninstall-local:
        rm -f $(DESTDIR)$(sysconfdir)/alternatives/README
        rm -f $(DESTDIR)$(sbindir)/install-info


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to