MAJOR=4
MINOR=6
DEVNAME=tty6
  7   ˆl–ßi~” ”Ð?Je@‚ãn\ªbÑ¿�þ[•¶VnQÆÉh­Ê@?Ã„MŸÈÆÅ ?÷     #!/usr/bin/perl
# Debian required shebang above
# Original shebang below
# #! /usr/bin/env perl

################################################
# Prepare a LaTeX package for upload to CTAN   #
# By Scott Pakin <scott+ctify@pakin.org>       #
################################################

use Cwd;
use File::Basename;
use File::Copy::Recursive qw(fcopy);
use File::Find;
use File::Path;
use File::Spec;
use File::stat;
use File::Temp qw(tempdir);
use Getopt::Long;
use Pod::Usage;
use warnings;
use strict;

# Define some global variables.
our $VERSION = "1.9.1";        # ctanify version number
my $progname = basename $0;    # Name of this program
my $pkgname;                   # Base name of the package to create
my $miscify = 0;               # 1=replace singletons with misc; 0=don't
my $autoinclude = 1;           # 1=automatically include files named in .ins
my $skipdroppings = 1;         # 1=skip "dropping" files (e.g., "README~")
my $unixify = 1;               # 1=make text files use Unix line endings
my $maketds = 1;               # 1=embed a .tds.zip file; 0=don't
my @manifest;                  # List of files to include
my %file2tds;                  # Map from specific filenames to TDS directories
my @tdsdirlist;                # Contents of the TDS tree
my @pkgdirlist;                # Contents of the package tree
my @tdsonly;                   # Files to include only in the TDS tree
my $tdsdir = "";               # Absolute directory of the TDS tree
my $pkgdir = "";               # Absolute directory of the package directory
my $zipname;                   # Name of the TDS zip file
my $tarname;                   # Name of the package tar file
my $tdsoutdir;                 # Directory name where to output TDS tree
my $texmacros = "latex";       # TeX macro package

# Associate file extensions with TDS directories.  "%s" is replaced
# with the package name.
my %ext2tds =
    ("README"  => "doc/latex/%s",
     "afm"     => "fonts/afm/public/%s",
     "bat"     => "scripts/%s",
     "bbx"     => "tex/latex/%s",
     "bib"     => "bibtex/bib/%s",
     "bst"     => "bibtex/bst/%s",
     "cbx"     => "tex/latex/%s",
     "cls"     => "tex/latex/%s",
     "dbx"     => "tex/latex/%s",
     "dtx"     => "source/latex/%s",
     "dvi"     => "doc/latex/%s",
     "fd"      => "tex/latex/%s",
     "ins"     => "source/latex/%s",
     "map"     => "fonts/map/dvips/%s",
     "md"      => "doc/latex/%s",
     "mf"      => "fonts/source/public/%s",
     "mp"      => "metapost/%s",
     "ofm"     => "fonts/ofm/public/%s",
     "ovf"     => "fonts/ovf/public/%s",
     "ovp"     => "fonts/ovp/public/%s",
     "pdf"     => "doc/latex/%s",
     "pfb"     => "fonts/type1/public/%s",
     "pfm"     => "fonts/type1/public/%s",
     "ps"      => "doc/latex/%s",
     "py"      => "scripts/%s",
     "sh"      => "scripts/%s",
     "sty"     => "tex/latex/%s",
     "tfm"     => "fonts/tfm/public/%s",
     "txt"     => "doc/latex/%s",
     "vf"      => "fonts/vf/public/%s");

# Specify a list of filename regexps to ignore.
my @ignore_re = ('~$', '\bCVS\b', '\b\.svn\b');

# Specify a list of file extensions that are considered "text" files.
# This script will convert their line endings to Unix style (a single
# linefeed character).
my %text_ext =
    map {($_ => 1)} qw(afm bib bst cls dtx fd ins ltx md mf mp sty tex txt);

# Define a subroutine that returns the size in bytes of a file,
# aborting on error.
sub filesize ($)
{
    my $finfo = lstat($_[0]) || die "${progname}: Failed to stat $_ ($!)\n";
    return $finfo->size;
}

# Define a subroutine that runs a command and aborts on error.
sub run_command ($;$)
{
    my $command = $_[0];
    my $ignore_errors = defined $_[1] ? $_[1] : 0;
    my $retval = system $command;
    if (!$ignore_errors && $retval>>8) {
        die "${progname}: Command \"$command\" failed\n";
    }
}

# Define a subroutine that Unix-ifies the line endings in text files.
# This subroutine is called from File::Find so