Move to a CPython-like installation layout
This commit is contained in:
parent
bc25649d52
commit
446ee50e4e
124
pypy3.9.spec
124
pypy3.9.spec
@ -124,7 +124,6 @@ URL: http://pypy.org/
|
|||||||
# Easy way to turn off the selftests:
|
# Easy way to turn off the selftests:
|
||||||
%global run_selftests 1
|
%global run_selftests 1
|
||||||
|
|
||||||
%global pypyprefix %{_libdir}/pypy%{pyversion}
|
|
||||||
%global pylibver 3
|
%global pylibver 3
|
||||||
|
|
||||||
# We refer to this subdir of the source tree in a few places during the build:
|
# We refer to this subdir of the source tree in a few places during the build:
|
||||||
@ -227,6 +226,7 @@ BuildRequires: perl-interpreter
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
BuildRequires: /usr/bin/execstack
|
BuildRequires: /usr/bin/execstack
|
||||||
|
BuildRequires: /usr/bin/patchelf
|
||||||
|
|
||||||
# For byte-compiling the JIT-viewing mode:
|
# For byte-compiling the JIT-viewing mode:
|
||||||
%if %{with_emacs}
|
%if %{with_emacs}
|
||||||
@ -518,12 +518,47 @@ BuildPyPy \
|
|||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}/%{_bindir}
|
# First, run packaging script, it will prep the installation tree in builddir
|
||||||
mkdir -p %{buildroot}/%{pypyprefix}
|
%global installation_archive_name pypy%{pyversion}-%{version_}
|
||||||
|
%global packaging_builddir builddir
|
||||||
|
%global packaged_prefix %{packaging_builddir}/%{installation_archive_name}
|
||||||
|
%global soname_version 0.1
|
||||||
|
|
||||||
|
%{bootstrap_python_interp} pypy/tool/release/package.py --archive-name '%{installation_archive_name}' --builddir '%{packaging_builddir}' --no-embedded-dependencies
|
||||||
|
|
||||||
# Run installing script, archive-name pypy%{pyversion} in %{buildroot}/%{_libdir} == %{pypyprefix}
|
# Mangle some paths to match CPython,
|
||||||
%{bootstrap_python_interp} pypy/tool/release/package.py --archive-name pypy%{pyversion} --builddir %{buildroot}/%{_libdir} --no-embedded-dependencies
|
# see https://mail.python.org/pipermail/pypy-dev/2022-January/016310.html and the replies there
|
||||||
|
# 1. remove the "python" executables, we still want CPython as the python command
|
||||||
|
rm %{packaged_prefix}/bin/python*
|
||||||
|
# 2. remove the "pypy" symbolic link, we still want pypy2 to be that for now
|
||||||
|
rm %{packaged_prefix}/bin/pypy
|
||||||
|
# 3. remove the "pypy3"symbolic link, if this is not the main pypy3
|
||||||
|
%{!?with_main_pypy3:rm %{packaged_prefix}/bin/pypy3}
|
||||||
|
# 4. move libpypy3.9-c.so to lib(64) and soname version it
|
||||||
|
# https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning
|
||||||
|
mv %{packaged_prefix}/bin/libpypy%{pyversion}-c.so %{packaged_prefix}/%{_lib}/libpypy%{pyversion}-c.so.%{soname_version}
|
||||||
|
ln -s libpypy%{pyversion}-c.so.%{soname_version} %{packaged_prefix}/%{_lib}/libpypy%{pyversion}-c.so
|
||||||
|
patchelf --set-soname libpypy%{pyversion}-c.so.%{soname_version} %{packaged_prefix}/%{_lib}/libpypy%{pyversion}-c.so
|
||||||
|
patchelf --replace-needed libpypy%{pyversion}-c.so libpypy%{pyversion}-c.so.%{soname_version} %{packaged_prefix}/bin/pypy%{pyversion}
|
||||||
|
# 5. remove stray README
|
||||||
|
rm %{packaged_prefix}/include/README
|
||||||
|
# 6. copy the main LICENSE file to pypy's libdir, as does CPython
|
||||||
|
cp -a LICENSE %{packaged_prefix}/%{_lib}/pypy%{pyversion}
|
||||||
|
|
||||||
|
# Create the prefix and move stuff into it
|
||||||
|
mkdir -p %{buildroot}%{_prefix}
|
||||||
|
mv %{packaged_prefix}/bin %{buildroot}%{_bindir}
|
||||||
|
mv %{packaged_prefix}/include %{buildroot}%{_includedir}
|
||||||
|
mv %{packaged_prefix}/%{_lib} %{buildroot}%{_libdir}
|
||||||
|
|
||||||
|
# Create directories we want to own
|
||||||
|
install -d -m 0755 %{buildroot}%{_libdir}/pypy%{pyversion}/site-packages/__pycache__
|
||||||
|
%if "%{_lib}" == "lib64"
|
||||||
|
# The 64-bit version needs to create "site-packages" in /usr/lib/ (for
|
||||||
|
# pure-Python modules) as well as in /usr/lib64/ (for packages with extension
|
||||||
|
# modules).
|
||||||
|
install -d -m 0755 %{buildroot}%{_prefix}/lib/pypy%{pyversion}/site-packages/__pycache__
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
# Remove shebang lines from .py files that aren't executable, and
|
# Remove shebang lines from .py files that aren't executable, and
|
||||||
@ -542,8 +577,6 @@ find \
|
|||||||
\) \
|
\) \
|
||||||
\)
|
\)
|
||||||
|
|
||||||
mkdir -p %{buildroot}/%{pypyprefix}/site-packages
|
|
||||||
|
|
||||||
# The generated machine code doesn't need an executable stack, but
|
# The generated machine code doesn't need an executable stack, but
|
||||||
# one of the assembler files (gcmaptable.s) doesn't have the necessary
|
# one of the assembler files (gcmaptable.s) doesn't have the necessary
|
||||||
# metadata to inform gcc of that, and thus gcc pessimistically assumes
|
# metadata to inform gcc of that, and thus gcc pessimistically assumes
|
||||||
@ -553,12 +586,7 @@ mkdir -p %{buildroot}/%{pypyprefix}/site-packages
|
|||||||
#
|
#
|
||||||
# I tried various approaches involving fixing the build, but the simplest
|
# I tried various approaches involving fixing the build, but the simplest
|
||||||
# approach is to postprocess the ELF file:
|
# approach is to postprocess the ELF file:
|
||||||
execstack --clear-execstack %{buildroot}/%{pypyprefix}/bin/pypy3
|
execstack --clear-execstack %{buildroot}%{_bindir}/pypy%{pyversion}
|
||||||
|
|
||||||
ln -s %{pypyprefix}/bin/pypy%{pyversion} %{buildroot}%{_bindir}/pypy%{pyversion}
|
|
||||||
%if %{with main_pypy3}
|
|
||||||
ln -s pypy%{pyversion} %{buildroot}%{_bindir}/pypy3
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# pypy uses .pyc files by default (--objspace-usepycfiles), but has a slightly
|
# pypy uses .pyc files by default (--objspace-usepycfiles), but has a slightly
|
||||||
# different bytecode format to CPython. It doesn't use .pyo files: the -O flag
|
# different bytecode format to CPython. It doesn't use .pyo files: the -O flag
|
||||||
@ -610,31 +638,18 @@ ln -s pypy%{pyversion} %{buildroot}%{_bindir}/pypy3
|
|||||||
#
|
#
|
||||||
# Note that some of the test files deliberately contain syntax errors, so
|
# Note that some of the test files deliberately contain syntax errors, so
|
||||||
# we are running it in subshell, to be able to ignore the failures and not to terminate the build.
|
# we are running it in subshell, to be able to ignore the failures and not to terminate the build.
|
||||||
(%{py_byte_compile %{buildroot}%{pypyprefix}/bin/pypy3 %{buildroot}%{pypyprefix}}) || :
|
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
|
||||||
|
(%{py_byte_compile %{buildroot}%{_bindir}/pypy%{pyversion} %{buildroot}}) || :
|
||||||
|
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'import _tkinter'
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'import tkinter'
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'import _sqlite3'
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'import _curses'
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'import curses'
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'import syslog'
|
||||||
|
%{buildroot}%{_bindir}/pypy%{pyversion} -c 'from _sqlite3 import *'
|
||||||
|
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'import _tkinter'
|
unset LD_LIBRARY_PATH
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'import tkinter'
|
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'import _sqlite3'
|
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'import _curses'
|
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'import curses'
|
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'import syslog'
|
|
||||||
%{buildroot}%{pypyprefix}/bin/pypy3 -c 'from _sqlite3 import *'
|
|
||||||
|
|
||||||
# Header files for C extension modules.
|
|
||||||
# Upstream's packaging process (pypy/tool/release/package.py)
|
|
||||||
# creates an "include" subdir and copies all *.h/*.inl from "include" there
|
|
||||||
# (it also has an apparently out-of-date comment about copying them from
|
|
||||||
# pypy/_interfaces, but this directory doesn't seem to exist, and it doesn't
|
|
||||||
# seem to do this as of 2011-01-13)
|
|
||||||
|
|
||||||
# FIXME: arguably these should be instead put into a subdir below /usr/include,
|
|
||||||
# it's not yet clear to me how upstream plan to deal with the C extension
|
|
||||||
# interface going forward, so let's just mimic upstream for now.
|
|
||||||
%global pypy_include_dir %{pypyprefix}/include
|
|
||||||
mkdir -p %{buildroot}%{pypy_include_dir}
|
|
||||||
rm -f %{buildroot}%{pypy_include_dir}/README
|
|
||||||
|
|
||||||
|
|
||||||
# Capture the RPython source code files from the build within the debuginfo
|
# Capture the RPython source code files from the build within the debuginfo
|
||||||
# package (rhbz#666975)
|
# package (rhbz#666975)
|
||||||
@ -692,17 +707,12 @@ cp -a rpython/jit/tool/pypytrace-mode.elc %{buildroot}/%{_emacs_sitelispdir}/pyp
|
|||||||
install -m0644 -p -D -t %{buildroot}/%{_rpmconfigdir}/macros.d %{SOURCE2}
|
install -m0644 -p -D -t %{buildroot}/%{_rpmconfigdir}/macros.d %{SOURCE2}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Remove files we don't want:
|
|
||||||
rm -f %{buildroot}%{_libdir}/%{name}.tar.bz2 \
|
|
||||||
%{buildroot}%{pypyprefix}/README.rst
|
|
||||||
|
|
||||||
# wtf? This is probably masking some bigger problem, but let's do this for now
|
# wtf? This is probably masking some bigger problem, but let's do this for now
|
||||||
mv -v lib-python/3/test/regrtest.py-new lib-python/3/test/regrtest.py || :
|
mv -v lib-python/3/test/regrtest.py-new lib-python/3/test/regrtest.py || :
|
||||||
|
|
||||||
# since 5.10.0, the debug binaries are built and shipped, making the
|
# since 5.10.0, the debug binaries are built and shipped, making the
|
||||||
# pypy3 package ~350 MiB. let's remove them here for now and TODO figure out why
|
# pypy3 package ~350 MiB. let's remove them here for now and TODO figure out why
|
||||||
rm -f %{buildroot}%{pypyprefix}/bin/pypy%{pyversion}.debug
|
rm -f %{buildroot}%{_bindir}/*.debug
|
||||||
rm -f %{buildroot}%{pypyprefix}/bin/libpypy%{pyversion}-c.so.debug
|
|
||||||
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
@ -842,31 +852,32 @@ CheckPyPy pypy%{pyversion}-c
|
|||||||
|
|
||||||
%files libs
|
%files libs
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
|
%license %{_libdir}/pypy%{pyversion}/LICENSE
|
||||||
|
%license %{_libdir}/pypy%{pyversion}/_cffi_ssl/LICENSE
|
||||||
|
%license %{_libdir}/pypy%{pyversion}/cffi/_pycparser/ply/LICENSE
|
||||||
|
%license %{_libdir}/pypy%{pyversion}/hpy.dist-info/LICENSE
|
||||||
|
%{_libdir}/pypy%{pyversion}/
|
||||||
|
%if "%{_lib}" == "lib64"
|
||||||
|
%{_prefix}/lib/pypy%{pyversion}/
|
||||||
|
%endif
|
||||||
|
%{_libdir}/libpypy%{pyversion}-c.so.%{soname_version}
|
||||||
|
|
||||||
%dir %{pypyprefix}
|
|
||||||
%license %{pypyprefix}/LICENSE
|
|
||||||
%license %{pypyprefix}/%{_lib}/pypy%{pyversion}/_cffi_ssl/LICENSE
|
|
||||||
%license %{pypyprefix}/%{_lib}/pypy%{pyversion}/cffi/_pycparser/ply/LICENSE
|
|
||||||
%license %{pypyprefix}/%{_lib}/pypy%{pyversion}/hpy.dist-info/LICENSE
|
|
||||||
%{pypyprefix}/%{_lib}/pypy%{pyversion}/
|
|
||||||
%{pypyprefix}/site-packages/
|
|
||||||
%if %{with_emacs}
|
%if %{with_emacs}
|
||||||
%{_emacs_sitelispdir}/pypy%{pyversion}trace-mode.el
|
%{_emacs_sitelispdir}/pypy%{pyversion}trace-mode.el
|
||||||
%{_emacs_sitelispdir}/pypy%{pyversion}trace-mode.elc
|
%{_emacs_sitelispdir}/pypy%{pyversion}trace-mode.elc
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
%if %{with main_pypy3}
|
%{?with_main_pypy3:%{_bindir}/pypy3}
|
||||||
%{_bindir}/pypy3
|
|
||||||
%endif
|
|
||||||
%{_bindir}/pypy%{pyversion}
|
%{_bindir}/pypy%{pyversion}
|
||||||
%{pypyprefix}/bin/
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%dir %{pypy_include_dir}
|
%dir %{_includedir}/pypy%{pyversion}
|
||||||
%dir %{pypy_include_dir}/pypy%{pyversion}
|
%{_includedir}/pypy%{pyversion}/*.h
|
||||||
%{pypy_include_dir}/pypy%{pyversion}/*.h
|
%{_libdir}/libpypy%{pyversion}-c.so
|
||||||
%if %{with main_pypy3}
|
%if %{with main_pypy3}
|
||||||
%{_rpmconfigdir}/macros.d/macros.pypy3
|
%{_rpmconfigdir}/macros.d/macros.pypy3
|
||||||
%endif
|
%endif
|
||||||
@ -875,6 +886,7 @@ CheckPyPy pypy%{pyversion}-c
|
|||||||
%changelog
|
%changelog
|
||||||
* Wed Jan 26 2022 Miro Hrončok <mhroncok@redhat.com> - 7.3.8~rc1-1
|
* Wed Jan 26 2022 Miro Hrončok <mhroncok@redhat.com> - 7.3.8~rc1-1
|
||||||
- Update to 7.3.8rc1
|
- Update to 7.3.8rc1
|
||||||
|
- Move to a CPython-like installation layout
|
||||||
|
|
||||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 7.3.7-3
|
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 7.3.7-3
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||||
|
Loading…
x
Reference in New Issue
Block a user