* Revert "Release Notes for PYTHON=python3"
  commit 2612b47c3f.

* Revert "Remove Python build dependency when LINKER_USE_RPATH=ORIGIN"
  commit f4c474eb77.
This commit is contained in:
Andrew Johnson
2025-02-19 14:10:16 -06:00
committed by GitHub
parent 7a6e11cae0
commit a3d8531008
6 changed files with 94 additions and 160 deletions

View File

@ -54,7 +54,8 @@ CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl)
FILTERMAKEFLAGS = $(PERL) $(call FIND_TOOL,filterMakeflags.pl)
FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl
GENVERSIONHEADER = $(PERL) $(TOOLS)/genVersionHeader.pl $(QUIET_FLAG) $(QUESTION_FLAG)
MAKERPATH = $(PERL) $(TOOLS)/makeRPath.pl
MAKERPATH = $(PYTHON) $(TOOLS)/makeRPath.py
#---------------------------------------------------------------
# tools for installing libraries and products

View File

@ -34,11 +34,11 @@ CROSS2 = $(CROSS_COMPILER_TARGET_ARCHS$(filter-out 1,$(words $(filter $(EPICS_HO
BUILD_ARCHS = $(EPICS_HOST_ARCH) $(CROSS1) $(CROSS2)
#-------------------------------------------------------
# Defaults for Perl and Python assume they're on $PATH.
# Python (now python3) is only needed by developers, when building docs.
# Override these in os/CONFIG_SITE.<host_arch>.Common or CONFIG_SITE.local
# Default for perl if it's on the PATH,
# otherwise override this in os/CONFIG_SITE.<host_arch>.Common
PERL = perl -CSD
PYTHON = python3
PYTHON = python
#-------------------------------------------------------
# Check configure/RELEASE file for consistency

View File

@ -22,24 +22,6 @@ should also be read to understand what has changed since earlier releases:
## Changes made on the 7.0 branch since 7.0.8.1
### Build system `$(PYTHON)` default changed
The default value of the build system's `$(PYTHON)` variable has changed from
`python` to `python3`, in line with many recent OS installations' removal of
the `python` binary after Python 2 support ended.
This change may affect EPICS support modules which run Python scripts at
build-time that haven't yet been converted to Python 3.
If needed, the value can be overridden in a `configure/CONFIG_SITE.local` file,
either in Base or in the specific module.
This variable was added in EPICS 7.0.3.1 and only used by Base when configured
with `LINKER_USE_RPATH=ORIGIN`.
That configuration now runs a Perl translation of the original script, so
Python is not required to build Base.
EPICS developers working on documentation may need to point `PYTHON` to a
Pythons venv that has the additional packages needed to run Sphinx.
### Post monitors from compress record when it's reset
Writing into a compress record's `RES` field now posts a monitor event instead

View File

@ -37,7 +37,6 @@ PERL_SCRIPTS += fullPathName.pl
PERL_SCRIPTS += installEpics.pl
PERL_SCRIPTS += makeAPIheader.pl
PERL_SCRIPTS += makeMakefile.pl
PERL_SCRIPTS += makeRPath.pl
PERL_SCRIPTS += makeTestfile.pl
PERL_SCRIPTS += mkmf.pl
PERL_SCRIPTS += munch.pl
@ -50,13 +49,14 @@ PERL_SCRIPTS += testFailures.pl
PERL_SCRIPTS += useManifestTool.pl
PERL_SCRIPTS += genVersionHeader.pl
PERL_SCRIPTS += makeRPath.py
HTMLS = style.css
HTMLS += EPICS/Getopts.html
HTMLS += EPICS/Path.html
HTMLS += EPICS/Readfile.html
HTMLS += fullPathName.html
HTMLS += makeAPIheader.html
HTMLS += makeRPath.html
HTMLS += munch.html
HTMLS += podToHtml.html
HTMLS += podToMD.html

View File

@ -1,135 +0,0 @@
#!/usr/bin/env perl
#*************************************************************************
# SPDX-License-Identifier: EPICS
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
use strict;
use warnings;
use Getopt::Long;
use Cwd qw(abs_path getcwd);
use File::Spec;
use File::Basename;
use Pod::Usage;
# Example:
# target to be installed as: /build/bin/blah
# post-install will copy as: /install/bin/blah
#
# Need to link against:
# /install/lib/libA.so
# /build/lib/libB.so
# /other/lib/libC.so
#
# Want final result to be:
# -rpath $ORIGIN/../lib -rpath /other/lib \
# -rpath-link /build/lib -rpath-link /install/lib
warn "[" . join(' ', $0, @ARGV) . "]\n"
if $ENV{EPICS_DEBUG_RPATH} && $ENV{EPICS_DEBUG_RPATH} eq 'YES';
# Defaults for command-line arguments
my $final = getcwd();
my $root = '';
my $origin = '$ORIGIN';
my $help = 0;
# Parse command-line arguments
GetOptions(
'final|F=s' => \$final,
'root|R=s' => \$root,
'origin|O=s' => \$origin,
'help|h' => \$help,
) or pod2usage(
-exitval => 2,
-verbose => 1,
-noperldoc => 1,
);
# Display help message if requested
pod2usage(
-exitval => 1,
-verbose => 2,
-noperldoc => 1,
) if $help;
# Convert paths to absolute
$final = abs_path($final);
my @roots = map { abs_path($_) } grep { length($_) } split(/:/, $root);
# Determine the root containing the final location
my $froot;
foreach my $root (@roots) {
my $frel = File::Spec->abs2rel($final, $root);
if ($frel !~ /^\.\./) {
$froot = $root;
last;
}
}
if (!defined $froot) {
warn "makeRPath: Final location $final\n" .
"Not under any of: @roots\n";
@roots = (); # Skip $ORIGIN handling below
}
# Prepare output
my (@output, %output);
foreach my $path (@ARGV) {
$path = abs_path($path);
foreach my $root (@roots) {
my $rrel = File::Spec->abs2rel($path, $root);
if ($rrel !~ /^\.\./) {
# Add rpath-link for internal use by 'ld'
my $opt = "-Wl,-rpath-link,$path";
push @output, $opt unless $output{$opt}++;
# Calculate relative path
my $rel_path = File::Spec->abs2rel($rrel, $final);
my $opath = File::Spec->catfile($origin, $rel_path);
$opt = "-Wl,-rpath,$opath";
push @output, $opt unless $output{$opt}++;
last;
}
}
}
# Print the output
print join(' ', @output), "\n";
__END__
=head1 NAME
makeRPath.pl - Compute and output -rpath entries for given paths
=head1 SYNOPSIS
makeRPath.pl [options] [path ...]
=head1 OPTIONS
-h, --help Display detailed help and exit
-F, --final Final install location for ELF file
-R, --root Root(s) of relocatable tree, separated by ':'
-O, --origin Origin path (default: '$ORIGIN')
=head1 DESCRIPTION
Computes and outputs -rpath entries for each of the given paths.
Paths under C<--root> will be computed as relative to C<--final>.
=head1 EXAMPLE
A library to be placed in C</build/lib> and linked against libraries in
C</build/lib>, C</build/module/lib>, and C</other/lib> would pass
makeRPath.pl -F /build/lib -R /build /build/lib /build/module/lib /other/lib
which generates
-Wl,-rpath,$ORIGIN/. -Wl,-rpath,$ORIGIN/../module/lib -Wl,-rpath,/other/lib
=cut

86
src/tools/makeRPath.py Normal file
View File

@ -0,0 +1,86 @@
#!/usr/bin/env python
#*************************************************************************
# SPDX-License-Identifier: EPICS
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
from __future__ import print_function
import sys
import os
from collections import OrderedDict # used as OrderedSet
from argparse import ArgumentParser
if os.environ.get('EPICS_DEBUG_RPATH','')=='YES':
sys.stderr.write('%s'%sys.argv)
P = ArgumentParser(description='''Compute and output -rpath entries for each of the given paths.
Paths under --root will be computed as relative to --final .''',
epilog='''
eg. A library to be placed in /build/lib and linked against libraries in
'/build/lib', '/build/module/lib', and '/other/lib' would pass:
"makeRPath.py -F /build/lib -R /build /build/lib /build/module/lib /other/lib"
which prints "-Wl,-rpath,$ORIGIN/. -Wl,-rpath,$ORIGIN/../module/lib -Wl,-rpath,/other/lib"
''')
P.add_argument('-F','--final',default=os.getcwd(), help='Final install location for ELF file')
P.add_argument('-R','--root',default='', help='Root(s) of relocatable tree. Separate with :')
P.add_argument('-O', '--origin', default='$ORIGIN')
P.add_argument('path', nargs='*')
args = P.parse_args()
# eg.
# target to be installed as: /build/bin/blah
#
# post-install will copy as: /install/bin/blah
#
# Need to link against:
# /install/lib/libA.so
# /build/lib/libB.so
# /other/lib/libC.so
#
# Want final result to be:
# -rpath $ORIGIN/../lib -rpath /other/lib \
# -rpath-link /build/lib -rpath-link /install/lib
fdir = os.path.abspath(args.final)
roots = [os.path.abspath(root) for root in args.root.split(':') if len(root)]
# find the root which contains the final location
froot = None
for root in roots:
frel = os.path.relpath(fdir, root)
if not frel.startswith('..'):
# final dir is under this root
froot = root
break
if froot is None:
sys.stderr.write("makeRPath: Final location %s\nNot under any of: %s\n"%(fdir, roots))
# skip $ORIGIN handling below...
roots = []
output = OrderedDict()
for path in args.path:
path = os.path.abspath(path)
for root in roots:
rrel = os.path.relpath(path, root)
if not rrel.startswith('..'):
# path is under this root
# some older binutils don't seem to handle $ORIGIN correctly
# when locating dependencies of libraries. So also provide
# the absolute path for internal use by 'ld' only.
output['-Wl,-rpath-link,'+path] = True
# frel is final location relative to enclosing root
# rrel is target location relative to enclosing root
path = os.path.relpath(rrel, frel)
break
output['-Wl,-rpath,'+os.path.join(args.origin, path)] = True
print(' '.join(output))