aboutsummaryrefslogtreecommitdiff
path: root/mkslackinfo
diff options
context:
space:
mode:
Diffstat (limited to 'mkslackinfo')
-rwxr-xr-xmkslackinfo76
1 files changed, 33 insertions, 43 deletions
diff --git a/mkslackinfo b/mkslackinfo
index 0f37b49..bf9947f 100755
--- a/mkslackinfo
+++ b/mkslackinfo
@@ -18,7 +18,7 @@ sub usage {
}
sub get_build_command {
- %buildcmds = {
+ %buildcmds = (
'autoconf' => <<'EOF',
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
@@ -60,29 +60,31 @@ make
make test
make install DESTDIR=$PKG
EOF
- };
+ );
- my $cmd = $buildcmd{autoconf};
- # if it ain't a tar file, just return the default
- return $cmd unless $tar;
+ my $cmd = $buildcmds{autoconf};
my ($file, $tar) = @_;
+ # if it ain't a tar file, just return the default
+ return $cmd unless $tar;
- # look only at the 2nd level dir (e.g. foo-1.2.3/configure.ac)
- open my $f, "tar tf $file --wildcards */* |" or return $cmd;
+ open my $f, "tar tf $file |" or return $cmd;
while(<$f>) {
chomp;
+ # look only at the 2nd level dir (e.g. foo-1.2.3/configure.ac)
+ next if m,.*/.*/,;
+ warn "looking at file $_\n";
if(/^\bconfigure\.(ac|in)$/) {
- $cmd = $buildcmd{autoconf};
+ $cmd = $buildcmds{autoconf};
last;
} elsif(/\bCMakeLists\.txt$/) {
- $cmd = $buildcmd{cmake};
+ $cmd = $buildcmds{cmake};
last;
} elsif(/\bsetup\.py$/) {
- $cmd = $buildcmd{python};
+ $cmd = $buildcmds{python};
last;
} elsif(/\bMakefile\.PL$/) {
- $cmd = $buildcmd{python};
+ $cmd = $buildcmds{perl};
last;
}
}
@@ -117,6 +119,8 @@ $homepage = shift;
if(!$homepage) {
if($url =~ m{http://downloads.(?:sourceforge|sf).net/([^/]+)/}) {
$homepage = "http://sourceforge.net/projects/$1/";
+ } elsif($url =~ m,https://github\.com/[^/]*/[^/]*/,) {
+ $homepage = $&;
} elsif($url =~ m,((?:ht|f)tp://[^/]+/),) {
$homepage = $1;
} else {
@@ -137,6 +141,23 @@ if(!$version) {
}
}
+print STDERR "Downloading $url...";
+if($url =~ /sourceforge\.net/i) {
+ $extra_wget_params = "--user-agent wget";
+} else {
+ $extra_wget_params = "--referer='$url'";
+}
+
+system("wget $extra_wget_params $url");
+
+if(open $f, "<$file") {
+ $md5 = Digest::MD5->new->addfile($f)->hexdigest;
+ close $f;
+} else {
+ warn "Can't find downloaded file '$file', MD5SUM will be wrong in .info\n";
+ $md5 = "FIXME";
+}
+
if(not -e "$package.SlackBuild") {
warn "$package.SlackBuild does not exist, creating from template\n";
$buildcmd = get_build_command($file, $tar);
@@ -159,16 +180,6 @@ if((-e "README") && (! -e "slack-desc")) {
system("mkslackdesc");
}
-print STDERR "Downloading $url...";
-$content = get($url);
-if($content) {
- $md5 = md5_hex($content);
- print STDERR "OK\nWriting $package.info\n";
-} else {
- warn "Can't download $url with LWP::Simple, MD5SUM will be wrong in .info\n";
- $md5 = "FIXME";
-}
-
open $f, ">$package.info" or die $!;
$content = <<EOF;
PRGNAM="$package"
@@ -186,14 +197,6 @@ print $content;
print $f $content;
close $f;
-if($url =~ /sourceforge\.net/i) {
- $extra_wget_params = "--user-agent wget";
-} else {
- $extra_wget_params = "--referer='$url'";
-}
-
-exec("wget $extra_wget_params $url");
-
__DATA__
#!/bin/sh
@@ -247,20 +250,7 @@ chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
-CFLAGS="$SLKCFLAGS" \
-CXXFLAGS="$SLKCFLAGS" \
-./configure \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --mandir=/usr/man \
- --docdir=/usr/doc/$PRGNAM-$VERSION \
- --build=$ARCH-slackware-linux
-
-make
-make install-strip DESTDIR=$PKG
-
+__BUILD__
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true