sub createABIFile()

in src/main/abi-symbols/abi-dumper.pl [2084:2166]


sub createABIFile()
{
    printMsg("INFO", "Creating ABI dump");
    
    my %ABI = (
        "TypeInfo" => \%TypeInfo,
        "SymbolInfo" => \%SymbolInfo,
        "Symbols" => \%Library_Symbol,
        "UndefinedSymbols" => \%Library_UndefSymbol,
        "Needed" => \%Library_Needed,
        "SymbolVersion" => \%SymVer,
        "LibraryVersion" => $TargetVersion,
        "LibraryName" => $TargetName,
        "Language" => $LIB_LANG,
        "Headers" => \%HeadersInfo,
        "Sources" => \%SourcesInfo,
        "NameSpaces" => \%NestedNameSpaces,
        "Target" => "unix",
        "Arch" => $SYS_ARCH,
        "WordSize" => $SYS_WORD,
        "ABI_DUMP_VERSION" => $ABI_DUMP_VERSION,
        "ABI_DUMPER_VERSION" => $TOOL_VERSION,
    );
    
    if($SYS_GCCV) {
        $ABI{"GccVersion"} = $SYS_GCCV;
    }
    elsif($SYS_CLANGV) {
        $ABI{"ClangVersion"} = $SYS_CLANGV;
    }
    else {
        $ABI{"Compiler"} = $SYS_COMP;
    }

    if(defined $ExtraDump) {
        $ABI{"ExtraDump"} = "On";
    }

    if(defined $PublicHeadersPath) {
        $ABI{"PublicABI"} = "1";
    }
    
    if(defined $IncompatibleOpt)
    {
        $ABI{"MissedOffsets"} = "1";
        $ABI{"MissedRegs"} = "1";
    }
    
    if($StdOut)
    { # --stdout option
        print STDOUT Dumper(\%ABI);
    }
    else
    {
        my $DumpPath = "ABI.dump";
        if($OutputDump)
        { # user defined path
            $DumpPath = $OutputDump;
        }
        my $Archive = ($DumpPath=~s/\Q.$COMPRESS\E\Z//g);
        my ($DDir, $DName) = sepPath($DumpPath);
        
        my $DPath = $TMP_DIR."/".$DName;
        if(not $Archive) {
            $DPath = $DumpPath;
        }
        
        mkpath($DDir);
        
        open(DUMP, ">", $DPath) || die ("can't open file \'$DumpPath\': $!\n");
        print DUMP Dumper(\%ABI);
        close(DUMP);
        
        if(not -s $DPath) {
            exitStatus("Error", "can't create ABI dump because something is going wrong with the Data::Dumper module");
        }
        if($Archive) {
            $DumpPath = createArchive($DPath, $DDir);
        }
        
        printMsg("INFO", "\nThe object ABI has been dumped to:\n  $DumpPath");
    }
}