File: pkgApp.pl

package info (click to toggle)
freedroidrpg 1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 273,532 kB
  • sloc: ansic: 66,191; cpp: 2,033; sh: 766; makefile: 627; python: 322; xml: 94; perl: 87
file content (52 lines) | stat: -rw-r--r-- 961 bytes parent folder | download
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
#!/usr/bin/perl
#
# Script inspired by pkgApp.pl from https://www.stellarium.org/
# under GPL General Public License
#

use strict;
use Cwd;

my $objdump = qq{objdump -x \%s | grep "DLL Name" | cut -d: -f2};

my $windir = shift(@ARGV);
chdir $windir;
my $main_executable = shift(@ARGV);
my $dll_dir = shift(@ARGV);

&recurse( $main_executable, $dll_dir );

sub recurse {
  my($main_executable, $dll_dir) = @_;

  my $cmd1 = sprintf($objdump, $main_executable);
  my(@names) = `$cmd1`;

  my $name;

  NAME_LOOP:
  foreach $name ( @names ) {
    chomp($name);
    $name =~ s,^\s*,,;
    my $absName = "$dll_dir/$name";

    if ( ! -e $absName ) {
      next NAME_LOOP;
    }

    my $winPath = "$name";
    
    my $not_existed = 1;
    if ( ! -e $winPath ) {
      #print STDOUT "$absName\n";
      my $c = "cp $absName $winPath";
      `$c`;
    } else {
      $not_existed = 0;
    }

    if ( $not_existed ) {
      &recurse($winPath, $dll_dir);
    }
  }
}