| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! @PERL@ | | 1 | #! @PERL@ |
2 | # $NetBSD: url2pkg.pl,v 1.35 2018/01/07 11:20:18 rillig Exp $ | | 2 | # $NetBSD: url2pkg.pl,v 1.36 2018/04/08 20:13:55 rillig Exp $ |
3 | # | | 3 | # |
4 | | | 4 | |
5 | # Copyright (c) 2010 The NetBSD Foundation, Inc. | | 5 | # Copyright (c) 2010 The NetBSD Foundation, Inc. |
6 | # All rights reserved. | | 6 | # All rights reserved. |
7 | # | | 7 | # |
8 | # This code is derived from software contributed to The NetBSD Foundation | | 8 | # This code is derived from software contributed to The NetBSD Foundation |
9 | # by Roland Illig. | | 9 | # by Roland Illig. |
10 | # | | 10 | # |
11 | # Redistribution and use in source and binary forms, with or without | | 11 | # Redistribution and use in source and binary forms, with or without |
12 | # modification, are permitted provided that the following conditions | | 12 | # modification, are permitted provided that the following conditions |
13 | # are met: | | 13 | # are met: |
14 | # 1. Redistributions of source code must retain the above copyright | | 14 | # 1. Redistributions of source code must retain the above copyright |
15 | # notice, this list of conditions and the following disclaimer. | | 15 | # notice, this list of conditions and the following disclaimer. |
| @@ -66,35 +66,35 @@ sub get_maintainer() { | | | @@ -66,35 +66,35 @@ sub get_maintainer() { |
66 | | | 66 | |
67 | return $ENV{"PKGMAINTAINER"} || $ENV{"REPLYTO"} || "INSERT_YOUR_MAIL_ADDRESS_HERE"; | | 67 | return $ENV{"PKGMAINTAINER"} || $ENV{"REPLYTO"} || "INSERT_YOUR_MAIL_ADDRESS_HERE"; |
68 | } | | 68 | } |
69 | | | 69 | |
70 | sub print_section($$) { | | 70 | sub print_section($$) { |
71 | my ($f, $vars) = @_; | | 71 | my ($f, $vars) = @_; |
72 | | | 72 | |
73 | if (scalar(@{$vars}) == 0) { | | 73 | if (scalar(@{$vars}) == 0) { |
74 | return; | | 74 | return; |
75 | } | | 75 | } |
76 | | | 76 | |
77 | my $width = 0; | | 77 | my $width = 0; |
78 | foreach my $var (@{$vars}) { | | 78 | foreach my $var (@{$vars}) { |
79 | my $len = length($var->[0]); | | 79 | my $varname = $var->[0]; |
| | | 80 | my $len = (length("$varname= ") + 7) & -8; |
80 | $width = ($len > $width) ? $len : $width; | | 81 | $width = ($len > $width) ? $len : $width; |
81 | } | | 82 | } |
82 | | | 83 | |
83 | foreach my $var (@{$vars}) { | | 84 | foreach my $var (@{$vars}) { |
84 | my $len = length($var->[0]) + 1; | | 85 | my ($varname, $varvalue) = @$var; |
85 | my $adjlen = (($width + 1 + 1) + 7) &-8; | | 86 | my $ntabs = ($width - length("$varname=") + 7) / 8; |
86 | my $ntabs = (7 + $adjlen - $len) / 8; | | 87 | printf $f ("%s=%s%s\n", $varname, "\t" x $ntabs, $varvalue); |
87 | printf $f ("%s=%s%s\n", $var->[0], "\t" x $ntabs, $var->[1]); | | | |
88 | } | | 88 | } |
89 | printf $f ("\n"); | | 89 | printf $f ("\n"); |
90 | } | | 90 | } |
91 | | | 91 | |
92 | # The following magic_* subroutines are called after the distfiles have | | 92 | # The following magic_* subroutines are called after the distfiles have |
93 | # been downloaded and extracted. They inspect the extracted files | | 93 | # been downloaded and extracted. They inspect the extracted files |
94 | # to automatically define some variables in the package Makefile. | | 94 | # to automatically define some variables in the package Makefile. |
95 | # | | 95 | # |
96 | # The following variables may be used in the magic_* subroutines: | | 96 | # The following variables may be used in the magic_* subroutines: |
97 | # | | 97 | # |
98 | # $distname | | 98 | # $distname |
99 | # contains the package name, including the version number. | | 99 | # contains the package name, including the version number. |
100 | # $abs_wrkdir | | 100 | # $abs_wrkdir |