]> git.pld-linux.org Git - projects/cleanbuild.git/blob - findbr
9e6fc5fb624e8ac6944250f53bde455af14a80c3
[projects/cleanbuild.git] / findbr
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use IPC::Open2;
6 use Cwd;
7
8 my $pwd = getcwd();
9 # how to run poldek
10 my @ignore = qw(vserver-packages python-devel-src);
11 my @poldek = (qw(sudo poldek -n th-x86_64-ready), "--cachedir=$pwd/poldekcache",
12         "--skip-installed", "--conf=$pwd/poldekconf/poldek.conf",
13         "-O", "ignore=" . (join " ", @ignore)
14 );
15
16 # if multiple packages provide some funcionality those will be selected:
17 my %preferred = (
18         "automake" => +1,
19         "autoconf" => +1,
20         "pkgconfig" => +1,
21
22         "python" => +1,
23         "python-modules" => +1,
24         "python-setuptools" => +1,
25
26         "perl-modules" => +1,
27         "perl-Encode" => +2,
28
29         "zlib-devel" => +1,
30         "libstdc++-devel" => +1,
31         "libusb-compat-devel" => +1,
32         "libjpeg-devel" => +1,
33         "libpng-devel" => +1,
34         "libsamplerate-devel" => +1,
35         "pulseaudio-devel" => +1,
36         "xorg-lib-libXrandr-devel" => +1,
37         "sqlite-devel" => +1,
38
39         "ice-devel" => -1,
40 );
41
42 # translate package name to provides name
43 my %translate = (
44         "gcc-c++" => "libstdc++-devel",
45         "rarian-compat" => "scrollkeeper",
46         "Mesa-libGL" => "OpenGL",
47         "Mesa-libGL-devel" => "OpenGL-devel",
48         "Mesa-libGLU-devel" => "OpenGL-GLU-devel",
49 );
50
51 my @skip = qw(hostname git svn svnversion mt gawk);
52 my %skip;
53 @skip{ @skip } = (1) x scalar @skip;
54
55 # for m4 in *.m4; do R=$(rpm -qf $m4); R=${R%-*-*}; \
56 #   awk -vr=$R '/^\s*(AC_DEFUN|AU_ALIAS)/ { gsub(/\].*/,""); gsub(/.*\[/,""); print r " " $0}' $m4; \
57 # done | sort | awk '{print "\t\"" $2 "\" => \"" $1 "\","}'
58 my %ac2br = do "findbr-ac2br";
59
60 my %cmake2br = (
61         "findkde4:44" => "kde4-kdelibs",
62         "findmsgfmt" => "gettext-tools",
63         "findpythoninterp" => "python",
64 );
65
66 BEGIN {
67         $SIG{__WARN__} = sub
68         {
69                 local $_ = shift;
70                 chomp;
71                 print STDERR "\033[31;1m" . $_ . "\033[0m\n"
72         };
73 }
74
75 my $builddir = shift @ARGV;
76 my @lines = <ARGV>;
77
78 my $reason;
79
80 my %out;
81 sub add_br
82 {
83         my $pkg = shift;
84         my $msg = shift || $reason;
85         if ( ref $pkg ) {
86                 foreach my $p ( @$pkg ) {
87                         add_br( $p, $msg );
88                 }
89                 return;
90         }
91
92         $msg =~ s/\n/ # /sg;
93
94         $pkg = $translate{ $pkg } || $pkg;
95
96         return if exists $out{ $pkg };
97         $out{ $pkg } = $msg;
98         print STDERR "\033[33;1madding: $pkg => $msg\033[0m\n";
99 }
100
101 sub poldek_cmd
102 {
103         my $cmd = shift;
104         warn "Poldek: $cmd\n";
105         my $pid = open( READ, "-|", @poldek, "--shcmd=".$cmd );
106
107         my @read = <READ>;
108         close READ;
109
110         return @read if wantarray;
111         return \@read;
112 }
113
114 my $check_ac = 0;
115 my $check_config_log = undef;
116
117 my %checked_files;
118 sub poldek_file
119 {
120         my @files;
121         foreach ( @_ ) {
122                 next if $checked_files{ $_ };
123                 $checked_files{ $_ } = 1;
124                 push @files, $_;
125         }
126         return unless @files;
127
128         my $search = join "; ", map "search -f $_", @files;
129         warn "Reason: $reason\n";
130         my @read = poldek_cmd( $search );
131
132         local $_;
133         my @found;
134         while ( $_ = shift @read ) {
135                 if ( /(\d+) package\(s\) found:$/ ) {
136                         foreach my $i ( 1..$1 ) {
137                                 $_ = shift @read;
138                                 chomp;
139                                 $_ =~ /^(.*)-.*?-.*?$/;
140                                 push @found, $1;
141                         }
142                 }
143         }
144
145         return unless @found;
146
147         my $found = $found[0];
148         if ( @found > 1 ) {
149                 my $i = 0.0;
150                 my %pts = map { ( $_ => ( ($i += 0.001) + ( $preferred{ $_ } || 0 ) ) ) }
151                         reverse @found;
152                 my @pref = sort { $pts{$b} <=> $pts{$a} } @found;
153                 my $pref = join ", ", map "$_ => $pts{$_}", @pref;
154                 warn "Multiple found: $pref\n";
155                 $found = $pref[0];
156         }
157
158         $found = $translate{ $found } if $translate{ $found };
159
160         add_br( $found );
161 }
162
163 my $pkglist;
164 sub get_pkglist
165 {
166         my %pkglist;
167         my $read = poldek_cmd( "ls" );
168         foreach ( @$read ) {
169                 chomp;
170                 next unless /(\S+)-.*?-.*?\.[a-z0-9_]+$/;
171                 my $pkg = $1;
172                 $pkglist{ lc $pkg } = $pkg;
173         }
174         $pkglist = \%pkglist;
175 }
176
177 sub guess_package
178 {
179         my $origname = shift;
180         get_pkglist() unless $pkglist;
181         return unless defined $origname;
182         my $name = lc $origname;
183         my @try = (
184                 "lib$name-devel",
185                 "$name-devel",
186                 "$name",
187                 "lib$name-.*-devel",
188                 "$name-.*-devel",
189                 ".*-lib$name-devel",
190                 ".*-$name-devel",
191                 ".*-lib$name-.*-devel",
192                 ".*-$name-.*-devel",
193         );
194         my @select;
195         for my $k ( keys %$pkglist ) {
196                 if ( $k =~ /$name/ ) {
197                         push @select, $k;
198                 }
199         }
200         @select = sort @select;
201
202         foreach my $try ( @try ) {
203                 foreach my $pkg ( @select ) {
204                         if ( $pkg =~ /^$try$/ ) {
205                                 warn "guessed: $origname => $pkglist->{ $pkg }\n";
206                                 return $pkglist->{ $pkg };
207                         }
208                 }
209         }
210         warn "$origname not guessed\n";
211         return undef;
212 }
213
214 start_check:
215
216 my %checked;
217 my $cmake_get_call = 0;
218 my $cmake_pkg_list = 0;
219 my $py_ver = undef;
220 while ( $_ = shift @lines ) {
221         chomp;
222         #next if $checked{ $_ };
223         #$checked{ $_ } = 1;
224
225         # try to extract current python version from setup.py run
226         if (m{^copying .+ -> build-(\d+)/lib/}) {
227                 $py_ver = $1;
228                 warn "py_ver set to '$py_ver'\n";
229         }
230
231         $reason = $_;
232         if ( /^\S+: (\S+): (?:Command )?not found$/ or /.*configure\[\d+\]: (\S+): not found$/
233                         or m{which: no (\S+) in \(.*/bin.*\)}
234                         or m{\S+: (\S+): command not found$}
235                         or m{(?:/usr/bin/)?env: (\S+): No such file or directory}
236                         or m{flock: (\S+): No such file or directory}
237                         or m{Can't exec "(\S+)": No such file or directory} ) {
238                 my $exec = $1;
239                 $exec = $1 if $exec =~ m{^"(.*)"$};
240                 next if $skip{ $exec };
241                 warn "Looking for executable $exec\n";
242                 if ( $exec =~ m#^/# ) {
243                         poldek_file( $exec );
244                 }
245                 poldek_file( "/usr/bin/$exec", "/bin/$exec" );
246         }
247
248         if ( /\S+\.[ch](?:pp|xx|c)?:\d+:\d+: error: (\S+): No such file or directory$/ or
249                 /\S+\.[ch](?:pp|xx|c)?:\d+:\d+: fatal error: (\S+): No such file or directory$/ or
250                 /Can't find the '(\S+\.h)'? header/
251         ) {
252                 my $h = $1;
253                 warn "Looking for C(++) header $h\n";
254                 poldek_file( "/usr/include*/$h" );
255         }
256
257         if (m{^ImportError: No module named (\S+)$}
258                 or m{^ERROR: Cannot find .+: No module named (\S+)$}
259                 or m{^ERROR: Failed to import the ".+" module: No module named (\S+)$}
260                 or m{^distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse\('([^'>=]+).*'\)}
261                 or                           m{^error: Could not find suitable distribution for Requirement.parse\('([^'>=]+).*'\)}
262                 or m{^Couldn't find index page for '(\S+)'}
263                 ) {
264                 my $mod = $1;
265                 $mod =~ s#\.#/#g;
266                 warn "Looking for Python$py_ver module $mod\n";
267                 poldek_file(
268                                 "/usr/share/python$py_ver*/site-packages/$mod/__init__.py*",
269                                 "/usr/share/python$py_ver*/$mod/__init__.py*",
270                                 "/usr/share/python$py_ver*/site-packages/$mod.py*",
271                                 "/usr/share/python$py_ver*/$mod.py*",
272                                 "/usr/lib*/python$py_ver*/site-packages/$mod/__init__.py*",
273                                 "/usr/lib*/python$py_ver*/$mod/__init__.py*",
274                                 "/usr/lib*/python$py_ver*/site-packages/$mod.py*",
275                                 "/usr/lib*/python$py_ver*/$mod.py*",
276                                 "/usr/lib*/python$py_ver*/site-packages/_$mod.so",
277                                 "/usr/lib*/python$py_ver*/_$mod.so",
278                                 "/usr/lib*/python$py_ver*/site-packages/$mod.so",
279                                 "/usr/lib*/python$py_ver*/$mod.so",
280                 );
281         }
282
283         if (
284                 m{^-- Could NOT find Sphinx \(missing:  SPHINX_EXECUTABLE\)}
285         ) {
286                 add_br("sphinx-pdg");
287                 next;
288         }
289
290         if (
291                 m{^You need to install the (\S+) module} or
292                 m{\*\*\*Error\*\*\*: You must have (\S+) >= (\S+) installed}
293         ) {
294                 add_br($1);
295                 next;
296         }
297
298         if (
299                 m{^cannot load such file -- (\S+)} or
300                 m{in `require': cannot load such file -- (\S+) \(LoadError\)}
301         ) {
302                 my $mod = $1;
303                 warn "Looking for ruby module $mod\n";
304                 poldek_file(
305                         "/usr/share/ruby/*/$mod.rb",
306                         "/usr/share/ruby/vendor_ruby/*/$mod.rb",
307                         "/usr/lib64/ruby/vendor_ruby/*/$mod.so",
308                 );
309         }
310
311         if ( /configure(?:\.in|\.ac)?:\d+: error: possibly undefined macro: (\S+)/
312                         or m{configure(?:\.in|\.ac)?:\d+: error: m4 macro `(\S+)' is not defined}
313                         or m{warning: macro `(\S+)' not found in library} ) {
314                 my $macro = $1;
315                 warn "Looking for autotools macro $macro\n";
316                 if ( my $br = $ac2br{ $macro } ) {
317                         add_br( $br );
318                         next;
319                 } else {
320                         $check_ac = 1;
321                 }
322         }
323         if ( /^No package '(\S+)' found$/ or
324                         /Package (\S+) was not found in the pkg-config search path/
325                                 or m{None of the required '(\S+?)(?:[<>=].*)?' found}
326                                 or m{--\s+package '(\S+?)(?:[<>=].*)?' not found}
327                                 or m{ERROR: cannot find a valid pkg-config package for \['(\S+?)(?:[<>=].*)?'\]}
328                 ) {
329                 my $pkg = $1;
330                 warn "Looking for package $pkg\n";
331                 poldek_file( "/usr/lib*/pkgconfig/$pkg.pc", "/usr/share/pkgconfig/$pkg.pc" );
332         }
333
334         if (/^ocamlfind: Package `(\S+)' not found - required by/
335                 or m{Camlp4: Uncaught exception: DynLoader.Error \("(\S+)", "file not found in path"\)}
336                 ) {
337                 my $pkg = $1;
338                 warn "Looking for ocaml package $pkg\n";
339                 poldek_file( "/usr/lib*/ocaml/*/$pkg.a", "/usr/lib*/ocaml/*/$pkg");
340         }
341
342         if ( m{^cp: cannot stat `(/.*)': No such file or directory$} ) {
343                 my $f = $1;
344                 warn "Looking for file $f\n";
345                 poldek_file( $f );
346         }
347
348         if ( m{ERROR: Could not find KDE4 (kde4-config)}) {
349                 my $f = "/usr/bin/$1";
350                 warn "Looking for file $f\n";
351                 poldek_file( $f );
352         }
353
354         if (m{Ragel State Machine Compiler not found}) {
355                 add_br( "ragel" );
356                 next;
357         }
358
359         if (m{ERROR: CMake is required to build}) {
360                 add_br("cmake");
361                 next;
362         }
363
364         # lucky guessing
365         if (m{'yum install (\S+)'}) {
366                 add_br($1);
367                 next;
368         }
369
370         if ( m{^find-lang.sh: Error: international files not found for '}
371                         or m{ gettext tools not found}
372                         ) {
373                 add_br( "gettext-tools" );
374                 next;
375         }
376
377         if ( m{ pkg-config .*not .*found}
378                 or m{^checking for pkg-config\.\.\. no}
379                 or m{^pkg-config unavailable, build terminated}
380                 or m{^\*\*\*Error\*\*\*: You must have pkg-config >= .* installed}
381                 or m{^-- Could NOT find PkgConfig \(missing:  PKG_CONFIG_EXECUTABLE\)}
382                 or m{exec: "pkg-config": executable file not found in \$PATH}
383         ) {
384                 add_br( "pkgconfig" );
385                 next;
386         }
387
388         if ( m{Can't locate (.*?\.pm) in \@INC} ) {
389                 my $mod = $1;
390                 warn "Looking for perl module $mod\n";
391                 poldek_file( "/usr/lib*/perl*/$mod", "/usr/share/perl*/$mod" );
392         }
393
394         if (
395                 m{^(?:/usr/bin/ld: )?cannot find -l(.*?)$}
396         ) {
397                 my $lib = $1;
398                 warn "Looking for library $lib\n";
399                 poldek_file( "/usr/lib64/lib$lib.so", "/usr/lib/lib$lib.so",
400                         "/usr/lib*/lib$lib.so" );
401         }
402
403         # full path to ldd files
404         if (
405                 m{^WARNING; can.*t resolve .* dependency: (.*?)$}
406         ) {
407                 my $lib = $1;
408                 warn "Looking for library '$lib'\n";
409                 poldek_file( "/usr/lib64/$lib", "/usr/lib/$lib", "/lib64/$lib", "/lib/$lib");
410         }
411
412         if ( m{^error: Couldn't exec (/\S+): No such file or directory$}
413                         or m{^Can't open perl script "(/\S+)": No such file or directory$}
414                         or m{unable to open (/\S+) \(No such file or directory\)$}
415                         or m{GConf-CRITICAL \*\*: No such file `(/.\S+?)'$}
416                         or m{make.*: \*\*\* No rule to make target `(/\S+)'}
417                         or m{g(?:cc|\+\+): (/\S+): No such file or directory$}
418                         or m{env: (/\S+): No such file or directory$}
419                         ) {
420                 my $file = $1;
421                 warn "Looking for file $file\n";
422                 poldek_file( $file );
423         }
424
425         if ( m{^ValueError: Couldn't find include '(.*\.gir)'} ) {
426                 my $file = $1;
427                 warn "Looking for gir file $file\n";
428                 poldek_file( "/usr/share/gir-1.0/" . $file );
429         }
430
431         if ( m{^error: Package `(\S+)' not found in specified Vala API directories or GObject-Introspection GIR directories}
432         ) {
433                 my $file = $1;
434                 warn "Looking for gir file $file\n";
435                 poldek_file( "/usr/share/vala/vapi/$file.vapi");
436         }
437
438         if ( m{failed.*http://www\.oasis-open\.org/docbook/xml/([\d\.]+/\S+\.dtd)} ) {
439                 my $dtd = $1;
440                 warn "Looking for docbook file $dtd\n";
441                 poldek_file( "/usr/share/sgml/docbook/xml-dtd-$dtd" );
442         }
443         if ( m{http://docbook.sourceforge.net/release/xsl/current/(\S+\.xsl)} ) {
444                 my $db = $1;
445                 next if m{^\s*(/usr/bin/)?xsltproc };
446                 warn "Looking for docbook file $db\n";
447                 poldek_file( "/usr/share/sgml/*/$db" );
448         }
449
450         if ( m{LaTeX Error: File `(\S+)' not found} ) {
451                 my $tex = $1;
452                 warn "Looking for tex file $tex\n";
453                 poldek_file( "/usr/share/tex*/$tex" );
454         }
455         if ( m{mv: cannot move `\S+' to `(/var/lib/texmf.*?)':} ) {
456                 my $tex = $1;
457                 warn "Looking for tex file $tex\n";
458                 poldek_file( $tex );
459         }
460
461         if ( m{configure: error: C\+\+ preprocessor "/lib/cpp" fails sanity check} ) {
462                 add_br( "gcc-c++", "try: %undefine\t__cxx" );
463         }
464         if ( m{configure: error: C\+\+ compiler cannot create executables} ) {
465                 add_br( "libstdc++-devel", "maybe try: %undefine\t__cxx" );
466         }
467         if ( m{configure: error: XML::Parser perl module is required for intltool} ) {
468                 add_br( "perl-XML-Parser" );
469         }
470         if ( m{iconv: conversion from `\S+' is not supported} ) {
471                 add_br( "iconv" );
472         }
473
474         if (m{rst2man \(python-docutils\) is required to build man pages}) {
475                 add_br("docutils");
476         }
477
478         if ( m{ (\S+) does not appear in AM_CONDITIONAL$} ) {
479                 my $macro = $1;
480                 warn "Looking for autotools macro $macro\n";
481                 if ( my $br = $ac2br{ $macro } ) {
482                         add_br( $br );
483                         next;
484                 } else {
485                         $check_ac = 1;
486                 }
487         }
488
489         if ( m{configure\[\d+\]: syntax error: }
490                         or m{\./configure\[\d+\]: \S+_\S+: not found}
491                         or m{./configure\[\d+\]: .*unexpected}
492                         or m{does not appear in AM_CONDITIONAL$}
493                         ) {
494                 warn "Need to check configure source: $reason\n";
495                 $check_ac = 1;
496         }
497         if ( m{^configure: error:} ) {
498                 $check_config_log = 1 unless defined $check_config_log;
499         }
500
501         if ( m{^CMake (?:Error|Warning) at (?:\S+/)?(\S+?)\.cmake:(\d+) } ) {
502                 my ( $module, $line ) = ( lc $1, $2 );
503                 my $br;
504                 if ( $module eq "findqt4" ) {
505                         my $l = $lines[0];
506                         chomp $l;
507                         if ( $l =~ /qmake/ ) {
508                                 add_br( "qt4-qmake", $l );
509                         } elsif ( $l =~ /rcc/ ) {
510                                 add_br( "qt4-build", $l );
511                         } elsif ( $l =~ /Could NOT find (Qt\S+) header/ ) {
512                                 add_br( "$1-devel", $l );
513                         } else {
514                                 warn "unrecognized Qt requirement: $l\n";
515                         }
516                 } elsif ( $module eq "cmakedeterminecxxcompiler" ) {
517                         add_br( "libstdc++-devel",
518                                 '"try: -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER="%{__cc}"' );
519                 } elsif ( $br = $cmake2br{ $module . ":" . $line } ) {
520                         add_br( $br );
521                 } elsif ( $br = $cmake2br{ $module } ) {
522                         add_br( $br );
523                 } elsif ( $br = guess_package( $module =~ /find(.+)/ ) ) {
524                         add_br( $br );
525                 } else {
526                         $cmake_get_call = 1;
527                         warn "Unrecognized cmake error: $reason\n";
528                 }
529         }
530         if ( m{^\s*ERROR: (?:\S+/)?(\S+?\.cmake) not found} ) {
531                 my $cmake = $1;
532                 warn "Looking for cmake file: $cmake\n";
533                 poldek_file( "/usr/*/cmake/*/$cmake" )
534         }
535         if ( $cmake_get_call ) {
536                 if ( m{^\s*/\S+/(\S+)\.cmake:(\d+) } ) {
537                         my ( $module, $line ) = ( lc $1, $2 );
538                         my $br;
539                         if ( $br = $cmake2br{ $module . ":" . $line } ) {
540                                 add_br( $br );
541                                 $cmake_get_call = 0;
542                         } elsif ( $br = $cmake2br{ $module } ) {
543                                 add_br( $br );
544                                 $cmake_get_call = 0;
545                         } elsif ( $br = guess_package( $module =~ /find(.+)/ ) ) {
546                                 add_br( $br );
547                                 $cmake_get_call = 0;
548                         }
549                 } elsif (m{Can not use "(.+)" module which has not yet been found}
550                         or m{Could not find a package configuration file provided by "(.+)"}) {
551                         my $cmake = $1;
552
553                         warn "Looking for cmake file: $cmake\n";
554                         poldek_file(
555                                 "/usr/*/cmake/*/$cmake.cmake",
556                                 "/usr/*/cmake/*/${cmake}Config.cmake",
557                                 "/usr/*/cmake/*/${cmake}-config.cmake",
558                         );
559                         $cmake_get_call = 0;
560                 }
561         }
562         if ( m{^-- WARNING: you are using the obsolete 'PKGCONFIG' macro} ) {
563                 add_br( "pkgconfig" );
564         }
565         if ( m{QT_(QT\S+)_LIBRARY \(ADVANCED\)}
566                         or m{X11_(\S+)_LIB \(ADVANCED\)}
567                         or m{Qt (\S+) library not found} ) {
568                 my $find = $1;
569                 my $pkg = guess_package( $find );
570                 if ( $pkg ) {
571                         add_br( $pkg );
572                 } else {
573                         warn "Cannot quess qt package: $find\n";
574                 }
575         }
576
577         if ( m{Unable to find a javac compiler;$} ) {
578                 add_br( "jdk" );
579         }
580         if ( m{Could not find (\S+) Java extension for this JVM$} ) {
581                 my $jar = $1;
582                 warn "Looking for jar file: $jar\n";
583                 poldek_file( "/usr/share/java/$jar.jar", "*/$jar.jar" )
584         }
585
586
587         if ( m{^-- The following OPTIONAL packages could NOT be located on your system} ) {
588                 $cmake_pkg_list = 1;
589         }
590         if ( $cmake_pkg_list ) {
591                 if ( /\s+\* (\S+) / ) {
592                         my $find = $1;
593                         my $pkg = guess_package( $find );
594                         if ( $pkg ) {
595                                 add_br( $pkg );
596                         } else {
597                                 warn "Cannot quess optional package: $find\n";
598                         }
599                 } elsif ( /^\s*$/ ) {
600                         $cmake_pkg_list = 0;
601                 }
602         }
603
604         # CMake Error at CMakeLists.txt:86 (find_package):
605         #  By not providing "FindQt5LinguistTools.cmake" in CMAKE_MODULE_PATH this
606         #  project has asked CMake to find a package configuration file provided by
607         #  "Qt5LinguistTools", but CMake did not find one.
608         #
609         #  Could not find a package configuration file provided by "Qt5LinguistTools"
610         #  with any of the following names:
611         #
612         #    Qt5LinguistToolsConfig.cmake
613         #    qt5linguisttools-config.cmake
614         #
615         #  Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
616         #  set "Qt5LinguistTools_DIR" to a directory containing one of the above
617         #  files.  If "Qt5LinguistTools" provides a separate development package or
618         #  SDK, be sure it has been installed.
619         # ---
620         #CMake Warning at /usr/lib64/cmake/Qt5Core/Qt5CoreMacros.cmake:273 (find_package):
621         #  Could not find a package configuration file provided by "Qt5Network" with
622         #  any of the following names:
623         #
624         #    Qt5NetworkConfig.cmake
625         #    qt5network-config.cmake
626         #
627         #  Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
628         #  "Qt5Network_DIR" to a directory containing one of the above files.  If
629         #  "Qt5Network" provides a separate development package or SDK, be sure it has
630         #  been installed.
631         #   Can not use "Network" module which has not yet been found.
632
633         if (m{By not providing "Find(.+)\.cmake" in CMAKE_MODULE_PATH}
634                 or m{Could not find a package configuration file provided by "(.+)"
635                 }) {
636                 my $cmake = $1;
637                 my $lcmake = lc $cmake;
638
639                 warn "Looking for cmake file: $cmake\n";
640                 poldek_file(
641                         "/usr/*/cmake/*/$cmake.cmake",
642                         "/usr/*/cmake/*/${cmake}Config.cmake",
643                         "/usr/*/cmake/*/${cmake}-config.cmake",
644                         "/usr/*/cmake/*/${lcmake}Config.cmake",
645                         "/usr/*/cmake/*/${lcmake}-config.cmake",
646                 )
647         }
648
649         if ( m{^configure:\d+: checking for (?:"(\S+)"|(\S+))$} ) {
650                 my $exec = $1 || $2;
651                 if ( @lines and $lines[0] =~ m{^configure:\d+: result: no$} ) {
652                         next if $skip{ $exec };
653                         warn "Looking for executable $exec\n";
654                         poldek_file( $exec ) if $exec =~ m#^/#;
655                         poldek_file( "/usr/bin/$exec", "/bin/$exec" );
656                 }
657         }
658 }
659
660
661
662 sub wanted
663 {
664         return unless /^configure(\.(?:ac|in|in\.in))?$/;
665         return unless -r;
666
667         warn "$File::Find::name\n";
668         open F_IN, "<", $_;
669         my $file = $_;
670         while ( <F_IN> ) {
671                 chomp;
672                 if ( m{^\s*([A-Za-z0-9_]+)\s*(\(.*)?$} ) {
673                         my $def = $1;
674                         if ( my $br = $ac2br{ $def } ) {
675                                 add_br( $br, "$file: $_" );
676                         } elsif ( $def !~ /^A[CM]_/ and $def =~ /^_?[A-Z]+_[A-Z_0-9a-z]+$/ ) {
677                                 #warn "Possible macro unrecognized: $def [[[$_]]]\n";
678                         }
679                 }
680         }
681         close F_IN;
682 }
683
684 use File::Find;
685 if ( $check_ac ) {
686         find( \&wanted, $builddir );
687 }
688
689 sub wanted2
690 {
691         return unless /^config\.log$/;
692         return unless -r;
693
694         warn "$File::Find::name\n";
695         open F_IN, "<", $_;
696         push @lines, <F_IN>;
697         close F_IN;
698 }
699
700 if ( $check_config_log ) {
701         $check_config_log = 0;
702         find( \&wanted2, $builddir );
703         goto start_check if @lines;
704 }
705
706 foreach my $pkg ( sort keys %out ) {
707         print "$pkg -- $out{$pkg}\n";
708 }
709 # vim: ts=4 sw=4
This page took 0.17772 seconds and 2 git commands to generate.