summaryrefslogtreecommitdiffstats
path: root/src/makedef.pl
blob: 42ae3b08ab4529cead121353739258dd5110f964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! perl

&doMakeDef();
exit(0);

sub doMakeDef()
{
    print "####### Generating 'inkscape.def' #######\n";

    my $nmlines = ();  #store lines read in hash, to remove dupes
    my @lines;         #output lines	
    my $line;          #single line of input
    my $datestr;       #current date
    local(*PIPE);      #output of the 'nm' command
    local(*OUTFILE);   #output file - inkscape.def

    open (PIPE, "nm libinkscape.a |");
    while(<PIPE>)
        {
        if ($_ =~ /\./)
            {
            next;
            }
        elsif ($_ =~ /T _/)
            {
            $line = $_;
            $line =~ s/.* T _//;
            $nmlines->{$line} = 1;
            }
        elsif  ($_ =~ /B _/)
            {
            $line = $_;
            $line =~ s/.* B _//;
            $nmlines->{$line} = 1;
            }
        }
    close (PIPE);

    foreach (keys(%{$nmlines}))
        {
        push @lines, $_;
        }
        
    @lines = sort(@lines);

    $datestr = gmtime();
    open (OUTFILE, ">inkscape.def");
    print OUTFILE ";########################################################\n";
    print OUTFILE ";## File: inkscape.def\n";
    print OUTFILE ";## Purpose: Used by dllwrap to make inkscape.dll\n";
    print OUTFILE ";## Generated by makedef.pl at :$datestr\n";
    print OUTFILE ";########################################################\n\n";
    print OUTFILE "LIBRARY\tinkscape.dll\n";
    print OUTFILE "EXPORTS\n";
    foreach (<@lines>)
        {
        # print $_, "\n";
        print OUTFILE "    ", $_, "\n";
        }
    close (OUTFILE);
}