"Fossies" - the Fresh Open Source Software Archive

Member "squidanalyzer-6.6/Makefile.PL" (7 May 2017, 6544 Bytes) of package /linux/privat/squidanalyzer-6.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile.PL": 6.5_vs_6.6.

    1 use ExtUtils::MakeMaker;
    2 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
    3 # the contents of the Makefile that is written.
    4 
    5 use strict;
    6 
    7 my @ALLOWED_ARGS = ('LOGFILE','BINDIR','ETCDIR', 'CONFDIR','HTMLDIR','BASEURL','DOCDIR','MANDIR','QUIET','INSTALLDIRS','DESTDIR');
    8 
    9 # Parse command line arguments and store them as environment variables
   10 while ($_ = shift) {
   11     my ($k,$v) = split(/=/, $_, 2);
   12     if (grep(/^$k$/, @ALLOWED_ARGS)) {
   13         $ENV{$k} = $v;
   14     }
   15 }
   16 $ENV{DESTDIR} =~ s/\/$//;
   17 
   18 # Search for default log dir
   19 my $default_log = '/var/log/squid/access.log';
   20 if (! -d $default_log ) {
   21     $default_log = '/var/log/squid3/access.log';
   22 }
   23 
   24 # Default install path
   25 my $LOGFILE = $ENV{LOGFILE} || $default_log;
   26 my $BINDIR = $ENV{BINDIR} || '/usr/local/bin';
   27 my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer';
   28 my $ETCDIR = $ENV{ETCDIR} || $CONFDIR;
   29 my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer';
   30 my $BASEURL = $ENV{BASEURL} || '/squidreport';
   31 my $DOCDIR = $ENV{DOCDIR} || '';
   32 my $MANDIR = $ENV{MANDIR} || '/usr/local/man/man3';
   33 my $DESTDIR = $ENV{DESTDIR} || '';
   34 $ENV{INSTALLDIRS} ||= 'site';
   35 
   36 unless(open(INST, ">install_all.sh")) {
   37         print "\nError: can't write post install file install_all.sh, $!\n";
   38         exit 0;
   39 }
   40 print INST qq{#!/bin/sh
   41 test ! -d "$DESTDIR$BINDIR" && mkdir -p $DESTDIR$BINDIR
   42 test ! -d "$DESTDIR$ETCDIR" && mkdir -p $DESTDIR$ETCDIR
   43 test ! -d "$DESTDIR$ETCDIR/lang" && mkdir -p $DESTDIR$ETCDIR/lang
   44 test ! -d "$DESTDIR$HTMLDIR" && mkdir -p $DESTDIR$HTMLDIR
   45 test ! -d "$DESTDIR$HTMLDIR/images" && mkdir -p $DESTDIR$HTMLDIR/images
   46 };
   47 
   48 if ($DOCDIR ne '') {
   49     print INST qq{
   50 test ! -d "$DESTDIR$DOCDIR" && mkdir -p $DESTDIR$DOCDIR
   51 };
   52 }
   53 
   54 print INST qq{
   55 test ! -d "$DESTDIR$MANDIR" && mkdir -p $DESTDIR$MANDIR
   56 
   57 # Copy files that must not be overriden 
   58 for file in squidanalyzer.conf network-aliases user-aliases excluded included; do
   59 if [ -r $DESTDIR$ETCDIR/\$file ]; then
   60     install -m 644 etc/\$file $DESTDIR$ETCDIR/\$file.sample
   61 else
   62     install -m 644 etc/\$file $DESTDIR$ETCDIR/\$file
   63 fi
   64 done
   65 install -m 755 squid-analyzer $DESTDIR$BINDIR/
   66 install -m 644 resources/sorttable.js $DESTDIR$HTMLDIR/
   67 install -m 644 resources/squidanalyzer.css $DESTDIR$HTMLDIR/
   68 install -m 644 resources/flotr2.js $DESTDIR$HTMLDIR/
   69 install -m 644 resources/images/logo-squidanalyzer.png $DESTDIR$HTMLDIR/images/
   70 install -m 644 resources/images/cursor.png $DESTDIR$HTMLDIR/images/
   71 install -m 644 resources/images/domain.png $DESTDIR$HTMLDIR/images/
   72 install -m 644 resources/images/back-arrow.png $DESTDIR$HTMLDIR/images/
   73 install -m 644 resources/images/info.png $DESTDIR$HTMLDIR/images/
   74 install -m 644 resources/images/network.png $DESTDIR$HTMLDIR/images/
   75 install -m 644 resources/images/user.png $DESTDIR$HTMLDIR/images/
   76 install -m 644 lang/* $DESTDIR$ETCDIR/lang/
   77 pod2text doc/SquidAnalyzer.pod README
   78 pod2man doc/SquidAnalyzer.pod squid-analyzer.3
   79 };
   80 if ($DOCDIR ne '') {
   81         print INST qq{
   82     install -m 644 README $DESTDIR$DOCDIR/
   83     install -m 644 INSTALL $DESTDIR$DOCDIR/
   84     install -m 644 ChangeLog $DESTDIR$DOCDIR/
   85 };
   86 }
   87 if ($MANDIR ne '') {
   88         print INST qq{
   89     install -m 644 squid-analyzer.3 $DESTDIR$MANDIR/
   90 };
   91 }
   92 
   93 if (!$ENV{QUIET}) {
   94         print INST qq{
   95 echo "
   96 -----------------------------------------------------------------------------
   97 1. Modify your httpd.conf to allow access to HTML output like follow:
   98         Alias /squidreport $HTMLDIR
   99         <Directory $HTMLDIR>
  100             Options -Indexes FollowSymLinks MultiViews
  101         AllowOverride None
  102             Order deny,allow
  103             Deny from all
  104             Allow from 127.0.0.1
  105         </Directory>
  106 2. If necessary, give additional host access to SquidAnalyzer in httpd.conf.
  107    Restart and ensure that httpd is running.
  108 3. Browse to http://my.host.dom/squidreport/ to ensure that things are working
  109    properly.
  110 4. Setup a cronjob to run squid-analyzer daily:
  111 
  112      # SquidAnalyzer log reporting daily
  113      0 2 * * * $BINDIR/squid-analyzer > /dev/null 2>&1
  114 
  115 or run it manually. For more information, see $DOCDIR/README file.
  116 -----------------------------------------------------------------------------
  117 "
  118 };
  119 }
  120 close(INST);
  121 `chmod 755 install_all.sh`;
  122 
  123 # Change path into the default configuration file
  124 `perl -p -i -e 's#/.*/squidanalyzer.conf#$ETCDIR/squidanalyzer.conf#' etc/squidanalyzer.conf squid-analyzer`;
  125 `perl -p -i -e 's#^Output.*#Output  $HTMLDIR#' etc/squidanalyzer.conf`;
  126 `perl -p -i -e 's#^LogFile.*#LogFile    $LOGFILE#' etc/squidanalyzer.conf`;
  127 `perl -p -i -e 's#^WebUrl.*#WebUrl  $BASEURL#' etc/squidanalyzer.conf`;
  128 `perl -p -i -e 's#^NetworkAlias.*#NetworkAlias  $ETCDIR/network-aliases#' etc/squidanalyzer.conf`;
  129 `perl -p -i -e 's#^UserAlias.*#UserAlias    $ETCDIR/user-aliases#' etc/squidanalyzer.conf`;
  130 `perl -p -i -e 's#^Exclude.*#Exclude    $ETCDIR/excluded#' etc/squidanalyzer.conf`;
  131 `perl -p -i -e 's#^Include.*#Include    $ETCDIR/included#' etc/squidanalyzer.conf`;
  132 `perl -p -i -e 's#Lang.*\.txt#Lang  $ETCDIR/lang/en_US.txt#' etc/squidanalyzer.conf`;
  133 
  134 my $zcat = `which zcat`;
  135 chomp($zcat);
  136 `perl -p -i -e 's#^\\\$ZCAT_PROG.*#\\\$ZCAT_PROG = "$zcat";#' SquidAnalyzer.pm`;
  137 
  138 my $bzcat = `which bzcat`;
  139 chomp($bzcat);
  140 `perl -p -i -e 's#^\\\$BZCAT_PROG.*#\\\$BZCAT_PROG = "$bzcat";#' SquidAnalyzer.pm`;
  141 
  142 my $xzcat = `which xzcat`;
  143 chomp($xzcat);
  144 `perl -p -i -e 's#^\\\$XZCAT_PROG.*#\\\$XZCAT_PROG = "$xzcat";#' SquidAnalyzer.pm`;
  145 
  146 
  147 WriteMakefile(
  148     'DISTNAME'  => 'SquidAnalyzer',
  149     'NAME'      => 'SquidAnalyzer',
  150     'VERSION_FROM'  => 'SquidAnalyzer.pm',
  151     'dist'  => {
  152             'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
  153             'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'
  154            },
  155     'AUTHOR'       => 'Gilles Darold (gilles@darold.net)',
  156     'ABSTRACT'     => 'Squid log analyzer',
  157     'EXE_FILES'    => [ qw(squid-analyzer) ],
  158     'MAN3PODS'     => { 'doc/SquidAnalyzer.pod' => 'blib/man3/SquidAnalyzer.3pm' },
  159     'DESTDIR'      => $ENV{DESTDIR},
  160     'INSTALLDIRS'  => $ENV{INSTALLDIRS},
  161     'clean'        => { FILES => "install_all.sh lib/blib/ squid-analyzer.3" },
  162     'META_MERGE'   => {
  163         resources  => {
  164             homepage => 'http://squidanalyzer.darold.net/',
  165             repository  => {
  166                 type => 'git',
  167                 git => 'git@github.com:darold/squidanalyzer.git',
  168                 web => 'https://github.com/darold/squidanalyzer',
  169             },
  170         },
  171     }
  172 
  173 );
  174 
  175 sub MY::install {
  176     my $self = shift;
  177 
  178     my $string = $self->MM::install;
  179     $string =~ s/(pure_install\s+)(.*)/$1 install_all $2/;
  180 
  181     return $string;
  182 }
  183 
  184 sub MY::postamble {
  185     my $postamble = <<'END';
  186 install_all: install_all.sh
  187     sh install_all.sh
  188 END
  189     return $postamble;
  190 }
  191 
  192 if (!$ENV{QUIET}) {
  193     print "Done...\n\n";
  194     print "Now type 'make && make install'\n\n";
  195 }
  196