Browse code

Use makeinfo to generate html doc for the new website

texi2html is deprecated by upstream in favor of makeinfo/texi2any. See:

- https://www.gnu.org/software/texinfo/manual/texinfo/html_node/texi2html.html
- https://wiki.debian.org/Texi2htmlTransition
- https://lists.debian.org/debian-devel/2013/05/msg01516.html

This is actually two separate changes.

Based on a patch by Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>.

Fixes Trac ticket #3232.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Timothy Gu authored on 2014/09/01 11:39:35
Showing 7 changed files
... ...
@@ -12,6 +12,7 @@ version <next>:
12 12
 - HEVC/H.265 RTP payload format (draft v6) depacketizer
13 13
 - added codecview filter to visualize information exported by some codecs
14 14
 - matroska 3d support thorugh side data
15
+- HTML generation using texi2html is deprecated in favor of makeinfo/texi2any
15 16
 
16 17
 
17 18
 version 2.3:
... ...
@@ -52,3 +52,5 @@
52 52
   • dctdnoiz filter now uses a block size of 8x8 instead of 16x16 by default
53 53
   • -vismv option is deprecated in favor of the codecview filter
54 54
   • libmodplug is now detected through pkg-config
55
+  • HTML documentation generation through texi2html is deprecated in
56
+    favor of makeinfo/texi2any
... ...
@@ -1802,6 +1802,7 @@ HAVE_LIST="
1802 1802
     libdc1394_1
1803 1803
     libdc1394_2
1804 1804
     makeinfo
1805
+    makeinfo_html
1805 1806
     perl
1806 1807
     pod2man
1807 1808
     sdl
... ...
@@ -2631,7 +2632,8 @@ ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
2631 2631
 # documentation
2632 2632
 podpages_deps="perl"
2633 2633
 manpages_deps="perl pod2man"
2634
-htmlpages_deps="perl texi2html"
2634
+htmlpages_deps="perl"
2635
+htmlpages_deps_any="makeinfo_html texi2html"
2635 2636
 txtpages_deps="perl makeinfo"
2636 2637
 doc_deps_any="manpages htmlpages podpages txtpages"
2637 2638
 
... ...
@@ -4916,8 +4918,11 @@ else
4916 4916
 fi
4917 4917
 enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
4918 4918
 
4919
-texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
4920 4919
 makeinfo --version > /dev/null 2>&1 && enable makeinfo  || disable makeinfo
4920
+enabled makeinfo && (makeinfo --version | \
4921
+                     grep -q 'makeinfo (GNU texinfo) 5' > /dev/null 2>&1) \
4922
+    && enable makeinfo_html || disable makeinfo_html
4923
+disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
4921 4924
 perl -v            > /dev/null 2>&1 && enable perl      || disable perl
4922 4925
 pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
4923 4926
 rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
... ...
@@ -5401,6 +5406,7 @@ echo "texi2html enabled         ${texi2html-no}"
5401 5401
 echo "perl enabled              ${perl-no}"
5402 5402
 echo "pod2man enabled           ${pod2man-no}"
5403 5403
 echo "makeinfo enabled          ${makeinfo-no}"
5404
+echo "makeinfo supports HTML    ${makeinfo_html-no}"
5404 5405
 test -n "$random_seed" &&
5405 5406
     echo "random seed               ${random_seed}"
5406 5407
 echo
... ...
@@ -82,14 +82,25 @@ $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
82 82
 	$(M)doc/print_options $* > $@
83 83
 
84 84
 doc/%.html: TAG = HTML
85
+doc/%-all.html: TAG = HTML
86
+
87
+ifdef HAVE_MAKEINFO_HTML
88
+doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
89
+	$(Q)$(TEXIDEP)
90
+	$(M)makeinfo --html -I doc --no-split -D config-not-all --init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
91
+
92
+doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
93
+	$(Q)$(TEXIDEP)
94
+	$(M)makeinfo --html -I doc --no-split -D config-all --init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
95
+else
85 96
 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
86 97
 	$(Q)$(TEXIDEP)
87 98
 	$(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
88 99
 
89
-doc/%-all.html: TAG = HTML
90 100
 doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
91 101
 	$(Q)$(TEXIDEP)
92 102
 	$(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
103
+endif
93 104
 
94 105
 doc/%.pod: TAG = POD
95 106
 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
... ...
@@ -278,7 +278,7 @@ llrint() in its C library.
278 278
 Install your Cygwin with all the "Base" packages, plus the
279 279
 following "Devel" ones:
280 280
 @example
281
-binutils, gcc4-core, make, git, mingw-runtime, texi2html
281
+binutils, gcc4-core, make, git, mingw-runtime, texinfo
282 282
 @end example
283 283
 
284 284
 In order to run FATE you will also need the following "Utils" packages:
... ...
@@ -1,3 +1,7 @@
1
+# Init file for texi2html.
2
+
3
+# This is deprecated, and the makeinfo/texi2any version is doc/t2h.pm
4
+
1 5
 # no horiz rules between sections
2 6
 $end_section = \&FFmpeg_end_section;
3 7
 sub FFmpeg_end_section($$)
4 8
new file mode 100644
... ...
@@ -0,0 +1,220 @@
0
+# makeinfo HTML output init file
1
+#
2
+# Copyright (c) 2011, 2012 Free Software Foundation, Inc.
3
+# Copyright (c) 2014 Andreas Cadhalpun
4
+# Copyright (c) 2014 Tiancheng "Timothy" Gu
5
+#
6
+# This file is part of FFmpeg.
7
+#
8
+# FFmpeg is free software; you can redistribute it and/or modify
9
+# it under the terms of the GNU General Public License as published by
10
+# the Free Software Foundation; either version 3 of the License, or
11
+# (at your option) any later version.
12
+#
13
+# FFmpeg is distributed in the hope that it will be useful,
14
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+# Lesser General Public License for more details.
17
+#
18
+# You should have received a copy of the GNU Lesser General Public
19
+# License along with FFmpeg; if not, write to the Free Software
20
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+
22
+# no navigation elements
23
+set_from_init_file('HEADERS', 0);
24
+
25
+# TOC and Chapter headings link
26
+set_from_init_file('TOC_LINKS', 1);
27
+
28
+# print the TOC where @contents is used
29
+set_from_init_file('INLINE_CONTENTS', 1);
30
+
31
+# make chapters <h2>
32
+set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
33
+
34
+# Do not add <hr>
35
+set_from_init_file('DEFAULT_RULE', '');
36
+set_from_init_file('BIG_RULE', '');
37
+
38
+# Customized file beginning
39
+sub ffmpeg_begin_file($$$)
40
+{
41
+    my $self = shift;
42
+    my $filename = shift;
43
+    my $element = shift;
44
+
45
+    my $command;
46
+    if ($element and $self->get_conf('SPLIT')) {
47
+        $command = $self->element_command($element);
48
+    }
49
+
50
+    my ($title, $description, $encoding, $date, $css_lines,
51
+        $doctype, $bodytext, $copying_comment, $after_body_open,
52
+        $extra_head, $program_and_version, $program_homepage,
53
+        $program, $generator) = $self->_file_header_informations($command);
54
+
55
+    my $links = $self->_get_links ($filename, $element);
56
+
57
+    my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
58
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
59
+<html>
60
+<!-- Created by $program_and_version, $program_homepage -->
61
+  <head>
62
+    <meta charset="utf-8">
63
+    <title>
64
+EOT
65
+    my $head_title = <<EOT;
66
+      $title
67
+EOT
68
+
69
+    my $head2 = $ENV{"FFMPEG_HEADER2"} || <<EOT;
70
+    </title>
71
+    <link rel="stylesheet" type="text/css" href="style.min.css">
72
+  </head>
73
+  <body>
74
+    <div style="width: 95%; margin: auto">
75
+      <h1>
76
+EOT
77
+
78
+    my $head3 = $ENV{"FFMPEG_HEADER3"} || <<EOT;
79
+      </h1>
80
+EOT
81
+
82
+    return $head1 . $head_title . $head2 . $head_title . $head3;
83
+}
84
+texinfo_register_formatting_function('begin_file', \&ffmpeg_begin_file);
85
+
86
+# Customized file ending
87
+sub ffmpeg_end_file($)
88
+{
89
+    my $self = shift;
90
+    my $program_string = &{$self->{'format_program_string'}}($self);
91
+    my $program_text = <<EOT;
92
+      <p style="font-size: small;">
93
+        $program_string
94
+      </p>
95
+EOT
96
+    my $footer = $ENV{FFMPEG_FOOTER} || <<EOT;
97
+    </div>
98
+  </body>
99
+</html>
100
+EOT
101
+    return $program_text . $footer;
102
+}
103
+texinfo_register_formatting_function('end_file', \&ffmpeg_end_file);
104
+
105
+# Dummy title command
106
+# Ignore title. Title is handled through ffmpeg_begin_file().
107
+set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
108
+sub ffmpeg_title($$$$)
109
+{
110
+    return '';
111
+}
112
+
113
+texinfo_register_command_formatting('titlefont',
114
+                                    \&ffmpeg_title);
115
+
116
+# Customized float command. Part of code borrowed from GNU Texinfo.
117
+sub ffmpeg_float($$$$$)
118
+{
119
+    my $self = shift;
120
+    my $cmdname = shift;
121
+    my $command = shift;
122
+    my $args = shift;
123
+    my $content = shift;
124
+
125
+    my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
126
+                                                                $command);
127
+    my $caption_text = '';
128
+    my $prepended_text;
129
+    my $prepended_save = '';
130
+
131
+    if ($self->in_string()) {
132
+        if ($prepended) {
133
+            $prepended_text = $self->convert_tree_new_formatting_context(
134
+                $prepended, 'float prepended');
135
+        } else {
136
+            $prepended_text = '';
137
+        }
138
+        if ($caption) {
139
+            $caption_text = $self->convert_tree_new_formatting_context(
140
+                {'contents' => $caption->{'args'}->[0]->{'contents'}},
141
+                'float caption');
142
+        }
143
+        return $prepended.$content.$caption_text;
144
+    }
145
+
146
+    my $id = $self->command_id($command);
147
+    my $label;
148
+    if (defined($id) and $id ne '') {
149
+        $label = "<a name=\"$id\"></a>";
150
+    } else {
151
+        $label = '';
152
+    }
153
+
154
+    if ($prepended) {
155
+        if ($caption) {
156
+            # prepend the prepended tree to the first paragraph
157
+            my @caption_original_contents = @{$caption->{'args'}->[0]->{'contents'}};
158
+            my @caption_contents;
159
+            my $new_paragraph;
160
+            while (@caption_original_contents) {
161
+                my $content = shift @caption_original_contents;
162
+                if ($content->{'type'} and $content->{'type'} eq 'paragraph') {
163
+                    %{$new_paragraph} = %{$content};
164
+                    $new_paragraph->{'contents'} = [@{$content->{'contents'}}];
165
+                    unshift (@{$new_paragraph->{'contents'}}, {'cmdname' => 'strong',
166
+                             'args' => [{'type' => 'brace_command_arg',
167
+                                                    'contents' => [$prepended]}]});
168
+                    push @caption_contents, $new_paragraph;
169
+                    last;
170
+                } else {
171
+                    push @caption_contents, $content;
172
+                }
173
+            }
174
+            push @caption_contents, @caption_original_contents;
175
+            if ($new_paragraph) {
176
+                $caption_text = $self->convert_tree_new_formatting_context(
177
+                 {'contents' => \@caption_contents}, 'float caption');
178
+                $prepended_text = '';
179
+            }
180
+        }
181
+        if ($caption_text eq '') {
182
+            $prepended_text = $self->convert_tree_new_formatting_context(
183
+                $prepended, 'float prepended');
184
+            if ($prepended_text ne '') {
185
+                $prepended_save = $prepended_text;
186
+                $prepended_text = '<p><strong>'.$prepended_text.'</strong></p>';
187
+            }
188
+        }
189
+    } else {
190
+        $prepended_text = '';
191
+    }
192
+
193
+    if ($caption and $caption_text eq '') {
194
+        $caption_text = $self->convert_tree_new_formatting_context(
195
+            $caption->{'args'}->[0], 'float caption');
196
+    }
197
+    if ($prepended_text.$caption_text ne '') {
198
+        $prepended_text = $self->_attribute_class('div','float-caption'). '>'
199
+                . $prepended_text;
200
+        $caption_text .= '</div>';
201
+    }
202
+    my $html_class = '';
203
+    if ($prepended_save =~ /NOTE/) {
204
+        $html_class = 'info';
205
+        $prepended_text = '';
206
+        $caption_text   = '';
207
+    } elsif ($prepended_save =~ /IMPORTANT/) {
208
+        $html_class = 'warning';
209
+        $prepended_text = '';
210
+        $caption_text   = '';
211
+    }
212
+    return $self->_attribute_class('div', $html_class). '>' . "\n" .
213
+        $prepended_text . $caption_text . $content . '</div>';
214
+}
215
+
216
+texinfo_register_command_formatting('float',
217
+                                    \&ffmpeg_float);
218
+
219
+1;