-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenlib.pl
executable file
·47 lines (42 loc) · 1.33 KB
/
genlib.pl
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
#!/usr/bin/perl -w
# Copyright (c) 2024 Dry Ark LLC
use strict;
use lib 'mod';
use Util qw/files_in_dir find_in_dir/;
for my $pkgDir ( files_in_dir( "pkgs" ) ) {
next if( $pkgDir =~ m/~$/ );
my $pkgDirFull = "pkgs/$pkgDir";
print "$pkgDirFull $pkgDir\n";
next if( ! -d $pkgDirFull );
handle_dir( $pkgDirFull, $pkgDir );
}
sub handle_dir {
my ( $dir, $pkg ) = @_;
for my $versionDir ( files_in_dir( "./$dir" ) ) {
if( $versionDir =~ m/^[0-9\.\_]+$/ ) {
#print "$dir/$file\n";
my $libdir = "$dir/$versionDir/lib";
if( -e $libdir ) {
#print "$libdir\n";
handle_libdir( $libdir );
}
if( $pkg =~ m/^python/ ) {
if( $versionDir =~ m/^([0-9]+)\.([0-9]+)/ ) {
my $twoParts = "$1.$2";
my $pyHome = "../$dir/$versionDir/Frameworks/Python.framework/Versions/$twoParts";
symlink( $pyHome, "lib/pythonHome" );
}
}
}
}
}
sub handle_libdir {
my $libdir = shift;
print "libdir:$libdir\n";
#exit 0;
for my $dy ( find_in_dir( $libdir, qw/\.dylib$/ ) ) {
my $symlink = "lib/" . $dy->{rel};
unlink $symlink if( -e $symlink );
symlink( "../" . $dy->{full}, $symlink );
}
}