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