diff --git a/autospec/config.py b/autospec/config.py index 1a632351..a839e1c1 100644 --- a/autospec/config.py +++ b/autospec/config.py @@ -74,6 +74,7 @@ def __init__(self, download_path): self.extra_configure64 = "" self.extra_configure_avx2 = "" self.extra_configure_avx512 = "" + self.extra_configure_apx = "" self.extra_configure_openmpi = "" self.config_files = set() self.parallel_build = " %{?_smp_mflags} " @@ -413,10 +414,7 @@ def rewrite_config_opts(self): # (in case of a user-created options.conf) missing = set(self.config_options.keys()).difference(set(self.config_opts.keys())) for option in missing: - if option in ['use_apx']: - self.config_opts[option] = True - else: - self.config_opts[option] = False + self.config_opts[option] = False for fname, comment in sorted(self.config_options.items()): config_f.set('autospec', '# {}'.format(comment)) @@ -913,6 +911,9 @@ def parse_config_files(self, bump, filemanager, version, requirements): content = self.read_conf_file(os.path.join(self.download_path, "configure_avx512")) self.extra_configure_avx512 = " \\\n".join(content) + content = self.read_conf_file(os.path.join(self.download_path, "configure_apx")) + self.extra_configure_apx = " \\\n".join(content) + content = self.read_conf_file(os.path.join(self.download_path, "configure_openmpi")) self.extra_configure_openmpi = " \\\n".join(content) diff --git a/autospec/files.py b/autospec/files.py index ef5d6bd3..aca2293f 100644 --- a/autospec/files.py +++ b/autospec/files.py @@ -59,7 +59,7 @@ def banned_path(path): r"/usr/src.*", r"/var.*"] for bpath in banned_paths: - if re.search(r"^(/V3|/V4)?" + bpath, path): + if re.search(r"^(/V3|/V4|/VA)?" + bpath, path): return True return False @@ -101,7 +101,7 @@ def compat_exclude(self, filename): exclude = True for pat in patterns: - pat = re.compile(r"^(/V3|/V4)?" + pat) + pat = re.compile(r"^(/V3|/V4|/VA)?" + pat) if pat.search(filename): exclude = False break @@ -126,10 +126,10 @@ def file_pat_match(self, filename, pattern, package, replacement=""): # All patterns at this time and should always be prefixed by '^' # but just in case add the following to strip just the '^' pattern = pattern if not pattern.startswith('^') else pattern[1:] - pat = re.compile(r"^(/V3|/V4)?" + pattern) + pat = re.compile(r"^(/V3|/V4|/VA)?" + pattern) match = pat.search(filename) if match: - if len(match.groups()) > 0 and match.groups()[0] in ['/V3', '/V4']: + if len(match.groups()) > 0 and match.groups()[0] in ['/V3', '/V4', '/VA']: norm_filename = filename.removeprefix(match.groups()[0]) if replacement != filename: replacement = match.groups()[0] + replacement @@ -236,7 +236,7 @@ def push_file(self, filename, pkg_name): # Explicit file packaging for k, v in self.file_maps.items(): for match_name in v['files']: - match = re.search(r"^/(V3|V4)", filename) + match = re.search(r"^/(V3|V4|VA)", filename) norm_filename = filename if not match else filename.removeprefix(match.group()) if isinstance(match_name, str): if norm_filename == match_name: diff --git a/autospec/specfiles.py b/autospec/specfiles.py index 03f72d86..fe8df3b5 100644 --- a/autospec/specfiles.py +++ b/autospec/specfiles.py @@ -34,6 +34,8 @@ AVX512_FCFLAGS = "-march=x86-64-v4 -mprefer-vector-width=256" AVX512_LFLAGS = "-Wl,-z,x86-64-v4" AVX512_LCFLAGS = "-march=x86-64-v4" +APX_CFLAGS = "-march=x86-64-v3 -mapxf -mavx10.1" +APX_LFLAGS = "-Wl,-z,x86-64-v3" class Specfile(object): @@ -488,11 +490,7 @@ def write_prep(self): if self.config.subdir: self._write_strip("popd") - if self.config.default_pattern == "distutils3" or self.config.default_pattern == "pyproject": - self._write_strip("pushd ..") - self._write_strip("cp -a {} buildavx2".format(self.content.tarball_prefix)) - self._write_strip("popd") - elif self.config.default_pattern != 'cmake': + if self.config.default_pattern != 'cmake': if self.config.config_opts['32bit']: self._write_strip("pushd ..") self._write_strip("cp -a {} build32".format(self.content.tarball_prefix)) @@ -505,6 +503,10 @@ def write_prep(self): self._write_strip("pushd ..") self._write_strip("cp -a {} buildavx512".format(self.content.tarball_prefix)) self._write_strip("popd") + if self.config.config_opts['use_apx']: + self._write_strip("pushd ..") + self._write_strip("cp -a {} buildapx".format(self.content.tarball_prefix)) + self._write_strip("popd") if self.config.config_opts['openmpi']: self._write_strip("pushd ..") self._write_strip("cp -a {} build-openmpi".format(self.content.tarball_prefix)) @@ -734,6 +736,11 @@ def write_make_install(self): self._write_strip("%s_v4 %s\n" % (self.config.install_macro, self.config.extra_make_install)) self._write_strip("popd") + if self.config.config_opts['use_apx']: + self._write_strip("pushd ../buildapx/" + self.config.subdir) + self._write_strip("%s_va %s\n" % (self.config.install_macro, self.config.extra_make_install)) + self._write_strip("popd") + if self.config.config_opts['openmpi']: self._write_strip("pushd ../build-openmpi/" + self.config.subdir) self.write_install_openmpi() @@ -802,10 +809,12 @@ def write_elf_move(self): skips = "" for setuid in self.setuid: skips = f"{skips} --skip-path {setuid}" - if self.config.config_opts['use_avx2'] or self.config.default_pattern == "distutils3" or self.config.default_pattern == "pyproject": + if self.config.config_opts['use_avx2']: self._write_strip('/usr/bin/elf-move.py avx2 %{buildroot}-v3 %{buildroot} %{buildroot}/usr/share/clear/filemap/filemap-%{name}' + skips) if self.config.config_opts['use_avx512']: self._write_strip('/usr/bin/elf-move.py avx512 %{buildroot}-v4 %{buildroot} %{buildroot}/usr/share/clear/filemap/filemap-%{name}' + skips) + if self.config.config_opts['use_apx']: + self._write_strip('/usr/bin/elf-move.py apx %{buildroot}-va %{buildroot} %{buildroot}/usr/share/clear/filemap/filemap-%{name}' + skips) def write_exclude_deletes(self): """Write out deletes for excluded files.""" @@ -900,6 +909,11 @@ def write_cmake_install(self): self._write_strip("%s_v4 %s || :\n" % (self.config.install_macro, self.config.extra_make_install)) self._write_strip("popd") + if self.config.config_opts['use_apx']: + self._write_strip("pushd clr-build-apx") + self._write_strip("%s_va %s || :\n" % (self.config.install_macro, self.config.extra_make_install)) + self._write_strip("popd") + if self.config.config_opts['openmpi']: self._write_strip("pushd clr-build-openmpi") self.write_install_openmpi() @@ -1168,6 +1182,17 @@ def write_make_pattern(self): self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX512_LCFLAGS} "') self.write_make_line() self._write_strip("popd") + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("pushd ../buildapx" + self.config.subdir) + self.write_build_prepend() + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_CFLAGS} "') + self.write_make_line() + self._write_strip("popd") self._write_strip("\n") self.write_check() @@ -1231,6 +1256,22 @@ def write_autogen_pattern(self): self.write_make_line() self._write_strip("popd") + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("pushd ../buildapx/" + self.config.subdir) + self.write_build_prepend() + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_CFLAGS} "') + self._write_strip("%autogen {0} {1} {2} " + .format(self.config.disable_static, + self.config.extra_configure, + self.config.extra_configure_apx)) + self.write_make_line() + self._write_strip("popd") + self.write_check() self.write_make_install() @@ -1246,18 +1287,34 @@ def write_pyproject_pattern(self): self._write_strip(f"pypi-dep-fix.py . {module}") self._write_strip("python3 -m build --wheel --skip-dependency-check --no-isolation " + self.config.extra_configure) - self._write_strip("pushd ../buildavx2/" + self.config.subdir) - self.write_build_prepend() - self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') - self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') - for module in self.config.pypi_overrides: - self._write_strip(f"pypi-dep-fix.py . {module}") - self._write_strip("python3 -m build --wheel --skip-dependency-check --no-isolation " + self.config.extra_configure) - self._write_strip("\n") - self._write_strip("popd") + if self.config.config_opts['use_avx2']: + self._write_strip("pushd ../buildavx2/" + self.config.subdir) + self.write_build_prepend() + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') + for module in self.config.pypi_overrides: + self._write_strip(f"pypi-dep-fix.py . {module}") + self._write_strip("python3 -m build --wheel --skip-dependency-check --no-isolation " + self.config.extra_configure) + self._write_strip("\n") + self._write_strip("popd") + + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("pushd ../buildapx/" + self.config.subdir) + self.write_build_prepend() + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_CFLAGS} "') + for module in self.config.pypi_overrides: + self._write_strip(f"pypi-dep-fix.py . {module}") + self._write_strip("python3 -m build --wheel --skip-dependency-check --no-isolation " + self.config.extra_configure) + self._write_strip("\n") + self._write_strip("popd") self._write_strip("\n") if self.config.subdir: @@ -1283,14 +1340,26 @@ def write_pyproject_pattern(self): self._write_strip("cat %{buildroot}/usr/lib/python3*/site-packages/*/requires.txt || :") self._write_strip("echo ----[ mark ]----") - self._write_strip("pushd ../buildavx2/" + self.config.subdir) - self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') - self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') - self._write_strip("python3 -m installer --destdir=%{buildroot}-v3 dist/*.whl") - self._write_strip("popd") + if self.config.config_opts['use_avx2']: + self._write_strip("pushd ../buildavx2/" + self.config.subdir) + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') + self._write_strip("python3 -m installer --destdir=%{buildroot}-v3 dist/*.whl") + self._write_strip("popd") + + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("pushd ../buildapx/" + self.config.subdir) + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_CFLAGS} "') + self._write_strip("python3 -m installer --destdir=%{buildroot}-va dist/*.whl") + self._write_strip("popd") self.write_find_lang() @@ -1309,18 +1378,34 @@ def write_distutils3_pattern(self): if self.config.subdir: self._write_strip("popd") - self._write_strip("pushd ../buildavx2/" + self.config.subdir) - self.write_build_prepend() - self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') - self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') - for module in self.config.pypi_overrides: - self._write_strip(f"pypi-dep-fix.py . {module}") - self._write_strip("python3 setup.py build " + self.config.extra_configure) - self._write_strip("\n") - self._write_strip("popd") + if self.config.config_opts['use_avx2']: + self._write_strip("pushd ../buildavx2/" + self.config.subdir) + self.write_build_prepend() + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') + for module in self.config.pypi_overrides: + self._write_strip(f"pypi-dep-fix.py . {module}") + self._write_strip("python3 setup.py build " + self.config.extra_configure) + self._write_strip("\n") + self._write_strip("popd") + + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("pushd ../buildapx/" + self.config.subdir) + self.write_build_prepend() + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_CFLAGS} "') + for module in self.config.pypi_overrides: + self._write_strip(f"pypi-dep-fix.py . {module}") + self._write_strip("python3 setup.py build " + self.config.extra_configure) + self._write_strip("\n") + self._write_strip("popd") self.write_build_append() self.write_check() @@ -1343,14 +1428,26 @@ def write_distutils3_pattern(self): self._write_strip("cat %{buildroot}/usr/lib/python3*/site-packages/*/requires.txt || :") self._write_strip("echo ----[ mark ]----") - self._write_strip("pushd ../buildavx2/" + self.config.subdir) - self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') - self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') - self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') - self._write_strip("python3 -tt setup.py build install --root=%{buildroot}-v3") - self._write_strip("popd") + if self.config.config_opts['use_avx2']: + self._write_strip("pushd ../buildavx2/" + self.config.subdir) + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {AVX2_CFLAGS} "') + self._write_strip("python3 -tt setup.py build install --root=%{buildroot}-v3") + self._write_strip("popd") + + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("pushd ../buildapx/" + self.config.subdir) + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_CFLAGS} "') + self._write_strip("python3 -tt setup.py build install --root=%{buildroot}-va") + self._write_strip("popd") self.write_find_lang() @@ -1375,9 +1472,11 @@ def write_R_pattern(self): self._write_strip('LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS -Wl,-z -Wl,relro"\n') self._write_strip("mkdir -p %{buildroot}/usr/lib64/R/library") + self._write_strip("mkdir -p %{buildroot}-v3/usr/lib64/R/library") + self._write_strip("mkdir -p %{buildroot}-v4/usr/lib64/R/library") + self._write_strip("mkdir -p %{buildroot}-va/usr/lib64/R/library") self._write_strip("\n") self._write_strip("mkdir -p ~/.R") - self._write_strip("mkdir -p ~/.stash") self._write_strip(f"echo \"CFLAGS = $CFLAGS {AVX2_CFLAGS} -ftree-vectorize -mno-vzeroupper\" > ~/.R/Makevars") self._write_strip(f"echo \"FFLAGS = $FFLAGS {AVX2_CFLAGS} -ftree-vectorize -mno-vzeroupper \" >> ~/.R/Makevars") @@ -1391,8 +1490,7 @@ def write_R_pattern(self): "--data-compress=none " "--compress=none " "--build -l " - "%{buildroot}/usr/lib64/R/library .") - self._write_strip("for i in `find %{buildroot}/usr/lib64/R/ -name \"*.so\"`; do mv $i $i.avx2 ; mv $i.avx2 ~/.stash/; done\n") + "%{buildroot}-v3/usr/lib64/R/library .") self._write_strip(f"echo \"CFLAGS = $CFLAGS {AVX512_CFLAGS} -ftree-vectorize -mno-vzeroupper \" > ~/.R/Makevars") self._write_strip(f"echo \"FFLAGS = $FFLAGS {AVX512_CFLAGS} -ftree-vectorize -mno-vzeroupper \" >> ~/.R/Makevars") @@ -1408,8 +1506,21 @@ def write_R_pattern(self): "--compress=none " "--built-timestamp=${SOURCE_DATE_EPOCH} " "--build -l " - "%{buildroot}/usr/lib64/R/library .") - self._write_strip("for i in `find %{buildroot}/usr/lib64/R/ -name \"*.so\"`; do mv $i $i.avx512 ; mv $i.avx512 ~/.stash/; done\n") + "%{buildroot}-v4/usr/lib64/R/library .") + + self._write_strip(f"echo \"CFLAGS = $CFLAGS {APX_CFLAGS} -ftree-vectorize -mno-vzeroupper\" > ~/.R/Makevars") + self._write_strip(f"echo \"FFLAGS = $FFLAGS {APX_CFLAGS} -ftree-vectorize -mno-vzeroupper \" >> ~/.R/Makevars") + self._write_strip(f"echo \"CXXFLAGS = $CXXFLAGS {AVX2_CFLAGS} -ftree-vectorize -mno-vzeroupper \" >> ~/.R/Makevars") + + self._write_strip("R CMD INSTALL " + f"{self.config.extra_configure} " + "--install-tests " + "--use-LTO " + "--built-timestamp=${SOURCE_DATE_EPOCH} " + "--data-compress=none " + "--compress=none " + "--build -l " + "%{buildroot}-va/usr/lib64/R/library .") self._write_strip("echo \"CFLAGS = $CFLAGS -ftree-vectorize \" > ~/.R/Makevars") self._write_strip("echo \"FFLAGS = $FFLAGS -ftree-vectorize \" >> ~/.R/Makevars") @@ -1425,7 +1536,6 @@ def write_R_pattern(self): "--built-timestamp=${SOURCE_DATE_EPOCH} " "--build -l " "%{buildroot}/usr/lib64/R/library .") - self._write_strip("cp ~/.stash/* %{buildroot}/usr/lib64/R/library/*/libs/ || :") self._write_strip("%{__rm} -rf %{buildroot}%{_datadir}/R/library/R.css") self.write_find_lang() @@ -1475,6 +1585,20 @@ def write_cmake_pattern(self): self.write_make_line() self._write_strip("popd") + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip("mkdir -p clr-build-apx") + self._write_strip("pushd clr-build-apx") + self.write_build_prepend() + self.write_variables() + self._write_strip('CC=gcc-14') + self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "') + self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "') + self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "') + self._write_strip("%cmake {} {}".format(self.config.cmake_srcdir, self.extra_cmake)) + self.write_make_line() + self._write_strip("popd") + if self.config.config_opts['32bit']: self._write_strip("mkdir -p clr-build32") self._write_strip("pushd clr-build32") @@ -1655,6 +1779,32 @@ def write_meson_pattern(self): 'meson --libdir=lib64 --prefix=/usr --buildtype=plain {0} ' '{1} builddiravx512'.format(self.config.extra_configure, self.config.extra_configure64)) self._write_strip('ninja -v -C builddiravx512') + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip('CC=gcc-14') + if self.config.config_opts['pgo'] and self.config.profile_payload != "": + self._write_strip(f'CFLAGS="$CFLAGS_GENERATE {APX_CFLAGS} {APX_LFLAGS} "' + f' CXXFLAGS="$CXXFLAGS_GENERATE {AVX2_CFLAGS} {AVX2_LFLAGS} "' + f' LDFLAGS="$LDFLAGS_GENERATE {APX_CFLAGS} " ' + ' meson --libdir=lib64 --prefix=/usr --buildtype=plain {0} ' + ' {1} builddirapx'.format(self.config.extra_configure, self.config.extra_configure64)) + self._write_strip('ninja -v -C builddirapx') + self._write_strip('pushd builddirapx') + self._write_strip("\n".join(self.config.profile_payload)) + self._write_strip('popd') + self._write_strip('rm -rf builddirapx') + self._write_strip(f'CFLAGS="$CFLAGS_USE {APX_CFLAGS} {APX_LFLAGS} "' + f' CXXFLAGS="$CXXFLAGS_USE {AVX2_CFLAGS} {AVX2_LFLAGS} "' + f' LDFLAGS="$LDFLAGS_USE {APX_LFLAGS} " ' + ' meson --libdir=lib64 --prefix=/usr --buildtype=plain {0} ' + ' {1} builddirapx'.format(self.config.extra_configure, self.config.extra_configure64)) + self._write_strip('ninja -v -C builddirapx') + else: + self._write_strip(f'CFLAGS="$CFLAGS {APX_CFLAGS} {APX_LFLAGS} "' + f' CXXFLAGS="$CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "' + f' LDFLAGS="$LDFLAGS {APX_CFLAGS} " ' + ' meson --libdir=lib64 --prefix=/usr --buildtype=plain {0} ' + ' {1} builddirapx'.format(self.config.extra_configure, self.config.extra_configure64)) + self._write_strip('ninja -v -C builddirapx') if self.config.subdir: self._write_strip("popd") if self.config.config_opts['32bit']: @@ -1696,6 +1846,9 @@ def write_meson_pattern(self): self._write_strip('DESTDIR=%{buildroot}-v3 ninja -C builddiravx2 install') if self.config.config_opts['use_avx512']: self._write_strip('DESTDIR=%{buildroot}-v4 ninja -C builddiravx512 install') + if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']: + self._write_strip('CC=gcc-14') + self._write_strip('DESTDIR=%{buildroot}-va ninja -C builddirapx install') self._write_strip("DESTDIR=%{buildroot} ninja -C builddir install") if self.config.subdir: diff --git a/tests/test_files.py b/tests/test_files.py index c6a9c811..6d7c10ad 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -33,6 +33,7 @@ def test_banned_path(self): "/opt/two", "/V3/opt/two", "/V4/opt/two", + "/VA/opt/two", "/usr/etc/three", "/usr/local/four", "/usr/src/five", @@ -58,6 +59,7 @@ def test_push_package_file_banned(self): self.fm.push_package_file('/etc/test-fn') self.fm.push_package_file('/V3/etc/test-fn') self.fm.push_package_file('/V4/etc/test-fn') + self.fm.push_package_file('/VA/etc/test-fn') self.assertTrue(self.fm.has_banned) self.assertFalse(self.fm.newfiles_printed) @@ -84,6 +86,7 @@ def test_compat_exclude_exclude_file(self): self.assertTrue(self.fm.compat_exclude('/usr/lib64/libfoo.so')) self.assertTrue(self.fm.compat_exclude('/V3/usr/lib64/libfoo.so')) self.assertTrue(self.fm.compat_exclude('/V4/usr/lib64/libfoo.so')) + self.assertTrue(self.fm.compat_exclude('/VA/usr/lib64/libfoo.so')) def test_compat_exclude_not_compat_mode(self): """ @@ -94,6 +97,7 @@ def test_compat_exclude_not_compat_mode(self): self.assertFalse(self.fm.compat_exclude('/usr/lib64/libfoo.so')) self.assertFalse(self.fm.compat_exclude('/V3/usr/lib64/libfoo.so')) self.assertFalse(self.fm.compat_exclude('/V4/usr/lib64/libfoo.so')) + self.assertFalse(self.fm.compat_exclude('/VA/usr/lib64/libfoo.so')) def test_file_pat_match(self): """ @@ -107,6 +111,8 @@ def test_file_pat_match(self): self.fm.push_package_file.assert_called_with('/V3/test-fn', 'main') self.assertTrue(self.fm.file_pat_match('/V4/test-fn', r'^/test-fn', 'main')) self.fm.push_package_file.assert_called_with('/V4/test-fn', 'main') + self.assertTrue(self.fm.file_pat_match('/VA/test-fn', r'^/test-fn', 'main')) + self.fm.push_package_file.assert_called_with('/VA/test-fn', 'main') def test_file_pat_match_exclude(self): """ @@ -117,6 +123,7 @@ def test_file_pat_match_exclude(self): self.assertTrue(self.fm.file_pat_match('/test-fn', r'^/test-fn', 'main')) self.assertTrue(self.fm.file_pat_match('/V3/test-fn', r'^/test-fn', 'main')) self.assertTrue(self.fm.file_pat_match('/V4/test-fn', r'^/test-fn', 'main')) + self.assertTrue(self.fm.file_pat_match('/VA/test-fn', r'^/test-fn', 'main')) self.fm.push_package_file.assert_not_called() def test_file_pat_match_replacement(self): @@ -130,6 +137,8 @@ def test_file_pat_match_replacement(self): self.fm.push_package_file.assert_called_with('/V3/testfn', 'main') self.assertTrue(self.fm.file_pat_match('/V4/test-fn', r'/test-fn', 'main', '/testfn')) self.fm.push_package_file.assert_called_with('/V4/testfn', 'main') + self.assertTrue(self.fm.file_pat_match('/VA/test-fn', r'/test-fn', 'main', '/testfn')) + self.fm.push_package_file.assert_called_with('/VA/testfn', 'main') def test_file_pat_match_replacement_no_glob(self): """ @@ -143,6 +152,8 @@ def test_file_pat_match_replacement_no_glob(self): self.fm.push_package_file.assert_called_with('/V3/test-fn', 'main') self.assertTrue(self.fm.file_pat_match('/V4/test-fn', r'^/test-fn', 'main', '/testfn')) self.fm.push_package_file.assert_called_with('/V4/test-fn', 'main') + self.assertTrue(self.fm.file_pat_match('/VA/test-fn', r'^/test-fn', 'main', '/testfn')) + self.fm.push_package_file.assert_called_with('/VA/test-fn', 'main') def test_file_windows_exe_not_allowed(self): """ @@ -237,6 +248,9 @@ def test_push_file_custom_extras(self): self.fm.push_file('/V4/foobar', '') calls = [call('/V4/foobar', 'foobar-extras')] self.fm.push_package_file.assert_has_calls(calls) + self.fm.push_file('/VA/foobar', '') + calls = [call('/VA/foobar', 'foobar-extras')] + self.fm.push_package_file.assert_has_calls(calls) def test_push_package_file_glob_empty(self): """ @@ -254,6 +268,9 @@ def test_push_package_file_glob_empty(self): self.fm.push_file('/V4/leftglobrightglob', '') calls = [call('/V4/leftglob*rightglob', 'foobar-extras')] self.fm.push_package_file.assert_has_calls(calls) + self.fm.push_file('/VA/leftglobrightglob', '') + calls = [call('/VA/leftglob*rightglob', 'foobar-extras')] + self.fm.push_package_file.assert_has_calls(calls) def test_push_package_file_glob_left_match(self): """ @@ -271,6 +288,9 @@ def test_push_package_file_glob_left_match(self): self.fm.push_file('/V4/leftglobrightglob', '') calls = [call('/V4/leftglob*', 'foobar-extras')] self.fm.push_package_file.assert_has_calls(calls) + self.fm.push_file('/VA/leftglobrightglob', '') + calls = [call('/VA/leftglob*', 'foobar-extras')] + self.fm.push_package_file.assert_has_calls(calls) def test_push_package_file_glob_right_match(self): """ @@ -288,6 +308,9 @@ def test_push_package_file_glob_right_match(self): self.fm.push_file('/V4/leftglobrightglob', '') calls = [call('/V4/*rightglob', 'foobar-extras')] self.fm.push_package_file.assert_has_calls(calls) + self.fm.push_file('/VA/leftglobrightglob', '') + calls = [call('/VA/*rightglob', 'foobar-extras')] + self.fm.push_package_file.assert_has_calls(calls) def test_push_package_file_glob_leftright_match(self): """ @@ -305,6 +328,9 @@ def test_push_package_file_glob_leftright_match(self): self.fm.push_file('/V4/leftglobstuffrightglob', '') calls = [call('/V4/leftglob*rightglob', 'foobar-extras')] self.fm.push_package_file.assert_has_calls(calls) + self.fm.push_file('/VA/leftglobstuffrightglob', '') + calls = [call('/VA/leftglob*rightglob', 'foobar-extras')] + self.fm.push_package_file.assert_has_calls(calls) def test_push_package_file_glob_multi_match(self): """ @@ -322,6 +348,9 @@ def test_push_package_file_glob_multi_match(self): self.fm.push_file('/V4/leftglobstuff/stuffrightglob', '') calls = [call('/V4/leftglob*/*rightglob', 'foobar-extras')] self.fm.push_package_file.assert_has_calls(calls) + self.fm.push_file('/VA/leftglobstuff/stuffrightglob', '') + calls = [call('/VA/leftglob*/*rightglob', 'foobar-extras')] + self.fm.push_package_file.assert_has_calls(calls) def test_push_file_setuid(self): """ @@ -347,6 +376,8 @@ def test_push_file_match(self): self.fm.push_package_file.assert_has_calls([call('/V3/usr/bin/test', 'bin')]) self.fm.push_file('/V4/usr/bin/test', '') self.fm.push_package_file.assert_has_calls([call('/V4/usr/bin/test', 'bin')]) + self.fm.push_file('/VA/usr/bin/test', '') + self.fm.push_package_file.assert_has_calls([call('/VA/usr/bin/test', 'bin')]) def test_push_file_match_pkg_name_dependency(self): """ @@ -361,6 +392,8 @@ def test_push_file_match_pkg_name_dependency(self): self.fm.push_package_file.assert_has_calls([call('/V3/usr/share/doc/testball/*', 'doc')]) self.fm.push_file('/V4/usr/share/doc/testball/', 'testball') self.fm.push_package_file.assert_has_calls([call('/V4/usr/share/doc/testball/*', 'doc')]) + self.fm.push_file('/VA/usr/share/doc/testball/', 'testball') + self.fm.push_package_file.assert_has_calls([call('/VA/usr/share/doc/testball/*', 'doc')]) def test_push_file_no_match(self): """