aboutsummaryrefslogtreecommitdiff
path: root/Tools/scripts/mkptools
diff options
context:
space:
mode:
authorNeil Blakey-Milner <nbm@FreeBSD.org>2000-10-14 02:45:49 +0000
committerNeil Blakey-Milner <nbm@FreeBSD.org>2000-10-14 02:45:49 +0000
commit90d103f7cccf0eaaed04de7bed64f238f6520294 (patch)
tree19a88cf785198fd1d5e3c0375bfa22fe283b40f8 /Tools/scripts/mkptools
parent464444fe4dc6617668686b55b3a65848a541ba04 (diff)
downloadports-90d103f7cccf0eaaed04de7bed64f238f6520294.tar.gz
ports-90d103f7cccf0eaaed04de7bed64f238f6520294.zip
Notes
Diffstat (limited to 'Tools/scripts/mkptools')
-rwxr-xr-xTools/scripts/mkptools/mkpclean30
-rwxr-xr-xTools/scripts/mkptools/mkpextr255
-rwxr-xr-xTools/scripts/mkptools/mkpmerge48
-rwxr-xr-xTools/scripts/mkptools/mkpskel280
4 files changed, 613 insertions, 0 deletions
diff --git a/Tools/scripts/mkptools/mkpclean b/Tools/scripts/mkptools/mkpclean
new file mode 100755
index 000000000000..90beab470e9e
--- /dev/null
+++ b/Tools/scripts/mkptools/mkpclean
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+#
+# Copyright (c) 2000 Neil Blakey-Milner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+unlink("Makefile.old");
+unlink("Makefile.extr");
+`make clean NOCLEANDEPENDS=1`;
diff --git a/Tools/scripts/mkptools/mkpextr b/Tools/scripts/mkptools/mkpextr
new file mode 100755
index 000000000000..4e2fe8e97e69
--- /dev/null
+++ b/Tools/scripts/mkptools/mkpextr
@@ -0,0 +1,255 @@
+#!/usr/bin/perl -w
+#
+# Copyright (c) 2000 Neil Blakey-Milner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+use strict;
+
+use Getopt::Std qw( getopts );
+
+my ($initdir, $distname);
+my ($makefile, $wrksrc);
+my ($portname, $portversion);
+my (%cap); # persistent version of the make variables
+my (%tmp); # temporary version of the make variables
+
+chomp($initdir = `pwd`);
+
+getopts('o');
+
+#&usage if $#ARGV != 0;
+
+&initmk;
+&chk_scripts;
+chdir($initdir);
+open(MAKEFILE, ">Makefile.extr");
+&writemk;
+
+exit;
+
+sub nl {
+ print MAKEFILE "\n";
+}
+
+sub writeiffound {
+ my($var) = (@_);
+
+ if ($tmp{"$var"}) {
+ print MAKEFILE "$var=\t". $tmp{$var} . "\n";
+ delete($tmp{$var});
+ return 1;
+ }
+ return 0;
+}
+
+sub appendvar {
+ my ($var, $item) = (@_);
+
+ if ($tmp{$var}) {
+ $tmp{$var} .= "\t\\\n\t\t$item";
+ } else {
+ $tmp{$var} = "$item";
+ }
+}
+
+sub writemk {
+
+ my (@freeform);
+
+ my ($key);
+
+ foreach $key (keys %cap) {
+ $tmp{$key} = $cap{$key};
+ }
+
+ foreach $key (keys %tmp) {
+ if ($tmp{"USE_KDE"}) {
+ appendvar("LIB_DEPENDS",
+ "kdecore.4:\${PORTSDIR}/x11/kdelibs2");
+ delete($tmp{"USE_KDE"});
+ }
+
+ if ($tmp{"USE_GNOME"}) {
+ appendvar("LIB_DEPENDS",
+ "gnome.4:\${PORTSDIR}/x11/gnomelibs");
+ delete($tmp{"USE_GNOME"});
+ }
+
+ if ($tmp{"USE_GTK"}) {
+ appendvar("LIB_DEPENDS",
+ "gtk12.2:\${PORTSDIR}/x11-toolkits/gtk12");
+
+ $tmp{"GTK_CONFIG"} =
+ "\${X11BASE}/bin/gtk12-config";
+
+ appendvar("CONFIGURE_ENV",
+ "GTK_CONFIG=\"\${GTK_CONFIG}\"");
+
+ delete($tmp{"USE_GTK"});
+ }
+ }
+
+ my ($date);
+ chomp($date = `date +"\%d \%b \%Y"`);
+
+ nl if writeiffound("LIB_DEPENDS");
+
+ nl if (writeiffound("GNU_CONFIGURE") +
+ writeiffound("HAS_CONFIGURE") +
+ writeiffound("CONFIGURE_ARGS") +
+ writeiffound("CONFIGURE_ENV"));
+
+ #second group
+ foreach $key (keys %tmp) {
+ my($tmp) = $tmp{$key};
+ print MAKEFILE "$key=\t$tmp\n";
+ }
+
+ print MAKEFILE @freeform;
+
+ print MAKEFILE "\n.include <bsd.port.mk>\n";
+ close (MAKEFILE);
+}
+
+sub initmk {
+ chomp($portname = `make -V PORTNAME`);
+ chomp($portversion = `make -V PORTVERSION`);
+ `make extract`;
+}
+
+sub getwrksrc {
+ my (@files);
+ my ($wrkdir);
+ $wrkdir = "work";
+ chdir ($initdir);
+ chdir ($wrkdir);
+
+ if (-d "$portname-$portversion") {
+ $wrksrc = $wrkdir . "$portname-$portversion";
+ chdir ("$portname-$portversion");
+ return;
+ }
+
+ opendir(DIR, ".");
+ @files = grep { ! /^\./ } readdir(DIR);
+ closedir DIR;
+ if ($#files > 1) { # more than one entry in dir
+ $cap{"NO_WRKSUBDIR"} = "YES";
+ $wrksrc = $wrkdir;
+ } else { # just one, so change to directory
+ $cap{"WRKSRC"} = '${WRKDIR}/' . $files[0];
+ $wrksrc = $wrkdir . $files[0];
+ chdir ($files[0]);
+ }
+}
+
+sub getmkfile {
+ if ((! -f "Makefile")) {
+ if (-f "Makefile.in") {
+ $makefile = "Makefile.in";
+ } elsif (-f "makefile") {
+ $cap{"MAKEFILE"} = "makefile";
+ $makefile = "makefile";
+ } elsif (-f "GNUmakefile") {
+ $cap{"MAKEFILE"} = "GNUmakefile";
+ $cap{"USE_GMAKE"} = "YES";
+ $makefile = "GNUmakefile";
+ } else {
+ print STDERR "No Makefile!\n";
+ $cap{"NO_BUILD"} = "YES";
+ $cap{"NO_INSTALL"} = "YES";
+ }
+ } else {
+ $makefile = "Makefile";
+ }
+}
+
+sub gettargets {
+ my($targets);
+ $targets = "";
+ $targets = `make -f $makefile -dg1 -q | grep "^[^.#][-_.a-zA-Z ]*:" | awk "{\$1}"` if defined($makefile);
+ print $targets;
+}
+
+sub getconfinfo {
+ if (-f "configure") { # ooh, but HAS_CONFIGURE or GNU_CONFIGURE?
+ if (`./configure --version` =~ /autoconf/) {
+ $cap{"GNU_CONFIGURE"} = "YES";
+ $cap{"USE_QT"} = "YES" if (`./configure --help | grep -Fe --with-qt`);
+ $cap{"USE_GTK"} = "YES" if (`./configure --help | grep -Fe --with-gtk`);
+ $cap{"USE_GNOME"} = "YES" if (`./configure --help | grep -Fe --with-gnome`);
+ $cap{"USE_KDE"} = "YES" if (`grep -F "checking for KDE" configure`);
+ $cap{"USE_OPENSSL"} = "MUST" if (`grep -F 'configure: error: --with-openssl must be specified' configure`);
+ $cap{"USE_OPENSSL"} = "OPTIONAL" if ( (`grep -F 'configure: error: "OpenSSL not in ' configure`) && !($cap{"USE_OPENSSL"}) );
+ } else {
+ $cap{"HAS_CONFIGURE"} = "YES";
+ }
+ } else { # maybe they expect us to build configure for them?!
+ if (-f "configure.in") {
+ $cap{"USE_AUTOCONF"} = "YES";
+ } elsif (-f "Configure") {
+ $cap{"HAS_CONFIGURE"} = "YES";
+ $cap{"CONFIGURE_SCRIPT"} = "Configure";
+ }
+ }
+
+ if (!$cap{"USE_QT"}) { # haven't seen QT yet, let's try some more
+ if ($cap{"USE_KDE"}) {
+ $cap{"USE_QT"} = "YES";
+ } elsif (-f "automoc") {
+ $cap{"USE_QT"} = "YES";
+ } elsif (-d "moc") {
+ $cap{"USE_QT"} = "YES";
+ } elsif (defined($makefile) && -f $makefile && `grep -F -e -lqt $makefile`) { # more insane.
+ $cap{"USE_QT"} = "YES";
+ }
+ }
+}
+
+sub chk_scripts {
+ &getwrksrc;
+ &getmkfile;
+ #&gettargets;
+
+ &getconfinfo;
+
+ if (-f "ltconfig") {
+ $cap{"USE_LIBTOOL"} = "YES";
+ }
+
+ if (-f "Imakefile") {
+ $cap{"USE_IMAKE"} = "YES";
+ }
+}
+
+sub usage {
+ print STDERR <<"EOF";
+usage: $0 filename
+
+ generates a ports skeleton for port based on filename
+
+EOF
+ exit;
+}
diff --git a/Tools/scripts/mkptools/mkpmerge b/Tools/scripts/mkptools/mkpmerge
new file mode 100755
index 000000000000..76cddb359805
--- /dev/null
+++ b/Tools/scripts/mkptools/mkpmerge
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+#
+# Copyright (c) 2000 Neil Blakey-Milner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+open(OLDMAKE, "<Makefile") || die "$!";
+open(EXTMAKE, "<Makefile.extr") || die "Makefile.extr - $! - run mpkextr\n";
+open(NEWMAKE, ">Makefile.new") || die "$!";
+
+while(<OLDMAKE>) {
+ print NEWMAKE $_;
+ last if /^# -- eos --$/;
+}
+
+print NEWMAKE "\n";
+
+while(<EXTMAKE>) {
+ print NEWMAKE $_;
+}
+
+close(NEWMAKE);
+close(EXTMAKE);
+close(OLDMAKE);
+
+`cp -f Makefile Makefile.old`;
+`mv -f Makefile.new Makefile`;
diff --git a/Tools/scripts/mkptools/mkpskel b/Tools/scripts/mkptools/mkpskel
new file mode 100755
index 000000000000..bc5336812ed6
--- /dev/null
+++ b/Tools/scripts/mkptools/mkpskel
@@ -0,0 +1,280 @@
+#!/usr/bin/perl -w
+#
+# Copyright (c) 2000 Neil Blakey-Milner
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+# a script to gain a bit of knowledge about a supplied distfile
+
+use strict;
+use vars qw/ $opt_n /;
+
+use File::Basename qw( basename dirname );
+use Getopt::Std qw( getopts );
+
+my ($filename, $ver, $initdir, $distdir, $wrkdir, $tmpdir);
+my ($makefile, $wrksrc);
+my (%cap);
+
+chomp($initdir = `pwd`);
+
+$cap{"MAINTAINER"} = ($ENV{"MAINTAINER"} || "ports\@freebsd.org");
+
+getopts('n');
+
+&usage if $#ARGV != 0;
+
+$filename = $ARGV[0];
+
+if ($filename =~ m#^(f|ht)tp\://#) {
+ print `fetch $filename`;
+ $filename = basename($filename);
+}
+chdir(dirname($filename));
+chomp($distdir = `pwd`);
+chdir ($initdir);
+
+&chk_extract; # .tar.gz vs .tgz vs .tar.bz2, &c.
+&enh_distname;
+if ($opt_n) {
+ print "filename is $filename\n";
+ print "PORTNAME is " . $cap{"PORTNAME"} . "\n";
+ print "PORTVERSION is " . $cap{"PORTVERSION"} . "\n";
+ exit;
+}
+&bareskel;
+&md5;
+&writemk;
+
+exit;
+
+sub bareskel {
+ $tmpdir = $cap{'PORTNAME'};
+ $tmpdir .= ".$$" while -e $tmpdir;
+ mkdir($tmpdir,0777);
+
+ `printf "\n" > $tmpdir/pkg-plist`;
+ `printf "\n" > $tmpdir/pkg-descr`;
+ `printf "A\n" > $tmpdir/pkg-comment`;
+}
+
+sub writemk {
+
+ my (%tmp);
+ my ($key);
+
+ my ($distname);
+ $distname = $cap{"PORTNAME"};
+
+ foreach $key (keys %cap) {
+ $tmp{$key} = $cap{$key};
+ }
+
+ open(MAKEFILE, ">$tmpdir/Makefile");
+ my ($date);
+ chomp($date = `date +"\%d \%b \%Y"`);
+
+ print MAKEFILE <<EOF;
+# New ports collection makefile for: $distname
+# Date created: $date
+# Whom: makeport.pl
+#
+# \$FreeBSD\$
+#
+
+EOF
+
+ print MAKEFILE "PORTNAME= " . $tmp{"PORTNAME"} . "\n";
+ print MAKEFILE "PORTVERSION= " . $tmp{"PORTVERSION"} . "\n";
+ delete($tmp{"PORTNAME"});
+ delete($tmp{"PORTVERSION"});
+
+ print MAKEFILE "CATEGORIES= misc\n";
+ foreach $key (keys %tmp) {
+ my($tmp) = $tmp{$key};
+ if (($key eq "DISTNAME") || ($key eq "EXTRACT_SUFX")) {
+ print MAKEFILE "$key=\t$tmp\n";
+ delete($tmp{$key});
+ }
+ }
+
+ print MAKEFILE "\nMAINTAINER=\t" . $tmp{"MAINTAINER"} . "\n\n";
+ delete($tmp{"MAINTAINER"});
+
+ if ($tmp{"LIB_DEPENDS"}) {
+ print MAKEFILE "LIB_DEPENDS=". $tmp{"LIB_DEPENDS"} . "\n\n";
+ delete($tmp{"LIB_DEPENDS"});
+ }
+
+ #second group
+ foreach $key (keys %tmp) {
+ my($tmp) = $tmp{$key};
+ print MAKEFILE "$key=\t$tmp\n";
+ }
+
+ print MAKEFILE "# -- eos --\n\n";
+
+ print MAKEFILE ".include <bsd.port.mk>\n";
+ close (MAKEFILE);
+}
+
+sub md5 {
+ my $tmp = basename($filename);
+ chdir ($initdir);
+ `md5 $filename | perl -pe "s#$filename#$tmp#" > $tmpdir/distinfo`;
+}
+
+sub chk_extract {
+ my $tmp = basename($filename);
+
+ $tmp =~ s/(\.tgz)$// && do {
+ $cap{"DISTNAME"} = $tmp;
+ $cap{"EXTRACT_SUFX"} = $1;
+ return;
+ };
+ $tmp =~ s/(\.tar\.bz2)$// && do {
+ $cap{"DISTNAME"} = $tmp;
+ $cap{"EXTRACT_SUFX"} = $1 if ($1 ne ".tar.bz2");
+ $cap{"USE_BZIP2"} = "YES";
+ return;
+ };
+ $tmp =~ s/(\.tar)$// && do {
+ $cap{"DISTNAME"} = $tmp;
+ $cap{"EXTRACT_SUFX"} = $1;
+ return;
+ };
+ $tmp =~ s/(\.tar.*)$// && do {
+ $cap{"DISTNAME"} = $tmp;
+ $cap{"EXTRACT_SUFX"} = $1 if ($1 ne ".tar.gz");
+ return;
+ };
+}
+
+sub add_extsuffix {
+ return if $cap{"EXTRACT_SUFX"};
+ if ($cap{"USE_BZIP2"}) {
+ $cap{"EXTRACT_SUFX"} = ".tar.bz2";
+ } else {
+ $cap{"EXTRACT_SUFX"} = ".tar.gz";
+ }
+}
+
+sub enh_distname {
+ my($changes) = 0;
+ my($play) = $cap{"DISTNAME"};
+ #print "starting play...\n";
+ my($firstshot) = 0;
+ my($portname, $portversion);
+ if (defined($play) eq "") {
+ die "can't make heads or tails of $filename";
+ }
+ while ($changes == 0) {
+ $changes = 1;
+ $firstshot++;
+ $_ = $play;
+ #print "using $play\n";
+ /^(.*[0-9][a-z]?)([-._][a-z]*)$/i && do {
+ print "Door #1\n";
+ $cap{"DISTNAME"} = $1;
+ $play = $1;
+ &add_extsuffix;
+ $cap{"EXTRACT_SUFX"} = $2 . $cap{"EXTRACT_SUFX"};
+ $changes = 0;
+ next;
+ };
+ /^([a-z]*)([0-9]+)([-._])([0-9]+([-._]).*)$/i && do {
+ print "Door #2\n";
+ if ($5 eq $3) {
+ $play = "$1-$2.$4";
+ #$cap{"PORTNAME"} = $1;
+ #$cap{"PORTVERSION"} = "$2.$4";
+ $portname = $1;
+ $portversion = "$2.$4";
+ $changes = 0;
+ next;
+ }
+ };
+ /^(.*?[^-._])([0-9])([-._])([^v]?[0-9]*[a-z]*)([-._]?)(.*)$/i &&( $firstshot == 1) && do {
+ print "Door #4\n";
+ if (($5 eq $3) || ($5 eq "")) {
+ #$cap{"PORTNAME"} = $1;
+ #$cap{"PORTVERSION"} = "$2$3$4$5$6";
+ $portname = $1;
+ $portversion = "$2$3$4$5$6";
+ next;
+ }
+ };
+ /^(.*?)([-._])(v?)((?:[0-9][-._])*[0-9][a-z]?.*)$/i && do {
+ print "Door #3\n";
+ my($tmp);
+ $tmp = $1;
+ $ver = "$4";
+ if ($ver =~ /^(.*)([-._])([0-9]?)([a-z])[a-z]+([0-9]?)$/) {
+ print "Door #3.1\n";
+ my($foo) = "";
+ #print "1 - $1\n";
+ #print "2 - $2\n";
+ #print "3 - $3\n";
+ #print "4 - $4\n";
+ #print "5 - $5\n";
+ $foo = "." if $2;
+ #$ver = "$1$foo$3$4$5";
+ $ver = "$1$foo$3$4$5";
+ }
+ $portname = $tmp;
+ $portversion = $ver;
+ next;
+ };
+ }
+
+ if (defined($portversion) eq "") {
+ die "can't make heads or tails of $filename";
+ }
+
+ $portversion =~ s/_/./g;
+ $portversion =~ s/-/./g;
+
+ $cap{"PORTNAME"} = $portname;
+ $cap{"PORTVERSION"} = $portversion;
+
+ my ($temp1);
+ my ($temp2);
+
+ $temp1 = $cap{"DISTNAME"};
+ $temp2 = $cap{"PORTNAME"} . "-" . $cap{"PORTVERSION"};
+
+ if ($temp1 eq $temp2) {
+ delete($cap{"DISTNAME"});
+ }
+}
+
+sub usage {
+ print STDERR <<"EOF";
+usage: $0 filename
+
+ generates a ports skeleton for port based on filename
+
+EOF
+ exit;
+}