Blame view

RIOT/boards/msba2-common/tools/mkstaticlist 1.22 KB
fb11e647   vrobic   reseau statique a...
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
  #! /usr/bin/perl
  
  @arg = split(/\s+/, `gtk-config --libs`);
  
  %liblist = (
      'libgtk.a', '/usr/lib/libgtk.a',
      'libgdk.a', '/usr/lib/libgdk.a',
      'libgmodule.a', '/usr/lib/libgmodule.a',
      'libglib.a',    '/usr/lib/libglib.a',
      'libXi.a',  '/usr/X11R6/lib/libXi.a',
      'libXext.a',    '/usr/X11R6/lib/libXext.a',
      'libX11.a', '/usr/X11R6/lib/libX11.a'
  );
  
  
  for ($i=0; $i<@arg; $i++) {
      $a = $arg[$i];
      next if $a eq '-rdynamic';  # always delete -rdynamic
      if (($a eq '-lm') || ($a eq '-ldl') || ($a =~ /^-L/)) {
          # a few things we never change
          print "$a ";
          next;
      }
      if ($a =~ /^-l/) {
          $lib = $';
          $lib = 'lib' . $lib . '.a';
          # first check if it's in the known location
          if (-f $liblist{$lib}) {
              print $liblist{$lib}, " ";
              next;
          }
          # resort to trying whereis to find it
          @source = split(/\s+/, `whereis $lib`);
          undef($static);
          for ($j=0; $j<@source; $j++) {
              $static = $source[$j] if $source[$j] =~ /$lib$/;
          }
          # if we found a static lib, use it.
          if ($static) {
              print $static, " ";
          } else {
              print $a, " ";
          }
      }
  }
  print "\n";