summaryrefslogtreecommitdiff
path: root/pkgtools/url2pkg
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-10-02 19:39:24 +0000
committerrillig <rillig@pkgsrc.org>2006-10-02 19:39:24 +0000
commit26d41e536cf7aaf3ba8852feaa13a22c72c59920 (patch)
tree4a0246426de87149eaece7836813493b5b403a07 /pkgtools/url2pkg
parentdd11e141d03620c0c0151fec91abcedba58608bc (diff)
downloadpkgsrc-26d41e536cf7aaf3ba8852feaa13a22c72c59920.tar.gz
Updated url2pkg to 2.1.
Changes since 2.0: - Made the dependency detection for Perl modules work again. The code does not assume to be run in a special directory anymore. - Perl modules that use the prompt() function to query the user interactively can be handled. All questions are assumed to be answered by just pressing <enter>. - Made url2pkg more robust when interpreting the output of MakeMaker.pm. Many Perl modules write additional things to stdout during the generation of the Makefile. - The language for the *.f files is "fortran", not "f". - Fixed the regular expression for prdownloads.sourceforge.net links, so that the distfile name is properly extracted.
Diffstat (limited to 'pkgtools/url2pkg')
-rw-r--r--pkgtools/url2pkg/Makefile17
-rw-r--r--pkgtools/url2pkg/files/MakeMaker.pm18
-rw-r--r--pkgtools/url2pkg/files/url2pkg.pl20
3 files changed, 36 insertions, 19 deletions
diff --git a/pkgtools/url2pkg/Makefile b/pkgtools/url2pkg/Makefile
index 0099f5b3400..97c80acf341 100644
--- a/pkgtools/url2pkg/Makefile
+++ b/pkgtools/url2pkg/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.44 2006/10/02 16:49:30 rillig Exp $
+# $NetBSD: Makefile,v 1.45 2006/10/02 19:39:24 rillig Exp $
#
-DISTNAME= url2pkg-2.0
+DISTNAME= url2pkg-2.1
CATEGORIES= pkgtools
MASTER_SITES= # none
DISTFILES= # none
@@ -21,18 +21,25 @@ USE_TOOLS+= perl:run
INSTALLATION_DIRS= bin ${PKGMANDIR}/man8 lib/url2pkg/ExtUtils
do-extract:
- cp ${FILESDIR}/url2pkg.pl ${WRKSRC}/
+ cd ${FILESDIR} && cp *.pl *.pm ${WRKSRC}/
+
+.include "../../mk/bsd.prefs.mk"
SUBST_CLASSES+= up
SUBST_STAGE.up= do-configure
-SUBST_FILES.up= url2pkg.pl
+SUBST_FILES.up= url2pkg.pl MakeMaker.pm
SUBST_SED.up= -e 's,@MAKE@,'${MAKE:Q}',g'
SUBST_SED.up+= -e 's,@PERL@,${PERL5},g'
SUBST_SED.up+= -e 's,@PERLLIBDIR@,${PREFIX}/lib/url2pkg,g'
+.if defined(BATCH)
+SUBST_SED.up+= -e 's,@PKGSRCDIR@,/usr/pkgsrc,g'
+.else
+SUBST_SED.up+= -e 's,@PKGSRCDIR@,${PKGSRCDIR},g'
+.endif
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/url2pkg.pl ${PREFIX}/bin/url2pkg
${INSTALL_MAN} ${FILESDIR}/url2pkg.8 ${PREFIX}/${PKGMANDIR}/man8
- ${INSTALL_DATA} ${FILESDIR}/MakeMaker.pm ${PREFIX}/lib/url2pkg/ExtUtils/
+ ${INSTALL_DATA} ${WRKSRC}/MakeMaker.pm ${PREFIX}/lib/url2pkg/ExtUtils/
.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/url2pkg/files/MakeMaker.pm b/pkgtools/url2pkg/files/MakeMaker.pm
index 7889d50f25e..de1e9b7cd8d 100644
--- a/pkgtools/url2pkg/files/MakeMaker.pm
+++ b/pkgtools/url2pkg/files/MakeMaker.pm
@@ -10,28 +10,28 @@ package ExtUtils::MakeMaker;
use strict;
use warnings;
+use constant conf_pkgsrcdir => '@PKGSRCDIR@';
+
BEGIN {
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
- @EXPORT = qw(WriteMakefile);
+ @EXPORT = qw(WriteMakefile prompt);
}
-use constant pkgsrcdir => "../..";
-
# Finds and returns the category a given package lies in.
# If the package does not exist, C<undef> is returned.
# If the package exists more than once, it is unspecified which
# of the categories is returned.
sub find_category($) {
my ($pkg) = @_;
- my $retval;
+ my ($retval, $pkgsrcdir);
- opendir(D, pkgsrcdir) or die;
+ opendir(D, conf_pkgsrcdir) or die;
foreach my $cat (readdir(D)) {
next if ($cat =~ qr"^\.");
- if (-d (sprintf("%s/%s/%s", pkgsrcdir, $cat, $pkg))) {
+ if (-d (conf_pkgsrcdir."/${cat}/${pkg}")) {
$retval = $cat;
}
}
@@ -67,4 +67,10 @@ sub WriteMakefile(%) {
}
}
+sub prompt(@) {
+ my ($message, $default) = @_;
+
+ return $default || "";
+}
+
1;
diff --git a/pkgtools/url2pkg/files/url2pkg.pl b/pkgtools/url2pkg/files/url2pkg.pl
index 8440b883bb3..d45f92b291b 100644
--- a/pkgtools/url2pkg/files/url2pkg.pl
+++ b/pkgtools/url2pkg/files/url2pkg.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: url2pkg.pl,v 1.1 2006/10/02 16:49:30 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.2 2006/10/02 19:39:24 rillig Exp $
#
use strict;
@@ -139,7 +139,11 @@ sub magic_perlmod() {
open(DEPS, "cd ${abs_wrksrc} && perl -I${perllibdir} Makefile.PL |") or die;
while (defined(my $dep = <DEPS>)) {
chomp($dep);
- push(@depends, $dep);
+ if ($dep =~ qr"\.\./\.\./") {
+ # Many Perl modules write other things to
+ # stdout, so filter them out.
+ push(@depends, $dep);
+ }
}
close(DEPS) or die;
@@ -175,13 +179,13 @@ sub magic_use_languages() {
my $c_files = `cd $abs_wrksrc && find * -type f -name "*.c" -print 2>/dev/null`;
my $cxx_files = `cd $abs_wrksrc && find * -type f "(" -name "*.cpp" -o -name "*.cc" -o -name "*.C" ")" -print 2>/dev/null`;
my $f_files = `cd $abs_wrksrc && find * -type f -name "*.f" -print 2>/dev/null`;
- my $languages = {};
+ my @languages;
- $c_files =~ qr"\S" and $languages->{"c"} = true;
- $cxx_files =~ qr"\S" and $languages->{"c++"} = true;
- $f_files =~ qr"\S" and $languages->{"f"} = true;
+ $c_files =~ qr"\S" and push(@languages, "c");
+ $cxx_files =~ qr"\S" and push(@languages, "c++");
+ $f_files =~ qr"\S" and push(@languages, "fortran");
- my $use_languages = join(" ", sort(keys(%{$languages})));
+ my $use_languages = join(" ", @languages);
if ($use_languages eq "") {
$use_languages = "# none";
}
@@ -234,7 +238,7 @@ sub generate_initial_package($) {
}
if (!$found) {
- if ($url =~ qr"^http://prdownloads\.sourceforge\.net/([^/]*)/[^/]*\?download$") {
+ if ($url =~ qr"^http://prdownloads\.sourceforge\.net/([^/]*)/([^/]+)\?download$") {
my $pkgbase = $1;
$distfile = $2;