autotools: add attribute to delete libtool archives .la files (#18850)

* autotools: add attribute to delete libtool archives .la files

According to Autotools Mythbuster (https://autotools.io/libtool/lafiles.html)
libtool archive files are mostly vestigial, but they might create issues
when relocating binary packages as shown in #18694.

For GCC specifically, most distributions remove these files with
explicit commands:

https://git.stg.centos.org/rpms/gcc/blob/master/f/gcc.spec#_1303

Considered all of that, this commit adds an easy way for each
AutotoolsPackage to remove every .la file that has been installed.
The default, for the time being, is to maintain them - to be consistent
with what Spack was doing previously.

* autotools: delete libtool archive files by default

Following review this commit changes the default for
libtool archive files deletion and adds test to verify
the behavior.
This commit is contained in:
Massimiliano Culpo
2020-10-13 18:15:48 +02:00
committed by GitHub
parent c40de7c895
commit b84812256d
3 changed files with 102 additions and 8 deletions

View File

@@ -0,0 +1,35 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
class LibtoolDeletion(AutotoolsPackage):
"""Mock AutotoolsPackage to check proper deletion
of libtool archives.
"""
homepage = "https://www.gnu.org/software/make/"
url = "http://www.example.com/libtool-deletion-1.0.tar.gz"
version('4.2.1', sha256='e40b8f018c1da64edd1cc9a6fce5fa63b2e707e404e20cad91fbae337c98a5b7')
def do_stage(self):
mkdirp(self.stage.source_path)
def autoreconf(self, spec, prefix):
mkdirp(os.path.dirname(self.configure_abs_path))
touch(self.configure_abs_path)
def configure(self, spec, prefix):
pass
def build(self, spec, prefix):
pass
def install(self, spec, prefix):
mkdirp(os.path.dirname(self.libtool_archive_file))
touch(self.libtool_archive_file)
@property
def libtool_archive_file(self):
return os.path.join(str(self.prefix.lib), 'libfoo.la')