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