]> git.pld-linux.org Git - projects/cleanbuild.git/blobdiff - findbr
update cmake find modules
[projects/cleanbuild.git] / findbr
diff --git a/findbr b/findbr
index aeea384dc7c3814b85404d55ab7e873ea13301d6..4000f7db30daeb3ffcbc8a016fe9de052777a9a7 100755 (executable)
--- a/findbr
+++ b/findbr
@@ -11,7 +11,7 @@ my $pwd = getcwd();
 my @ignore = qw(vserver-packages python-devel-src);
 my @poldek;
 if (DOCKER) {
-       push(@poldek, "poldek");
+       push(@poldek, qw[poldek]);
 } else {
        push(@poldek, qw[sudo poldek -n th-x86_64-ready],
                "--cachedir=$pwd/poldekcache",
@@ -65,7 +65,7 @@ my %skip;
 # for m4 in *.m4; do R=$(rpm -qf $m4); R=${R%-*-*}; \
 #   awk -vr=$R '/^\s*(AC_DEFUN|AU_ALIAS)/ { gsub(/\].*/,""); gsub(/.*\[/,""); print r " " $0}' $m4; \
 # done | sort | awk '{print "\t\"" $2 "\" => \"" $1 "\","}'
-my %ac2br = do (DOCKER ? 'cleanbuild/findbr-ac2br' : 'findbr-ac2br');
+my %ac2br = do (DOCKER ? './cleanbuild/findbr-ac2br' : './findbr-ac2br');
 
 my %cmake2br = (
        "findkde4:44" => "kde4-kdelibs",
@@ -111,18 +111,20 @@ sub add_br
 sub poldek_cmd
 {
        my $cmd = shift;
+
        warn "Poldek: $cmd\n";
-       my $pid = open( READ, "-|", @poldek, "--shcmd=".$cmd );
 
-       my @read = <READ>;
-       close READ;
+       my @cmd = (@poldek, "--shcmd=".$cmd);
+       open my $fh, '-|', @cmd or die "$!: @cmd";
+       my @read = <$fh>;
+       close $fh or die $!;
 
-       return @read if wantarray;
-       return \@read;
+       return wantarray ? @read : \@read;
 }
 
 my $check_ac = 0;
 my $check_config_log = undef;
+my $check_mkmf_log = undef;
 
 my %checked_files;
 sub poldek_file
@@ -477,6 +479,9 @@ while ( $_ = shift @lines ) {
        if ( m{configure: error: C\+\+ compiler cannot create executables} ) {
                add_br( "libstdc++-devel", "maybe try: %undefine\t__cxx" );
        }
+       if ( m{ccache: error: Could not find compiler ".+-g\+\+" in PATH}) {
+               add_br("libstdc++-devel");
+       }
        if ( m{configure: error: XML::Parser perl module is required for intltool} ) {
                add_br( "perl-XML-Parser" );
        }
@@ -511,6 +516,10 @@ while ( $_ = shift @lines ) {
                $check_config_log = 1 unless defined $check_config_log;
        }
 
+       if ( m{Check the mkmf.log file for more details} ) {
+               $check_mkmf_log = 1 unless defined $check_mkmf_log;
+       }
+
        if ( m{^CMake (?:Error|Warning) at (?:\S+/)?(\S+?)\.cmake:(\d+) } ) {
                my ( $module, $line ) = ( lc $1, $2 );
                my $br;
@@ -526,6 +535,16 @@ while ( $_ = shift @lines ) {
                        } else {
                                warn "unrecognized Qt requirement: $l\n";
                        }
+               } elsif ( $module eq "qt5coreconfig" ) {
+                       my $l = $lines[2];
+                       chomp $l;
+                       if ( $l =~ /qmake/ ) {
+                               add_br( "qt5-qmake", $l );
+                       } elsif ( $l =~ /moc/) {
+                               add_br( "qt5-build", $l );
+                       } else {
+                               warn "Unrecognized Qt requirement: $l\n";
+                       }
                } elsif ( $module eq "cmakedeterminecxxcompiler" ) {
                        add_br( "libstdc++-devel",
                                '"try: -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER="%{__cc}"' );
@@ -540,6 +559,20 @@ while ( $_ = shift @lines ) {
                        warn "Unrecognized cmake error: $reason\n";
                }
        }
+
+       if ( m{^CMake Error at (?:\S+/)?(\S+?):(\d+) \(find_package\):} ) {
+               my ($file, $line) = (lc $1, $2);
+
+               #CMake Error at CMakeLists.txt:29 (find_package):
+               #  Could not find a package configuration file provided by "LLVM" with any of the following names:
+               #
+               #    LLVMConfig.cmake
+               #    llvm-config.cmake
+               my @files = grep { /\.cmake$/ } @lines;
+               my @find = map { chomp; s/^\s+//; "/usr/*/cmake/*/$_" } @files;
+               poldek_file(@find);
+       }
+
        if ( m{^\s*ERROR: (?:\S+/)?(\S+?\.cmake) not found} ) {
                my $cmake = $1;
                warn "Looking for cmake file: $cmake\n";
@@ -614,35 +647,6 @@ while ( $_ = shift @lines ) {
                }
        }
 
-       # CMake Error at CMakeLists.txt:86 (find_package):
-       #  By not providing "FindQt5LinguistTools.cmake" in CMAKE_MODULE_PATH this
-       #  project has asked CMake to find a package configuration file provided by
-       #  "Qt5LinguistTools", but CMake did not find one.
-       #
-       #  Could not find a package configuration file provided by "Qt5LinguistTools"
-       #  with any of the following names:
-       #
-       #    Qt5LinguistToolsConfig.cmake
-       #    qt5linguisttools-config.cmake
-       #
-       #  Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
-       #  set "Qt5LinguistTools_DIR" to a directory containing one of the above
-       #  files.  If "Qt5LinguistTools" provides a separate development package or
-       #  SDK, be sure it has been installed.
-       # ---
-       #CMake Warning at /usr/lib64/cmake/Qt5Core/Qt5CoreMacros.cmake:273 (find_package):
-       #  Could not find a package configuration file provided by "Qt5Network" with
-       #  any of the following names:
-       #
-       #    Qt5NetworkConfig.cmake
-       #    qt5network-config.cmake
-       #
-       #  Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
-       #  "Qt5Network_DIR" to a directory containing one of the above files.  If
-       #  "Qt5Network" provides a separate development package or SDK, be sure it has
-       #  been installed.
-       #   Can not use "Network" module which has not yet been found.
-
        if (m{By not providing "Find(.+)\.cmake" in CMAKE_MODULE_PATH}
                or m{Could not find a package configuration file provided by "(.+)"
                }) {
@@ -680,7 +684,7 @@ while ( $_ = shift @lines ) {
 
 
 
-sub wanted
+sub find_configure
 {
        return unless /^configure(\.(?:ac|in|in\.in))?$/;
        return unless -r;
@@ -704,10 +708,10 @@ sub wanted
 
 use File::Find;
 if ( $check_ac ) {
-       find( \&wanted, $builddir );
+       find( \&find_configure, $builddir );
 }
 
-sub wanted2
+sub find_config_log
 {
        return unless /^config\.log$/;
        return unless -r;
@@ -720,7 +724,21 @@ sub wanted2
 
 if ( $check_config_log ) {
        $check_config_log = 0;
-       find( \&wanted2, $builddir );
+       find( \&find_config_log, $builddir );
+       goto start_check if @lines;
+}
+
+if ($check_mkmf_log) {
+       $check_mkmf_log = 0;
+       find(sub {
+               return unless /^mkmf\.log$/;
+               return unless -r;
+
+               warn "$File::Find::name\n";
+               open F_IN, "<", $_;
+               push @lines, <F_IN>;
+               close F_IN;
+       }, $builddir);
        goto start_check if @lines;
 }
 
This page took 0.11854 seconds and 4 git commands to generate.