4 include 'blfs-include.php';
7 $CHAPTERS = 'Chapter 44';
8 $START_PACKAGE = 'alsa-lib';
9 $STOP_PACKAGE = 'xvidcore';
12 $renames[ 'libmusicbrainz' ] = 'libmusicbrainz2';
13 $renames[ 'libmusicbrainz1' ] = 'libmusicbrainz5';
14 $renames[ 'x264-snapshot' ] = 'x264';
15 $renames[ 'x1' ] = 'x265';
16 $renames[ 'flash_player_ppapi_linux.x' ] = 'flashplayer';
19 $ignores[ 'chromium-launcher' ] = '';
20 $ignores[ 'flash_player_ppapi_linux.x' ] = '';
21 $ignores[ 'flash_player_ppapi_linux.i' ] = '';
22 $ignores[ 'flash_player_npapi_linux.x' ] = '';
23 $ignores[ 'flash_player_npapi_linux.i' ] = '';
25 //$current="libcanberra";
28 $regex[ 'a52dec' ] = "/^.*a52dec-(\d[\d\.]+\d) is.*$/";
29 $regex[ 'libass' ] = "/^.*Release (\d[\d\.]+\d).*$/";
30 $regex[ 'libmpeg2' ] = "/^.*libmpeg2-(\d[\d\.]+\d).*$/";
31 $regex[ 'libmusicbrainz1' ] = "/^.*libmusicbrainz-(5[\d\.]+\d).*$/";
32 $regex[ 'flash_player_ppapi_linux.x' ] = "/^.*latest versions are (\d[\d\.]+\d).*$/";
33 $regex[ 'libcanberra' ] = "/^.*(\d[\d\.]+\d) released.*$/";
34 $regex[ 'xvidcore' ] = "/^.*Xvid (\d[\d\.]+\d) stable.*$/";
38 array( 'pkg' => 'alsa-lib',
40 'replace' => "https://alsa-project.org/wiki/Main_Page" ),
42 array( 'pkg' => 'alsa-plugins',
44 'replace' => "https://alsa-project.org/wiki/Main_Page" ),
46 array( 'pkg' => 'alsa-utils',
48 'replace' => "https://alsa-project.org/wiki/Main_Page" ),
50 array( 'pkg' => 'alsa-tools',
52 'replace' => "https://alsa-project.org/wiki/Main_Page" ),
54 array( 'pkg' => 'alsa-oss',
56 'replace' => "https://alsa-project.org/wiki/Main_Page" ),
58 array( 'pkg' => 'alsa-firmware',
60 'replace' => "https://www.alsa-project.org/files/pub/firmware" ),
62 array( 'pkg' => 'faac',
64 'replace' => "https://github.com/knik0/faac/releases" ),
66 array( 'pkg' => 'faad2',
68 'replace' => "https://github.com/knik0/faad2/releases" ),
70 array( 'pkg' => 'fdk-aac',
72 'replace' => "http://sourceforge.net/projects/opencore-amr/files/fdk-aac" ),
74 array( 'pkg' => 'frei0r-plugins',
76 'replace' => "https://files.dyne.org/frei0r/releases" ),
78 array( 'pkg' => 'a52dec',
80 'replace' => "http://liba52.sourceforge.net/" ),
82 array( 'pkg' => 'id3lib',
84 'replace' => "http://sourceforge.net/projects/id3lib/files/id3lib" ),
86 array( 'pkg' => 'libao',
88 'replace' => "http://downloads.xiph.org/releases/ao" ),
90 array( 'pkg' => 'libass',
92 'replace' => "https://github.com/libass/libass/releases" ),
94 array( 'pkg' => 'libdv',
96 'replace' => "http://sourceforge.net/projects/libdv/files" ),
98 array( 'pkg' => 'libmpeg2',
100 'replace' => "http://libmpeg2.sourceforge.net/downloads.html" ),
102 array( 'pkg' => 'libmpeg3',
104 'replace' => "http://sourceforge.net/projects/heroines/files/releases" ),
106 array( 'pkg' => 'libmusicbrainz',
108 'replace' => "http://ftp.musicbrainz.org/pub/musicbrainz/historical" ),
110 array( 'pkg' => 'libmusicbrainz1',
112 'replace' => "http://musicbrainz.org/doc/libmusicbrainz" ),
114 array( 'pkg' => 'libquicktime',
116 'replace' => "http://sourceforge.net/projects/libquicktime/files" ),
118 array( 'pkg' => 'libsamplerate',
120 'replace' => "https://github.com/libsndfile/libsamplerate/releases" ),
122 array( 'pkg' => 'libsndfile',
124 'replace' => "https://github.com/libsndfile/libsndfile/releases" ),
126 array( 'pkg' => 'libvpx',
128 'replace' => "https://github.com/webmproject/libvpx/releases" ),
130 array( 'pkg' => 'pipewire',
132 'replace' => "https://github.com/Pipewire/pipewire/releases" ),
134 array( 'pkg' => 'soundtouch',
136 'replace' => "https://gitlab.com/soundtouch/soundtouch/-/tags" ),
138 array( 'pkg' => 'taglib',
140 'replace' => "http://taglib.github.io" ),
142 array( 'pkg' => 'xine-lib',
144 'replace' => "http://sourceforge.net/projects/xine/files/xine-lib" ),
146 array( 'pkg' => 'xvidcore',
148 'replace' => "https://labs.xvid.com/source/" ),
150 array( 'pkg' => 'gavl',
152 'replace' => "https://sourceforge.net/projects/gmerlin/files/gavl" ),
154 array( 'pkg' => 'mlt',
156 'replace' => "https://github.com/mltframework/mlt/releases" ),
158 array( 'pkg' => 'libcddb',
160 'replace' => "https://sourceforge.net/projects/libcddb/files" ),
162 array( 'pkg' => 'flash_player_ppapi_linux.x',
164 'replace' => "https://www.adobe.com/support/flashplayer/debug_downloads.html" ),
166 array( 'pkg' => 'x265',
168 'replace' => "http://hg.videolan.org/x265/tags" ),
171 function get_packages( $package, $dirpath )
178 if ( isset( $current ) && $book_index != "$current" ) return 0;
179 if ( $book_index == "x265" ) return "manual"; # x265
181 // Fix up directory path
182 foreach ( $url_fix as $u )
184 $replace = $u[ 'replace' ];
185 $match = $u[ 'match' ];
187 if ( isset( $u[ 'pkg' ] ) )
189 if ( $package == $u[ 'pkg' ] )
191 $dirpath = preg_replace( "/$match/", "$replace", $dirpath );
197 if ( preg_match( "/$match/", $dirpath ) )
199 $dirpath = preg_replace( "/$match/", "$replace", $dirpath );
206 if ( preg_match( "/^ftp/", $dirpath ) )
208 if ( $package == "audiofile" ||
209 $package == "esound" ||
212 // Default ftp enties for this chapter
213 $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
214 $position = strrpos( $dirpath, "/" );
215 $dirpath = substr ( $dirpath, 0, $position ); // Up 1
216 exec( "curl -L -s -m30 '$dirpath/'", $dirs );
217 $dir = find_max( $dirs, "/\d\./", "/^.* ([\d\.]+)$/" );
218 $dirpath .= "/$dir/";
222 exec( "curl -L -s -m30 '$dirpath/'", $lines );
226 if ( $package == "gavl" )
228 exec( "links -dump '$dirpath/'", $dirs );
229 $dir = find_max( $dirs, "/^\s*\d\./", "/^\s*([\d\.]+).*$/" );
230 $dirpath .= "/$dir/";
233 if ( $package == "libdvdcss" ||
234 $package == "libdvdnav" ||
235 $package == "libdvdread" )
237 $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
238 $position = strrpos( $dirpath, "/" );
239 $dirpath = substr ( $dirpath, 0, $position ); // Up 1
240 $lines = http_get_file( $dirpath . "/" );
241 return find_max( $lines, "/^\d\./", ":^(\d[\d\.]+)/.*$:", TRUE );
244 // Directories are in the form of mmddyy :(
245 if ( $package == "libmpeg3" )
248 $dirs = http_get_file( $dirpath );
249 foreach ( $dirs as $d )
251 // Isolate the version and put in an array
252 $slice = preg_replace( "/^\s*(\d{2})(\d{2})(\d{2})\s*$/", "$3$2$1", $d );
253 if ( "x$slice" == "x$d" ) continue;
254 array_push( $a, $slice );
257 rsort( $a, SORT_NATURAL
); // Max version is at the top
259 $lines = http_get_file( "$dirpath/$dir" );
260 return find_max( $lines, "/libmpeg3/", "/^.*libmpeg3-(\d[\d\.]+)-src.*$/" );
263 if ( $package == "x265" )
265 # We have to process the stupid javascript to get this to work
266 //exec( "lynx -dump $dirpath", $output );
267 $output = http_get_file( "$dirpath" );
268 $max = find_max( $output, "/\d\./", "/^([\d\.]+)$/" );
272 if ( $package == "frei0r-plugins" )
274 exec( "wget -q --no-check-certificate -O- $dirpath", $output );
275 $max = find_max( $output, "/frei0r/", "/^.*plugins-([\d\.]*\d)\.tar.*$/" );
279 if ( $package == "opus" ) $dirpath .= '/';
281 if ( $package == "id3lib" )
282 exec( "links -dump $dirpath", $lines );
284 $lines = http_get_file( $dirpath );
286 if ( ! is_array( $lines ) ) return $lines;
289 if ( isset( $regex[ $package ] ) )
291 // Custom search for latest package name
292 foreach ( $lines as $l )
294 if ( preg_match( '/^\h*$/', $l ) ) continue;
296 $ver = preg_replace( $regex[ $package ], "$1", $l );
297 if ( $ver == $l ) continue;
299 return $ver; // Return first match of regex
302 return 0; // This is an error
305 if ( preg_match( '/alsa-firmware/', $package ) )
307 $max = find_max( $lines, "/$package/", "/^.*$package-(\d\.[\d\.]+).tar.*$/" );
311 if ( preg_match( '/alsa-lib/', $package ) )
313 $max = find_max( $lines, "/$package/", "/^.*$package-(\d\.[\d\.]+).tar.*$/" );
314 if ( $max != 0 ) return $max; // else fall through
317 if ( preg_match( '/alsa/', $package ) )
319 $max = find_max( $lines, "/$package/", "/^.*$package-(\d\.[\d\.]+).*$/" );
323 if ( $package == "faad2" )
325 $ver = find_max( $lines, "/FAAD2 \d/", "/^.*FAAD2 ([\d\.]+).*$/" );
326 return preg_replace( "/\./", "_", $ver );
329 if ( $package == "faac" )
331 $ver = find_max( $lines, "/FAAC \d/", "/^.*FAAC ([\d\.]+).*$/" );
332 return preg_replace( "/\./", "_", $ver );
335 if ( $package == "gstreamer" )
336 return find_even_max( $lines, "/gstreamer/", "/^.*gstreamer-(1\.[\d\.]+).tar.*$/" );
338 if ( $package == "gst-plugins-base" )
339 return find_even_max( $lines, "/base-/", "/^.*base-(1\.[\d\.]+).tar.*$/" );
341 if ( $package == "gst-plugins-good" )
342 return find_even_max( $lines, "/good-/", "/^.*good-(1\.[\d\.]+).tar.*$/" );
344 if ( $package == "gst-plugins-bad" )
345 return find_even_max( $lines, "/bad-/", "/^.*bad-(1\.[\d\.]+).tar.*$/" );
347 if ( $package == "gst-plugins-ugly" )
348 return find_even_max( $lines, "/ugly-/", "/^.*ugly-(1\.[\d\.]+).tar.*$/" );
350 if ( $package == "gst-libav" )
351 return find_even_max( $lines, "/$package/", "/^.*$package-([\d\.]+).tar.*$/" );
353 if ( $package == "gstreamer-vaapi" )
354 return find_even_max( $lines, "/$package/", "/^.*$package-([\d\.]+).tar.*$/" );
356 if ( $package == "libmad" )
357 return find_max( $lines, "/^.*libmad-/", "/^.*libmad-([\d\.]+[a-m]{0,1}).tar.*$/" );
359 if ( $package == "id3lib" )
360 return find_max( $lines, "/id3lib/", "/^.*id3lib-([\d\.]+)binaries.*$/" );
362 if ( $package == "libmusicbrainz" )
363 return find_max( $lines, "/^.*libmusicbrainz-/", "/^.*libmusicbrainz-(2[\d\.]+).tar.*$/" );
365 if ( $package == "libmusicbrainz1" )
366 return find_max( $lines, "/^.*libmusicbrainz-/", "/^.*libmusicbrainz-(3[\d\.]+).tar.*$/" );
368 if ( $package == "libvpx" )
369 return find_max( $lines, "/v\d/", "/^.*v(\d[\d\.]+\d).*$/" );
371 if ( $package == "soundtouch" )
372 return find_max( $lines, "/release/", "/^.*release ([\d\.]+).*$/" );
374 if ( $package == "speexdsp" )
375 return find_max( $lines, "/$package/", "/^.*$package-([\d\.]+).tar.*$/" );
377 if ( $package == "taglib" )
378 return find_max( $lines, "/TagLib/", "/^.*TagLib ([\d\.]+).*$/" );
380 if ( $package == "libcdio-paranoia" )
381 return find_max( $lines, "/paranoia/", "/^.*paranoia-([\d\.\+]+).tar.*$/" );
383 if ( $package == "pulseaudio" ) // Skip minors > 90
384 return find_max( $lines, "/$package/",
385 "/^.*$package-([\d\.]*\d)\.tar.*$/" , TRUE );
387 if ( $package == "xine-lib" )
388 return find_max( $lines, "/^\\s*\d\./", "/^\\s*(\d\.[\d\.]+) .*$/" );
390 if ( $package == "pipewire" )
391 return find_max( $lines, "/^\\s*\d\./", "/^\\s*(\d\.[\d\.]+).*$/" );
394 // Most packages are in the form $package-n.n.n
395 // Occasionally there are dashes (e.g. 201-1)
397 $max = find_max( $lines, "/$package/", "/^.*$package-([\d\.]*\d)\.tar.*$/" );
401 Function get_pattern( $line )
404 array( 'pkg' => 'a52dec',
405 'regex' => "/^.*a52dec-(\d[\d\.]+).*$/" ),
407 array( 'pkg' => 'faad2',
408 'regex' => "/^.*faad2-(\d[\d_]+).*$/" ),
410 array( 'pkg' => 'frei',
411 'regex' => "/^.*frei0r-plugins-(\d[\d\.]+).*$/" ),
413 array( 'pkg' => 'id3lib',
414 'regex' => "/^.*id3lib-(\d[\d\.]+).*$/" ),
416 array( 'pkg' => 'libmpeg2',
417 'regex' => "/^.*libmpeg2-(\d[\d\.]+).*$/" ),
419 array( 'pkg' => 'libmpeg3',
420 'regex' => "/^.*libmpeg3-(\d[\d\.]+).*$/" ),
422 array( 'pkg' => 'libmad',
423 'regex' => "/^.*libmad-(\d[\d\.]+[a-m]{0,1}).*$/" ),
425 array( 'pkg' => 'SDL2',
426 'regex' => "/^.*SDL2-(\d[\d\.]+\d).*$/" ),
428 array( 'pkg' => 'v4l-utils',
429 'regex' => "/^.*v4l-utils-(\d[\d\.]+\d).*$/" ),
431 array( 'pkg' => 'x264',
432 'regex' => "/^.*x264-(\d+).*$/" ),
434 array( 'pkg' => 'x265',
435 'regex' => "/^.*x265_(\d[\d\.]+\d).*$/" ),
438 foreach( $match as $m )
442 if ( preg_match( "/$pkg/", $line ) )
443 return $m[ 'regex' ];
446 return "/\D*(\d.*\d)\D*$/";
449 get_current(); // Get what is in the book
452 // Get latest version for each package
453 foreach ( $book as $pkg => $data )
457 $base = $data[ 'basename' ];
458 $url = $data[ 'url' ];
459 $bver = $data[ 'version' ];
461 echo "book index: $book_index $url $bver\n";
463 $v = get_packages( $book_index, $url );
464 $vers[ $book_index ] = $v;
467 html(); // Write html output