1 #! perl
3 &doMakeDef();
4 exit(0);
6 sub doMakeDef()
7 {
8 print "####### Generating 'inkscape.def' #######\n";
10 my $nmlines = (); #store lines read in hash, to remove dupes
11 my @lines; #output lines
12 my $line; #single line of input
13 my $datestr; #current date
14 local(*PIPE); #output of the 'nm' command
15 local(*OUTFILE); #output file - inkscape.def
17 open (PIPE, "nm libinkscape.a |");
18 while(<PIPE>)
19 {
20 if ($_ =~ /\./)
21 {
22 next;
23 }
24 elsif ($_ =~ /T _/)
25 {
26 $line = $_;
27 $line =~ s/.* T _//;
28 $nmlines->{$line} = 1;
29 }
30 elsif ($_ =~ /B _/)
31 {
32 $line = $_;
33 $line =~ s/.* B _//;
34 $nmlines->{$line} = 1;
35 }
36 }
37 close (PIPE);
39 foreach (keys(%{$nmlines}))
40 {
41 push @lines, $_;
42 }
44 @lines = sort(@lines);
46 $datestr = gmtime();
47 open (OUTFILE, ">inkscape.def");
48 print OUTFILE ";########################################################\n";
49 print OUTFILE ";## File: inkscape.def\n";
50 print OUTFILE ";## Purpose: Used by dllwrap to make inkscape.dll\n";
51 print OUTFILE ";## Generated by makedef.pl at :$datestr\n";
52 print OUTFILE ";########################################################\n\n";
53 print OUTFILE "LIBRARY\tinkscape.dll\n";
54 print OUTFILE "EXPORTS\n";
55 foreach (<@lines>)
56 {
57 # print $_, "\n";
58 print OUTFILE " ", $_, "\n";
59 }
60 close (OUTFILE);
61 }