From b84812256dae57d4bccbe46d7f7956585f57c0d6 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 13 Oct 2020 18:15:48 +0200 Subject: 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. --- .../packages/libtool-deletion/package.py | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 var/spack/repos/builtin.mock/packages/libtool-deletion/package.py (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py b/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py new file mode 100644 index 0000000000..6ca8ce03d8 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py @@ -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') -- cgit v1.2.3-70-g09d2