Skip to content

Commit

Permalink
Build: Support library unification in fdmake
Browse files Browse the repository at this point in the history
* build/fdmake.pl
  ($unify): New option variable.
  (&build_library): Pass -unify to the compiler when requested.
  (&library_products): Adapt expected build products based on whether
   or not the -unify option is provided.
  • Loading branch information
housel committed Jul 16, 2022
1 parent 920b94a commit 5eae0fb
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions build/fdmake.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
my $debugger;
my $gdb;
my $lldb;
my $unify;
my $compiler = 'dylan-compiler';
&GetOptions('verbose' => \$verbose,
'debugger' => \$debugger,
'gdb' => \$gdb,
'lldb' => \$lldb,
'unify'=> \$unify,
'compiler=s' => \$compiler);

# Names of libraries we already built successfully.
Expand Down Expand Up @@ -153,6 +155,9 @@ sub build_library {
}

my $command = $compiler;
if ($unify) {
$command .= " -unify";
}
if ($debugger) {
$command .= " -debugger";
}
Expand Down Expand Up @@ -300,12 +305,25 @@ sub library_products {
else {
my $so = ($platform_name =~ /-darwin$/) ? 'dylib' : 'so';
$executable = lc($executable);
push(@products,
File::Spec->catfile($user_root, 'lib', "lib${executable}.${so}"));
if ($unify) {
push(@products,
File::Spec->catfile($user_root, 'lib', "lib${executable},unify.a"));
}
else {
push(@products,
File::Spec->catfile($user_root, 'lib', "lib${executable}.${so}"));
}

if (!defined $header->{'target-type'}
|| lc($header->{'target-type'}) eq 'executable') {
push @products, File::Spec->catfile($user_root, 'bin', $executable);
if ($unify) {
push @products, File::Spec->catfile($user_root, 'sbin',
$executable);
}
else {
push @products, File::Spec->catfile($user_root, 'bin',
$executable);
}
}
}

Expand Down

0 comments on commit 5eae0fb

Please sign in to comment.