texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/options_data.txt: Remove _OPTION suf


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/options_data.txt: Remove _OPTION suffixes from PACKAGE_* variables in order to maintain backwards compatability, especially for customization files (e.g. for ffmpeg). Report from Arsen Arsenović <address@hidden>.
Date: Sun, 28 Jan 2024 09:54:04 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ad068adda6 * tp/Texinfo/options_data.txt: Remove _OPTION suffixes from 
PACKAGE_* variables in order to maintain backwards compatability, especially 
for customization files (e.g. for ffmpeg). Report from Arsen Arsenović 
<arsen@gentoo.org>.
ad068adda6 is described below

commit ad068adda6e445e9677b887df976d00b59788b18
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Jan 28 14:53:53 2024 +0000

    * tp/Texinfo/options_data.txt: Remove _OPTION suffixes from
    PACKAGE_* variables in order to maintain backwards compatability,
    especially for customization files (e.g. for ffmpeg).
    Report from Arsen Arsenović <arsen@gentoo.org>.
    
    * tp/texi2any.pl: Set the variables from the "configured information"
    without adding a suffix.
    * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
    tp/Texinfo/Convert/Info.pm, tp/Texinfo/XS/convert/convert_html.c,
    tp/t/init/t2h_singular.init, tp/t/layout.t: Consequent changes.
    
    * tp/maintain/regenerate_C_options_info.pl: #undef the PACKAGE_*
    symbols to avoid a clash with symbols defined by autoconf.
    Analysis by Patrice.
    
    * tp/Texinfo/XS/configure.ac: Propagate PACKAGE, PACKAGE_NAME,
    PACKAGE_URL and PACKAGE_VERSION using AC_DEFINE_UNQUOTED, with
    a _CONFIG suffix, in order to make these symbols still accessible
    in the XS sources.  Suggestion from Patrice.
    * tp/Texinfo/XS/main/build_perl_info.c (init): Refer to PACKAGE_CONFIG
    rather than PACKAGE.
---
 ChangeLog                                | 24 ++++++++++++++++++++++++
 tp/Texinfo/Convert/Converter.pm          |  6 +++---
 tp/Texinfo/Convert/HTML.pm               |  8 ++++----
 tp/Texinfo/Convert/Info.pm               |  2 +-
 tp/Texinfo/XS/configure.ac               | 11 +++++++++++
 tp/Texinfo/XS/convert/convert_html.c     | 12 ++++++------
 tp/Texinfo/XS/main/build_perl_info.c     |  4 ++--
 tp/Texinfo/options_data.txt              | 10 +++++-----
 tp/maintain/regenerate_C_options_info.pl |  9 +++++++++
 tp/t/init/t2h_singular.init              |  8 ++++----
 tp/t/layout.t                            |  2 +-
 tp/texi2any.pl                           | 15 ++++++---------
 12 files changed, 76 insertions(+), 35 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e65211afb7..d2b07e8a86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2024-01-28  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/options_data.txt: Remove _OPTION suffixes from
+       PACKAGE_* variables in order to maintain backwards compatability,
+       especially for customization files (e.g. for ffmpeg).
+       Report from Arsen Arsenović <arsen@gentoo.org>.
+
+       * tp/texi2any.pl: Set the variables from the "configured information"
+       without adding a suffix.
+       * tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
+       tp/Texinfo/Convert/Info.pm, tp/Texinfo/XS/convert/convert_html.c,
+       tp/t/init/t2h_singular.init, tp/t/layout.t: Consequent changes.
+
+       * tp/maintain/regenerate_C_options_info.pl: #undef the PACKAGE_*
+       symbols to avoid a clash with symbols defined by autoconf.
+       Analysis by Patrice.
+
+       * tp/Texinfo/XS/configure.ac: Propagate PACKAGE, PACKAGE_NAME,
+       PACKAGE_URL and PACKAGE_VERSION using AC_DEFINE_UNQUOTED, with
+       a _CONFIG suffix, in order to make these symbols still accessible
+       in the XS sources.  Suggestion from Patrice.
+       * tp/Texinfo/XS/main/build_perl_info.c (init): Refer to PACKAGE_CONFIG
+       rather than PACKAGE.
+
 2024-01-27  Gavin Smith <gavinsmith0123@gmail.com>
 
        * doc/texinfo.texi (Invoking texi2any),
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 5d271a37c5..a96e353c72 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -162,9 +162,9 @@ my %common_converters_defaults = (
 # values are what is used in tests of the Converters.  These variables are
 # customization options, set in the main program when a converter is
 # called from the main program.
-  'PACKAGE_AND_VERSION_OPTION'  => 'texinfo',
-  'PACKAGE_VERSION_OPTION'      => '',
-  'PACKAGE_URL_OPTION'          => 'http://www.gnu.org/software/texinfo/',
+  'PACKAGE_AND_VERSION'  => 'texinfo',
+  'PACKAGE_VERSION'      => '',
+  'PACKAGE_URL'          => 'http://www.gnu.org/software/texinfo/',
   'PROGRAM'              => '',
 );
 
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 4153982a41..5688bf9c25 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -10828,11 +10828,11 @@ sub _default_format_program_string($)
   my $self = shift;
   if (defined($self->get_conf('PROGRAM'))
       and $self->get_conf('PROGRAM') ne ''
-      and defined($self->get_conf('PACKAGE_URL_OPTION'))) {
+      and defined($self->get_conf('PACKAGE_URL'))) {
     return $self->convert_tree(
       $self->gdt('This document was generated on @emph{@today{}} using 
@uref{{program_homepage}, @emph{{program}}}.',
          { 'program_homepage' => {'text'
-                           => $self->get_conf('PACKAGE_URL_OPTION')},
+                           => $self->get_conf('PACKAGE_URL')},
            'program' => {'text' => $self->get_conf('PROGRAM')} }));
   } else {
     return $self->convert_tree(
@@ -10974,8 +10974,8 @@ sub _file_header_information($$;$)
   my $after_body_open = '';
   $after_body_open = $self->get_conf('AFTER_BODY_OPEN')
     if (defined($self->get_conf('AFTER_BODY_OPEN')));
-  my $program_and_version = $self->get_conf('PACKAGE_AND_VERSION_OPTION');
-  my $program_homepage = $self->get_conf('PACKAGE_URL_OPTION');
+  my $program_and_version = $self->get_conf('PACKAGE_AND_VERSION');
+  my $program_homepage = $self->get_conf('PACKAGE_URL');
   my $program = $self->get_conf('PROGRAM');
   my $generator = '';
   if (defined($program) and $program ne '') {
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index f26b3397cd..9bface112d 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -416,7 +416,7 @@ sub _info_header($$$)
   # This ensures that spaces in file are kept.
   $result .= add_next($paragraph, $output_filename);
   my $program = $self->get_conf('PROGRAM');
-  my $version = $self->get_conf('PACKAGE_VERSION_OPTION');
+  my $version = $self->get_conf('PACKAGE_VERSION');
   if (defined($program) and $program ne '') {
     $result .=
         add_text($paragraph, ", produced by $program version $version from ");
diff --git a/tp/Texinfo/XS/configure.ac b/tp/Texinfo/XS/configure.ac
index 8b5573968f..9e271fda20 100644
--- a/tp/Texinfo/XS/configure.ac
+++ b/tp/Texinfo/XS/configure.ac
@@ -175,5 +175,16 @@ esac
 AC_SUBST([perl_conf_CFLAGS], [$perl_conf_CFLAGS])
 AC_SUBST([perl_conf_LDFLAGS], [$perl_conf_LDFLAGS])
 
+# Output these with the _CONFIG suffix as we use the originals as names
+# of customization variables.
+AC_DEFINE_UNQUOTED([PACKAGE_CONFIG], ["$PACKAGE"],
+                   [autoconf PACKAGE value])
+AC_DEFINE_UNQUOTED([PACKAGE_NAME_CONFIG], ["$PACKAGE_NAME"],
+                   [autoconf PACKAGE_NAME value])
+AC_DEFINE_UNQUOTED([PACKAGE_URL_CONFIG], ["$PACKAGE_URL"],
+                   [autoconf PACKAGE_URL value])
+AC_DEFINE_UNQUOTED([PACKAGE_VERSION_CONFIG], ["$PACKAGE_VERSION"],
+                   [autoconf PACKAGE_VERSION value])
+
 AC_CONFIG_FILES([Makefile gnulib/lib/Makefile])
 AC_OUTPUT
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 719ce3b4c6..60e29808b1 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -6536,14 +6536,14 @@ html_default_format_program_string (CONVERTER *self, 
TEXT *result)
 {
   ELEMENT *tree;
   if (self->conf->PROGRAM.string && strlen (self->conf->PROGRAM.string)
-      && self->conf->PACKAGE_URL_OPTION.string)
+      && self->conf->PACKAGE_URL.string)
     {
       ELEMENT *program_homepage = new_element (ET_NONE);
       ELEMENT *program = new_element (ET_NONE);
       NAMED_STRING_ELEMENT_LIST *substrings
                                    = new_named_string_element_list ();
 
-      text_append (&program_homepage->text, 
self->conf->PACKAGE_URL_OPTION.string);
+      text_append (&program_homepage->text, self->conf->PACKAGE_URL.string);
       text_append (&program->text, self->conf->PROGRAM.string);
 
       add_element_to_named_string_element_list (substrings,
@@ -7152,8 +7152,8 @@ html_default_format_begin_file (CONVERTER *self, const 
char *filename,
   text_append_n (&result, "\n", 1);
   text_printf (&result, "<html%s>\n", 
begin_info->root_html_element_attributes);
   text_printf (&result, "<!-- Created by %s, %s -->\n<head>\n",
-                        self->conf->PACKAGE_AND_VERSION_OPTION.string,
-                        self->conf->PACKAGE_URL_OPTION.string);
+                        self->conf->PACKAGE_AND_VERSION.string,
+                        self->conf->PACKAGE_URL.string);
   if (begin_info->encoding)
     text_append (&result, begin_info->encoding);
   text_append_n (&result, "\n", 1);
@@ -8198,8 +8198,8 @@ html_default_format_node_redirection_page (CONVERTER 
*self,
   text_printf (&result, "<!-- Created by %s, %s -->\n"
        "<!-- This file redirects to the location of a node or anchor -->\n"
        "<head>\n",
-                        self->conf->PACKAGE_AND_VERSION_OPTION.string,
-                        self->conf->PACKAGE_URL_OPTION.string);
+                        self->conf->PACKAGE_AND_VERSION.string,
+                        self->conf->PACKAGE_URL.string);
   if (begin_info->encoding)
     text_append (&result, begin_info->encoding);
   text_append_n (&result, "\n", 1);
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index e8f64f05f2..9dcc6f7b87 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -82,9 +82,9 @@ init (int texinfo_uninstalled, char *builddir)
 
   /* Note: this uses the installed translations even when running an
      uninstalled program. */
-  bindtextdomain (PACKAGE, LOCALEDIR);
+  bindtextdomain (PACKAGE_CONFIG, LOCALEDIR);
 
-  textdomain (PACKAGE);
+  textdomain (PACKAGE_CONFIG);
 #else
 
 #endif
diff --git a/tp/Texinfo/options_data.txt b/tp/Texinfo/options_data.txt
index 09046c7201..e972d75f6b 100644
--- a/tp/Texinfo/options_data.txt
+++ b/tp/Texinfo/options_data.txt
@@ -280,11 +280,11 @@ OUTPUT_CHARACTERS                  
converter_customization undef   integer
 OUTPUT_ENCODING_NAME               converter_customization undef   char
 OUTPUT_FILE_NAME_ENCODING          converter_customization undef   char
 OUTPUT_PERL_ENCODING               converter_customization undef   char
-PACKAGE_OPTION                     converter_customization undef   char
-PACKAGE_AND_VERSION_OPTION         converter_customization undef   char
-PACKAGE_NAME_OPTION                converter_customization undef   char
-PACKAGE_URL_OPTION                 converter_customization undef   char
-PACKAGE_VERSION_OPTION             converter_customization undef   char
+PACKAGE                            converter_customization undef   char
+PACKAGE_AND_VERSION                converter_customization undef   char
+PACKAGE_NAME                       converter_customization undef   char
+PACKAGE_URL                        converter_customization undef   char
+PACKAGE_VERSION                    converter_customization undef   char
 PRE_BODY_CLOSE                     converter_customization undef   char
 PREFIX                             converter_customization undef   char
 PROGRAM                            converter_customization undef   char
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index 3c2d344594..0cb6c82cb7 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -103,6 +103,15 @@ print HEADER "#ifndef OPTIONS_TYPES_H\n#define 
OPTIONS_TYPES_H\n\n";
 
 print HEADER "#include \"main/option_types.h\"\n\n";
 
+print HEADER "/* Undefine values set from autoconf as we use these as\n";
+print HEADER "   customization variable names.  The original values are\n";
+print HEADER "   available with a _CONFIG suffix, e.g. PACKAGE_CONFIG for\n";
+print HEADER "   PACKAGE. */\n";
+print HEADER "#undef PACKAGE\n";
+print HEADER "#undef PACKAGE_NAME\n";
+print HEADER "#undef PACKAGE_URL\n";
+print HEADER "#undef PACKAGE_VERSION\n\n";
+
 print HEADER "typedef struct OPTIONS {\n";
 
 foreach my $category (sort(keys(%option_categories))) {
diff --git a/tp/t/init/t2h_singular.init b/tp/t/init/t2h_singular.init
index 05dab7fcc4..c38b5c7a55 100644
--- a/tp/t/init/t2h_singular.init
+++ b/tp/t/init/t2h_singular.init
@@ -113,8 +113,8 @@ sub singular_format_end_file($$$)
 {
   my $self = shift;
   my $pre_body_close = $self->get_conf('PRE_BODY_CLOSE');
-  my $program_homepage = $self->get_conf('PACKAGE_URL_OPTION');
-  my $program_and_version = $self->get_conf('PACKAGE_AND_VERSION_OPTION');
+  my $program_homepage = $self->get_conf('PACKAGE_URL');
+  my $program_and_version = $self->get_conf('PACKAGE_AND_VERSION');
   my $version = $self->get_value('VERSION');
   my $version_date = $self->get_value('VERSION_DATE');
   $version = 'NO VERSION' if (!defined($version));
@@ -261,8 +261,8 @@ sub singular_format_special_body_about($$$)
   my $version_date = $self->get_value('VERSION_DATE');
   $version = 'NO VERSION' if (!defined($version));
   $version_date = 'NO VERSION DATE' if (!defined($version_date));
-  my $program_homepage = $self->get_conf('PACKAGE_URL_OPTION');
-  my $program_and_version = $self->get_conf('PACKAGE_AND_VERSION_OPTION');
+  my $program_homepage = $self->get_conf('PACKAGE_URL');
+  my $program_and_version = $self->get_conf('PACKAGE_AND_VERSION');
   my $result = '';
   $result .= <<EOT;
 <p>
diff --git a/tp/t/layout.t b/tp/t/layout.t
index 760efb9230..c6577b67f9 100644
--- a/tp/t/layout.t
+++ b/tp/t/layout.t
@@ -101,7 +101,7 @@ foreach my $test (@test_cases) {
   }
   $test->[3]->{'TEXI2HTML'} = 1;
   $test->[3]->{'PROGRAM'} = 'texi2any';
-  $test->[3]->{'PACKAGE_URL_OPTION'} = 'http://www.gnu.org/software/texinfo/';
+  $test->[3]->{'PACKAGE_URL'} = 'http://www.gnu.org/software/texinfo/';
 }
 
 run_all('layout', [@test_cases]);
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index ef9e040148..ee1fbdad9b 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -345,11 +345,8 @@ foreach my $configured_variable 
(keys(%$configured_information)) {
                        $configured_information->{$configured_variable});
 }
 
-# here set configure information with _OPTION prepended, to mark that
-# these are customization variables that may be modified in init files
-# or on the command line.
 foreach my $configured_variable (keys(%$configured_information)) {
-  $main_program_set_options->{$configured_variable . '_OPTION'}
+  $main_program_set_options->{$configured_variable}
     = $configured_information->{$configured_variable};
 }
 
@@ -1147,11 +1144,11 @@ if ($cmdline_options->{'HIGHLIGHT_SYNTAX'}) {
 
 # For tests, set some strings to values not changing with releases
 my %test_conf = (
-    'PACKAGE_VERSION_OPTION' => '',
-    'PACKAGE_OPTION' => 'texinfo',
-    'PACKAGE_NAME_OPTION' => 'texinfo',
-    'PACKAGE_AND_VERSION_OPTION' => 'texinfo',
-    'PACKAGE_URL_OPTION' => 'http://www.gnu.org/software/texinfo/',
+    'PACKAGE_VERSION' => '',
+    'PACKAGE' => 'texinfo',
+    'PACKAGE_NAME' => 'texinfo',
+    'PACKAGE_AND_VERSION' => 'texinfo',
+    'PACKAGE_URL' => 'http://www.gnu.org/software/texinfo/',
 # maybe don't set this?
     'PROGRAM' => 'texi2any',
 );



reply via email to

[Prev in Thread] Current Thread [Next in Thread]