summaryrefslogtreecommitdiff
path: root/sysutils/libgtop/patches
diff options
context:
space:
mode:
authorgutteridge <gutteridge@pkgsrc.org>2019-08-19 05:59:56 +0000
committergutteridge <gutteridge@pkgsrc.org>2019-08-19 05:59:56 +0000
commit85da35e275951838248de0e1383e5bf74e996a4f (patch)
tree8084bed01c6cffff3f1a0f221a7de38f846267eb /sysutils/libgtop/patches
parentae48e22c728f2d8439a7ec784e5631ee42336b9a (diff)
downloadpkgsrc-85da35e275951838248de0e1383e5bf74e996a4f.tar.gz
libgtop: fix build with Perl >= 5.30
As of Perl 5.30, it's no longer permitted to set $[ to a non-zero value, which was causing the lib.pl script to fail. Adjust the script to use zero-based indexing. (Upstream has also changed this script accordingly in subsequent releases, but this isn't a straight lift from there, as the ingoing features.def input file format has also changed in intervening releases, and there were other, unrelated changes applied too.) This is a workaround until this package is updated to a newer release (that is non-trivial because of the number of local patches, etc.). Addresses PR pkg/54475.
Diffstat (limited to 'sysutils/libgtop/patches')
-rw-r--r--sysutils/libgtop/patches/patch-lib_lib.pl72
1 files changed, 72 insertions, 0 deletions
diff --git a/sysutils/libgtop/patches/patch-lib_lib.pl b/sysutils/libgtop/patches/patch-lib_lib.pl
new file mode 100644
index 00000000000..c481d5247b2
--- /dev/null
+++ b/sysutils/libgtop/patches/patch-lib_lib.pl
@@ -0,0 +1,72 @@
+$NetBSD: patch-lib_lib.pl,v 1.1 2019/08/19 05:59:56 gutteridge Exp $
+
+Adjust indexing basis for compatibility with Perl >=5.30.
+
+--- lib/lib.pl.orig 2011-06-01 15:40:47.000000000 +0000
++++ lib/lib.pl
+@@ -1,6 +1,5 @@
+ #!/usr/bin/perl
+
+-$[ = 1; # set array base to 1
+ $, = ' '; # set output field separator
+ $\ = "\n"; # set output record separator
+
+@@ -86,9 +85,9 @@ while (<>) {
+ sub output {
+ local($line) = @_;
+ @line_fields = split(/\|/, $line, 9999);
+- $retval = $line_fields[1];
+- $feature = $line_fields[2];
+- $param_def = $line_fields[4];
++ $retval = $line_fields[0];
++ $feature = $line_fields[1];
++ $param_def = $line_fields[3];
+
+ $orig = $feature;
+ $feature =~ s/^@//;
+@@ -106,16 +105,16 @@ sub output {
+ }
+
+ if ($param_def eq 'string') {
+- $call_param = ', ' . $line_fields[5];
++ $call_param = ', ' . $line_fields[4];
+ $param_buf = '';
+ $buf_set = '';
+ $param_decl = ",\n " . $space . ' const char *' .
+
+- $line_fields[5];
+- $send_ptr = "\n\tconst void *send_ptr = " . $line_fields[5] . ';';
++ $line_fields[4];
++ $send_ptr = "\n\tconst void *send_ptr = " . $line_fields[4] . ';';
+ $send_size = "\n\tconst size_t send_size =\n\t\tstrlen (" .
+
+- $line_fields[5] . ') + 1;';
++ $line_fields[4] . ') + 1;';
+ }
+ else {
+ $call_param = '';
+@@ -128,7 +127,7 @@ sub output {
+ if ($nr_params) {
+ $param_buf = "\n\tstruct {\n";
+ }
+- for ($param = 1; $param <= $nr_params; $param++) {
++ for ($param = 0; $param < $nr_params; $param++) {
+ $list = $params[$param];
+ $type = $params[$param];
+ $type =~ s/\(.*//;
+@@ -137,13 +136,13 @@ sub output {
+ $count = (@fields = split(/,/, $list, 9999));
+
+ if ($count > 0) {
+- for ($field = 1; $field <= $count; $field++) {
++ for ($field = 0; $field < $count; $field++) {
+ $param_buf .= "\t\t$convert{$type} buf_$fields[$field];\n";
+ $buf_set .= "\tparam_buf.buf_$fields[$field] = $fields[$field];\n";
+ }
+ }
+
+- for ($field = 1; $field <= $count; $field++) {
++ for ($field = 0; $field < $count; $field++) {
+ if ($param_decl eq '') {
+ $param_decl = ",\n " . $space . ' ';
+ }