so figured out what to do with links. Fun!
(there's still one corner case to detect, but it's unlikely to happen in practice)
This commit is contained in:
parent
fd49ba4384
commit
e8b70183b5
@ -1,5 +1,5 @@
|
||||
#! /usr/bin/perl
|
||||
# $OpenBSD: build-debug-info,v 1.26 2019/11/26 12:02:46 espie Exp $
|
||||
# $OpenBSD: build-debug-info,v 1.27 2019/11/27 15:10:19 espie Exp $
|
||||
# Copyright (c) 2019 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
@ -121,23 +121,31 @@ sub write_debug_info
|
||||
my $k = join('/', (stat $path)[0,1]);
|
||||
my $l = $o->{linkstash}{$k};
|
||||
if (defined $l) {
|
||||
$self->handle_hardlink($fh, $o, $dbg, $l);
|
||||
my $ldir = dirname($l)."/";
|
||||
if ($ldir eq $dir) {
|
||||
# if both mogrified dirs are the same
|
||||
# the debug-info link will do the right thing
|
||||
return;
|
||||
}
|
||||
# so we need to create a link in our dir
|
||||
# but that link must have the right name
|
||||
my $n = $dir.basename($l);
|
||||
# that link may already exist! don't emit it again
|
||||
return if exists $o->{ostash}{$n};
|
||||
print $fh $n, "\n";
|
||||
$self->write_rule($o->{mk}, $l, $n, "LINK_RULE");
|
||||
$o->{ostash}{$n} = 1;
|
||||
} else {
|
||||
print $fh $dbg, "\n";
|
||||
$self->write_rule($o->{mk}, $s, $dbg, "OBJCOPY_RULE");
|
||||
$o->{linkstash}{$k} = $dbg;
|
||||
$o->{ostash}{$dbg} = 1;
|
||||
}
|
||||
} else {
|
||||
$o->{state}->fatal("Error: #1 does not exist", $path);
|
||||
}
|
||||
}
|
||||
|
||||
sub handle_hardlink
|
||||
{
|
||||
my ($self, $fh, $o, $dbg, $l) = @_;
|
||||
$self->write_rule($o->{mk}, $l, $dbg, "LINK_RULE");
|
||||
}
|
||||
|
||||
sub write_rule
|
||||
{
|
||||
my ($self, $mk, $s, $dbg, $what) = @_;
|
||||
@ -218,9 +226,10 @@ PlistReader->parse_args($self);
|
||||
use File::Basename;
|
||||
$self->{dirstash} = {};
|
||||
$self->{linkstash} = {};
|
||||
$self->{ostash} = {};
|
||||
$self->{mk} = $state->openfile($state->{pkgdir}."/Makefile");
|
||||
print {$self->{mk}} << 'EOPREAMBLE';
|
||||
# Makefile generated by build-debug-info $OpenBSD: build-debug-info,v 1.26 2019/11/26 12:02:46 espie Exp $
|
||||
# Makefile generated by build-debug-info $OpenBSD: build-debug-info,v 1.27 2019/11/27 15:10:19 espie Exp $
|
||||
# No serviceable parts
|
||||
# Intended to run under the stage area after cd ${WRKINST}
|
||||
|
||||
@ -237,9 +246,6 @@ OBJCOPY_RULE = ${INSTALL_DATA_DIR} ${@D} && \
|
||||
LINK_RULE = ${INSTALL_DATA_DIR} ${@D} && \
|
||||
echo "> Link debug info from $? to $@" && ln $? $@
|
||||
|
||||
SYMLINK_RULE = ${INSTALL_DATA_DIR} ${@D} && \
|
||||
echo "> Link debug info from $? to $@" && ln -s $? $@
|
||||
|
||||
all:
|
||||
.PHONY: all
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user