mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 04:06:33 +02:00
Flatcar SDK: add experimental prefix builds
This change adds experimental prefix builds to the Flatcar SDK. Prefix builds use a custom sys prefix path and emerge all binaries and runtime dependencies into that prefix. This path can then e.g. be shipped as a portable sysext since it includes all dependencies, and has libraries at a custom path so these do not conflict with libraries on target systems. Prefix uses a staging environment (path) featuring a full-blown development environment, and a "final" environment for installing. Staging and final need to be created using setup_prefix first, which will also create an emerge wrapper to emerge ebuilds into staging and subsequently final. The root fs in final may then e.g. be used to create a distro independent, portable sysext. Co-authored-by: James Le Cuirot <chewi@gentoo.org> Co-authored-by: Jeremi Piotrowski <jpiotrowski@microsoft.com> Co-authored-by: Thilo Fromm <thilofromm@microsoft.com>
This commit is contained in:
parent
1f5658e7ad
commit
a4d4a94068
86
PREFIX.md
Normal file
86
PREFIX.md
Normal file
@ -0,0 +1,86 @@
|
||||
# Prefix - build portable, distro-independent apps
|
||||
|
||||
**!!! NOTE: Prefix support in the Flatcar SDK is EXPERIMENTAL at this time !!!**
|
||||
|
||||
## About
|
||||
|
||||
Prefix builds let you build and ship applications and all their dependencies in a custom directory.
|
||||
This custom directory is self-contained, all dependencies are included, and binaries are only linked agains libraries in the custom directory.
|
||||
The applications' root will be `/` - i.e. there's no need to `chroot` into the custom directory.
|
||||
|
||||
For example, applications built with the prefix `/usr/local/my-app` will ship
|
||||
* binaries in `/usr/local/my-app/bin`, `/usr/local/my-app/usr/bin`
|
||||
* libraries in `/usr/local/my-app/lib[64]`, `/usr/local/my-app/usr/lib[64]`
|
||||
|
||||
These binaries can be called directly, e.g. `/usr/local/my-app/usr/bin/myprog`.
|
||||
`myprog` will only use libraries from `/usr/local/my-app/lib` etc., not from `/`.
|
||||
|
||||
A good use case example for prefix builds is to create distro independent, portable [system extensions](https://www.flatcar.org/docs/latest/provisioning/sysext/).
|
||||
|
||||
## How does it do that?
|
||||
|
||||
Prefix uses a _staging environment_ to build binary packages, then installs these to a _final environment_.
|
||||
The _staging environment_ contains toolchains and all build tools required to create binary packages (a full `@system`).
|
||||
The _final environment_ only contains run-time dependencies.
|
||||
|
||||
Packages are built from ebuilds in coreos-overlay, portage-stable, and prefix-overlay.
|
||||
|
||||
A QoL `emerge` wrapper is included to install packages to the prefix.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Prefix utilises the [cross-boss](https://github.com/chewi/cross-boss) project to bootstrap prefixes and to build packages.
|
||||
For the time being the user is expected to provide cross-boss manually.
|
||||
By default, a `cross-boss` sub-directory is expected in the scripts repository root.
|
||||
Cross-boss location can be customised via the `--cross_boss_root` option to `setup_prefix`.
|
||||
|
||||
* Run `git clone https://github.com/chewi/cross-boss` in the scripts directory.
|
||||
|
||||
## Quick-start guide
|
||||
|
||||
For working with a prefix, you will need to agree on:
|
||||
1. A name for the prefix. Should be a single word and is used for generating protage wrappers.
|
||||
2. A prefix directory where applications and libraries will live on the target system.
|
||||
For use with systemd-sysext this should be a path below `/usr` or `/opt`.
|
||||
|
||||
For the purpose of the example below we'll use
|
||||
* `my-prefix` as the prefix name, and
|
||||
* `/usr/local/my-stuff` as prefix directory.
|
||||
|
||||
**TL;DR**
|
||||
* `./setup_prefix my-prefix /usr/local/my-stuff`
|
||||
* `emerge-prefix-my-stuff-amd64-usr python`
|
||||
will create a portable python installation in `__prefix__/amd64-usr/my-stuff/root`.
|
||||
|
||||
|
||||
**Step by step**
|
||||
|
||||
First we'll create the prefix.
|
||||
This will create "staging" and "final" roots and cross-compile a staging environment into "staging".
|
||||
* In the SDK container, run `./setup_prefix my-prefix /usr/local/my-stuff`
|
||||
* Go fetch a coffee, bootstrapping may take some 20-ish minutes to complete.
|
||||
|
||||
`setup_prefix` will default to `amd64-usr` architecture and will use
|
||||
* `/build/prefix-<arch>/my-stuff` for the staging environment
|
||||
* `__prefix__/<arch>/my-stuff` in the scripts directory as install root (aka "final")
|
||||
* It will also create an emerge wrapper `emerge-prefix-my-stuff-<arch>` to install packages.
|
||||
|
||||
Time to use the wrapper! Let's build a portable python sysext.
|
||||
* `emerge-prefix-my-stuff-amd64-usr python`
|
||||
|
||||
Now we'll use [bake.sh](https://raw.githubusercontent.com/flatcar/sysext-bakery/main/bake.sh) from Flatcar's [sysext-bakery](https://github.com/flatcar/sysext-bakery) to create a python sysext.
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/flatcar/sysext-bakery/main/bake.sh
|
||||
chmod 755 bake.sh
|
||||
cd __prefix__/amd64-usr/my-stuff
|
||||
sudo cp -R root python
|
||||
sudo ../../../bake.sh python
|
||||
```
|
||||
|
||||
On a Flatcar instance, we now copy the resulting `python.raw` to `/etc/extensions`.
|
||||
We merge with `systemd-sysext refresh`.
|
||||
Then we can run:
|
||||
* `/usr/local/my-stuff/usr/bin/python`
|
||||
|
||||
Note that this sysext can be used on any Linux distro that ships `systemd-sysext`.
|
||||
It is self-contained, there are no user space dependencies.
|
||||
217
build_library/prefix_util.sh
Normal file
217
build_library/prefix_util.sh
Normal file
@ -0,0 +1,217 @@
|
||||
# Copyright (c) 2023 The Flatcar Maintainers. All rights reserved.
|
||||
# Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
DEFAULT_STAGING_ROOT="/build/"
|
||||
|
||||
function lineprepend() {
|
||||
awk -v msg="$@" '{ print msg ": " $0}'
|
||||
}
|
||||
# --
|
||||
|
||||
function set_prefix_vars() {
|
||||
local name="${1}"
|
||||
local prefix="${2}"
|
||||
|
||||
EPREFIX="${prefix}"
|
||||
PREFIXNAME="${name}"
|
||||
STAGINGDIR="${FLAGS_staging_dir}"
|
||||
STAGINGROOT="${STAGINGDIR}/root"
|
||||
FINALDIR="${FLAGS_final_dir}"
|
||||
FINALROOT="${FINALDIR}/root"
|
||||
|
||||
CB_ROOT="${FLAGS_cross_boss_root}"
|
||||
|
||||
# the prefix profile enables unstable via MAKE_DEFAULTS; we don't want those.
|
||||
PREFIX_BOARD="${FLAGS_board}"
|
||||
case "${PREFIX_BOARD}" in
|
||||
amd64-usr)
|
||||
PREFIX_CHOST="x86_64-cros-linux-gnu"
|
||||
PREFIX_KEYWORDS="amd64 -~amd64"
|
||||
;;
|
||||
arm64-usr)
|
||||
PREFIX_CHOST="aarch64-cros-linux-gnu"
|
||||
PREFIX_KEYWORDS="arm64 -~arm64 -multilib"
|
||||
;;
|
||||
esac
|
||||
|
||||
export EPREFIX PREFIXNAME STAGINGDIR STAGINGROOT FINALDIR FINALROOT CB_ROOT \
|
||||
PREFIX_CHOST PREFIX_KEYWORDS PREFIX_BOARD
|
||||
}
|
||||
# --
|
||||
|
||||
function install_prereqs() {
|
||||
# Make sure cross-boss prerequisites are installed in the SDK
|
||||
local prefix_repo="${1}"
|
||||
|
||||
sudo emerge --newuse sys-apps/bubblewrap
|
||||
sudo emerge --newuse -1 ">=dev-python/gpep517-15"
|
||||
|
||||
# HACK ALERT: needed for cb-bootstrap to build the initial toolchain in staging.
|
||||
# cb-bootstrap should be ported to use the prefix repos.conf instead.
|
||||
sudo cp -r "${prefix_repo}/skel/etc/portage/repos.conf" /usr/x86_64-cros-linux-gnu/etc/portage/
|
||||
sudo cp -r "${prefix_repo}/skel/etc/portage/repos.conf" /usr/aarch64-cros-linux-gnu/etc/portage/
|
||||
}
|
||||
# --
|
||||
|
||||
function setup_prefix_dirs() {
|
||||
local prefix_repo="${1}"
|
||||
sudo mkdir -v -p \
|
||||
"${STAGINGDIR}/logs" \
|
||||
"${STAGINGDIR}/pkgs" \
|
||||
"${STAGINGDIR}/tmp" \
|
||||
"${STAGINGROOT}${EPREFIX}/etc" \
|
||||
"${FINALDIR}/logs" \
|
||||
"${FINALDIR}/tmp" \
|
||||
"${FINALROOT}${EPREFIX}/etc"
|
||||
|
||||
sudo cp -vR "${prefix_repo}/skel/etc/portage" "${STAGINGROOT}${EPREFIX}/etc/"
|
||||
sudo cp -vR "${prefix_repo}/skel/etc/portage" "${FINALROOT}${EPREFIX}/etc/"
|
||||
|
||||
local profile="/mnt/host/source/src/third_party/portage-stable/profiles/default/linux"
|
||||
case "${PREFIX_BOARD}" in
|
||||
amd64-usr) profile="${profile}/amd64/17.1/no-multilib/prefix/kernel-3.2+";;
|
||||
arm64-usr) profile="${profile}/arm64/17.0/prefix/kernel-3.2+";;
|
||||
esac
|
||||
|
||||
sudo ln -s "${profile}" "${STAGINGROOT}${EPREFIX}/etc/portage/make.profile"
|
||||
sudo ln -s "${profile}" "${FINALROOT}${EPREFIX}/etc/portage/make.profile"
|
||||
}
|
||||
# --
|
||||
|
||||
function extract_gcc_libs() {
|
||||
# GCC libs aren't available in a separate package but a full GCC install would make final too big
|
||||
# TODO: the below is effectively a copy of build_library/prod_image_util.sh::extract_prod_gcc()
|
||||
# and should eventually be reconciled.
|
||||
gcc_ver="$(sudo -E PORTAGE_CONFIGROOT="${STAGINGROOT}${EPREFIX}" \
|
||||
portageq best_visible "${STAGINGROOT}${EPREFIX}" installed sys-devel/gcc)"
|
||||
pkgdir="$(sudo -E PORTAGE_CONFIGROOT="${STAGINGROOT}${EPREFIX}" portageq pkgdir)"
|
||||
qtbz2 -O -t "$pkgdir/$gcc_ver".tbz2 \
|
||||
| sudo tar -v -C "${FINALROOT}" -xj \
|
||||
--transform "s#.${EPREFIX}/usr/lib/.*/#.${EPREFIX}/usr/lib64/#" \
|
||||
--wildcards ".${EPREFIX}/usr/lib/gcc/*.so*"
|
||||
}
|
||||
# --
|
||||
|
||||
function create_make_conf() {
|
||||
local which="${1}" \
|
||||
filepath \
|
||||
dir \
|
||||
portage_profile \
|
||||
emerge_opts
|
||||
|
||||
case "${which}" in
|
||||
staging)
|
||||
filepath="${STAGINGROOT}${EPREFIX}/etc/portage/make.conf"
|
||||
dir="${STAGINGDIR}"
|
||||
emerge_opts="--buildpkg"
|
||||
;;
|
||||
final)
|
||||
filepath="${FINALROOT}${EPREFIX}/etc/portage/make.conf"
|
||||
dir="${FINALDIR}"
|
||||
emerge_opts="--root-deps=rdeps --usepkgonly"
|
||||
;;
|
||||
esac
|
||||
|
||||
sudo_clobber "${filepath}" <<EOF
|
||||
DISTDIR="/mnt/host/source/.cache/distfiles"
|
||||
PKGDIR="${STAGINGDIR}/pkgs"
|
||||
PORT_LOGDIR="${dir}/logs"
|
||||
PORTAGE_TMPDIR="${dir}/tmp"
|
||||
PORTAGE_BINHOST=""
|
||||
PORTAGE_USERNAME="sdk"
|
||||
MAKEOPTS="--jobs=4"
|
||||
CHOST="${PREFIX_CHOST}"
|
||||
|
||||
ACCEPT_KEYWORDS="${PREFIX_KEYWORDS}"
|
||||
|
||||
EMERGE_DEFAULT_OPTS="${emerge_opts}"
|
||||
|
||||
USE="
|
||||
-desktop
|
||||
-ensurepip
|
||||
-installkernel
|
||||
-llvm
|
||||
-nls
|
||||
-openmp
|
||||
-udev
|
||||
-wayland
|
||||
-X
|
||||
"
|
||||
EOF
|
||||
}
|
||||
# --
|
||||
|
||||
function emerge_name() {
|
||||
local path=""
|
||||
if [ "${1:-}" = "with-path" ] ; then
|
||||
path="/usr/local/bin/"
|
||||
fi
|
||||
|
||||
echo "${path}emerge-prefix-${PREFIXNAME}-${PREFIX_BOARD}"
|
||||
}
|
||||
# --
|
||||
|
||||
function create_emerge_wrapper() {
|
||||
local filename="$(emerge_name with-path)"
|
||||
sudo_clobber "${filename}" <<EOF
|
||||
#!/bin/bash
|
||||
|
||||
# emerge comfort wrapper for emerging prefix packages.
|
||||
# The wrapper will build packages and dependencies in staging
|
||||
# and then install binpkgs in prefix.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PREFIXNAME="${PREFIXNAME}"
|
||||
EPREFIX="${EPREFIX}"
|
||||
STAGINGROOT="${STAGINGROOT}"
|
||||
FINALROOT="${FINALROOT}"
|
||||
CB_ROOT="${CB_ROOT}"
|
||||
|
||||
if [ "\${1}" = "--help" ] ; then
|
||||
echo "\$0 : emerge prefix wrapper for prefix '\${PREFIXNAME}'"
|
||||
echo "Usage:"
|
||||
echo " \$0 [--install|--stage] <emerge-opts>"
|
||||
echo " Builds packages in prefix' staging and installs w/ runtime dependencies"
|
||||
echo " to prefix' final root."
|
||||
echo " --stage Build binpkg in staging but don't install."
|
||||
echo " --install Skip build, just install. Binpkg must exist in staging."
|
||||
echo
|
||||
echo " Prefix configuration:"
|
||||
echo " PREFIXNAME=\"\${PREFIXNAME}\""
|
||||
echo " EPREFIX=\"\${EPREFIX}\""
|
||||
echo " STAGINGROOT=\"\${STAGINGROOT}\""
|
||||
echo " FINALROOT=\"\${FINALROOT}\""
|
||||
echo " CB_ROOT="\${CB_ROOT}""
|
||||
exit
|
||||
fi
|
||||
|
||||
skip_build="false"
|
||||
skip_install="false"
|
||||
|
||||
case "\${1}" in
|
||||
--install) skip_build="true"; shift;;
|
||||
--stage) skip_install="true"; shift;;
|
||||
esac
|
||||
|
||||
if [ "\${skip_build}" = "true" ] ; then
|
||||
echo "Skipping build into staging as requested."
|
||||
echo "NOTE that install into final will fail if binpkgs are missing."
|
||||
else
|
||||
echo "Building in staging..."
|
||||
sudo -E EPREFIX=\${EPREFIX} \${CB_ROOT}/bin/cb-emerge \${STAGINGROOT} "\$@"
|
||||
fi
|
||||
|
||||
if [ "\${skip_install}" = "true" ] ; then
|
||||
echo "Skipping install into final as requested."
|
||||
else
|
||||
echo "Installing..."
|
||||
sudo -E EPREFIX="\${EPREFIX}" \\
|
||||
ROOT="\${FINALROOT}" \\
|
||||
PORTAGE_CONFIGROOT="\${FINALROOT}\${EPREFIX}" emerge "\$@"
|
||||
fi
|
||||
EOF
|
||||
|
||||
sudo chmod 755 "${filename}"
|
||||
}
|
||||
# --
|
||||
@ -61,4 +61,9 @@ DEPEND="${DEPEND}
|
||||
)
|
||||
sys-devel/m4"
|
||||
|
||||
DEPEND="${DEPEND}
|
||||
sys-apps/bubblewrap
|
||||
>=dev-python/gpep517-15
|
||||
"
|
||||
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
@ -447,6 +447,10 @@ setup_flags() {
|
||||
# https://sourceware.org/PR27837
|
||||
filter-ldflags '-Wl,--relax'
|
||||
|
||||
# Flag added for cross-prefix, but causes ldconfig to segfault. Not needed
|
||||
# anyway because glibc already handles this by itself.
|
||||
filter-ldflags '-Wl,--dynamic-linker=*'
|
||||
|
||||
# some weird software relies on sysv hashes in glibc, bug 863863, bug 864100
|
||||
# we have to do that here already so mips can filter it out again :P
|
||||
if use hash-sysv-compat ; then
|
||||
|
||||
@ -21,7 +21,7 @@ SRC_URI="
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
|
||||
RDEPEND="
|
||||
>=dev-python/installer-0.5.0[${PYTHON_USEDEP}]
|
||||
|
||||
1
sdk_container/src/third_party/portage-stable/sys-apps/bubblewrap/Manifest
vendored
Normal file
1
sdk_container/src/third_party/portage-stable/sys-apps/bubblewrap/Manifest
vendored
Normal file
@ -0,0 +1 @@
|
||||
DIST bubblewrap-0.8.0.tar.xz 149088 BLAKE2B 5853cf42a7ab653540ec5134866c6f2459aa101e9eea724a4f283405cbcae2beb3551b7c1a7aa93d82016d4eb0d12f9c97c47df53a6d9b589db40483696253de SHA512 1cbc33f3c834ff83f4c1808d3ec2555921277d495f903ad152cbd5065a6e100c5420b4b5c62386bb2d303eb1734e074b09625013e55e3bd8631cfb3582d70e1c
|
||||
58
sdk_container/src/third_party/portage-stable/sys-apps/bubblewrap/bubblewrap-0.8.0.ebuild
vendored
Normal file
58
sdk_container/src/third_party/portage-stable/sys-apps/bubblewrap/bubblewrap-0.8.0.ebuild
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit linux-info meson
|
||||
|
||||
DESCRIPTION="Unprivileged sandboxing tool, namespaces-powered chroot-like solution"
|
||||
HOMEPAGE="https://github.com/containers/bubblewrap/"
|
||||
SRC_URI="https://github.com/containers/${PN}/releases/download/v${PV}/${P}.tar.xz"
|
||||
|
||||
LICENSE="LGPL-2+"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv x86"
|
||||
IUSE="selinux suid"
|
||||
|
||||
RDEPEND="
|
||||
sys-libs/libseccomp
|
||||
sys-libs/libcap
|
||||
selinux? ( >=sys-libs/libselinux-2.1.9 )
|
||||
"
|
||||
DEPEND="${RDEPEND}"
|
||||
BDEPEND="
|
||||
app-text/docbook-xml-dtd:4.3
|
||||
app-text/docbook-xsl-stylesheets
|
||||
dev-libs/libxslt
|
||||
virtual/pkgconfig
|
||||
"
|
||||
|
||||
# tests require root privileges
|
||||
RESTRICT="test"
|
||||
|
||||
pkg_setup() {
|
||||
if [[ ${MERGE_TYPE} != buildonly ]]; then
|
||||
CONFIG_CHECK="~UTS_NS ~IPC_NS ~USER_NS ~PID_NS ~NET_NS"
|
||||
linux-info_pkg_setup
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local emesonargs=(
|
||||
-Dbash_completion=enabled
|
||||
-Dman=enabled
|
||||
-Dtests=false
|
||||
-Dzsh_completion=enabled
|
||||
$(meson_feature selinux)
|
||||
)
|
||||
|
||||
meson_src_configure
|
||||
}
|
||||
|
||||
src_install() {
|
||||
meson_src_install
|
||||
|
||||
if use suid; then
|
||||
chmod u+s "${ED}"/usr/bin/bwrap
|
||||
fi
|
||||
}
|
||||
11
sdk_container/src/third_party/portage-stable/sys-apps/bubblewrap/metadata.xml
vendored
Normal file
11
sdk_container/src/third_party/portage-stable/sys-apps/bubblewrap/metadata.xml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>gnome@gentoo.org</email>
|
||||
<name>Gentoo GNOME Desktop</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">containers/bubblewrap</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
@ -1,17 +0,0 @@
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
DESCRIPTION="Virtual to select between different tmpfiles.d handlers"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||
|
||||
RDEPEND="
|
||||
!prefix-guest? (
|
||||
|| (
|
||||
sys-apps/systemd-tmpfiles
|
||||
sys-apps/opentmpfiles
|
||||
sys-apps/systemd
|
||||
)
|
||||
)"
|
||||
16
sdk_container/src/third_party/portage-stable/virtual/tmpfiles/tmpfiles-0-r5.ebuild
vendored
Normal file
16
sdk_container/src/third_party/portage-stable/virtual/tmpfiles/tmpfiles-0-r5.ebuild
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DESCRIPTION="Virtual to select between different tmpfiles.d handlers"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
IUSE="systemd"
|
||||
|
||||
RDEPEND="
|
||||
!prefix-guest? (
|
||||
systemd? ( sys-apps/systemd )
|
||||
!systemd? ( sys-apps/systemd-utils[tmpfiles] )
|
||||
)
|
||||
"
|
||||
3
sdk_container/src/third_party/prefix-overlay/app-misc/ca-certificates/Manifest
vendored
Normal file
3
sdk_container/src/third_party/prefix-overlay/app-misc/ca-certificates/Manifest
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
DIST ca-certificates_20230311.tar.xz 257772 BLAKE2B b807a6415126afdc11896efea8e6509d7ad58b26bc8562b276e93176e80bb8b467a5bd2ba948d3dbbeaf0e4477d93f3ea2b99d3186e856fb47d1033cb779d560 SHA512 00571bdc87897813fd7dbe024f3a186cfc9f0d4f55e92545a90888c9e5282f99cb8d75b5932c034731b911bf27a9b38fd7d062dd511eb1152acf8b2811490fa7
|
||||
DIST nss-3.93.tar.gz 72281331 BLAKE2B 99e50f450a451f2b0bc0aad9b0fba405c987d88546d4aad6c490cb43dc274f23eb99d03d5fa8cf7ef16585abebfdae942fe1092d3f1c86816ba35e16ed3d490f SHA512 d96f13a70e825b39efadfe7c973c24c1e5ad43319bd813599010383e2b8434181f53489672f68fe79e2cb0c4d4ea0088499e588c3524eccf9298aafc57b94951
|
||||
DIST nss-cacert-class1-class3-r2.patch 21925 BLAKE2B 7627ff9a09f084c19d72d0490676865e3cab3ca7c920ae1ce4bea2db664f37fd0aa84fcda919809a516891ab2a62e2e7a43a9d6ada4c231adfe4c216525fac7d SHA512 1ce6ff9ab310aaca9005eafb461338b291df8523cc7044e096cd75774ce746c26eed19ec6bb2643c6c67f94650f2f309463492d80a90568f38ce2557f8ada2f4
|
||||
@ -0,0 +1,206 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# The Debian ca-certificates package merely takes the CA database as it exists
|
||||
# in the nss package and repackages it for use by openssl.
|
||||
#
|
||||
# The issue with using the compiled debs directly is two fold:
|
||||
# - they do not update frequently enough for us to rely on them
|
||||
# - they pull the CA database from nss tip of tree rather than the release
|
||||
#
|
||||
# So we take the Debian source tools and combine them with the latest nss
|
||||
# release to produce (largely) the same end result. The difference is that
|
||||
# now we know our cert database is kept in sync with nss and, if need be,
|
||||
# can be sync with nss tip of tree more frequently to respond to bugs.
|
||||
|
||||
# Where possible, bump to stable/LTS releases of NSS for the last part
|
||||
# of the version (when not using a pure Debian release).
|
||||
|
||||
# When triaging user reports, refer to our wiki for tips:
|
||||
# https://wiki.gentoo.org/wiki/Certificates#Debugging_certificate_issues
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
|
||||
inherit python-any-r1
|
||||
|
||||
if [[ ${PV} == *.* ]] ; then
|
||||
# Compile from source ourselves.
|
||||
PRECOMPILED=false
|
||||
|
||||
DEB_VER=$(ver_cut 1)
|
||||
NSS_VER=$(ver_cut 2-)
|
||||
RTM_NAME="NSS_${NSS_VER//./_}_RTM"
|
||||
else
|
||||
# Debian precompiled version.
|
||||
PRECOMPILED=true
|
||||
inherit unpacker
|
||||
fi
|
||||
|
||||
DESCRIPTION="Common CA Certificates PEM files"
|
||||
HOMEPAGE="https://packages.debian.org/sid/ca-certificates"
|
||||
NMU_PR=""
|
||||
if ${PRECOMPILED} ; then
|
||||
SRC_URI="mirror://debian/pool/main/c/${PN}/${PN}_${PV}${NMU_PR:++nmu}${NMU_PR}_all.deb"
|
||||
else
|
||||
SRC_URI="
|
||||
mirror://debian/pool/main/c/${PN}/${PN}_${DEB_VER}${NMU_PR:++nmu}${NMU_PR}.tar.xz
|
||||
https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/nss-${NSS_VER}.tar.gz
|
||||
cacert? (
|
||||
https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r2.patch
|
||||
)
|
||||
"
|
||||
fi
|
||||
|
||||
LICENSE="MPL-1.1"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
IUSE=""
|
||||
${PRECOMPILED} || IUSE+=" cacert"
|
||||
|
||||
# c_rehash: we run `c_rehash`
|
||||
# debianutils: we run `run-parts`
|
||||
CDEPEND="
|
||||
sys-apps/debianutils"
|
||||
|
||||
BDEPEND="${CDEPEND}"
|
||||
if ! ${PRECOMPILED} ; then
|
||||
BDEPEND+=" ${PYTHON_DEPS}"
|
||||
fi
|
||||
|
||||
DEPEND=""
|
||||
if ${PRECOMPILED} ; then
|
||||
DEPEND+=" !<sys-apps/portage-2.1.10.41"
|
||||
fi
|
||||
|
||||
RDEPEND="${CDEPEND}
|
||||
${DEPEND}"
|
||||
|
||||
S="${WORKDIR}"
|
||||
|
||||
pkg_setup() {
|
||||
# For the conversion to having it in CONFIG_PROTECT_MASK,
|
||||
# we need to tell users about it once manually first.
|
||||
[[ -f "${EPREFIX}"/etc/env.d/98ca-certificates ]] \
|
||||
|| ewarn "You should run update-ca-certificates manually after etc-update"
|
||||
|
||||
if ! ${PRECOMPILED} ; then
|
||||
python-any-r1_pkg_setup
|
||||
fi
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if ! ${PRECOMPILED} ; then
|
||||
default
|
||||
# Initial 20200601 deb release had bad naming inside the debian source tarball.
|
||||
DEB_S="${WORKDIR}/${PN}-${DEB_VER}"
|
||||
DEB_BAD_S="${WORKDIR}/work"
|
||||
if [[ -d "${DEB_BAD_S}" ]] && [[ ! -d "${DEB_S}" ]] ; then
|
||||
mv "${DEB_BAD_S}" "${DEB_S}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Do all the work in the image subdir to avoid conflicting with source
|
||||
# dirs in ${WORKDIR}. Need to perform everything in the offset #381937
|
||||
mkdir -p "image/${EPREFIX}" || die
|
||||
cd "image/${EPREFIX}" || die
|
||||
|
||||
${PRECOMPILED} && unpacker_src_unpack
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
cd "image/${EPREFIX}" || die
|
||||
|
||||
if ! ${PRECOMPILED} ; then
|
||||
mkdir -p usr/sbin || die
|
||||
cp -p "${S}"/${PN}/sbin/update-ca-certificates \
|
||||
usr/sbin/ || die
|
||||
|
||||
if use cacert ; then
|
||||
pushd "${S}"/nss-${NSS_VER} >/dev/null || die
|
||||
eapply "${DISTDIR}"/nss-cacert-class1-class3-r2.patch
|
||||
popd >/dev/null || die
|
||||
fi
|
||||
fi
|
||||
|
||||
default
|
||||
eapply -p2 "${FILESDIR}"/${PN}-20150426-root.patch
|
||||
|
||||
pushd "${S}/${PN}" >/dev/null || die
|
||||
# We patch out the dep on cryptography as it's not particularly useful
|
||||
# for us. Please see the discussion in bug #821706. Not to be removed lightly!
|
||||
eapply "${FILESDIR}"/${PN}-20230311.3.89-no-cryptography.patch
|
||||
popd >/dev/null || die
|
||||
|
||||
local relp=$(echo "${EPREFIX}" | sed -e 's:[^/]\+:..:g')
|
||||
sed -i \
|
||||
-e '/="$ROOT/s:ROOT:ROOT'"${EPREFIX}"':' \
|
||||
-e '/RELPATH="\.\./s:"$:'"${relp}"'":' \
|
||||
usr/sbin/update-ca-certificates || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cd "image/${EPREFIX}" || die
|
||||
|
||||
if ! ${PRECOMPILED} ; then
|
||||
local d="${S}/${PN}/mozilla" c="usr/share/${PN}"
|
||||
|
||||
# Grab the database from the nss sources.
|
||||
cp "${S}"/nss-${NSS_VER}/nss/lib/ckfw/builtins/{certdata.txt,nssckbi.h} "${d}" || die
|
||||
emake -C "${d}"
|
||||
|
||||
# Now move the files to the same places that the precompiled would.
|
||||
mkdir -p etc/ssl/certs \
|
||||
etc/ca-certificates/update.d \
|
||||
"${c}"/mozilla \
|
||||
|| die
|
||||
if use cacert ; then
|
||||
mkdir -p "${c}"/cacert.org || die
|
||||
mv "${d}"/CA_Cert_Signing_Authority.crt \
|
||||
"${c}"/cacert.org/cacert.org_class1.crt || die
|
||||
mv "${d}"/CAcert_Class_3_Root.crt \
|
||||
"${c}"/cacert.org/cacert.org_class3.crt || die
|
||||
fi
|
||||
mv "${d}"/*.crt "${c}"/mozilla/ || die
|
||||
else
|
||||
mv usr/share/doc/{ca-certificates,${PF}} || die
|
||||
fi
|
||||
|
||||
(
|
||||
echo "# Automatically generated by ${CATEGORY}/${PF}"
|
||||
echo "# $(date -u)"
|
||||
echo "# Do not edit."
|
||||
cd "${c}" || die
|
||||
find * -name '*.crt' | LC_ALL=C sort
|
||||
) > etc/ca-certificates.conf
|
||||
|
||||
sh usr/sbin/update-ca-certificates --root "${S}/image" || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cp -pPR image/* "${D}"/ || die
|
||||
if ! ${PRECOMPILED} ; then
|
||||
cd ${PN} || die
|
||||
doman sbin/*.8
|
||||
dodoc debian/README.* examples/ca-certificates-local/README
|
||||
fi
|
||||
|
||||
echo 'CONFIG_PROTECT_MASK="/etc/ca-certificates.conf"' > 98ca-certificates || die
|
||||
doenvd 98ca-certificates
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
if [[ -d "${EROOT}/usr/local/share/ca-certificates" ]] ; then
|
||||
# If the user has local certs, we need to rebuild again
|
||||
# to include their stuff in the db.
|
||||
# However it's too overzealous when the user has custom certs in place.
|
||||
# --fresh is to clean up dangling symlinks
|
||||
"${EROOT}"/usr/sbin/update-ca-certificates --root "${ROOT}"
|
||||
fi
|
||||
|
||||
if [[ -n "$(find -L "${EROOT}"/etc/ssl/certs/ -type l)" ]] ; then
|
||||
ewarn "Removing the following broken symlinks:"
|
||||
ewarn "$(find -L "${EROOT}"/etc/ssl/certs/ -type l -printf '%p -> %l\n' -delete)"
|
||||
fi
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
add a --root option so we can generate with DESTDIR installs
|
||||
|
||||
--- a/image/usr/sbin/update-ca-certificates
|
||||
+++ b/image/usr/sbin/update-ca-certificates
|
||||
@@ -30,6 +30,8 @@ LOCALCERTSDIR=/usr/local/share/ca-certificates
|
||||
CERTBUNDLE=ca-certificates.crt
|
||||
ETCCERTSDIR=/etc/ssl/certs
|
||||
HOOKSDIR=/etc/ca-certificates/update.d
|
||||
+ROOT=""
|
||||
+RELPATH=""
|
||||
|
||||
while [ $# -gt 0 ];
|
||||
do
|
||||
@@ -59,13 +61,25 @@ do
|
||||
--hooksdir)
|
||||
shift
|
||||
HOOKSDIR="$1";;
|
||||
+ --root|-r)
|
||||
+ shift
|
||||
+ # Needed as c_rehash wants to read the files directly.
|
||||
+ # This gets us from $CERTSCONF to $CERTSDIR.
|
||||
+ RELPATH="../../.."
|
||||
+ ROOT=$(readlink -f "$1");;
|
||||
--help|-h|*)
|
||||
- echo "$0: [--verbose] [--fresh]"
|
||||
+ echo "$0: [--verbose] [--fresh] [--root <dir>]"
|
||||
exit;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
+CERTSCONF="$ROOT$CERTSCONF"
|
||||
+CERTSDIR="$ROOT$CERTSDIR"
|
||||
+LOCALCERTSDIR="$ROOT$LOCALCERTSDIR"
|
||||
+ETCCERTSDIR="$ROOT$ETCCERTSDIR"
|
||||
+HOOKSDIR="$ROOT$HOOKSDIR"
|
||||
+
|
||||
if [ ! -s "$CERTSCONF" ]
|
||||
then
|
||||
fresh=1
|
||||
@@ -94,7 +107,7 @@ add() {
|
||||
-e 's/,/_/g').pem"
|
||||
if ! test -e "$PEM" || [ "$(readlink "$PEM")" != "$CERT" ]
|
||||
then
|
||||
- ln -sf "$CERT" "$PEM"
|
||||
+ ln -sf "${RELPATH}${CERT#$ROOT}" "$PEM"
|
||||
echo "+$PEM" >> "$ADDED"
|
||||
fi
|
||||
# Add trailing newline to certificate, if it is missing (#635570)
|
||||
@ -0,0 +1,25 @@
|
||||
Remove the dependency on non-portable dev-python/cryptography.
|
||||
https://bugs.gentoo.org/821706#c4 by Alex Xu
|
||||
--- a/mozilla/certdata2pem.py
|
||||
+++ b/mozilla/certdata2pem.py
|
||||
@@ -28,7 +28,6 @@ import sys
|
||||
import textwrap
|
||||
import io
|
||||
|
||||
-from cryptography import x509
|
||||
|
||||
|
||||
objects = []
|
||||
@@ -122,12 +121,6 @@ for obj in objects:
|
||||
if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
|
||||
continue
|
||||
|
||||
- cert = x509.load_der_x509_certificate(bytes(obj['CKA_VALUE']))
|
||||
- if cert.not_valid_after < datetime.datetime.utcnow():
|
||||
- print('!'*74)
|
||||
- print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
|
||||
- print('!'*74)
|
||||
-
|
||||
bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
|
||||
.replace(' ', '_')\
|
||||
.replace('(', '=')\
|
||||
13
sdk_container/src/third_party/prefix-overlay/app-misc/ca-certificates/metadata.xml
vendored
Normal file
13
sdk_container/src/third_party/prefix-overlay/app-misc/ca-certificates/metadata.xml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>base-system@gentoo.org</email>
|
||||
<name>Gentoo Base System</name>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="cacert">
|
||||
Include root/class3 certs from CAcert (https://www.cacert.org/)
|
||||
</flag>
|
||||
</use>
|
||||
</pkgmetadata>
|
||||
25
sdk_container/src/third_party/prefix-overlay/dev-lang/python/Manifest
vendored
Normal file
25
sdk_container/src/third_party/prefix-overlay/dev-lang/python/Manifest
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
DIST Python-2.7.18.tar.xz 12854736 BLAKE2B 060a621c91dd8e3d321aec99d44c17aa67381998256a1a002d316b38288349884d5960de35c49352d03129ed0bae599e641ec2225898158ebce50a7a2fd74d2c SHA512 a7bb62b51f48ff0b6df0b18f5b0312a523e3110f49c3237936bfe56ed0e26838c0274ff5401bda6fc21bf24337477ccac49e8026c5d651e4b4cafb5eb5086f6c
|
||||
DIST Python-2.7.18.tar.xz.asc 833 BLAKE2B 1d98770e46171971fb99994508d238c01d2755281d2f94353314014d9e83e0ec5f0b3e3950ea1fdf5fce9ba6b8f55312355845c2a3fc4291c27ee56fe6215448 SHA512 c2a5f5a52f47dec52460ad3275758d4e5de6e7075c3def4353c988d74d563a39b42cae2d5eb24e2a23a6247cef69100f91620b11a49c2359fbf99b203c9cbda8
|
||||
DIST Python-3.10.13.tar.xz 19663088 BLAKE2B d9a8edf89d0ccd665fd5ed444a144af240e078fcab1876fea8b44586c23651a08cf5833fc54c39e8471fd9e66ea0ded11fcaa5d215bc025acaf4504a15c5846d SHA512 7579772e501486b2b07f78142082dee1e99c7643640098860ac0cf2ca87daf7588b0c00b1db1960146b37f56a6ed98fd08297c25c9a19b612cf6e6a258984da8
|
||||
DIST Python-3.10.13.tar.xz.asc 833 BLAKE2B b00222b30a6701e77c11c6019e2240be7cf42f2b4e558c03f7a058664d242a00665fbc52fdf03106e84c75f49b51b705d8acd1f381d1f41ada67c4647652ef4c SHA512 3083e66f8d26128302dc77a0c6ba3bfefc4229928a1bbd06460f2fec2421188bd30d493e3bce138cde1fed1df206e1dda04912b9f43a0b81229f1e69135e3a7f
|
||||
DIST Python-3.11.5.tar.xz 20053580 BLAKE2B 3b85f2d9d32787b0500abeec4211032bb147bd991f1a865ff3d13350f6beddef8051ebdda21e130cbf094e6546b31ae43d827840735ce245f462feea6868e0b2 SHA512 93fa640bedcea449060caac8aa691aa315a19f172fd9f0422183d17749c3512d4ecac60e7599f9ef14e3cdb3c8b4b060e484c9061b1e7ee8d958200d6041e408
|
||||
DIST Python-3.11.5.tar.xz.asc 833 BLAKE2B e3c277f30203b5a0253aa1a41b8754bce7c00b54f0563e2d178c8fd264925a1b308ed84a875faeeae18405c419341ee286ea4ddaff93ce1e59b896daaf805e6e SHA512 5a8e1b1cabe89de03c050d581bbd3ec917d93ec943b2e8241db05c245809cf80294022c4cfc1bea3b90aa0570176109aac90455057256c025e2596aa136375fc
|
||||
DIST Python-3.12.0b4.tar.xz 20244176 BLAKE2B 6f1d199fcce07b5ca4fbf5a24b382aac2af793c6f43346708d984b20422a2f9ac4e6bc352e3c008e7815083e06c4b69e36c1a3ea94a8e3c398a1d2188595a0f5 SHA512 942a47d12c51e13939c815de908e766b818e4862c536153ae94b8032b5263b0cc23bda9a75fe60f48ee400a4ce405e2583da684847623cf552c20efcbc663469
|
||||
DIST Python-3.12.0b4.tar.xz.asc 963 BLAKE2B 3ed0c47bd892791325598f20578bca72d8ffce9421c80d35c12b2a0d23611dfc329a2016f332950910990fcd9bd55e90753f547ca8a54dde039618b43c71a6b4 SHA512 ab2684cc4044bf39c8064ec7d41dc2d04f01c9bccf5404ec1fffbce89a3a831b4d7dac3613ef892988a16839aeb13cbc03a085fae5c086ee19d3bfb925dff6c0
|
||||
DIST Python-3.12.0rc1.tar.xz 20285264 BLAKE2B 2cbf77e9405426c58714506c14281a941b4006219215d990f79672719eaa4f26c7b6356a1096400aae84d682c5a9622dfd8ea90dc635312efba6cd8c730d3f37 SHA512 67c38317e34aa1c4ced831cf50f74de21f9e40ce708397be3682d0c1012c3e0b2617d77525dc6c3246725dfc11b5448792adc0ef2e3741e818776bc5fba0c50d
|
||||
DIST Python-3.12.0rc1.tar.xz.asc 963 BLAKE2B 852298edf878c891e53e317d21a31a5fbd6876aa958aae715a77c0bd27a508844964ad69280d15d59428375a14a8f97c24ce9ef64ab101020bd541d5125e8676 SHA512 319ce9c5d935dcbb5ea12468c5127b4541c1b8af443aef210bdd26030fc3eee062639601fd72e70428cc18179fafb33ad2527a0c262650c4da678544fd06d0b9
|
||||
DIST Python-3.12.0rc2.tar.xz 20563748 BLAKE2B a6d474cab25fc50878539c214e5f80be59e4f5ab8a69432d4757db6add6ee9f5c04c08be01818b6bc4c6d4eb338eedb6ed350005e07b9af668c573bf10891146 SHA512 102fbce1db186e95df586eeb56e7a3c2c9dee388670aef9c9caf4eb652cad528291601186c8dee5653f064b2f606ccac37bcb81d5afe77853db768bc4291f8a4
|
||||
DIST Python-3.12.0rc2.tar.xz.asc 963 BLAKE2B 6746c9455e292c43d2984a81879145302f3cfe45f447ea586387e5d70f713a2d36fa7055b62f00dbd2ab277ce7f0cc90b66d76a6bcc12df7e56cea67413deffc SHA512 e5cd0952fe20f7b5022be3bc057eb83ae64304640f0761bbf08382be733ed7e6ed75c113b844e827903634c701641644298f26e2d6624857760eda1908382428
|
||||
DIST Python-3.8.18.tar.xz 20696952 BLAKE2B 45be712aeef8bb3ba04aa2bd7d0282aa5f817327749c620ede18ee307fcb432540db9062a8186b08b49467515c74f01eb6fa739f366cca76dfadedcb22858429 SHA512 0be1d85cafade25e99b8277ba51d7b9b3a3d2dbbcc52fd0d1c633c47982e5dd87fd7a0ca180a78d7801d79a8ecafa79bd9d501d544cd7b6da53ea409daa70adf
|
||||
DIST Python-3.8.18.tar.xz.asc 833 BLAKE2B bc4e989748d53c6be7040e78d9f1852227c6a76f4c63a68824f5139defd51d1ea7988df01f961ff5c77382e156ef45fead2bb97bddbb38b208ddfa9c709e4f34 SHA512 99a0fd74fe19144819fd9522836474e10c1593787eb464694bdc6224b2d4a9331e31d2ecafc35c2bbb9bf67f20186295b28f9374c1fdcd05ac13f5f400219489
|
||||
DIST Python-3.9.18.tar.xz 19673928 BLAKE2B 97da9bedaf29101e5df82199ac3ee12f1da74d5cc89de21ff1510c3f6d34d7f9194489e79855f1ab3c6f26768738e784cb7231c1a692fa746edd21d35558bc4e SHA512 aab155aca757d298394eddb91ff9a8f239665bd46feb495c6b6f735bbcb7489c05c858cc4cd08f1575c24f293b33492d763e9a140d92f0b2b0cc81a165a677c7
|
||||
DIST Python-3.9.18.tar.xz.asc 833 BLAKE2B b2160eedf7a7529c379ede5cd626f2d1e36db65bad8c8968adbc2940e597bf0e66f4872078c6543c69aed9b7f38b41d922fdc1cb8046738c1d8566a3f48da7d3 SHA512 dff9a86df2b0774b68e7c762bacf05e2482dbb218301acfdc9128fc600bbc51c97a3a44f6b7cee87bd4e153bcb4a0af3c98109560d0c7861b7508edc9ae05ea1
|
||||
DIST python-gentoo-patches-2.7.18_p16.tar.xz 35448 BLAKE2B 0139c0944f62f9cdd236f6a8557e0ed19704c7d72869af1cb7d8bd3e646a746cd4a0201e1b44232a5e78ef49f254db20b0d0271bf744fbfd4fe0f1e99b8f3e6c SHA512 810be590d0e06fab4b2165e6852ca49662f09dcd7e20b47a29f613ad7653252c8dfac3f0eb228d77c8a914efa7c08788b2fbd552a4b47504f5fd0ec17450c48f
|
||||
DIST python-gentoo-patches-3.10.13.tar.xz 13996 BLAKE2B 0123a18c8c39397ac03b1be1d243d8ae4da9f62888f409157bc1781285c9c6cd3d9ec23f1ae7ff0e0591b3dd2934ee366b3eb235e7cc6663afc9d617c4fd42f2 SHA512 ddfc830d2ced508a64e202a6082930f53edb48411c19cc9f364b29977ecd5a4f052d0ce953bbfb7fdf26072acb2836e0b7d5ce55f941955f2039551fa1f48edd
|
||||
DIST python-gentoo-patches-3.11.5.tar.xz 7124 BLAKE2B 04e19b0cce37794622d211fb7758988e734eca7298be59169fff81f8ec98f9c2454be3bba0944e681efcdca0810b74b4a07993965d89cdc0261cbc61862cd6f1 SHA512 3e137ab2b7ff4aaa41e4c760a7340d86cc3fb226c47985bd0f0bb8a4ef4fc157e1442e69995e585db15f04f95a734a19d80534a89067981ea314ef5be042b02e
|
||||
DIST python-gentoo-patches-3.12.0b4_p2.tar.xz 8132 BLAKE2B 4c1df7c8e1dda483724d8c3bb8ab7a7739fcdee16eaf1a2a5aeedb6011c13769ee9f2d0b1cf849df12aaf3230c0771b16533496539e1a0fab633e38699c8a75f SHA512 9051311d1e31163d13b8d2b1981d700ad2cf297b30f8d2867df8fe535fdb7da11efcb6fef8a201a76ff05aa8ae91c3679eeee72a729dc7249714796f6af2be9f
|
||||
DIST python-gentoo-patches-3.12.0rc1_p5.tar.xz 348764 BLAKE2B 8f71d6172ca4e557c195f4226d548f10b888842a110824db6c73613016d5b1c900545a2a3331519cc35cd9cc740fba3970737f40cdb64bd4d48e23a2be9e8be6 SHA512 e05f6e51a0689f0b5bdc745518742aebc3ae9fe145cb82c5e43a1a048df0ea4f11711ac4850726f807a73e232f76cfdc09c62d513ad0007acea7d5d5420c8569
|
||||
DIST python-gentoo-patches-3.12.0rc1_p6.tar.xz 349384 BLAKE2B 975aae449a01a31c459b287a47bd4d1a2d8b0b39e594a1c976371acc4948765bcb4733dd9e10b70c87dfb9409d4db6b2492004841db61577576852634a40365c SHA512 f262d1a9291867e1bdc8f92c682338369b1b52f210d6db0c648c3bbabea68c6b596dfd8d13507f6d65de37d1b83beb336be3abff239d2a588054794b5bebeb81
|
||||
DIST python-gentoo-patches-3.12.0rc2_p1.tar.xz 5168 BLAKE2B 399ad4854c46e0a2bdc7c3028cc5ad1807a1d6566654a1a85bf9a8a1b205aa7b57ab1706d8ae478b93f0938a9c205374b291aaac0c3356c05d99c5955633f541 SHA512 61ac3191e0dabbc9eeef54595e4071523205def60dca9c86fdb58d72971423d6d4b37a0875562b8f1ec8627230062aea765c07b771a9ce002a1026cdaacd507e
|
||||
DIST python-gentoo-patches-3.8.18.tar.xz 32424 BLAKE2B 2e0b6e1c8e3df666934ba283214ca1577b01140dea00513f6420b0255650002e4bc4cb142076620227cd430bc2547123fd392883285886e543ef72ca466f8ea6 SHA512 b005f1054b726fc8c82a50b006309de64fb7858fe5c22cc7b160687d059a7859ec9388706b74a0e6c1f42301bed071dc639eb8cfae0d7c5eef2f565c63cc2d29
|
||||
DIST python-gentoo-patches-3.9.18.tar.xz 25044 BLAKE2B 1d9ace5c5a0f1c15bc23595cc51d64b4c2b416552cdaaa960c3e34360aba3e7029a06e2a077212c68fa7aee4fd20f649a3b0926bd4ebb10e529e8350ab051e63 SHA512 bc180c3346dfae60a7db221d114146ee83409bc42092171eb05c83de528bf5f0e5654d1441f40ba839d0a98e866a5b43452fb7a72047c837497620a12097b8f5
|
||||
6
sdk_container/src/third_party/prefix-overlay/dev-lang/python/files/pydoc.conf
vendored
Normal file
6
sdk_container/src/third_party/prefix-overlay/dev-lang/python/files/pydoc.conf
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
# /etc/init.d/pydoc.conf
|
||||
|
||||
# This file contains the configuration for pydoc's internal webserver.
|
||||
|
||||
# Default port for Python's pydoc server.
|
||||
@PYDOC_PORT_VARIABLE@="7464"
|
||||
24
sdk_container/src/third_party/prefix-overlay/dev-lang/python/files/pydoc.init
vendored
Normal file
24
sdk_container/src/third_party/prefix-overlay/dev-lang/python/files/pydoc.init
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public Licence v2
|
||||
|
||||
start() {
|
||||
local pydoc_port="${@PYDOC_PORT_VARIABLE@-${PYDOC_PORT}}"
|
||||
|
||||
if [ -z "${pydoc_port}" ]; then
|
||||
eerror "Port not set"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ebegin "Starting pydoc server on port ${pydoc_port}"
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile /var/run/@PYDOC@.pid \
|
||||
--exec /usr/bin/@PYDOC@ -- -p "${pydoc_port}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping pydoc server"
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/@PYDOC@.pid
|
||||
eend $?
|
||||
}
|
||||
43
sdk_container/src/third_party/prefix-overlay/dev-lang/python/metadata.xml
vendored
Normal file
43
sdk_container/src/third_party/prefix-overlay/dev-lang/python/metadata.xml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>python@gentoo.org</email>
|
||||
<name>Python</name>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="bluetooth">
|
||||
Build Bluetooth protocol support in socket module
|
||||
</flag>
|
||||
<flag name="ensurepip">
|
||||
Install the ensurepip module that uses bundled wheels
|
||||
to bootstrap pip and setuptools (if disabled, it will
|
||||
be only possible to use venv `--without-pip`)
|
||||
</flag>
|
||||
<flag name="libedit">
|
||||
Link readline extension against <pkg>dev-libs/libedit</pkg>
|
||||
instead of <pkg>sys-libs/readline</pkg>
|
||||
</flag>
|
||||
<flag name="pgo">
|
||||
Optimize the build using Profile Guided Optimization (PGO)
|
||||
by running Python's test suite and collecting statistics
|
||||
based on its performance. This will take longer to build.
|
||||
</flag>
|
||||
<flag name="lto">
|
||||
Optimize the build using Link Time Optimization (LTO)
|
||||
</flag>
|
||||
<flag name="valgrind">
|
||||
Disable pymalloc when running under
|
||||
<pkg>dev-util/valgrind</pkg> is detected (may incur minor
|
||||
performance penalty even when valgrind is not used)
|
||||
</flag>
|
||||
<flag name="wininst">
|
||||
Install Windows executables required to create an executable
|
||||
installer for MS Windows
|
||||
</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="cpe">cpe:/a:python:python</remote-id>
|
||||
<remote-id type="github">python/cpython</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
322
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-2.7.18_p16-r1.ebuild
vendored
Normal file
322
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-2.7.18_p16-r1.ebuild
vendored
Normal file
@ -0,0 +1,322 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools flag-o-matic pax-utils toolchain-funcs verify-sig
|
||||
|
||||
MY_P="Python-${PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
https://gitweb.gentoo.org/fork/cpython.git/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
||||
IUSE="
|
||||
berkdb bluetooth build examples gdbm +ncurses +readline
|
||||
+sqlite +ssl tk valgrind wininst +xml
|
||||
"
|
||||
RESTRICT="test"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
dev-libs/libffi:=
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
berkdb? ( || (
|
||||
sys-libs/db:5.3
|
||||
sys-libs/db:4.8
|
||||
) )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? ( >=sys-libs/readline-4.1:= )
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( dev-libs/openssl:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
xml? ( >=dev-libs/expat-2.1:= )
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
BDEPEND="
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( sec-keys/openpgp-keys-python )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_setup() {
|
||||
if use berkdb; then
|
||||
ewarn "'bsddb' module is out-of-date and no longer maintained inside"
|
||||
ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
|
||||
ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
|
||||
ewarn "is provided by dev-python/bsddb3."
|
||||
fi
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat, libffi and zlib are not used.
|
||||
rm -r Modules/expat || die
|
||||
rm -r Modules/_ctypes/libffi* || die
|
||||
rm -r Modules/zlib || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
|
||||
Lib/distutils/command/install.py \
|
||||
Lib/distutils/sysconfig.py \
|
||||
Lib/site.py \
|
||||
Lib/sysconfig.py \
|
||||
Lib/test/test_site.py \
|
||||
Makefile.pre.in \
|
||||
Modules/Setup.dist \
|
||||
Modules/getpath.c \
|
||||
setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
|
||||
|
||||
if ! use wininst; then
|
||||
rm Lib/distutils/command/wininst*.exe || die
|
||||
fi
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# dbm module can be linked against berkdb or gdbm.
|
||||
# Defaults to gdbm when both are enabled, #204343.
|
||||
local disable
|
||||
use berkdb || use gdbm || disable+=" dbm"
|
||||
use berkdb || disable+=" _bsddb"
|
||||
# disable automagic bluetooth headers detection
|
||||
use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
|
||||
use gdbm || disable+=" gdbm"
|
||||
use ncurses || disable+=" _curses _curses_panel"
|
||||
use readline || disable+=" readline"
|
||||
use sqlite || disable+=" _sqlite3"
|
||||
use ssl || export PYTHON_DISABLE_SSL="1"
|
||||
use tk || disable+=" _tkinter"
|
||||
use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
|
||||
export PYTHON_DISABLE_MODULES="${disable}"
|
||||
|
||||
if ! use xml; then
|
||||
ewarn "You have configured Python without XML support."
|
||||
ewarn "This is NOT a recommended configuration as you"
|
||||
ewarn "may face problems parsing any XML documents."
|
||||
fi
|
||||
|
||||
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
|
||||
einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
|
||||
filter-flags -malign-double
|
||||
|
||||
if tc-is-cross-compiler; then
|
||||
# Force some tests that try to poke fs paths.
|
||||
export ac_cv_file__dev_ptc=no
|
||||
export ac_cv_file__dev_ptmx=yes
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
|
||||
tc-export CXX
|
||||
# The configure script fails to use pkg-config correctly.
|
||||
# http://bugs.python.org/issue15506
|
||||
export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
if use berkdb; then
|
||||
dbmliborder+="${dbmliborder:+:}bdb"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# The check is broken on clang, and gives false positive:
|
||||
# https://bugs.gentoo.org/596798
|
||||
# (upstream dropped this flag in 3.2a4 anyway)
|
||||
ac_cv_opt_olimit_ok=no
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
# Test program has missing includes. This doesn't change
|
||||
# the result but it's cleaner to force it.
|
||||
ac_cv_broken_poll=no
|
||||
|
||||
--with-fpectl
|
||||
--enable-shared
|
||||
--enable-ipv6
|
||||
--with-threads
|
||||
--enable-unicode=ucs4
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-system-ffi
|
||||
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
|
||||
# Avoid invoking pgen for cross-compiles.
|
||||
touch Include/graminit.h Python/graminit.c || die
|
||||
|
||||
emake
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# Skip failing tests.
|
||||
local skipped_tests=( distutils gdb )
|
||||
|
||||
for test in "${skipped_tests[@]}"; do
|
||||
mv Lib/test/test_${test}.py "${T}"/ || die
|
||||
done
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
|
||||
# Daylight saving time problem
|
||||
# https://bugs.python.org/issue22067
|
||||
# https://bugs.gentoo.org/610628
|
||||
local -x TZ=UTC
|
||||
|
||||
# Rerun failed tests in verbose mode (regrtest -w).
|
||||
emake test EXTRATESTOPTS="-w" < /dev/tty
|
||||
|
||||
for test in "${skipped_tests[@]}"; do
|
||||
mv "${T}/test_${test}.py" Lib/test/ || die
|
||||
done
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
|
||||
|
||||
emake DESTDIR="${D}" altinstall
|
||||
|
||||
sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die
|
||||
|
||||
# Remove static library
|
||||
rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
mv "${ED}/usr/bin/2to3" "${ED}/usr/bin/2to3-${PYVER}" || die
|
||||
mv "${ED}/usr/bin/pydoc" "${ED}/usr/bin/pydoc${PYVER}" || die
|
||||
mv "${ED}/usr/bin/idle" "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm "${ED}/usr/bin/smtpd.py" || die
|
||||
|
||||
if ! use berkdb; then
|
||||
rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,lib-tk} || die
|
||||
fi
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
dodoc -r Tools
|
||||
fi
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python2* is no longer wrapped, so just symlink it
|
||||
local pymajor=${PYVER%.*}
|
||||
dosym "python${PYVER}" "/usr/bin/python${pymajor}"
|
||||
dosym "python${PYVER}-config" "/usr/bin/python${pymajor}-config"
|
||||
}
|
||||
506
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.10.13.ebuild
vendored
Normal file
506
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.10.13.ebuild
vendored
Normal file
@ -0,0 +1,506 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit prefix python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind +xml
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
dev-lang/python-exec[python_targets_python3_10(-)]
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-wheels )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
xml? ( >=dev-libs/expat-2.1:= )
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
valgrind? ( dev-util/valgrind )
|
||||
test? ( app-arch/xz-utils[extra-filters(+)] )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( sec-keys/openpgp-keys-python )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
rm -r Modules/expat || die
|
||||
rm -r Modules/_ctypes/libffi* || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# https://bugs.gentoo.org/850151
|
||||
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
local jobs=$(makeopts_jobs)
|
||||
sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
|
||||
sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
build_cbuild_python() {
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910 and bug #864911.
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--prefix="${BROOT}"/usr
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross.
|
||||
--without-lto
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES+=" _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS=disabled
|
||||
MODULE__DBM=disabled
|
||||
MODULE__GDBM=disabled
|
||||
MODULE__DBM=disabled
|
||||
MODULE__SQLITE3=disabled
|
||||
MODULE__HASHLIB=disabled
|
||||
MODULE__SSL=disabled
|
||||
MODULE__CURSES=disabled
|
||||
MODULE__CURSES_PANEL=disabled
|
||||
MODULE_READLINE=disabled
|
||||
MODULE__TKINTER=disabled
|
||||
MODULE_PYEXPAT=disabled
|
||||
MODULE_ZLIB=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the Python it was pointed to
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES+=" _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
local disable
|
||||
use gdbm || disable+=" gdbm"
|
||||
use ncurses || disable+=" _curses _curses_panel"
|
||||
use readline || disable+=" readline"
|
||||
use sqlite || disable+=" _sqlite3"
|
||||
use ssl || export PYTHON_DISABLE_SSL="1"
|
||||
use tk || disable+=" _tkinter"
|
||||
use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
|
||||
export PYTHON_DISABLE_MODULES="${disable}"
|
||||
|
||||
if ! use xml; then
|
||||
ewarn "You have configured Python without XML support."
|
||||
ewarn "This is NOT a recommended configuration as you"
|
||||
ewarn "may face problems parsing any XML documents."
|
||||
fi
|
||||
|
||||
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
|
||||
einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-system-ffi
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
build_cbuild_python
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
export PATH="${WORKDIR}/${P}-${CBUILD}:${PATH}"
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
hprefixify setup.py
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
# Prevent using distutils bundled by setuptools.
|
||||
# https://bugs.gentoo.org/823728
|
||||
export SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
emake DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
535
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.11.5.ebuild
vendored
Normal file
535
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.11.5.ebuild
vendored
Normal file
@ -0,0 +1,535 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit prefix python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
app-crypt/libb2
|
||||
>=dev-libs/expat-2.1:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-wheels )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? ( app-arch/xz-utils[extra-filters(+)] )
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( sec-keys/openpgp-keys-python )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
if [[ ${PV} != *_alpha* ]]; then
|
||||
RDEPEND+="
|
||||
dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
|
||||
"
|
||||
fi
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
rm -r Modules/expat || die
|
||||
rm -r Modules/_ctypes/libffi* || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# https://bugs.gentoo.org/850151
|
||||
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
local jobs=$(makeopts_jobs)
|
||||
sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
|
||||
sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
build_cbuild_python() {
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--prefix="${BROOT}"/usr
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross to satisfy --with-build-python.
|
||||
--without-lto
|
||||
--without-readline
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES+=" _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__GDBM_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__SQLITE3_STATE=disabled
|
||||
MODULE__HASHLIB_STATE=disabled
|
||||
MODULE__SSL_STATE=disabled
|
||||
MODULE__CURSES_STATE=disabled
|
||||
MODULE__CURSES_PANEL_STATE=disabled
|
||||
MODULE_READLINE_STATE=disabled
|
||||
MODULE__TKINTER_STATE=disabled
|
||||
MODULE_PYEXPAT_STATE=disabled
|
||||
MODULE_ZLIB_STATE=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the --with-build-python value
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES+=" _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local disable
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-system-ffi
|
||||
--with-platlibdir=lib
|
||||
--with-pkg-config=yes
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
build_cbuild_python
|
||||
myeconfargs+=(
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
|
||||
)
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
hprefixify setup.py
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# force-disable modules we don't want built
|
||||
local disable_modules=( NIS )
|
||||
use gdbm || disable_modules+=( _GDBM _DBM )
|
||||
use sqlite || disable_modules+=( _SQLITE3 )
|
||||
use ssl || disable_modules+=( _HASHLIB _SSL )
|
||||
use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
|
||||
use readline || disable_modules+=( READLINE )
|
||||
use tk || disable_modules+=( _TKINTER )
|
||||
|
||||
local mod
|
||||
for mod in "${disable_modules[@]}"; do
|
||||
echo "MODULE_${mod}_STATE=disabled"
|
||||
done >> Makefile || die
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
# Prevent using distutils bundled by setuptools.
|
||||
# https://bugs.gentoo.org/823728
|
||||
export SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
export PYTHONSTRICTEXTENSIONBUILD=1
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# this just happens to skip test_support.test_freeze that is broken
|
||||
# without bundled expat
|
||||
# TODO: get a proper skip for it upstream
|
||||
local -x LOGNAME=buildbot
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
# -j1 hack for now for bug #843458
|
||||
emake -j1 DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"sqlite3 || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local v
|
||||
for v in ${REPLACING_VERSIONS}; do
|
||||
if ver_test "${v}" -lt 3.11.0_beta4-r2; then
|
||||
ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files"
|
||||
ewarn "installed previously are no longer valid and will be regenerated"
|
||||
ewarn "(or ignored) on the next import. This may cause sandbox failures"
|
||||
ewarn "when installing some packages and checksum mismatches when removing"
|
||||
ewarn "old versions. To actively prevent this, rebuild all packages"
|
||||
ewarn "installing Python 3.11 modules, e.g. using:"
|
||||
ewarn
|
||||
ewarn " emerge -1v /usr/lib/python3.11/site-packages"
|
||||
fi
|
||||
done
|
||||
}
|
||||
530
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_beta4_p2.ebuild
vendored
Normal file
530
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_beta4_p2.ebuild
vendored
Normal file
@ -0,0 +1,530 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_beta/b}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
app-crypt/libb2
|
||||
>=dev-libs/expat-2.1:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-pip )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? (
|
||||
app-arch/xz-utils[extra-filters(+)]
|
||||
dev-python/ensurepip-pip
|
||||
dev-python/ensurepip-setuptools
|
||||
dev-python/ensurepip-wheel
|
||||
)
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
if [[ ${PV} != *_alpha* ]]; then
|
||||
RDEPEND+="
|
||||
dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
|
||||
"
|
||||
fi
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
# TODO: Makefile has annoying deps on expat headers
|
||||
#rm -r Modules/expat || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local disable
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-platlibdir=lib
|
||||
--with-pkg-config=yes
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross to satisfy --with-build-python.
|
||||
--without-lto
|
||||
--without-readline
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
myeconfargs+=(
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__GDBM_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__SQLITE3_STATE=disabled
|
||||
MODULE__HASHLIB_STATE=disabled
|
||||
MODULE__SSL_STATE=disabled
|
||||
MODULE__CURSES_STATE=disabled
|
||||
MODULE__CURSES_PANEL_STATE=disabled
|
||||
MODULE_READLINE_STATE=disabled
|
||||
MODULE__TKINTER_STATE=disabled
|
||||
MODULE_PYEXPAT_STATE=disabled
|
||||
MODULE_ZLIB_STATE=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the --with-build-python value
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# force-disable modules we don't want built
|
||||
local disable_modules=( NIS )
|
||||
use gdbm || disable_modules+=( _GDBM _DBM )
|
||||
use sqlite || disable_modules+=( _SQLITE3 )
|
||||
use ssl || disable_modules+=( _HASHLIB _SSL )
|
||||
use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
|
||||
use readline || disable_modules+=( READLINE )
|
||||
use tk || disable_modules+=( _TKINTER )
|
||||
|
||||
local mod
|
||||
for mod in "${disable_modules[@]}"; do
|
||||
echo "MODULE_${mod}_STATE=disabled"
|
||||
done >> Makefile || die
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
export PYTHONSTRICTEXTENSIONBUILD=1
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# this just happens to skip test_support.test_freeze that is broken
|
||||
# without bundled expat
|
||||
# TODO: get a proper skip for it upstream
|
||||
local -x LOGNAME=buildbot
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
# the Makefile rules are broken
|
||||
# https://github.com/python/cpython/issues/100221
|
||||
mkdir -p "${libdir}"/lib-dynload || die
|
||||
|
||||
# -j1 hack for now for bug #843458
|
||||
emake -j1 DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"sqlite3 || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local v
|
||||
for v in ${REPLACING_VERSIONS}; do
|
||||
if ver_test "${v}" -lt 3.11.0_beta4-r2; then
|
||||
ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files"
|
||||
ewarn "installed previously are no longer valid and will be regenerated"
|
||||
ewarn "(or ignored) on the next import. This may cause sandbox failures"
|
||||
ewarn "when installing some packages and checksum mismatches when removing"
|
||||
ewarn "old versions. To actively prevent this, rebuild all packages"
|
||||
ewarn "installing Python 3.11 modules, e.g. using:"
|
||||
ewarn
|
||||
ewarn " emerge -1v /usr/lib/python3.11/site-packages"
|
||||
fi
|
||||
done
|
||||
}
|
||||
530
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc1_p5.ebuild
vendored
Normal file
530
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc1_p5.ebuild
vendored
Normal file
@ -0,0 +1,530 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="8"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
app-crypt/libb2
|
||||
>=dev-libs/expat-2.1:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-pip )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? (
|
||||
app-arch/xz-utils[extra-filters(+)]
|
||||
dev-python/ensurepip-pip
|
||||
dev-python/ensurepip-setuptools
|
||||
dev-python/ensurepip-wheel
|
||||
)
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
if [[ ${PV} != *_alpha* ]]; then
|
||||
RDEPEND+="
|
||||
dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
|
||||
"
|
||||
fi
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
# TODO: Makefile has annoying deps on expat headers
|
||||
#rm -r Modules/expat || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local disable
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-platlibdir=lib
|
||||
--with-pkg-config=yes
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross to satisfy --with-build-python.
|
||||
--without-lto
|
||||
--without-readline
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
myeconfargs+=(
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__GDBM_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__SQLITE3_STATE=disabled
|
||||
MODULE__HASHLIB_STATE=disabled
|
||||
MODULE__SSL_STATE=disabled
|
||||
MODULE__CURSES_STATE=disabled
|
||||
MODULE__CURSES_PANEL_STATE=disabled
|
||||
MODULE_READLINE_STATE=disabled
|
||||
MODULE__TKINTER_STATE=disabled
|
||||
MODULE_PYEXPAT_STATE=disabled
|
||||
MODULE_ZLIB_STATE=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the --with-build-python value
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# force-disable modules we don't want built
|
||||
local disable_modules=( NIS )
|
||||
use gdbm || disable_modules+=( _GDBM _DBM )
|
||||
use sqlite || disable_modules+=( _SQLITE3 )
|
||||
use ssl || disable_modules+=( _HASHLIB _SSL )
|
||||
use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
|
||||
use readline || disable_modules+=( READLINE )
|
||||
use tk || disable_modules+=( _TKINTER )
|
||||
|
||||
local mod
|
||||
for mod in "${disable_modules[@]}"; do
|
||||
echo "MODULE_${mod}_STATE=disabled"
|
||||
done >> Makefile || die
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
export PYTHONSTRICTEXTENSIONBUILD=1
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# this just happens to skip test_support.test_freeze that is broken
|
||||
# without bundled expat
|
||||
# TODO: get a proper skip for it upstream
|
||||
local -x LOGNAME=buildbot
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
# the Makefile rules are broken
|
||||
# https://github.com/python/cpython/issues/100221
|
||||
mkdir -p "${libdir}"/lib-dynload || die
|
||||
|
||||
# -j1 hack for now for bug #843458
|
||||
emake -j1 DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"sqlite3 || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local v
|
||||
for v in ${REPLACING_VERSIONS}; do
|
||||
if ver_test "${v}" -lt 3.11.0_beta4-r2; then
|
||||
ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files"
|
||||
ewarn "installed previously are no longer valid and will be regenerated"
|
||||
ewarn "(or ignored) on the next import. This may cause sandbox failures"
|
||||
ewarn "when installing some packages and checksum mismatches when removing"
|
||||
ewarn "old versions. To actively prevent this, rebuild all packages"
|
||||
ewarn "installing Python 3.11 modules, e.g. using:"
|
||||
ewarn
|
||||
ewarn " emerge -1v /usr/lib/python3.11/site-packages"
|
||||
fi
|
||||
done
|
||||
}
|
||||
530
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc1_p6.ebuild
vendored
Normal file
530
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc1_p6.ebuild
vendored
Normal file
@ -0,0 +1,530 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="8"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
app-crypt/libb2
|
||||
>=dev-libs/expat-2.1:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-pip )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? (
|
||||
app-arch/xz-utils[extra-filters(+)]
|
||||
dev-python/ensurepip-pip
|
||||
dev-python/ensurepip-setuptools
|
||||
dev-python/ensurepip-wheel
|
||||
)
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
if [[ ${PV} != *_alpha* ]]; then
|
||||
RDEPEND+="
|
||||
dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
|
||||
"
|
||||
fi
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
# TODO: Makefile has annoying deps on expat headers
|
||||
#rm -r Modules/expat || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local disable
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-platlibdir=lib
|
||||
--with-pkg-config=yes
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross to satisfy --with-build-python.
|
||||
--without-lto
|
||||
--without-readline
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
myeconfargs+=(
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__GDBM_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__SQLITE3_STATE=disabled
|
||||
MODULE__HASHLIB_STATE=disabled
|
||||
MODULE__SSL_STATE=disabled
|
||||
MODULE__CURSES_STATE=disabled
|
||||
MODULE__CURSES_PANEL_STATE=disabled
|
||||
MODULE_READLINE_STATE=disabled
|
||||
MODULE__TKINTER_STATE=disabled
|
||||
MODULE_PYEXPAT_STATE=disabled
|
||||
MODULE_ZLIB_STATE=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the --with-build-python value
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# force-disable modules we don't want built
|
||||
local disable_modules=( NIS )
|
||||
use gdbm || disable_modules+=( _GDBM _DBM )
|
||||
use sqlite || disable_modules+=( _SQLITE3 )
|
||||
use ssl || disable_modules+=( _HASHLIB _SSL )
|
||||
use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
|
||||
use readline || disable_modules+=( READLINE )
|
||||
use tk || disable_modules+=( _TKINTER )
|
||||
|
||||
local mod
|
||||
for mod in "${disable_modules[@]}"; do
|
||||
echo "MODULE_${mod}_STATE=disabled"
|
||||
done >> Makefile || die
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
export PYTHONSTRICTEXTENSIONBUILD=1
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# this just happens to skip test_support.test_freeze that is broken
|
||||
# without bundled expat
|
||||
# TODO: get a proper skip for it upstream
|
||||
local -x LOGNAME=buildbot
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
# the Makefile rules are broken
|
||||
# https://github.com/python/cpython/issues/100221
|
||||
mkdir -p "${libdir}"/lib-dynload || die
|
||||
|
||||
# -j1 hack for now for bug #843458
|
||||
emake -j1 DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"sqlite3 || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local v
|
||||
for v in ${REPLACING_VERSIONS}; do
|
||||
if ver_test "${v}" -lt 3.11.0_beta4-r2; then
|
||||
ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files"
|
||||
ewarn "installed previously are no longer valid and will be regenerated"
|
||||
ewarn "(or ignored) on the next import. This may cause sandbox failures"
|
||||
ewarn "when installing some packages and checksum mismatches when removing"
|
||||
ewarn "old versions. To actively prevent this, rebuild all packages"
|
||||
ewarn "installing Python 3.11 modules, e.g. using:"
|
||||
ewarn
|
||||
ewarn " emerge -1v /usr/lib/python3.11/site-packages"
|
||||
fi
|
||||
done
|
||||
}
|
||||
532
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc2_p1-r1.ebuild
vendored
Normal file
532
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc2_p1-r1.ebuild
vendored
Normal file
@ -0,0 +1,532 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="8"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
app-crypt/libb2
|
||||
>=dev-libs/expat-2.1:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-pip )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? (
|
||||
app-arch/xz-utils[extra-filters(+)]
|
||||
dev-python/ensurepip-pip
|
||||
dev-python/ensurepip-setuptools
|
||||
dev-python/ensurepip-wheel
|
||||
)
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
if [[ ${PV} != *_alpha* ]]; then
|
||||
RDEPEND+="
|
||||
dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
|
||||
"
|
||||
fi
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
# TODO: Makefile has annoying deps on expat headers
|
||||
#rm -r Modules/expat || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
build_cbuild_python() {
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--prefix="${BROOT}"/usr
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross to satisfy --with-build-python.
|
||||
--without-lto
|
||||
--without-readline
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
mkdir Modules || die
|
||||
cat > Modules/Setup.local <<-EOF || die
|
||||
*disabled*
|
||||
nis
|
||||
_dbm _gdbm
|
||||
_sqlite3
|
||||
_hashlib _ssl
|
||||
_curses _curses_panel
|
||||
readline
|
||||
_tkinter
|
||||
pyexpat
|
||||
zlib
|
||||
# We disabled these for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross. This should be rechecked for the pure Makefile approach,
|
||||
# and uncommented if needed.
|
||||
#_ctypes _crypt
|
||||
EOF
|
||||
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the --with-build-python value
|
||||
# immediately.
|
||||
emake
|
||||
popd &> /dev/null || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local disable
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-platlibdir=lib
|
||||
--with-pkg-config=yes
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
# Force-disable modules we don't want built.
|
||||
# See Modules/Setup for docs on how this works. Setup.local contains our local deviations.
|
||||
cat > Modules/Setup.local <<-EOF || die
|
||||
*disabled*
|
||||
nis
|
||||
$(usev !gdbm '_gdbm _dbm')
|
||||
$(usev !sqlite '_sqlite3')
|
||||
$(usev !ssl '_hashlib _ssl')
|
||||
$(usev !ncurses '_curses _curses_panel')
|
||||
$(usev !readline 'readline')
|
||||
$(usev !tk '_tkinter')
|
||||
EOF
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
build_cbuild_python
|
||||
myeconfargs+=(
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
|
||||
)
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
export PYTHONSTRICTEXTENSIONBUILD=1
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# this just happens to skip test_support.test_freeze that is broken
|
||||
# without bundled expat
|
||||
# TODO: get a proper skip for it upstream
|
||||
local -x LOGNAME=buildbot
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
# the Makefile rules are broken
|
||||
# https://github.com/python/cpython/issues/100221
|
||||
mkdir -p "${libdir}"/lib-dynload || die
|
||||
|
||||
# -j1 hack for now for bug #843458
|
||||
emake -j1 DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"sqlite3 || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local v
|
||||
for v in ${REPLACING_VERSIONS}; do
|
||||
if ver_test "${v}" -lt 3.11.0_beta4-r2; then
|
||||
ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files"
|
||||
ewarn "installed previously are no longer valid and will be regenerated"
|
||||
ewarn "(or ignored) on the next import. This may cause sandbox failures"
|
||||
ewarn "when installing some packages and checksum mismatches when removing"
|
||||
ewarn "old versions. To actively prevent this, rebuild all packages"
|
||||
ewarn "installing Python 3.11 modules, e.g. using:"
|
||||
ewarn
|
||||
ewarn " emerge -1v /usr/lib/python3.11/site-packages"
|
||||
fi
|
||||
done
|
||||
}
|
||||
531
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc2_p1.ebuild
vendored
Normal file
531
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.12.0_rc2_p1.ebuild
vendored
Normal file
@ -0,0 +1,531 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="8"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm libedit lto
|
||||
+ncurses pgo +readline +sqlite +ssl test tk valgrind
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
app-crypt/libb2
|
||||
>=dev-libs/expat-2.1:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-pip )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? (
|
||||
!libedit? ( >=sys-libs/readline-4.1:= )
|
||||
libedit? ( dev-libs/libedit:= )
|
||||
)
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? (
|
||||
app-arch/xz-utils[extra-filters(+)]
|
||||
dev-python/ensurepip-pip
|
||||
dev-python/ensurepip-setuptools
|
||||
dev-python/ensurepip-wheel
|
||||
)
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
if [[ ${PV} != *_alpha* ]]; then
|
||||
RDEPEND+="
|
||||
dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
|
||||
"
|
||||
fi
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
# TODO: Makefile has annoying deps on expat headers
|
||||
#rm -r Modules/expat || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local disable
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-u-network
|
||||
|
||||
# We use a timeout because of how often we've had hang issues
|
||||
# here. It also matches the default upstream PROFILE_TASK.
|
||||
--timeout 1200
|
||||
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--without-static-libpython
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-platlibdir=lib
|
||||
--with-pkg-config=yes
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with readline readline "$(usex libedit editline readline)")
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--prefix="${BROOT}"/usr
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross to satisfy --with-build-python.
|
||||
--without-lto
|
||||
--without-readline
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
myeconfargs+=(
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
|
||||
)
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__GDBM_STATE=disabled
|
||||
MODULE__DBM_STATE=disabled
|
||||
MODULE__SQLITE3_STATE=disabled
|
||||
MODULE__HASHLIB_STATE=disabled
|
||||
MODULE__SSL_STATE=disabled
|
||||
MODULE__CURSES_STATE=disabled
|
||||
MODULE__CURSES_PANEL_STATE=disabled
|
||||
MODULE_READLINE_STATE=disabled
|
||||
MODULE__TKINTER_STATE=disabled
|
||||
MODULE_PYEXPAT_STATE=disabled
|
||||
MODULE_ZLIB_STATE=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the --with-build-python value
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# force-disable modules we don't want built
|
||||
local disable_modules=( NIS )
|
||||
use gdbm || disable_modules+=( _GDBM _DBM )
|
||||
use sqlite || disable_modules+=( _SQLITE3 )
|
||||
use ssl || disable_modules+=( _HASHLIB _SSL )
|
||||
use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
|
||||
use readline || disable_modules+=( READLINE )
|
||||
use tk || disable_modules+=( _TKINTER )
|
||||
|
||||
local mod
|
||||
for mod in "${disable_modules[@]}"; do
|
||||
echo "MODULE_${mod}_STATE=disabled"
|
||||
done >> Makefile || die
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
export PYTHONSTRICTEXTENSIONBUILD=1
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
# this just happens to skip test_support.test_freeze that is broken
|
||||
# without bundled expat
|
||||
# TODO: get a proper skip for it upstream
|
||||
local -x LOGNAME=buildbot
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
# workaround https://bugs.gentoo.org/775416
|
||||
addwrite "/usr/lib/python${PYVER}/site-packages"
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
# the Makefile rules are broken
|
||||
# https://github.com/python/cpython/issues/100221
|
||||
mkdir -p "${libdir}"/lib-dynload || die
|
||||
|
||||
# -j1 hack for now for bug #843458
|
||||
emake -j1 DESTDIR="${D}" altinstall
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"sqlite3 || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local v
|
||||
for v in ${REPLACING_VERSIONS}; do
|
||||
if ver_test "${v}" -lt 3.11.0_beta4-r2; then
|
||||
ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files"
|
||||
ewarn "installed previously are no longer valid and will be regenerated"
|
||||
ewarn "(or ignored) on the next import. This may cause sandbox failures"
|
||||
ewarn "when installing some packages and checksum mismatches when removing"
|
||||
ewarn "old versions. To actively prevent this, rebuild all packages"
|
||||
ewarn "installing Python 3.11 modules, e.g. using:"
|
||||
ewarn
|
||||
ewarn " emerge -1v /usr/lib/python3.11/site-packages"
|
||||
fi
|
||||
done
|
||||
}
|
||||
432
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.8.18.ebuild
vendored
Normal file
432
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.8.18.ebuild
vendored
Normal file
@ -0,0 +1,432 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools flag-o-matic multiprocessing pax-utils
|
||||
inherit prefix python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm lto +ncurses pgo
|
||||
+readline +sqlite +ssl test tk valgrind wininst +xml
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
dev-libs/libffi:=
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-wheels )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? ( >=sys-libs/readline-4.1:= )
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
xml? ( >=dev-libs/expat-2.1:= )
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? ( app-arch/xz-utils[extra-filters(+)] )
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( sec-keys/openpgp-keys-python )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
rm -r Modules/expat || die
|
||||
rm -r Modules/_ctypes/libffi* || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# https://bugs.gentoo.org/850151
|
||||
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
local jobs=$(makeopts_jobs)
|
||||
sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
|
||||
sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
|
||||
|
||||
if ! use wininst; then
|
||||
rm Lib/distutils/command/wininst*.exe || die
|
||||
fi
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
local disable
|
||||
use gdbm || disable+=" gdbm"
|
||||
use ncurses || disable+=" _curses _curses_panel"
|
||||
use readline || disable+=" readline"
|
||||
use sqlite || disable+=" _sqlite3"
|
||||
use ssl || export PYTHON_DISABLE_SSL="1"
|
||||
use tk || disable+=" _tkinter"
|
||||
use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
|
||||
export PYTHON_DISABLE_MODULES="${disable}"
|
||||
|
||||
if ! use xml; then
|
||||
ewarn "You have configured Python without XML support."
|
||||
ewarn "This is NOT a recommended configuration as you"
|
||||
ewarn "may face problems parsing any XML documents."
|
||||
fi
|
||||
|
||||
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
|
||||
einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-system-ffi
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910 and bug #864911.
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross.
|
||||
--without-lto
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
export PATH="${WORKDIR}/${P}-${CBUILD}:${PATH}"
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS=disabled
|
||||
MODULE__DBM=disabled
|
||||
MODULE__GDBM=disabled
|
||||
MODULE__DBM=disabled
|
||||
MODULE__SQLITE3=disabled
|
||||
MODULE__HASHLIB=disabled
|
||||
MODULE__SSL=disabled
|
||||
MODULE__CURSES=disabled
|
||||
MODULE__CURSES_PANEL=disabled
|
||||
MODULE_READLINE=disabled
|
||||
MODULE__TKINTER=disabled
|
||||
MODULE_PYEXPAT=disabled
|
||||
MODULE_ZLIB=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the Python it was pointed to
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
hprefixify setup.py
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
# Prevent using distutils bundled by setuptools.
|
||||
# https://bugs.gentoo.org/823728
|
||||
export SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
emake DESTDIR="${D}" altinstall
|
||||
|
||||
# Remove static library
|
||||
rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
492
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.9.18.ebuild
vendored
Normal file
492
sdk_container/src/third_party/prefix-overlay/dev-lang/python/python-3.9.18.ebuild
vendored
Normal file
@ -0,0 +1,492 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
WANT_LIBTOOL="none"
|
||||
|
||||
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
|
||||
inherit prefix python-utils-r1 toolchain-funcs verify-sig
|
||||
|
||||
MY_PV=${PV/_rc/rc}
|
||||
MY_P="Python-${MY_PV%_p*}"
|
||||
PYVER=$(ver_cut 1-2)
|
||||
PATCHSET="python-gentoo-patches-${MY_PV}"
|
||||
|
||||
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
|
||||
HOMEPAGE="
|
||||
https://www.python.org/
|
||||
https://github.com/python/cpython/
|
||||
"
|
||||
SRC_URI="
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
|
||||
verify-sig? (
|
||||
https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
|
||||
)
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="PSF-2"
|
||||
SLOT="${PYVER}"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
||||
IUSE="
|
||||
bluetooth build debug +ensurepip examples gdbm lto +ncurses pgo
|
||||
+readline +sqlite +ssl test tk valgrind +xml
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
# Do not add a dependency on dev-lang/python to this ebuild.
|
||||
# If you need to apply a patch which requires python for bootstrapping, please
|
||||
# run the bootstrap code on your dev box and include the results in the
|
||||
# patchset. See bug 447752.
|
||||
|
||||
RDEPEND="
|
||||
app-arch/bzip2:=
|
||||
app-arch/xz-utils:=
|
||||
dev-libs/libffi:=
|
||||
dev-python/gentoo-common
|
||||
>=sys-libs/zlib-1.1.3:=
|
||||
virtual/libcrypt:=
|
||||
virtual/libintl
|
||||
ensurepip? ( dev-python/ensurepip-wheels )
|
||||
gdbm? ( sys-libs/gdbm:=[berkdb] )
|
||||
kernel_linux? ( sys-apps/util-linux:= )
|
||||
ncurses? ( >=sys-libs/ncurses-5.2:= )
|
||||
readline? ( >=sys-libs/readline-4.1:= )
|
||||
sqlite? ( >=dev-db/sqlite-3.3.8:3= )
|
||||
ssl? ( >=dev-libs/openssl-1.1.1:= )
|
||||
tk? (
|
||||
>=dev-lang/tcl-8.0:=
|
||||
>=dev-lang/tk-8.0:=
|
||||
dev-tcltk/blt:=
|
||||
dev-tcltk/tix
|
||||
)
|
||||
xml? ( >=dev-libs/expat-2.1:= )
|
||||
"
|
||||
# bluetooth requires headers from bluez
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
bluetooth? ( net-wireless/bluez )
|
||||
test? ( app-arch/xz-utils[extra-filters(+)] )
|
||||
valgrind? ( dev-util/valgrind )
|
||||
"
|
||||
# autoconf-archive needed to eautoreconf
|
||||
BDEPEND="
|
||||
sys-devel/autoconf-archive
|
||||
app-alternatives/awk
|
||||
virtual/pkgconfig
|
||||
verify-sig? ( sec-keys/openpgp-keys-python )
|
||||
"
|
||||
RDEPEND+="
|
||||
!build? ( app-misc/mime-types )
|
||||
"
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
|
||||
|
||||
# large file tests involve a 2.5G file being copied (duplicated)
|
||||
CHECKREQS_DISK_BUILD=5500M
|
||||
|
||||
QA_PKGCONFIG_VERSION=${PYVER}
|
||||
# false positives -- functions specific to *BSD
|
||||
QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
|
||||
|
||||
pkg_pretend() {
|
||||
use test && check-reqs_pkg_pretend
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use test && check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
|
||||
fi
|
||||
default
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Ensure that internal copies of expat and libffi are not used.
|
||||
rm -r Modules/expat || die
|
||||
rm -r Modules/_ctypes/libffi* || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/${PATCHSET}"
|
||||
)
|
||||
|
||||
default
|
||||
|
||||
# https://bugs.gentoo.org/850151
|
||||
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
|
||||
|
||||
# force the correct number of jobs
|
||||
# https://bugs.gentoo.org/737660
|
||||
local jobs=$(makeopts_jobs)
|
||||
sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
|
||||
sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# disable automagic bluetooth headers detection
|
||||
if ! use bluetooth; then
|
||||
local -x ac_cv_header_bluetooth_bluetooth_h=no
|
||||
fi
|
||||
local disable
|
||||
use gdbm || disable+=" gdbm"
|
||||
use ncurses || disable+=" _curses _curses_panel"
|
||||
use readline || disable+=" readline"
|
||||
use sqlite || disable+=" _sqlite3"
|
||||
use ssl || export PYTHON_DISABLE_SSL="1"
|
||||
use tk || disable+=" _tkinter"
|
||||
use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
|
||||
export PYTHON_DISABLE_MODULES="${disable}"
|
||||
|
||||
if ! use xml; then
|
||||
ewarn "You have configured Python without XML support."
|
||||
ewarn "This is NOT a recommended configuration as you"
|
||||
ewarn "may face problems parsing any XML documents."
|
||||
fi
|
||||
|
||||
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
|
||||
einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
|
||||
fi
|
||||
|
||||
append-flags -fwrapv
|
||||
filter-flags -malign-double
|
||||
|
||||
# https://bugs.gentoo.org/700012
|
||||
if is-flagq -flto || is-flagq '-flto=*'; then
|
||||
append-cflags $(test-flags-CC -ffat-lto-objects)
|
||||
fi
|
||||
|
||||
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
|
||||
# PKG_CONFIG needed for cross.
|
||||
tc-export CXX PKG_CONFIG
|
||||
|
||||
local dbmliborder=
|
||||
if use gdbm; then
|
||||
dbmliborder+="${dbmliborder:+:}gdbm"
|
||||
fi
|
||||
|
||||
if use pgo; then
|
||||
local profile_task_flags=(
|
||||
-m test
|
||||
"-j$(makeopts_jobs)"
|
||||
--pgo-extended
|
||||
-x test_gdb
|
||||
-x test_dtrace
|
||||
-u-network
|
||||
|
||||
# All of these seem to occasionally hang for PGO inconsistently
|
||||
# They'll even hang here but be fine in src_test sometimes.
|
||||
# bug #828535 (and related: bug #788022)
|
||||
-x test_asyncio
|
||||
-x test_httpservers
|
||||
-x test_logging
|
||||
-x test_multiprocessing_fork
|
||||
-x test_socket
|
||||
-x test_xmlrpc
|
||||
|
||||
# Hangs (actually runs indefinitely executing itself w/ many cpython builds)
|
||||
# bug #900429
|
||||
-x test_tools
|
||||
)
|
||||
|
||||
if has_version "app-arch/rpm" ; then
|
||||
# Avoid sandbox failure (attempts to write to /var/lib/rpm)
|
||||
profile_task_flags+=(
|
||||
-x test_distutils
|
||||
)
|
||||
fi
|
||||
local -x PROFILE_TASK="${profile_task_flags[*]}"
|
||||
fi
|
||||
|
||||
local myeconfargs=(
|
||||
# glibc-2.30 removes it; since we can't cleanly force-rebuild
|
||||
# Python on glibc upgrade, remove it proactively to give
|
||||
# a chance for users rebuilding python before glibc
|
||||
ac_cv_header_stropts_h=no
|
||||
|
||||
--enable-shared
|
||||
--enable-ipv6
|
||||
--infodir='${prefix}/share/info'
|
||||
--mandir='${prefix}/share/man'
|
||||
--with-computed-gotos
|
||||
--with-dbmliborder="${dbmliborder}"
|
||||
--with-libc=
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-system-expat
|
||||
--with-system-ffi
|
||||
--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
|
||||
|
||||
$(use_with debug assertions)
|
||||
$(use_with lto)
|
||||
$(use_enable pgo optimizations)
|
||||
$(use_with valgrind)
|
||||
)
|
||||
|
||||
# disable implicit optimization/debugging flags
|
||||
local -x OPT=
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
|
||||
local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
#
|
||||
# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
|
||||
local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
|
||||
local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
|
||||
local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
|
||||
|
||||
# We need to build our own Python on CBUILD first, and feed it in.
|
||||
# bug #847910 and bug #864911.
|
||||
local myeconfargs_cbuild=(
|
||||
"${myeconfargs[@]}"
|
||||
|
||||
--libdir="${cbuild_libdir:2}"
|
||||
|
||||
# Avoid needing to load the right libpython.so.
|
||||
--disable-shared
|
||||
|
||||
# As minimal as possible for the mini CBUILD Python
|
||||
# we build just for cross.
|
||||
--without-lto
|
||||
--disable-optimizations
|
||||
)
|
||||
|
||||
# Point the imminent CHOST build to the Python we just
|
||||
# built for CBUILD.
|
||||
export PATH="${WORKDIR}/${P}-${CBUILD}:${PATH}"
|
||||
|
||||
mkdir "${WORKDIR}"/${P}-${CBUILD} || die
|
||||
pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
|
||||
# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
|
||||
# libdir correctly for cross.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
|
||||
ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
|
||||
|
||||
# Avoid as many dependencies as possible for the cross build.
|
||||
cat >> Makefile <<-EOF || die
|
||||
MODULE_NIS=disabled
|
||||
MODULE__DBM=disabled
|
||||
MODULE__GDBM=disabled
|
||||
MODULE__DBM=disabled
|
||||
MODULE__SQLITE3=disabled
|
||||
MODULE__HASHLIB=disabled
|
||||
MODULE__SSL=disabled
|
||||
MODULE__CURSES=disabled
|
||||
MODULE__CURSES_PANEL=disabled
|
||||
MODULE_READLINE=disabled
|
||||
MODULE__TKINTER=disabled
|
||||
MODULE_PYEXPAT=disabled
|
||||
MODULE_ZLIB=disabled
|
||||
EOF
|
||||
|
||||
# Unfortunately, we do have to build this immediately, and
|
||||
# not in src_compile, because CHOST configure for Python
|
||||
# will check the existence of the Python it was pointed to
|
||||
# immediately.
|
||||
PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
|
||||
popd &> /dev/null || die
|
||||
fi
|
||||
|
||||
# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
|
||||
# propagated to sysconfig for built extensions
|
||||
local -x CFLAGS_NODIST=${CFLAGS}
|
||||
local -x LDFLAGS_NODIST=${LDFLAGS}
|
||||
local -x CFLAGS= LDFLAGS=
|
||||
|
||||
# Fix implicit declarations on cross and prefix builds. Bug #674070.
|
||||
if use ncurses; then
|
||||
append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
|
||||
fi
|
||||
|
||||
hprefixify setup.py
|
||||
econf "${myeconfargs[@]}"
|
||||
|
||||
if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
|
||||
eerror "configure has detected that the sem_open function is broken."
|
||||
eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
|
||||
die "Broken sem_open function (bug 496328)"
|
||||
fi
|
||||
|
||||
# install epython.py as part of stdlib
|
||||
echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Ensure sed works as expected
|
||||
# https://bugs.gentoo.org/594768
|
||||
local -x LC_ALL=C
|
||||
# Prevent using distutils bundled by setuptools.
|
||||
# https://bugs.gentoo.org/823728
|
||||
export SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
|
||||
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
|
||||
# end up writing bytecode & violating sandbox.
|
||||
# bug #831897
|
||||
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
if use pgo ; then
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
addpredict "/usr/lib/python${PYVER}/site-packages"
|
||||
fi
|
||||
|
||||
# also need to clear the flags explicitly here or they end up
|
||||
# in _sysconfigdata*
|
||||
emake CPPFLAGS= CFLAGS= LDFLAGS=
|
||||
|
||||
# Restore saved value from above.
|
||||
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
|
||||
|
||||
# Work around bug 329499. See also bug 413751 and 457194.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E python
|
||||
else
|
||||
pax-mark m python
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Tests will not work when cross compiling.
|
||||
if tc-is-cross-compiler; then
|
||||
elog "Disabling tests due to crosscompiling."
|
||||
return
|
||||
fi
|
||||
|
||||
local test_opts=(
|
||||
-u-network
|
||||
-j "$(makeopts_jobs)"
|
||||
|
||||
# fails
|
||||
-x test_gdb
|
||||
)
|
||||
|
||||
if use sparc ; then
|
||||
# bug #788022
|
||||
test_opts+=(
|
||||
-x test_multiprocessing_fork
|
||||
-x test_multiprocessing_forkserver
|
||||
)
|
||||
fi
|
||||
|
||||
# workaround docutils breaking tests
|
||||
cat > Lib/docutils.py <<-EOF || die
|
||||
raise ImportError("Thou shalt not import!")
|
||||
EOF
|
||||
|
||||
# bug 660358
|
||||
local -x COLUMNS=80
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
|
||||
CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
|
||||
local ret=${?}
|
||||
|
||||
rm Lib/docutils.py || die
|
||||
|
||||
[[ ${ret} -eq 0 ]] || die "emake test failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local libdir=${ED}/usr/lib/python${PYVER}
|
||||
|
||||
emake DESTDIR="${D}" altinstall
|
||||
|
||||
# Remove static library
|
||||
rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
|
||||
|
||||
# Fix collisions between different slots of Python.
|
||||
rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
|
||||
|
||||
# Cheap hack to get version with ABIFLAGS
|
||||
local abiver=$(cd "${ED}/usr/include"; echo python*)
|
||||
if [[ ${abiver} != python${PYVER} ]]; then
|
||||
# Replace python3.X with a symlink to python3.Xm
|
||||
rm "${ED}/usr/bin/python${PYVER}" || die
|
||||
dosym "${abiver}" "/usr/bin/python${PYVER}"
|
||||
# Create python3.X-config symlink
|
||||
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
|
||||
# Create python-3.5m.pc symlink
|
||||
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
|
||||
fi
|
||||
|
||||
# python seems to get rebuilt in src_install (bug 569908)
|
||||
# Work around it for now.
|
||||
if has_version dev-libs/libffi[pax-kernel]; then
|
||||
pax-mark E "${ED}/usr/bin/${abiver}"
|
||||
else
|
||||
pax-mark m "${ED}/usr/bin/${abiver}"
|
||||
fi
|
||||
|
||||
rm -r "${libdir}"/ensurepip/_bundled || die
|
||||
if ! use ensurepip; then
|
||||
rm -r "${libdir}"/ensurepip || die
|
||||
fi
|
||||
if ! use sqlite; then
|
||||
rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
|
||||
fi
|
||||
if ! use tk; then
|
||||
rm -r "${ED}/usr/bin/idle${PYVER}" || die
|
||||
rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
|
||||
fi
|
||||
|
||||
ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die
|
||||
|
||||
dodoc Misc/{ACKS,HISTORY,NEWS}
|
||||
|
||||
if use examples; then
|
||||
docinto examples
|
||||
find Tools -name __pycache__ -exec rm -fr {} + || die
|
||||
dodoc -r Tools
|
||||
fi
|
||||
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
|
||||
local libname=$(
|
||||
printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
|
||||
emake --no-print-directory -s -f - 2>/dev/null
|
||||
)
|
||||
newins Tools/gdb/libpython.py "${libname}"-gdb.py
|
||||
|
||||
newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
|
||||
newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
|
||||
sed \
|
||||
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
|
||||
-e "s:@PYDOC@:pydoc${PYVER}:" \
|
||||
-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
|
||||
"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
|
||||
|
||||
# python-exec wrapping support
|
||||
local pymajor=${PYVER%.*}
|
||||
local EPYTHON=python${PYVER}
|
||||
local scriptdir=${D}$(python_get_scriptdir)
|
||||
mkdir -p "${scriptdir}" || die
|
||||
# python and pythonX
|
||||
ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
|
||||
ln -s "python${pymajor}" "${scriptdir}/python" || die
|
||||
# python-config and pythonX-config
|
||||
# note: we need to create a wrapper rather than symlinking it due
|
||||
# to some random dirname(argv[0]) magic performed by python-config
|
||||
cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
|
||||
#!/bin/sh
|
||||
exec "${abiver}-config" "\${@}"
|
||||
EOF
|
||||
chmod +x "${scriptdir}/python${pymajor}-config" || die
|
||||
ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
|
||||
# 2to3, pydoc
|
||||
ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
|
||||
ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
|
||||
# idle
|
||||
if use tk; then
|
||||
ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
|
||||
fi
|
||||
}
|
||||
2
sdk_container/src/third_party/prefix-overlay/dev-libs/libgpg-error/Manifest
vendored
Normal file
2
sdk_container/src/third_party/prefix-overlay/dev-libs/libgpg-error/Manifest
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
DIST libgpg-error-1.47.tar.bz2 1020862 BLAKE2B bc04efa0686b1b7d7cdce045fc080c090c1abec60349b673c2e1ce27900483aea090eb6ebcb3fb49a4eed36f18156a12413d5446f739475632f4ed2a2481ff27 SHA512 bbb4b15dae75856ee5b1253568674b56ad155524ae29a075cb5b0a7e74c4af685131775c3ea2226fff2f84ef80855e77aa661645d002b490a795c7ae57b66a30
|
||||
DIST libgpg-error-1.47.tar.bz2.sig 119 BLAKE2B d23ea6c38621407c8f9f0c6bde71abd0e50c136d2e5de9a6cef64627f5d398c344a3438995a2405c4ef148ad8638ef7125f34670819957acd7d597370f1630e5 SHA512 09343016eaf7fcc455f8ce533847153a8a9b7c36f375a8ebe71ef5fc2923edf7b70842f834f52c51874e427869487b74a2286ea0112cffad0d72f79cb6d4eceb
|
||||
@ -0,0 +1,22 @@
|
||||
This breaks our multilib builds:
|
||||
|
||||
Confirm gpg-error-config works... no
|
||||
*** Please report to <https://bugs.gnupg.org> with gpg-error-config-test.log
|
||||
|
||||
--- libgpg-error-1.44/src/Makefile.am
|
||||
+++ libgpg-error-1.44/src/Makefile.am
|
||||
@@ -347,14 +347,6 @@
|
||||
cp gpg-error.h gpgrt.h
|
||||
|
||||
gpg-error-config: gpgrt-config gpg-error-config-old gpg-error-config-test.sh
|
||||
- @echo $(ECHO_N) "Confirm gpg-error-config works... $(ECHO_C)"
|
||||
- @if ./gpg-error-config-test.sh --old-new; then \
|
||||
- echo "good"; \
|
||||
- else \
|
||||
- echo "no"; \
|
||||
- echo "*** Please report to <https://bugs.gnupg.org> with gpg-error-config-test.log"; \
|
||||
- exit 1; \
|
||||
- fi
|
||||
cp gpg-error-config-old $@
|
||||
|
||||
install-data-local:
|
||||
95
sdk_container/src/third_party/prefix-overlay/dev-libs/libgpg-error/libgpg-error-1.47.ebuild
vendored
Normal file
95
sdk_container/src/third_party/prefix-overlay/dev-libs/libgpg-error/libgpg-error-1.47.ebuild
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
# Maintainers should:
|
||||
# 1. Join the "Gentoo" project at https://dev.gnupg.org/project/view/27/
|
||||
# 2. Subscribe to release tasks like https://dev.gnupg.org/T6159
|
||||
# (find the one for the current release then subscribe to it +
|
||||
# any subsequent ones linked within so you're covered for a while.)
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/gnupg.asc
|
||||
inherit autotools multilib-minimal toolchain-funcs prefix verify-sig
|
||||
|
||||
DESCRIPTION="Contains error handling functions used by GnuPG software"
|
||||
HOMEPAGE="https://www.gnupg.org/related_software/libgpg-error"
|
||||
SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
|
||||
SRC_URI+=" verify-sig? ( mirror://gnupg/${PN}/${P}.tar.bz2.sig )"
|
||||
|
||||
LICENSE="GPL-2 LGPL-2.1"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
IUSE="common-lisp nls static-libs test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )"
|
||||
DEPEND="${RDEPEND}"
|
||||
BDEPEND="
|
||||
nls? ( sys-devel/gettext )
|
||||
verify-sig? ( sec-keys/openpgp-keys-gnupg )
|
||||
"
|
||||
|
||||
MULTILIB_WRAPPED_HEADERS=(
|
||||
/usr/include/gpg-error.h
|
||||
/usr/include/gpgrt.h
|
||||
)
|
||||
|
||||
MULTILIB_CHOST_TOOLS=(
|
||||
/usr/bin/gpg-error-config
|
||||
/usr/bin/gpgrt-config
|
||||
)
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-1.44-remove_broken_check.patch"
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
if use prefix ; then
|
||||
# don't hardcode /usr/xpg4/bin/sh as shell on Solaris
|
||||
sed -i -e 's/solaris\*/disabled/' configure.ac || die
|
||||
fi
|
||||
|
||||
# only necessary for as long as we run eautoreconf, configure.ac
|
||||
# uses ./autogen.sh to generate PACKAGE_VERSION, but autogen.sh is
|
||||
# not a pure /bin/sh script, so it fails on some hosts
|
||||
# Flatcar / t-lo 2023-09-19: Use build root for hprefixify to
|
||||
# prevent issues with prefix and cross-compiling, which causes
|
||||
# VERSION to be emptied when eautoreconf runs. This, in turn, will break
|
||||
# compilation with:
|
||||
# usage: mkhe:ader host_triplet template.h config.h version version_number
|
||||
if tc-is-cross-compiler ; then
|
||||
hprefixify -e "s#${EPREFIX}#${BROOT}#" -w 1 autogen.sh
|
||||
else
|
||||
hprefixify -w 1 autogen.sh
|
||||
fi
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local myeconfargs=(
|
||||
$(multilib_is_native_abi || echo --disable-languages)
|
||||
$(use_enable common-lisp languages)
|
||||
$(use_enable nls)
|
||||
# required for sys-power/suspend[crypt], bug 751568
|
||||
$(use_enable static-libs static)
|
||||
$(use_enable test tests)
|
||||
|
||||
# See bug #699206 and its duplicates wrt gpgme-config
|
||||
# Upstream no longer install this by default and we should
|
||||
# seek to disable it at some point.
|
||||
--enable-install-gpg-error-config
|
||||
|
||||
--enable-threads
|
||||
CC_FOR_BUILD="$(tc-getBUILD_CC)"
|
||||
$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
|
||||
)
|
||||
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
einstalldocs
|
||||
find "${ED}" -type f -name '*.la' -delete || die
|
||||
}
|
||||
14
sdk_container/src/third_party/prefix-overlay/dev-libs/libgpg-error/metadata.xml
vendored
Normal file
14
sdk_container/src/third_party/prefix-overlay/dev-libs/libgpg-error/metadata.xml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>base-system@gentoo.org</email>
|
||||
<name>Gentoo Base System</name>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="common-lisp">Install common-lisp files</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="cpe">cpe:/a:gnupg:libgpg-error</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
2202
sdk_container/src/third_party/prefix-overlay/eclass/distutils-r1.eclass
vendored
Normal file
2202
sdk_container/src/third_party/prefix-overlay/eclass/distutils-r1.eclass
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1485
sdk_container/src/third_party/prefix-overlay/eclass/python-utils-r1.eclass
vendored
Normal file
1485
sdk_container/src/third_party/prefix-overlay/eclass/python-utils-r1.eclass
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
sdk_container/src/third_party/prefix-overlay/metadata/layout.conf
vendored
Normal file
5
sdk_container/src/third_party/prefix-overlay/metadata/layout.conf
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
masters = portage-stable
|
||||
thin-manifests = true
|
||||
use-manifests = strict
|
||||
cache-format = md5-dict
|
||||
profile-formats = portage-2
|
||||
8
sdk_container/src/third_party/prefix-overlay/prefix/prefix-final/metadata.xml
vendored
Normal file
8
sdk_container/src/third_party/prefix-overlay/prefix/prefix-final/metadata.xml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<herd>flatcar</herd>
|
||||
<longdescription>Flatcar distro-independent prefix "final" packages.</longdescription>
|
||||
<use>
|
||||
</use>
|
||||
</pkgmetadata>
|
||||
1
sdk_container/src/third_party/prefix-overlay/prefix/prefix-final/prefix-final-0.0.1-r1.ebuild
vendored
Symbolic link
1
sdk_container/src/third_party/prefix-overlay/prefix/prefix-final/prefix-final-0.0.1-r1.ebuild
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
prefix-final-0.0.1.ebuild
|
||||
16
sdk_container/src/third_party/prefix-overlay/prefix/prefix-final/prefix-final-0.0.1.ebuild
vendored
Normal file
16
sdk_container/src/third_party/prefix-overlay/prefix/prefix-final/prefix-final-0.0.1.ebuild
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2032 the Flatcar maintainers.
|
||||
# Distributed under the terms of the Apache 2.0 license.
|
||||
|
||||
EAPI=7
|
||||
|
||||
DESCRIPTION="Prefix final layer base dependencies"
|
||||
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm64"
|
||||
|
||||
# These should be the absolute minimum runtime dependencies of the "final" prefix.
|
||||
# "Staging" has @system so it is pretty heavyweight.
|
||||
RDEPEND="${RDEPEND}
|
||||
virtual/libc
|
||||
"
|
||||
1
sdk_container/src/third_party/prefix-overlay/profiles/categories
vendored
Normal file
1
sdk_container/src/third_party/prefix-overlay/profiles/categories
vendored
Normal file
@ -0,0 +1 @@
|
||||
prefix
|
||||
1
sdk_container/src/third_party/prefix-overlay/profiles/repo_name
vendored
Normal file
1
sdk_container/src/third_party/prefix-overlay/profiles/repo_name
vendored
Normal file
@ -0,0 +1 @@
|
||||
prefix
|
||||
1
sdk_container/src/third_party/prefix-overlay/skel/etc/group
vendored
Symbolic link
1
sdk_container/src/third_party/prefix-overlay/skel/etc/group
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
/etc/group
|
||||
1
sdk_container/src/third_party/prefix-overlay/skel/etc/passwd
vendored
Symbolic link
1
sdk_container/src/third_party/prefix-overlay/skel/etc/passwd
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
/etc/passwd
|
||||
@ -0,0 +1 @@
|
||||
sys-apps/portage ~amd64
|
||||
2
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/package.accept_keywords/prefix
vendored
Normal file
2
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/package.accept_keywords/prefix
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
=app-misc/ca-certificates-20230311.3.93 ~*
|
||||
=sys-apps/systemd-utils-254.3 ~*
|
||||
2
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/package.mask/coreos
vendored
Normal file
2
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/package.mask/coreos
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
app-misc/ca-certificates::coreos # coreos ca-certificates doesn't support prefix
|
||||
sys-apps/baselayout::coreos # coreos baselayout depends on systemd
|
||||
1
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/package.mask/cross
vendored
Normal file
1
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/package.mask/cross
vendored
Normal file
@ -0,0 +1 @@
|
||||
>=sys-devel/gcc-13 # FIXME: Cannot cross-compile gcc 13+ using older version
|
||||
8
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/repos.conf/coreos.conf
vendored
Normal file
8
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/repos.conf/coreos.conf
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
main-repo = portage-stable
|
||||
|
||||
[coreos]
|
||||
location = /mnt/host/source/src/third_party/coreos-overlay
|
||||
|
||||
[portage-stable]
|
||||
location = /mnt/host/source/src/third_party/portage-stable
|
||||
2
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/repos.conf/crossdev.conf
vendored
Normal file
2
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/repos.conf/crossdev.conf
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
[x-crossdev]
|
||||
location = /usr/local/portage/crossdev
|
||||
3
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/repos.conf/prefix.conf
vendored
Normal file
3
sdk_container/src/third_party/prefix-overlay/skel/etc/portage/repos.conf/prefix.conf
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[prefix]
|
||||
location = /mnt/host/source/src/third_party/prefix-overlay
|
||||
priority = 1000
|
||||
1
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/Manifest
vendored
Normal file
1
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/Manifest
vendored
Normal file
@ -0,0 +1 @@
|
||||
DIST baselayout-2.14.tar.bz2 30182 BLAKE2B c5f67795233e565c2c75c97a55c000aec98e901bb0a25f1aeb52b01b44d7c09bfc6e67813234629ca71ff32d603e82ada8e66e5ab6007fa0664b95367256320d SHA512 bffd118f5e92975b9247d854fc5683a311dbcd03efa37a13dfd05d04e92a6e784858d3a55aa689f782229afc5985e829eb332c08a79eed081bf0a47720ca7e8a
|
||||
350
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/baselayout-2.14.ebuild
vendored
Normal file
350
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/baselayout-2.14.ebuild
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit multilib prefix
|
||||
|
||||
DESCRIPTION="Filesystem baselayout and init scripts"
|
||||
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
|
||||
if [[ ${PV} = 9999 ]]; then
|
||||
EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI="https://gitweb.gentoo.org/proj/${PN}.git/snapshot/${P}.tar.bz2"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
fi
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
IUSE="build +split-usr"
|
||||
|
||||
RDEPEND="!sys-apps/baselayout-prefix"
|
||||
|
||||
riscv_compat_symlink() {
|
||||
# Here we apply some special sauce for riscv.
|
||||
# Two multilib layouts exist for now:
|
||||
# 1) one level libdirs, (32bit) "lib" and (64bit) "lib64"
|
||||
# these are chosen by us to closely resemble other arches
|
||||
# 2) two level libdirs, "lib64/lp64d" "lib64/lp64" "lib32/ilp32d" ...
|
||||
# this is the glibc/gcc default
|
||||
# Unfortunately, the default has only one fallback, which is "lib"
|
||||
# for both 32bit and 64bit. So things do not break in 1), we need
|
||||
# to provide compatibility symlinks...
|
||||
|
||||
# This function has exactly two parameters:
|
||||
# - the default libdir, to determine if 1) or 2) applies
|
||||
# - the location of the symlink (which points to ".")
|
||||
|
||||
# Note: we call this only in the ${SYMLINK_LIB} = no codepath, since
|
||||
# there never was a ${SYMLINK_LIB} = yes riscv profile.
|
||||
|
||||
case ${CHOST} in
|
||||
riscv*)
|
||||
# are we on a one level libdir profile? is there no symlink yet?
|
||||
if [[ ${1} != */* && ! -L ${2} ]] ; then
|
||||
ln -s . $2 || die "Unable to make $2 riscv compatibility symlink"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Create our multilib dirs - the Makefile has no knowledge of this
|
||||
multilib_layout() {
|
||||
local dir def_libdir libdir libdirs
|
||||
local prefix prefix_lst
|
||||
def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
|
||||
libdirs=$(get_all_libdirs)
|
||||
|
||||
if [[ -z "${SYMLINK_LIB}" || ${SYMLINK_LIB} = no ]] ; then
|
||||
prefix_lst=( "${EROOT}"/{,usr/,usr/local/} )
|
||||
for prefix in "${prefix_lst[@]}"; do
|
||||
for libdir in ${libdirs}; do
|
||||
dir="${prefix}${libdir}"
|
||||
if [[ -e "${dir}" ]]; then
|
||||
[[ ! -d "${dir}" ]] &&
|
||||
die "${dir} exists but is not a directory"
|
||||
continue
|
||||
fi
|
||||
if ! use split-usr && [[ ${prefix} = ${EROOT}/ ]]; then
|
||||
libdir="${libdir%%/*}"
|
||||
dir="${prefix}${libdir}"
|
||||
einfo "symlinking ${dir} to usr/${libdir}"
|
||||
ln -s usr/${libdir} ${dir} ||
|
||||
die "Unable to make ${dir} symlink"
|
||||
else
|
||||
einfo "creating directory ${dir}"
|
||||
mkdir -p "${dir}" ||
|
||||
die "Unable to create ${dir} directory"
|
||||
fi
|
||||
done
|
||||
[[ -d "${prefix}${def_libdir}" ]] && riscv_compat_symlink "${def_libdir}" "${prefix}${def_libdir}/${DEFAULT_ABI}"
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ -z "${def_libdir}" ] &&
|
||||
die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
|
||||
|
||||
# figure out which paths should be symlinks and which should be directories
|
||||
local dirs syms exp d
|
||||
for libdir in ${libdirs} ; do
|
||||
if use split-usr ; then
|
||||
exp=( {,usr/,usr/local/}${libdir} )
|
||||
else
|
||||
exp=( {usr/,usr/local/}${libdir} )
|
||||
fi
|
||||
for d in "${exp[@]}" ; do
|
||||
# most things should be dirs
|
||||
if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
|
||||
[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
|
||||
else
|
||||
[ -h "${d}" ] && syms+=" ${d}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [ -n "${syms}${dirs}" ] ; then
|
||||
ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
|
||||
ewarn "have these paths configured as follows:"
|
||||
[ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
|
||||
[ -n "${syms}" ] && ewarn "directories:${syms}"
|
||||
ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
|
||||
ewarn "If things fail, you will need to manually create/move the directories."
|
||||
echo
|
||||
fi
|
||||
|
||||
# setup symlinks and dirs where we expect them to be; do not migrate
|
||||
# data ... just fall over in that case.
|
||||
if use split-usr ; then
|
||||
prefix_lst=( "${EROOT}"/{,usr/,usr/local/} )
|
||||
else
|
||||
prefix_lst=( "${EROOT}"/{usr/,usr/local/} )
|
||||
fi
|
||||
for prefix in "${prefix_lst[@]}"; do
|
||||
if [ "${SYMLINK_LIB}" = yes ] ; then
|
||||
# we need to make sure "lib" points to the native libdir
|
||||
if [ -h "${prefix}lib" ] ; then
|
||||
# it's already a symlink! assume it's pointing to right place ...
|
||||
continue
|
||||
elif [ -d "${prefix}lib" ] ; then
|
||||
# "lib" is a dir, so need to convert to a symlink
|
||||
ewarn "Converting ${prefix}lib from a dir to a symlink"
|
||||
rm -f "${prefix}lib"/.keep || die
|
||||
if rmdir "${prefix}lib" 2>/dev/null ; then
|
||||
ln -s ${def_libdir} "${prefix}lib" || die
|
||||
else
|
||||
die "non-empty dir found where we needed a symlink: ${prefix}lib"
|
||||
fi
|
||||
else
|
||||
# nothing exists, so just set it up sanely
|
||||
ewarn "Initializing ${prefix}lib as a symlink"
|
||||
mkdir -p "${prefix}" || die
|
||||
rm -f "${prefix}lib" || die
|
||||
ln -s ${def_libdir} "${prefix}lib" || die
|
||||
mkdir -p "${prefix}${def_libdir}" || die #423571
|
||||
fi
|
||||
else
|
||||
# we need to make sure "lib" is a dir
|
||||
if [ -h "${prefix}lib" ] ; then
|
||||
# "lib" is a symlink, so need to convert to a dir
|
||||
ewarn "Converting ${prefix}lib from a symlink to a dir"
|
||||
rm -f "${prefix}lib" || die
|
||||
if [ -d "${prefix}lib32" ] ; then
|
||||
ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
|
||||
mv "${prefix}lib32" "${prefix}lib" || die
|
||||
else
|
||||
mkdir -p "${prefix}lib" || die
|
||||
fi
|
||||
elif [ -d "${prefix}lib" ] && ! has lib32 ${libdirs} ; then
|
||||
# make sure the old "lib" ABI location does not exist; we
|
||||
# only symlinked the lib dir on systems where we moved it
|
||||
# to "lib32" ...
|
||||
case ${CHOST} in
|
||||
i?86*|x86_64*|powerpc*|sparc*|s390*)
|
||||
if [[ -d ${prefix}lib32 && ! -h ${prefix}lib32 ]] ; then
|
||||
rm -f "${prefix}lib32"/.keep || die
|
||||
if ! rmdir "${prefix}lib32" 2>/dev/null ; then
|
||||
ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
|
||||
die "non-empty dir found where there should be none: ${prefix}lib32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# nothing exists, so just set it up sanely
|
||||
ewarn "Initializing ${prefix}lib as a dir"
|
||||
mkdir -p "${prefix}lib" || die
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if ! use split-usr ; then
|
||||
for libdir in ${libdirs}; do
|
||||
if [[ ! -e "${EROOT}${libdir}" ]]; then
|
||||
ln -s usr/"${libdir}" "${EROOT}${libdir}" ||
|
||||
die "Unable to make ${EROOT}${libdir} symlink"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
multilib_layout
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# don't want symlinked directories in PATH on systems with usr-merge
|
||||
if ! use split-usr && ! use prefix-guest; then
|
||||
sed \
|
||||
-e 's|:/usr/sbin:|:|g' \
|
||||
-e 's|:/sbin:|:|g' \
|
||||
-e 's|:/bin:|:|g' \
|
||||
-i etc/env.d/50baselayout || die
|
||||
fi
|
||||
|
||||
if use prefix; then
|
||||
hprefixify -e "/EUID/s,0,${EUID}," -q '"' etc/profile
|
||||
hprefixify etc/shells share/passwd
|
||||
hprefixify -w '/PATH=/' etc/env.d/50baselayout
|
||||
hprefixify -w 1 etc/env.d/50baselayout
|
||||
echo PATH=/usr/sbin:/sbin:/usr/bin:/bin >> etc/env.d/99host
|
||||
|
||||
# change branding
|
||||
sed -i \
|
||||
-e '/gentoo-release/s/Gentoo Base/Gentoo Prefix Base/' \
|
||||
-e '/make_os_release/s/${OS}/Prefix/' \
|
||||
Makefile || die
|
||||
fi
|
||||
|
||||
# handle multilib paths. do it here because we want this behavior
|
||||
# regardless of the C library that you're using. we do explicitly
|
||||
# list paths which the native ldconfig searches, but this isn't
|
||||
# problematic as it doesn't change the resulting ld.so.cache or
|
||||
# take longer to generate. similarly, listing both the native
|
||||
# path and the symlinked path doesn't change the resulting cache.
|
||||
local libdir ldpaths
|
||||
for libdir in $(get_all_libdirs) ; do
|
||||
if use split-usr || use prefix-guest; then
|
||||
ldpaths+=":${EPREFIX}/${libdir}"
|
||||
fi
|
||||
ldpaths+=":${EPREFIX}/usr/${libdir}"
|
||||
ldpaths+=":${EPREFIX}/usr/local/${libdir}"
|
||||
done
|
||||
echo "LDPATH='${ldpaths#:}'" >> etc/env.d/50baselayout
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake \
|
||||
DESTDIR="${ED}" \
|
||||
install
|
||||
|
||||
if [[ ${CHOST} == *-darwin* ]] ; then
|
||||
# add SDK path which contains development manpages
|
||||
echo "MANPATH=${EPREFIX}/MacOSX.sdk/usr/share/man" \
|
||||
> "${ED}"/etc/env.d/98macos-sdk
|
||||
fi
|
||||
|
||||
# need the makefile in pkg_preinst
|
||||
insinto /usr/share/${PN}
|
||||
doins Makefile
|
||||
|
||||
dodoc ChangeLog
|
||||
|
||||
# bug 858596
|
||||
if use prefix-guest ; then
|
||||
dodir sbin
|
||||
cat > "${ED}"/sbin/runscript <<- EOF
|
||||
#!/usr/bin/env sh
|
||||
source "${EPREFIX}/lib/gentoo/functions.sh"
|
||||
|
||||
eerror "runscript/openrc-run not supported by Gentoo Prefix Base System release ${PV}" 1>&2
|
||||
exit 1
|
||||
EOF
|
||||
chmod 755 "${ED}"/sbin/runscript || die
|
||||
cp "${ED}"/sbin/{runscript,openrc-run} || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
# We need to install directories and maybe some dev nodes when building
|
||||
# stages, but they cannot be in CONTENTS.
|
||||
# Also, we cannot reference $S as binpkg will break so we do this.
|
||||
multilib_layout
|
||||
if use build ; then
|
||||
if use split-usr ; then
|
||||
emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout
|
||||
else
|
||||
emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout-usrmerge
|
||||
fi
|
||||
fi
|
||||
rm -f "${ED}"/usr/share/${PN}/Makefile || die
|
||||
|
||||
# Create symlinks in pkg_preinst to avoid Portage collision check.
|
||||
# Create the symlinks in ${ED} via dosym so that we own it.
|
||||
# Only create the symlinks if it wont cause a conflict in ${EROOT}.
|
||||
if [[ -L ${EROOT}/var/lock || ! -e ${EROOT}/var/lock ]]; then
|
||||
dosym ../run/lock /var/lock
|
||||
fi
|
||||
if [[ -L ${EROOT}/var/run || ! -e ${EROOT}/var/run ]]; then
|
||||
dosym ../run /var/run
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local x
|
||||
|
||||
# We installed some files to /usr/share/baselayout instead of /etc to stop
|
||||
# (1) overwriting the user's settings
|
||||
# (2) screwing things up when attempting to merge files
|
||||
# (3) accidentally packaging up personal files with quickpkg
|
||||
# If they don't exist then we install them
|
||||
for x in master.passwd passwd shadow group fstab ; do
|
||||
[ -e "${EROOT}/etc/${x}" ] && continue
|
||||
[ -e "${EROOT}/usr/share/baselayout/${x}" ] || continue
|
||||
cp -p "${EROOT}/usr/share/baselayout/${x}" "${EROOT}"/etc || die
|
||||
done
|
||||
|
||||
# Force shadow permissions to not be world-readable #260993
|
||||
for x in shadow ; do
|
||||
if [ -e "${EROOT}/etc/${x}" ] ; then
|
||||
chmod o-rwx "${EROOT}/etc/${x}" || die
|
||||
fi
|
||||
done
|
||||
# whine about users that lack passwords #193541
|
||||
if [[ -e "${EROOT}"/etc/shadow ]] ; then
|
||||
local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow)
|
||||
if [[ -n ${bad_users} ]] ; then
|
||||
echo
|
||||
ewarn "The following users lack passwords!"
|
||||
ewarn ${bad_users}
|
||||
fi
|
||||
fi
|
||||
|
||||
# whine about users with invalid shells #215698
|
||||
if [[ -e "${EROOT}"/etc/passwd ]] ; then
|
||||
local bad_shells=$(awk -F: 'system("test -e ${ROOT}" $7) { print $1 " - " $7}' "${EROOT}"/etc/passwd | sort)
|
||||
if [[ -n ${bad_shells} ]] ; then
|
||||
echo
|
||||
ewarn "The following users have non-existent shells!"
|
||||
ewarn "${bad_shells}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# https://bugs.gentoo.org/361349
|
||||
if use kernel_linux; then
|
||||
mkdir -p "${EROOT}"/run || die
|
||||
|
||||
local found fstype mountpoint
|
||||
while read -r _ mountpoint fstype _; do
|
||||
[[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1
|
||||
done < "${ROOT}"/proc/mounts
|
||||
[[ -z ${found} ]] &&
|
||||
ewarn "You should reboot now to get /run mounted with tmpfs!"
|
||||
fi
|
||||
|
||||
if [[ -e "${EROOT}"/etc/env.d/00basic ]]; then
|
||||
ewarn "${EROOT}/etc/env.d/00basic is now ${EROOT}/etc/env.d/50baselayout"
|
||||
ewarn "Please migrate your changes."
|
||||
fi
|
||||
}
|
||||
350
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/baselayout-9999.ebuild
vendored
Normal file
350
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/baselayout-9999.ebuild
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit multilib prefix
|
||||
|
||||
DESCRIPTION="Filesystem baselayout and init scripts"
|
||||
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
|
||||
if [[ ${PV} = 9999 ]]; then
|
||||
EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI="https://gitweb.gentoo.org/proj/${PN}.git/snapshot/${P}.tar.bz2"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
||||
fi
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
IUSE="build +split-usr"
|
||||
|
||||
RDEPEND="!sys-apps/baselayout-prefix"
|
||||
|
||||
riscv_compat_symlink() {
|
||||
# Here we apply some special sauce for riscv.
|
||||
# Two multilib layouts exist for now:
|
||||
# 1) one level libdirs, (32bit) "lib" and (64bit) "lib64"
|
||||
# these are chosen by us to closely resemble other arches
|
||||
# 2) two level libdirs, "lib64/lp64d" "lib64/lp64" "lib32/ilp32d" ...
|
||||
# this is the glibc/gcc default
|
||||
# Unfortunately, the default has only one fallback, which is "lib"
|
||||
# for both 32bit and 64bit. So things do not break in 1), we need
|
||||
# to provide compatibility symlinks...
|
||||
|
||||
# This function has exactly two parameters:
|
||||
# - the default libdir, to determine if 1) or 2) applies
|
||||
# - the location of the symlink (which points to ".")
|
||||
|
||||
# Note: we call this only in the ${SYMLINK_LIB} = no codepath, since
|
||||
# there never was a ${SYMLINK_LIB} = yes riscv profile.
|
||||
|
||||
case ${CHOST} in
|
||||
riscv*)
|
||||
# are we on a one level libdir profile? is there no symlink yet?
|
||||
if [[ ${1} != */* && ! -L ${2} ]] ; then
|
||||
ln -s . $2 || die "Unable to make $2 riscv compatibility symlink"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Create our multilib dirs - the Makefile has no knowledge of this
|
||||
multilib_layout() {
|
||||
local dir def_libdir libdir libdirs
|
||||
local prefix prefix_lst
|
||||
def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
|
||||
libdirs=$(get_all_libdirs)
|
||||
|
||||
if [[ -z "${SYMLINK_LIB}" || ${SYMLINK_LIB} = no ]] ; then
|
||||
prefix_lst=( "${EROOT}"/{,usr/,usr/local/} )
|
||||
for prefix in "${prefix_lst[@]}"; do
|
||||
for libdir in ${libdirs}; do
|
||||
dir="${prefix}${libdir}"
|
||||
if [[ -e "${dir}" ]]; then
|
||||
[[ ! -d "${dir}" ]] &&
|
||||
die "${dir} exists but is not a directory"
|
||||
continue
|
||||
fi
|
||||
if ! use split-usr && [[ ${prefix} = ${EROOT}/ ]]; then
|
||||
libdir="${libdir%%/*}"
|
||||
dir="${prefix}${libdir}"
|
||||
einfo "symlinking ${dir} to usr/${libdir}"
|
||||
ln -s usr/${libdir} ${dir} ||
|
||||
die "Unable to make ${dir} symlink"
|
||||
else
|
||||
einfo "creating directory ${dir}"
|
||||
mkdir -p "${dir}" ||
|
||||
die "Unable to create ${dir} directory"
|
||||
fi
|
||||
done
|
||||
[[ -d "${prefix}${def_libdir}" ]] && riscv_compat_symlink "${def_libdir}" "${prefix}${def_libdir}/${DEFAULT_ABI}"
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ -z "${def_libdir}" ] &&
|
||||
die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
|
||||
|
||||
# figure out which paths should be symlinks and which should be directories
|
||||
local dirs syms exp d
|
||||
for libdir in ${libdirs} ; do
|
||||
if use split-usr ; then
|
||||
exp=( {,usr/,usr/local/}${libdir} )
|
||||
else
|
||||
exp=( {usr/,usr/local/}${libdir} )
|
||||
fi
|
||||
for d in "${exp[@]}" ; do
|
||||
# most things should be dirs
|
||||
if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
|
||||
[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
|
||||
else
|
||||
[ -h "${d}" ] && syms+=" ${d}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [ -n "${syms}${dirs}" ] ; then
|
||||
ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
|
||||
ewarn "have these paths configured as follows:"
|
||||
[ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
|
||||
[ -n "${syms}" ] && ewarn "directories:${syms}"
|
||||
ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
|
||||
ewarn "If things fail, you will need to manually create/move the directories."
|
||||
echo
|
||||
fi
|
||||
|
||||
# setup symlinks and dirs where we expect them to be; do not migrate
|
||||
# data ... just fall over in that case.
|
||||
if use split-usr ; then
|
||||
prefix_lst=( "${EROOT}"/{,usr/,usr/local/} )
|
||||
else
|
||||
prefix_lst=( "${EROOT}"/{usr/,usr/local/} )
|
||||
fi
|
||||
for prefix in "${prefix_lst[@]}"; do
|
||||
if [ "${SYMLINK_LIB}" = yes ] ; then
|
||||
# we need to make sure "lib" points to the native libdir
|
||||
if [ -h "${prefix}lib" ] ; then
|
||||
# it's already a symlink! assume it's pointing to right place ...
|
||||
continue
|
||||
elif [ -d "${prefix}lib" ] ; then
|
||||
# "lib" is a dir, so need to convert to a symlink
|
||||
ewarn "Converting ${prefix}lib from a dir to a symlink"
|
||||
rm -f "${prefix}lib"/.keep || die
|
||||
if rmdir "${prefix}lib" 2>/dev/null ; then
|
||||
ln -s ${def_libdir} "${prefix}lib" || die
|
||||
else
|
||||
die "non-empty dir found where we needed a symlink: ${prefix}lib"
|
||||
fi
|
||||
else
|
||||
# nothing exists, so just set it up sanely
|
||||
ewarn "Initializing ${prefix}lib as a symlink"
|
||||
mkdir -p "${prefix}" || die
|
||||
rm -f "${prefix}lib" || die
|
||||
ln -s ${def_libdir} "${prefix}lib" || die
|
||||
mkdir -p "${prefix}${def_libdir}" || die #423571
|
||||
fi
|
||||
else
|
||||
# we need to make sure "lib" is a dir
|
||||
if [ -h "${prefix}lib" ] ; then
|
||||
# "lib" is a symlink, so need to convert to a dir
|
||||
ewarn "Converting ${prefix}lib from a symlink to a dir"
|
||||
rm -f "${prefix}lib" || die
|
||||
if [ -d "${prefix}lib32" ] ; then
|
||||
ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
|
||||
mv "${prefix}lib32" "${prefix}lib" || die
|
||||
else
|
||||
mkdir -p "${prefix}lib" || die
|
||||
fi
|
||||
elif [ -d "${prefix}lib" ] && ! has lib32 ${libdirs} ; then
|
||||
# make sure the old "lib" ABI location does not exist; we
|
||||
# only symlinked the lib dir on systems where we moved it
|
||||
# to "lib32" ...
|
||||
case ${CHOST} in
|
||||
i?86*|x86_64*|powerpc*|sparc*|s390*)
|
||||
if [[ -d ${prefix}lib32 && ! -h ${prefix}lib32 ]] ; then
|
||||
rm -f "${prefix}lib32"/.keep || die
|
||||
if ! rmdir "${prefix}lib32" 2>/dev/null ; then
|
||||
ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
|
||||
die "non-empty dir found where there should be none: ${prefix}lib32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# nothing exists, so just set it up sanely
|
||||
ewarn "Initializing ${prefix}lib as a dir"
|
||||
mkdir -p "${prefix}lib" || die
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if ! use split-usr ; then
|
||||
for libdir in ${libdirs}; do
|
||||
if [[ ! -e "${EROOT}${libdir}" ]]; then
|
||||
ln -s usr/"${libdir}" "${EROOT}${libdir}" ||
|
||||
die "Unable to make ${EROOT}${libdir} symlink"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
multilib_layout
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# don't want symlinked directories in PATH on systems with usr-merge
|
||||
if ! use split-usr && ! use prefix-guest; then
|
||||
sed \
|
||||
-e 's|:/usr/sbin:|:|g' \
|
||||
-e 's|:/sbin:|:|g' \
|
||||
-e 's|:/bin:|:|g' \
|
||||
-i etc/env.d/50baselayout || die
|
||||
fi
|
||||
|
||||
if use prefix; then
|
||||
hprefixify -e "/EUID/s,0,${EUID}," -q '"' etc/profile
|
||||
hprefixify etc/shells share/passwd
|
||||
hprefixify -w '/PATH=/' etc/env.d/50baselayout
|
||||
hprefixify -w 1 etc/env.d/50baselayout
|
||||
echo PATH=/usr/sbin:/sbin:/usr/bin:/bin >> etc/env.d/99host
|
||||
|
||||
# change branding
|
||||
sed -i \
|
||||
-e '/gentoo-release/s/Gentoo Base/Gentoo Prefix Base/' \
|
||||
-e '/make_os_release/s/${OS}/Prefix/' \
|
||||
Makefile || die
|
||||
fi
|
||||
|
||||
# handle multilib paths. do it here because we want this behavior
|
||||
# regardless of the C library that you're using. we do explicitly
|
||||
# list paths which the native ldconfig searches, but this isn't
|
||||
# problematic as it doesn't change the resulting ld.so.cache or
|
||||
# take longer to generate. similarly, listing both the native
|
||||
# path and the symlinked path doesn't change the resulting cache.
|
||||
local libdir ldpaths
|
||||
for libdir in $(get_all_libdirs) ; do
|
||||
if use split-usr || use prefix-guest; then
|
||||
ldpaths+=":${EPREFIX}/${libdir}"
|
||||
fi
|
||||
ldpaths+=":${EPREFIX}/usr/${libdir}"
|
||||
ldpaths+=":${EPREFIX}/usr/local/${libdir}"
|
||||
done
|
||||
echo "LDPATH='${ldpaths#:}'" >> etc/env.d/50baselayout
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake \
|
||||
DESTDIR="${ED}" \
|
||||
install
|
||||
|
||||
if [[ ${CHOST} == *-darwin* ]] ; then
|
||||
# add SDK path which contains development manpages
|
||||
echo "MANPATH=${EPREFIX}/MacOSX.sdk/usr/share/man" \
|
||||
> "${ED}"/etc/env.d/98macos-sdk
|
||||
fi
|
||||
|
||||
# need the makefile in pkg_preinst
|
||||
insinto /usr/share/${PN}
|
||||
doins Makefile
|
||||
|
||||
dodoc ChangeLog
|
||||
|
||||
# bug 858596
|
||||
if use prefix-guest ; then
|
||||
dodir sbin
|
||||
cat > "${ED}"/sbin/runscript <<- EOF
|
||||
#!/usr/bin/env sh
|
||||
source "${EPREFIX}/lib/gentoo/functions.sh"
|
||||
|
||||
eerror "runscript/openrc-run not supported by Gentoo Prefix Base System release ${PV}" 1>&2
|
||||
exit 1
|
||||
EOF
|
||||
chmod 755 "${ED}"/sbin/runscript || die
|
||||
cp "${ED}"/sbin/{runscript,openrc-run} || die
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
# We need to install directories and maybe some dev nodes when building
|
||||
# stages, but they cannot be in CONTENTS.
|
||||
# Also, we cannot reference $S as binpkg will break so we do this.
|
||||
multilib_layout
|
||||
if use build ; then
|
||||
if use split-usr ; then
|
||||
emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout
|
||||
else
|
||||
emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout-usrmerge
|
||||
fi
|
||||
fi
|
||||
rm -f "${ED}"/usr/share/${PN}/Makefile || die
|
||||
|
||||
# Create symlinks in pkg_preinst to avoid Portage collision check.
|
||||
# Create the symlinks in ${ED} via dosym so that we own it.
|
||||
# Only create the symlinks if it wont cause a conflict in ${EROOT}.
|
||||
if [[ -L ${EROOT}/var/lock || ! -e ${EROOT}/var/lock ]]; then
|
||||
dosym ../run/lock /var/lock
|
||||
fi
|
||||
if [[ -L ${EROOT}/var/run || ! -e ${EROOT}/var/run ]]; then
|
||||
dosym ../run /var/run
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
local x
|
||||
|
||||
# We installed some files to /usr/share/baselayout instead of /etc to stop
|
||||
# (1) overwriting the user's settings
|
||||
# (2) screwing things up when attempting to merge files
|
||||
# (3) accidentally packaging up personal files with quickpkg
|
||||
# If they don't exist then we install them
|
||||
for x in master.passwd passwd shadow group fstab ; do
|
||||
[ -e "${EROOT}/etc/${x}" ] && continue
|
||||
[ -e "${EROOT}/usr/share/baselayout/${x}" ] || continue
|
||||
cp -p "${EROOT}/usr/share/baselayout/${x}" "${EROOT}"/etc || die
|
||||
done
|
||||
|
||||
# Force shadow permissions to not be world-readable #260993
|
||||
for x in shadow ; do
|
||||
if [ -e "${EROOT}/etc/${x}" ] ; then
|
||||
chmod o-rwx "${EROOT}/etc/${x}" || die
|
||||
fi
|
||||
done
|
||||
# whine about users that lack passwords #193541
|
||||
if [[ -e "${EROOT}"/etc/shadow ]] ; then
|
||||
local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow)
|
||||
if [[ -n ${bad_users} ]] ; then
|
||||
echo
|
||||
ewarn "The following users lack passwords!"
|
||||
ewarn ${bad_users}
|
||||
fi
|
||||
fi
|
||||
|
||||
# whine about users with invalid shells #215698
|
||||
if [[ -e "${EROOT}"/etc/passwd ]] ; then
|
||||
local bad_shells=$(awk -F: 'system("test -e ${ROOT}" $7) { print $1 " - " $7}' "${EROOT}"/etc/passwd | sort)
|
||||
if [[ -n ${bad_shells} ]] ; then
|
||||
echo
|
||||
ewarn "The following users have non-existent shells!"
|
||||
ewarn "${bad_shells}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# https://bugs.gentoo.org/361349
|
||||
if use kernel_linux; then
|
||||
mkdir -p "${EROOT}"/run || die
|
||||
|
||||
local found fstype mountpoint
|
||||
while read -r _ mountpoint fstype _; do
|
||||
[[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1
|
||||
done < "${ROOT}"/proc/mounts
|
||||
[[ -z ${found} ]] &&
|
||||
ewarn "You should reboot now to get /run mounted with tmpfs!"
|
||||
fi
|
||||
|
||||
if [[ -e "${EROOT}"/etc/env.d/00basic ]]; then
|
||||
ewarn "${EROOT}/etc/env.d/00basic is now ${EROOT}/etc/env.d/50baselayout"
|
||||
ewarn "Please migrate your changes."
|
||||
fi
|
||||
}
|
||||
17
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/metadata.xml
vendored
Normal file
17
sdk_container/src/third_party/prefix-overlay/sys-apps/baselayout/metadata.xml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>williamh@gentoo.org</email>
|
||||
<name>William Hubbs</name>
|
||||
</maintainer>
|
||||
<maintainer type="project">
|
||||
<email>base-system@gentoo.org</email>
|
||||
<name>Gentoo Base System</name>
|
||||
</maintainer>
|
||||
<stabilize-allarches/>
|
||||
<upstream>
|
||||
<remote-id type="gentoo">proj/baselayout</remote-id>
|
||||
<remote-id type="github">gentoo/baselayout</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
2
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/Manifest
vendored
Normal file
2
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/Manifest
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
DIST systemd-musl-patches-254.3.tar.gz 28640 BLAKE2B 54837f49cdb8cf025e367ad13bab0d0509c2e11ad84d29724bb6baa226c54e0ab97a91035361f66009dd9b1a22f7b3e82f90b1c14adf4aa20d576b9410589d38 SHA512 07d028a57025b2626471d6f48507f2dfc50658db24efaac93bafae9a1d4cdc3ec82e80da426d2a6280c32af2d813565609dab7df5538260ba809b63309a0ffed
|
||||
DIST systemd-stable-254.3.tar.gz 14329148 BLAKE2B 10b947e04a4ef9ccaeb7adaa67ac0f391927fb172c0750ffb93d4df69d970fd91f26b052f8bfdfb4f81ae69566d0a3459cbc87cc86b624014cfb8781a2914121 SHA512 a0c361c993ac9a121823bdd58e29ef7bd25ccfd206ae0c3e1eed9833b3ddf24f53afe6f669eb9fbff5078977403236b0e4ef5a5f6fde56c504caed1d411e71fe
|
||||
3
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/files/40-gentoo.rules
vendored
Normal file
3
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/files/40-gentoo.rules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Gentoo specific groups
|
||||
ACTION=="add", SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy"
|
||||
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
|
||||
3
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/files/legacy.conf
vendored
Normal file
3
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/files/legacy.conf
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Based on legacy.conf from systemd
|
||||
d /run/lock
|
||||
L /var/lock - - - - ../run/lock
|
||||
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec ionice -c idle -t systemd-tmpfiles --clean
|
||||
18
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/files/systemd-tmpfiles-setup
vendored
Normal file
18
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/files/systemd-tmpfiles-setup
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2022 Gentoo Authors
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
description="Create Volatile Files and Directories"
|
||||
|
||||
depend()
|
||||
{
|
||||
provide tmpfiles-setup tmpfiles.setup
|
||||
need localmount
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "${description}"
|
||||
systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
|
||||
eend $?
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2022 Gentoo Authors
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
description="Create Static Devices Nodes in /dev"
|
||||
|
||||
depend()
|
||||
{
|
||||
provide tmpfiles-dev tmpfiles.dev
|
||||
use dev-mount
|
||||
before dev
|
||||
keyword -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "${description}"
|
||||
systemd-tmpfiles --prefix=/dev --create --boot
|
||||
eend $?
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
From 5973e4b237e7b50dca1c9f3157db459ef1ee6da5 Mon Sep 17 00:00:00 2001
|
||||
From: Violet Purcell <vimproved@inventati.org>
|
||||
Date: Sat, 9 Sep 2023 13:22:54 -0400
|
||||
Subject: [PATCH] meson: add link-kernel-install-shared option
|
||||
|
||||
Signed-off-by: Violet Purcell <vimproved@inventati.org>
|
||||
---
|
||||
meson.build | 9 ++++++++-
|
||||
meson_options.txt | 2 ++
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 053e772567..003a34574a 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -4420,11 +4420,17 @@ executable(
|
||||
install : true,
|
||||
install_dir : rootlibexecdir)
|
||||
|
||||
+if get_option('link-kernel-install-shared')
|
||||
+ kernel_install_link_with = [libshared]
|
||||
+else
|
||||
+ kernel_install_link_with = [libsystemd_static, libshared_static]
|
||||
+endif
|
||||
+
|
||||
kernel_install = executable(
|
||||
'kernel-install',
|
||||
'src/kernel-install/kernel-install.c',
|
||||
include_directories : includes,
|
||||
- link_with : [libshared],
|
||||
+ link_with : kernel_install_link_with,
|
||||
dependencies : [userspace,
|
||||
versiondep],
|
||||
install_rpath : rootpkglibdir,
|
||||
@@ -5059,6 +5065,7 @@ foreach tuple : [
|
||||
['link-timesyncd-shared', get_option('link-timesyncd-shared')],
|
||||
['link-journalctl-shared', get_option('link-journalctl-shared')],
|
||||
['link-boot-shared', get_option('link-boot-shared')],
|
||||
+ ['link-kernel-install-shared', get_option('link-kernel-install-shared')],
|
||||
['link-portabled-shared', get_option('link-portabled-shared')],
|
||||
['first-boot-full-preset'],
|
||||
['fexecve'],
|
||||
diff --git a/meson_options.txt b/meson_options.txt
|
||||
index 1909323850..36794e6d98 100644
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -29,6 +29,8 @@ option('link-journalctl-shared', type: 'boolean',
|
||||
description : 'link journalctl against libsystemd-shared.so')
|
||||
option('link-boot-shared', type: 'boolean',
|
||||
description : 'link bootctl and systemd-bless-boot against libsystemd-shared.so')
|
||||
+option('link-kernel-install-shared', type: 'boolean',
|
||||
+ description : 'link kernel-install against libsystemd-shared.so')
|
||||
option('link-portabled-shared', type: 'boolean',
|
||||
description : 'link systemd-portabled and its helpers to libsystemd-shared.so')
|
||||
option('first-boot-full-preset', type: 'boolean', value: false,
|
||||
--
|
||||
2.42.0
|
||||
|
||||
18
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/metadata.xml
vendored
Normal file
18
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/metadata.xml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>systemd@gentoo.org</email>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="boot">Enable systemd-boot (UEFI boot manager)</flag>
|
||||
<flag name="kmod">Enable kernel module loading via <pkg>sys-apps/kmod</pkg></flag>
|
||||
<flag name="sysusers">Enable systemd-sysusers</flag>
|
||||
<flag name="tmpfiles">Enable systemd-tmpfiles</flag>
|
||||
<flag name="udev">Enable systemd-udev (userspace device manager)</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">systemd/systemd</remote-id>
|
||||
<remote-id type="github">systemd/systemd-stable</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
537
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/systemd-utils-254.3.ebuild
vendored
Normal file
537
sdk_container/src/third_party/prefix-overlay/sys-apps/systemd-utils/systemd-utils-254.3.ebuild
vendored
Normal file
@ -0,0 +1,537 @@
|
||||
# Copyright 2022-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
|
||||
QA_PKGCONFIG_VERSION=$(ver_cut 1)
|
||||
|
||||
inherit bash-completion-r1 flag-o-matic linux-info meson-multilib python-single-r1
|
||||
inherit secureboot toolchain-funcs udev usr-ldscript
|
||||
|
||||
DESCRIPTION="Utilities split out from systemd for OpenRC users"
|
||||
HOMEPAGE="https://systemd.io/"
|
||||
|
||||
if [[ ${PV} == *.* ]]; then
|
||||
MY_P="systemd-stable-${PV}"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
SRC_URI="https://github.com/systemd/systemd-stable/archive/refs/tags/v${PV}.tar.gz -> ${MY_P}.tar.gz"
|
||||
else
|
||||
MY_P="systemd-${PV}"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
SRC_URI="https://github.com/systemd/systemd/archive/refs/tags/v${PV}.tar.gz -> ${MY_P}.tar.gz"
|
||||
fi
|
||||
|
||||
MUSL_PATCHSET="systemd-musl-patches-254.3"
|
||||
SRC_URI+=" elibc_musl? ( https://dev.gentoo.org/~floppym/dist/${MUSL_PATCHSET}.tar.gz )"
|
||||
|
||||
LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
IUSE="+acl boot +kmod selinux split-usr sysusers +tmpfiles test +udev"
|
||||
REQUIRED_USE="
|
||||
|| ( boot tmpfiles sysusers udev )
|
||||
${PYTHON_REQUIRED_USE}
|
||||
"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
COMMON_DEPEND="
|
||||
elibc_musl? ( >=sys-libs/musl-1.2.3 )
|
||||
selinux? ( sys-libs/libselinux:0= )
|
||||
tmpfiles? (
|
||||
acl? ( sys-apps/acl:0= )
|
||||
)
|
||||
udev? (
|
||||
>=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
|
||||
sys-libs/libcap:0=[${MULTILIB_USEDEP}]
|
||||
virtual/libcrypt:=[${MULTILIB_USEDEP}]
|
||||
acl? ( sys-apps/acl:0= )
|
||||
kmod? ( >=sys-apps/kmod-15:0= )
|
||||
)
|
||||
!udev? (
|
||||
>=sys-apps/util-linux-2.30:0=
|
||||
sys-libs/libcap:0=
|
||||
virtual/libcrypt:=
|
||||
)
|
||||
"
|
||||
DEPEND="${COMMON_DEPEND}
|
||||
>=sys-kernel/linux-headers-3.11
|
||||
"
|
||||
|
||||
PEFILE_DEPEND='dev-python/pefile[${PYTHON_USEDEP}]'
|
||||
|
||||
RDEPEND="${COMMON_DEPEND}
|
||||
boot? (
|
||||
!<sys-boot/systemd-boot-250
|
||||
${PYTHON_DEPS}
|
||||
$(python_gen_cond_dep "${PEFILE_DEPEND}")
|
||||
)
|
||||
tmpfiles? ( !<sys-apps/systemd-tmpfiles-250 )
|
||||
udev? (
|
||||
acct-group/audio
|
||||
acct-group/cdrom
|
||||
acct-group/dialout
|
||||
acct-group/disk
|
||||
acct-group/floppy
|
||||
acct-group/input
|
||||
acct-group/kmem
|
||||
acct-group/kvm
|
||||
acct-group/lp
|
||||
acct-group/render
|
||||
acct-group/sgx
|
||||
acct-group/tape
|
||||
acct-group/tty
|
||||
acct-group/usb
|
||||
acct-group/video
|
||||
!sys-apps/gentoo-systemd-integration
|
||||
!sys-apps/hwids[udev]
|
||||
!<sys-fs/udev-250
|
||||
!sys-fs/eudev
|
||||
)
|
||||
!sys-apps/systemd
|
||||
"
|
||||
PDEPEND="
|
||||
udev? ( >=sys-fs/udev-init-scripts-34 )
|
||||
"
|
||||
BDEPEND="
|
||||
app-text/docbook-xml-dtd:4.2
|
||||
app-text/docbook-xml-dtd:4.5
|
||||
app-text/docbook-xsl-stylesheets
|
||||
dev-libs/libxslt
|
||||
dev-util/gperf
|
||||
>=sys-apps/coreutils-8.16
|
||||
sys-devel/gettext
|
||||
virtual/pkgconfig
|
||||
$(python_gen_cond_dep "
|
||||
dev-python/jinja[\${PYTHON_USEDEP}]
|
||||
dev-python/lxml[\${PYTHON_USEDEP}]
|
||||
boot? (
|
||||
>=dev-python/pyelftools-0.30[\${PYTHON_USEDEP}]
|
||||
test? ( ${PEFILE_DEPEND} )
|
||||
)
|
||||
")
|
||||
"
|
||||
|
||||
TMPFILES_OPTIONAL=1
|
||||
UDEV_OPTIONAL=1
|
||||
|
||||
QA_EXECSTACK="usr/lib/systemd/boot/efi/*"
|
||||
QA_FLAGS_IGNORED="usr/lib/systemd/boot/efi/.*"
|
||||
|
||||
CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED
|
||||
~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET ~UNIX"
|
||||
|
||||
pkg_setup() {
|
||||
if [[ ${MERGE_TYPE} != buildonly ]] && use udev; then
|
||||
linux-info_pkg_setup
|
||||
fi
|
||||
use boot && secureboot_pkg_setup
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
local PATCHES=(
|
||||
"${FILESDIR}/${PN}-254.3-add-link-kernel-install-shared-option.patch"
|
||||
)
|
||||
|
||||
if use elibc_musl; then
|
||||
PATCHES+=(
|
||||
"${WORKDIR}/${MUSL_PATCHSET}"
|
||||
)
|
||||
fi
|
||||
default
|
||||
|
||||
# Remove install_rpath; we link statically
|
||||
local rpath_pattern="install_rpath : rootpkglibdir,"
|
||||
grep -q -e "${rpath_pattern}" meson.build || die
|
||||
sed -i -e "/${rpath_pattern}/d" meson.build || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
python_setup
|
||||
meson-multilib_src_configure
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local emesonargs=(
|
||||
$(meson_use split-usr)
|
||||
$(meson_use split-usr split-bin)
|
||||
-Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
|
||||
-Drootlibdir="${EPREFIX}/usr/$(get_libdir)"
|
||||
-Dsysvinit-path=
|
||||
$(meson_native_use_bool boot bootloader)
|
||||
$(meson_native_use_bool selinux)
|
||||
$(meson_native_use_bool sysusers)
|
||||
$(meson_use test tests)
|
||||
$(meson_native_use_bool tmpfiles)
|
||||
$(meson_use udev hwdb)
|
||||
|
||||
# Link staticly with libsystemd-shared
|
||||
-Dlink-boot-shared=false
|
||||
-Dlink-kernel-install-shared=false
|
||||
-Dlink-udev-shared=false
|
||||
|
||||
# systemd-tmpfiles has a separate "systemd-tmpfiles.standalone" target
|
||||
-Dstandalone-binaries=true
|
||||
|
||||
# Disable all optional features
|
||||
-Dadm-group=false
|
||||
-Danalyze=false
|
||||
-Dapparmor=false
|
||||
-Daudit=false
|
||||
-Dbacklight=false
|
||||
-Dbinfmt=false
|
||||
-Dbpf-framework=false
|
||||
-Dbzip2=false
|
||||
-Dcoredump=false
|
||||
-Ddbus=false
|
||||
-Delfutils=false
|
||||
-Denvironment-d=false
|
||||
-Dfdisk=false
|
||||
-Dgcrypt=false
|
||||
-Dglib=false
|
||||
-Dgshadow=false
|
||||
-Dgnutls=false
|
||||
-Dhibernate=false
|
||||
-Dhostnamed=false
|
||||
-Didn=false
|
||||
-Dima=false
|
||||
-Dinitrd=false
|
||||
-Dfirstboot=false
|
||||
-Dldconfig=false
|
||||
-Dlibcryptsetup=false
|
||||
-Dlibcurl=false
|
||||
-Dlibfido2=false
|
||||
-Dlibidn=false
|
||||
-Dlibidn2=false
|
||||
-Dlibiptc=false
|
||||
-Dlocaled=false
|
||||
-Dlogind=false
|
||||
-Dlz4=false
|
||||
-Dmachined=false
|
||||
-Dmicrohttpd=false
|
||||
-Dnetworkd=false
|
||||
-Dnscd=false
|
||||
-Dnss-myhostname=false
|
||||
-Dnss-resolve=false
|
||||
-Dnss-systemd=false
|
||||
-Doomd=false
|
||||
-Dopenssl=false
|
||||
-Dp11kit=false
|
||||
-Dpam=false
|
||||
-Dpcre2=false
|
||||
-Dpolkit=false
|
||||
-Dportabled=false
|
||||
-Dpstore=false
|
||||
-Dpwquality=false
|
||||
-Drandomseed=false
|
||||
-Dresolve=false
|
||||
-Drfkill=false
|
||||
-Dseccomp=false
|
||||
-Dsmack=false
|
||||
-Dsysext=false
|
||||
-Dtimedated=false
|
||||
-Dtimesyncd=false
|
||||
-Dtpm=false
|
||||
-Dqrencode=false
|
||||
-Dquotacheck=false
|
||||
-Duserdb=false
|
||||
-Dutmp=false
|
||||
-Dvconsole=false
|
||||
-Dwheel-group=false
|
||||
-Dxdg-autostart=false
|
||||
-Dxkbcommon=false
|
||||
-Dxz=false
|
||||
-Dzlib=false
|
||||
-Dzstd=false
|
||||
)
|
||||
|
||||
if use tmpfiles || use udev; then
|
||||
emesonargs+=( $(meson_native_use_bool acl) )
|
||||
else
|
||||
emesonargs+=( -Dacl=false )
|
||||
fi
|
||||
|
||||
if use udev; then
|
||||
emesonargs+=( $(meson_native_use_bool kmod) )
|
||||
else
|
||||
emesonargs+=( -Dkmod=false )
|
||||
fi
|
||||
|
||||
if use elibc_musl; then
|
||||
# Avoid redefinition of struct ethhdr.
|
||||
append-cppflags -D__UAPI_DEF_ETHHDR=0
|
||||
fi
|
||||
|
||||
if multilib_is_native_abi || use udev; then
|
||||
meson_src_configure
|
||||
fi
|
||||
}
|
||||
|
||||
efi_arch() {
|
||||
case "$(tc-arch)" in
|
||||
amd64) echo x64 ;;
|
||||
arm) echo arm ;;
|
||||
arm64) echo aa64 ;;
|
||||
x86) echo x86 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
multilib_src_compile() {
|
||||
local targets=()
|
||||
if multilib_is_native_abi; then
|
||||
if use boot; then
|
||||
targets+=(
|
||||
bootctl
|
||||
kernel-install
|
||||
man/bootctl.1
|
||||
man/kernel-install.8
|
||||
90-loaderentry.install
|
||||
src/boot/efi/linux$(efi_arch).efi.stub
|
||||
src/boot/efi/systemd-boot$(efi_arch).efi
|
||||
)
|
||||
fi
|
||||
if use sysusers; then
|
||||
targets+=(
|
||||
systemd-sysusers.standalone
|
||||
man/sysusers.d.5
|
||||
man/systemd-sysusers.8
|
||||
)
|
||||
if use test; then
|
||||
targets+=(
|
||||
systemd-runtest.env
|
||||
)
|
||||
fi
|
||||
fi
|
||||
if use tmpfiles; then
|
||||
targets+=(
|
||||
systemd-tmpfiles.standalone
|
||||
man/tmpfiles.d.5
|
||||
man/systemd-tmpfiles.8
|
||||
tmpfiles.d/{etc,static-nodes-permissions,var}.conf
|
||||
)
|
||||
if use test; then
|
||||
targets+=( test-tmpfile-util )
|
||||
fi
|
||||
fi
|
||||
if use udev; then
|
||||
targets+=(
|
||||
udevadm
|
||||
systemd-hwdb
|
||||
src/udev/ata_id
|
||||
src/udev/cdrom_id
|
||||
src/udev/fido_id
|
||||
src/udev/mtd_probe
|
||||
src/udev/scsi_id
|
||||
src/udev/udev.pc
|
||||
src/udev/v4l_id
|
||||
man/udev.conf.5
|
||||
man/systemd.link.5
|
||||
man/hwdb.7
|
||||
man/udev.7
|
||||
man/systemd-hwdb.8
|
||||
man/systemd-udevd.service.8
|
||||
man/udevadm.8
|
||||
hwdb.d/60-autosuspend-chromiumos.hwdb
|
||||
rules.d/50-udev-default.rules
|
||||
rules.d/60-persistent-storage.rules
|
||||
rules.d/64-btrfs.rules
|
||||
)
|
||||
if use test; then
|
||||
targets+=(
|
||||
test-fido-id-desc
|
||||
test-udev-builtin
|
||||
test-udev-event
|
||||
test-udev-node
|
||||
test-udev-util
|
||||
udev-rule-runner
|
||||
)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if use udev; then
|
||||
targets+=(
|
||||
udev:shared_library
|
||||
src/libudev/libudev.pc
|
||||
)
|
||||
if use test; then
|
||||
targets+=(
|
||||
test-libudev
|
||||
test-libudev-sym
|
||||
test-udev-device-thread
|
||||
)
|
||||
fi
|
||||
fi
|
||||
if multilib_is_native_abi || use udev; then
|
||||
meson_src_compile "${targets[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
multilib_src_test() {
|
||||
local tests=()
|
||||
if multilib_is_native_abi; then
|
||||
if use sysusers; then
|
||||
tests+=(
|
||||
test-sysusers.standalone
|
||||
)
|
||||
fi
|
||||
if use tmpfiles; then
|
||||
tests+=(
|
||||
test-systemd-tmpfiles.standalone
|
||||
test-tmpfile-util
|
||||
)
|
||||
fi
|
||||
if use udev; then
|
||||
tests+=(
|
||||
rule-syntax-check
|
||||
test-fido-id-desc
|
||||
test-udev
|
||||
test-udev-builtin
|
||||
test-udev-event
|
||||
test-udev-node
|
||||
test-udev-util
|
||||
)
|
||||
fi
|
||||
fi
|
||||
if use udev; then
|
||||
tests+=(
|
||||
test-libudev
|
||||
test-libudev-sym
|
||||
test-udev-device-thread
|
||||
)
|
||||
fi
|
||||
if [[ ${#tests[@]} -ne 0 ]]; then
|
||||
meson_src_test "${tests[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local rootprefix="$(usex split-usr '' /usr)"
|
||||
meson-multilib_src_install
|
||||
}
|
||||
|
||||
multilib_src_install() {
|
||||
if multilib_is_native_abi; then
|
||||
if use boot; then
|
||||
into /usr
|
||||
dobin bootctl kernel-install
|
||||
doman man/{bootctl.1,kernel-install.8}
|
||||
# 90-loaderentry.install is generated from 90-loaderentry.install.in
|
||||
exeinto usr/lib/kernel/install.d
|
||||
doexe src/kernel-install/*.install
|
||||
insinto usr/lib/systemd/boot/efi
|
||||
doins src/boot/efi/{linux$(efi_arch).{efi,elf}.stub,systemd-boot$(efi_arch).efi}
|
||||
fi
|
||||
if use sysusers; then
|
||||
into "${rootprefix:-/}"
|
||||
newbin systemd-sysusers{.standalone,}
|
||||
doman man/{systemd-sysusers.8,sysusers.d.5}
|
||||
fi
|
||||
if use tmpfiles; then
|
||||
into "${rootprefix:-/}"
|
||||
newbin systemd-tmpfiles{.standalone,}
|
||||
doman man/{systemd-tmpfiles.8,tmpfiles.d.5}
|
||||
insinto /usr/lib/tmpfiles.d
|
||||
doins tmpfiles.d/{etc,static-nodes-permissions,var}.conf
|
||||
fi
|
||||
if use udev; then
|
||||
into "${rootprefix:-/}"
|
||||
dobin udevadm systemd-hwdb
|
||||
dosym ../../bin/udevadm "${rootprefix}"/lib/systemd/systemd-udevd
|
||||
|
||||
exeinto "${rootprefix}"/lib/udev
|
||||
doexe src/udev/{ata_id,cdrom_id,fido_id,mtd_probe,scsi_id,v4l_id}
|
||||
|
||||
rm -f rules.d/99-systemd.rules
|
||||
insinto "${rootprefix}"/lib/udev/rules.d
|
||||
doins rules.d/*.rules
|
||||
|
||||
insinto "${rootprefix}"/lib/udev/hwdb.d
|
||||
doins hwdb.d/*.hwdb
|
||||
|
||||
insinto /usr/share/pkgconfig
|
||||
doins src/udev/udev.pc
|
||||
|
||||
doman man/{udev.conf.5,systemd.link.5,hwdb.7,systemd-hwdb.8,udev.7,udevadm.8}
|
||||
newman man/systemd-udevd.service.8 systemd-udevd.8
|
||||
fi
|
||||
fi
|
||||
if use udev; then
|
||||
meson_install --no-rebuild --tags libudev
|
||||
gen_usr_ldscript -a udev
|
||||
insinto "/usr/$(get_libdir)/pkgconfig"
|
||||
doins src/libudev/libudev.pc
|
||||
fi
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
einstalldocs
|
||||
if use boot; then
|
||||
into /usr
|
||||
exeinto usr/lib/kernel/install.d
|
||||
doexe src/kernel-install/*.install
|
||||
dobashcomp shell-completion/bash/bootctl
|
||||
insinto /usr/share/zsh/site-functions
|
||||
doins shell-completion/zsh/{_bootctl,_kernel-install}
|
||||
fi
|
||||
if use tmpfiles; then
|
||||
doinitd "${FILESDIR}"/systemd-tmpfiles-setup
|
||||
doinitd "${FILESDIR}"/systemd-tmpfiles-setup-dev
|
||||
exeinto /etc/cron.daily
|
||||
doexe "${FILESDIR}"/systemd-tmpfiles-clean
|
||||
insinto /usr/share/zsh/site-functions
|
||||
doins shell-completion/zsh/_systemd-tmpfiles
|
||||
insinto /usr/lib/tmpfiles.d
|
||||
doins tmpfiles.d/{tmp,x11}.conf
|
||||
doins "${FILESDIR}"/legacy.conf
|
||||
fi
|
||||
if use udev; then
|
||||
doheader src/libudev/libudev.h
|
||||
|
||||
insinto /etc/udev
|
||||
doins src/udev/udev.conf
|
||||
keepdir /etc/udev/{hwdb.d,rules.d}
|
||||
|
||||
insinto "${rootprefix}"/lib/systemd/network
|
||||
doins network/99-default.link
|
||||
|
||||
# Remove to avoid conflict with elogind
|
||||
# https://bugs.gentoo.org/856433
|
||||
rm rules.d/70-power-switch.rules || die
|
||||
insinto "${rootprefix}"/lib/udev/rules.d
|
||||
doins rules.d/*.rules
|
||||
doins "${FILESDIR}"/40-gentoo.rules
|
||||
|
||||
insinto "${rootprefix}"/lib/udev/hwdb.d
|
||||
doins hwdb.d/*.hwdb
|
||||
|
||||
dobashcomp shell-completion/bash/udevadm
|
||||
|
||||
insinto /usr/share/zsh/site-functions
|
||||
doins shell-completion/zsh/_udevadm
|
||||
fi
|
||||
|
||||
use boot && secureboot_auto_sign
|
||||
}
|
||||
|
||||
add_service() {
|
||||
local initd=$1
|
||||
local runlevel=$2
|
||||
|
||||
ebegin "Adding '${initd}' service to the '${runlevel}' runlevel"
|
||||
mkdir -p "${EROOT}/etc/runlevels/${runlevel}" &&
|
||||
ln -snf "${EPREFIX}/etc/init.d/${initd}" "${EROOT}/etc/runlevels/${runlevel}/${initd}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
if [[ -z ${REPLACING_VERSIONS} ]]; then
|
||||
add_service systemd-tmpfiles-setup-dev sysinit
|
||||
add_service systemd-tmpfiles-setup boot
|
||||
fi
|
||||
if use udev; then
|
||||
ebegin "Updating hwdb"
|
||||
systemd-hwdb --root="${ROOT}" update
|
||||
eend $?
|
||||
udev_reload
|
||||
fi
|
||||
}
|
||||
1
sdk_container/src/third_party/prefix-overlay/sys-libs/libxcrypt/Manifest
vendored
Normal file
1
sdk_container/src/third_party/prefix-overlay/sys-libs/libxcrypt/Manifest
vendored
Normal file
@ -0,0 +1 @@
|
||||
DIST libxcrypt-4.4.36-autotools.tar.xz 624660 BLAKE2B 8dc3d0f354baf8c64dc011e95e7df10d48b0dfe428503936ffd55edf2745de04003c7efe231ed5d9a14cea7f682ba377b7e00f0463b4060c50c9c29f555b790f SHA512 fb8391ecb89622eb0d74d13c5fc1369718e83c47671449044ca0c2f78a236d7b06177a60bf8cda47694caa840c68eaaf0b23690e8975fa5d64b734c8eb246d10
|
||||
@ -0,0 +1,14 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index d0cca1d..4a5d4a1 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -86,9 +86,7 @@ noinst_HEADERS = \
|
||||
test/des-cases.h \
|
||||
test/ka-table.inc
|
||||
|
||||
-if ENABLE_XCRYPT_COMPAT_FILES
|
||||
nodist_include_HEADERS += xcrypt.h
|
||||
-endif
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
lib/gen-des-tables
|
||||
340
sdk_container/src/third_party/prefix-overlay/sys-libs/libxcrypt/libxcrypt-4.4.36.ebuild
vendored
Normal file
340
sdk_container/src/third_party/prefix-overlay/sys-libs/libxcrypt/libxcrypt-4.4.36.ebuild
vendored
Normal file
@ -0,0 +1,340 @@
|
||||
# Copyright 2004-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
# NEED_BOOTSTRAP is for developers to quickly generate a tarball
|
||||
# for publishing to the tree.
|
||||
NEED_BOOTSTRAP="no"
|
||||
inherit multibuild multilib python-any-r1 flag-o-matic toolchain-funcs multilib-minimal
|
||||
|
||||
DESCRIPTION="Extended crypt library for descrypt, md5crypt, bcrypt, and others"
|
||||
HOMEPAGE="https://github.com/besser82/libxcrypt"
|
||||
if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
|
||||
inherit autotools
|
||||
SRC_URI="https://github.com/besser82/libxcrypt/releases/download/v${PV}/${P}.tar.xz"
|
||||
else
|
||||
SRC_URI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools.tar.xz"
|
||||
fi
|
||||
|
||||
LICENSE="LGPL-2.1+ public-domain BSD BSD-2"
|
||||
SLOT="0/1"
|
||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86"
|
||||
IUSE="+compat split-usr static-libs +system test headers-only"
|
||||
REQUIRED_USE="split-usr? ( system )"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} == ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
|
||||
is_cross() {
|
||||
local enabled_abis=( $(multilib_get_enabled_abis) )
|
||||
[[ "${#enabled_abis[@]}" -le 1 ]] && [[ ${CHOST} != ${CTARGET} ]]
|
||||
}
|
||||
|
||||
DEPEND="
|
||||
system? (
|
||||
elibc_glibc? (
|
||||
${CATEGORY}/glibc[-crypt(+)]
|
||||
!${CATEGORY}/glibc[crypt(+)]
|
||||
)
|
||||
elibc_musl? (
|
||||
${CATEGORY}/musl[-crypt(+)]
|
||||
!${CATEGORY}/musl[crypt(+)]
|
||||
)
|
||||
)
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
BDEPEND="
|
||||
dev-lang/perl
|
||||
test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )
|
||||
"
|
||||
|
||||
python_check_deps() {
|
||||
python_has_version "dev-python/passlib[${PYTHON_USEDEP}]"
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
if has "distcc" ${FEATURES} ; then
|
||||
ewarn "Please verify all distcc nodes are using the same versions of GCC (>= 10) and Binutils!"
|
||||
ewarn "Older/mismatched versions of GCC may lead to a misbehaving library: bug #823179."
|
||||
|
||||
if [[ ${BUILD_TYPE} != "binary" ]] && tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]] ; then
|
||||
die "libxcrypt is known to fail to build or be broken at runtime with < GCC 10 (bug #823179)!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
MULTIBUILD_VARIANTS=(
|
||||
$(usev compat 'xcrypt_compat')
|
||||
xcrypt_nocompat
|
||||
)
|
||||
|
||||
use test && python-any-r1_pkg_setup
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# WARNING: Please read on bumping or applying patches!
|
||||
#
|
||||
# There are two circular dependencies to be aware of:
|
||||
# 1)
|
||||
# if we're bootstrapping configure and makefiles:
|
||||
# libxcrypt -> automake -> perl -> libxcrypt
|
||||
#
|
||||
# mitigation:
|
||||
# toolchain@ manually runs `make dist` after running autoconf + `./configure`
|
||||
# and the ebuild uses that.
|
||||
# (Don't include the pre-generated Perl artefacts.)
|
||||
#
|
||||
# solution for future:
|
||||
# Upstream are working on producing `make dist` tarballs.
|
||||
# https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
|
||||
#
|
||||
# 2)
|
||||
# configure *unconditionally* needs Perl at build time to generate
|
||||
# a list of enabled algorithms based on the set passed to `configure`:
|
||||
# libxcrypt -> perl -> libxcrypt
|
||||
#
|
||||
# mitigation:
|
||||
# None at the moment.
|
||||
#
|
||||
# solution for future:
|
||||
# Not possible right now. Upstream intend on depending on Perl for further
|
||||
# configuration options.
|
||||
# https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
|
||||
#
|
||||
# Therefore, on changes (inc. bumps):
|
||||
# * You must check whether upstream have started providing tarballs with bootstrapped
|
||||
# auto{conf,make};
|
||||
#
|
||||
# * diff the build system changes!
|
||||
#
|
||||
if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
|
||||
# Facilitate our split variant build for compat + non-compat
|
||||
eapply "${FILESDIR}"/${PN}-4.4.19-multibuild.patch
|
||||
eautoreconf
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# Avoid possible "illegal instruction" errors with gold
|
||||
# bug #821496
|
||||
tc-ld-disable-gold
|
||||
|
||||
# Doesn't work with LTO: bug #852917.
|
||||
# https://github.com/besser82/libxcrypt/issues/24
|
||||
filter-lto
|
||||
|
||||
# ideally we want !tc-ld-is-bfd for best future-proofing, but it needs
|
||||
# https://github.com/gentoo/gentoo/pull/28355
|
||||
# mold needs this too but right now tc-ld-is-mold is also not available
|
||||
if tc-ld-is-lld; then
|
||||
append-ldflags -Wl,--undefined-version
|
||||
fi
|
||||
|
||||
multibuild_foreach_variant multilib-minimal_src_configure
|
||||
}
|
||||
|
||||
get_xcprefix() {
|
||||
if is_cross; then
|
||||
echo "${EPREFIX}/usr/${CTARGET}"
|
||||
else
|
||||
echo "${EPREFIX}"
|
||||
fi
|
||||
}
|
||||
|
||||
get_xclibdir() {
|
||||
printf -- "%s/%s/%s/%s\n" \
|
||||
"$(get_xcprefix)" \
|
||||
"$(usev !split-usr '/usr')" \
|
||||
"$(get_libdir)" \
|
||||
"$(usev !system 'xcrypt')"
|
||||
}
|
||||
|
||||
get_xcincludedir() {
|
||||
printf -- "%s/usr/include/%s\n" \
|
||||
"$(get_xcprefix)" \
|
||||
"$(usev !system 'xcrypt')"
|
||||
}
|
||||
|
||||
get_xcmandir() {
|
||||
printf -- "%s/usr/share/man\n" \
|
||||
"$(get_xcprefix)"
|
||||
}
|
||||
|
||||
get_xcpkgconfigdir() {
|
||||
printf -- "%s/usr/%s/pkgconfig\n" \
|
||||
"$(get_xcprefix)" \
|
||||
"$(get_libdir)"
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local -a myconf=(
|
||||
--host=${CTARGET}
|
||||
--disable-werror
|
||||
--libdir=$(get_xclibdir)
|
||||
--with-pkgconfigdir=$(get_xcpkgconfigdir)
|
||||
--includedir=$(get_xcincludedir)
|
||||
--mandir="$(get_xcmandir)"
|
||||
)
|
||||
|
||||
tc-export PKG_CONFIG
|
||||
|
||||
if is_cross; then
|
||||
if tc-is-clang; then
|
||||
export CC="${CTARGET}-clang"
|
||||
else
|
||||
export CC="${CTARGET}-gcc"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "${MULTIBUILD_ID}" in
|
||||
xcrypt_compat-*)
|
||||
myconf+=(
|
||||
--disable-static
|
||||
--disable-xcrypt-compat-files
|
||||
--enable-obsolete-api=yes
|
||||
)
|
||||
;;
|
||||
xcrypt_nocompat-*)
|
||||
myconf+=(
|
||||
--enable-obsolete-api=no
|
||||
$(use_enable static-libs static)
|
||||
)
|
||||
;;
|
||||
*) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
|
||||
esac
|
||||
|
||||
if use headers-only; then
|
||||
# Nothing is compiled here which would affect the headers for the target.
|
||||
# So forcing CC is sane.
|
||||
headers_only_flags="CC=$(tc-getBUILD_CC)"
|
||||
fi
|
||||
|
||||
ECONF_SOURCE="${S}" econf "${myconf[@]}" "${headers_only_flags}"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
use headers-only && return
|
||||
|
||||
multibuild_foreach_variant multilib-minimal_src_compile
|
||||
}
|
||||
|
||||
multilib_src_test() {
|
||||
emake check
|
||||
}
|
||||
|
||||
src_test() {
|
||||
multibuild_foreach_variant multilib-minimal_src_test
|
||||
}
|
||||
|
||||
src_install() {
|
||||
multibuild_foreach_variant multilib-minimal_src_install
|
||||
|
||||
use headers-only || \
|
||||
(
|
||||
shopt -s failglob || die "failglob failed"
|
||||
|
||||
# Make sure our man pages do not collide with glibc or man-pages.
|
||||
for manpage in "${D}$(get_xcmandir)"/man3/crypt{,_r}.?*; do
|
||||
mv -n "${manpage}" "$(dirname "${manpage}")/xcrypt_$(basename "${manpage}")" \
|
||||
|| die "mv failed"
|
||||
done
|
||||
) || die "failglob error"
|
||||
|
||||
# Remove useless stuff from installation
|
||||
find "${ED}"/usr/share/doc/${PF} -type l -delete || die
|
||||
find "${ED}" -name '*.la' -delete || die
|
||||
|
||||
# workaround broken upstream cross-* --docdir by installing files in proper locations
|
||||
if is_cross; then
|
||||
insinto "$(get_xcprefix)"/usr/share
|
||||
doins -r "${ED}"/usr/share/doc
|
||||
rm -r "${ED}"/usr/share/doc || die
|
||||
fi
|
||||
}
|
||||
|
||||
multilib_src_install() {
|
||||
if use headers-only; then
|
||||
emake DESTDIR="${D}" install-nodist_includeHEADERS
|
||||
return
|
||||
fi
|
||||
|
||||
emake DESTDIR="${D}" install
|
||||
|
||||
# Don't install the libcrypt.so symlink for the "compat" version
|
||||
case "${MULTIBUILD_ID}" in
|
||||
xcrypt_compat-*)
|
||||
rm "${D}"$(get_xclibdir)/libcrypt$(get_libname) \
|
||||
|| die "failed to remove extra compat libraries"
|
||||
;;
|
||||
xcrypt_nocompat-*)
|
||||
if use split-usr; then
|
||||
(
|
||||
if use static-libs; then
|
||||
# .a files are installed to /$(get_libdir) by default
|
||||
# Move static libraries to /usr prefix or portage will abort
|
||||
shopt -s nullglob || die "failglob failed"
|
||||
static_libs=( "${D}"/$(get_xclibdir)/*.a )
|
||||
|
||||
if [[ -n ${static_libs[*]} ]]; then
|
||||
dodir "/usr/$(get_xclibdir)"
|
||||
mv "${static_libs[@]}" "${ED}/usr/$(get_xclibdir)" \
|
||||
|| die "Moving static libs failed"
|
||||
fi
|
||||
fi
|
||||
|
||||
if use system; then
|
||||
# Move versionless .so symlinks from /$(get_libdir) to /usr/$(get_libdir)
|
||||
# to allow linker to correctly find shared libraries.
|
||||
shopt -s failglob || die "failglob failed"
|
||||
|
||||
for lib_file in "${D}"$(get_xclibdir)/*$(get_libname); do
|
||||
lib_file_basename="$(basename "${lib_file}")"
|
||||
lib_file_target="$(basename "$(readlink -f "${lib_file}")")"
|
||||
|
||||
# We already know we're in split-usr (checked above)
|
||||
# See bug #843209 (also worth keeping in mind bug #802222 too)
|
||||
local libdir_no_prefix=$(get_xclibdir)
|
||||
libdir_no_prefix=${libdir_no_prefix#${EPREFIX}}
|
||||
libdir_no_prefix=${libdir_no_prefix%/usr}
|
||||
dosym -r "/$(get_libdir)/${lib_file_target}" "/usr/${libdir_no_prefix}/${lib_file_basename}"
|
||||
done
|
||||
|
||||
rm "${D}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect location failed"
|
||||
fi
|
||||
)
|
||||
fi
|
||||
;;
|
||||
*) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
|
||||
esac
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
# Verify we're not in a bad case like bug #843209 with broken symlinks.
|
||||
# This can be dropped when, if ever, the split-usr && system && compat case
|
||||
# is cleaned up in *_src_install.
|
||||
local broken_symlinks=()
|
||||
mapfile -d '' broken_symlinks < <(
|
||||
find "${ED}" -xtype l -print0
|
||||
)
|
||||
|
||||
if [[ ${#broken_symlinks[@]} -gt 0 ]]; then
|
||||
eerror "Broken symlinks found before merging!"
|
||||
local symlink target resolved
|
||||
for symlink in "${broken_symlinks[@]}" ; do
|
||||
target="$(readlink "${symlink}")"
|
||||
resolved="$(readlink -f "${symlink}")"
|
||||
eerror " '${symlink}' -> '${target}' (${resolved})"
|
||||
done
|
||||
die "Broken symlinks found! Aborting to avoid damaging system. Please report a bug."
|
||||
fi
|
||||
}
|
||||
21
sdk_container/src/third_party/prefix-overlay/sys-libs/libxcrypt/metadata.xml
vendored
Normal file
21
sdk_container/src/third_party/prefix-overlay/sys-libs/libxcrypt/metadata.xml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>toolchain@gentoo.org</email>
|
||||
<name>Gentoo Toolchain Project</name>
|
||||
</maintainer>
|
||||
<longdescription>
|
||||
Crypt library for DES, MD5, and blowfish. Libxcrypt is a replacement for
|
||||
libcrypt, which comes with the GNU C Library. It supports DES crypt,
|
||||
MD5, and passwords with blowfish encryption.
|
||||
</longdescription>
|
||||
<use>
|
||||
<flag name="compat">Build with compatibility interfaces for other crypt implementations</flag>
|
||||
<flag name="system">Install as system libcrypt.so rather than to an alternate directory (will collide with <pkg>sys-libs/glibc</pkg>'s version)</flag>
|
||||
<flag name="headers-only">Build and install only the headers.</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">besser82/libxcrypt</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
143
setup_prefix
Executable file
143
setup_prefix
Executable file
@ -0,0 +1,143 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
. "$(dirname "$0")/common.sh" || exit 1
|
||||
. "${BUILD_LIBRARY_DIR}/prefix_util.sh" || exit 1
|
||||
|
||||
assert_inside_chroot
|
||||
assert_not_root_user
|
||||
|
||||
staging_dir_opt_placeholder="${DEFAULT_STAGING_ROOT}prefix-<board>/<prefix-name>"
|
||||
final_dir_opt_placeholder="${SCRIPTS_DIR}/__prefix__/<board>/<prefix-name>"
|
||||
|
||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||
"Board (architecture) to build for in prefix."
|
||||
DEFINE_string staging_dir "${staging_dir_opt_placeholder}" \
|
||||
"Staging (build) directory for this prefix."
|
||||
DEFINE_string final_dir "${final_dir_opt_placeholder}" \
|
||||
"Local directory to install the final prefixed binaries and runtime dependencies to.
|
||||
'<final-dir>/root' will contain the FS root to e.g. create a sysext from."
|
||||
DEFINE_boolean force "${FLAGS_FALSE}" \
|
||||
"Force re-creating a prefix that already exists. THIS WILL REMOVE THE OLD PREFIX ENTIRELY."
|
||||
DEFINE_boolean uninstall "${FLAGS_FALSE}" \
|
||||
"Uninstall an existing prefix, removing all directories and wrapper scripts associated with it.
|
||||
If set, <prefix path> can be omitted."
|
||||
DEFINE_string cross_boss_root "${SCRIPTS_DIR}/cross-boss" \
|
||||
"Custom cross-boss scripts root."
|
||||
|
||||
# TODO: implement
|
||||
#DEFINE_string custom_ebuild_overlays "" \
|
||||
# "Comma-separated list of additional ebuild overlays to add to the prefix."
|
||||
|
||||
FLAGS_HELP="usage: setup_prefix [flags] <prefix name> <prefix path>
|
||||
|
||||
setup_prefix creates a new prefix as well as an emerge wrapper.
|
||||
|
||||
<prefix name> - Common name of the prefix. Will be used for naming portage wrappers.
|
||||
|
||||
<prefix path> - Absolute library / executables path to use for this prefix, e.g. '/usr/local/mystuff'.
|
||||
Binaries and libraries will live below <prefix>; binaries will be
|
||||
linked against <prefix>/lib etc. Should start with /usr or /opt if you
|
||||
want to use the installation directory to create a sysext.
|
||||
|
||||
Please refer to PREFIX.md for general information on prefixes.
|
||||
"
|
||||
|
||||
show_help_if_requested "$@"
|
||||
FLAGS "$@" || exit 1
|
||||
eval set -- "${FLAGS_ARGV}"
|
||||
|
||||
switch_to_strict_mode -uo pipefail
|
||||
|
||||
name="${1:-}"
|
||||
prefix="${2:-}"
|
||||
|
||||
if [ "${FLAGS_uninstall}" = "${FLAGS_TRUE}" ] ; then
|
||||
# We don't really care about prefix when uninstalling.
|
||||
# Make sure it is set so we don't need to set it on the uninstall command line.
|
||||
prefix="ignored"
|
||||
fi
|
||||
|
||||
if [[ ! ${name} || ! ${prefix} ]] ; then
|
||||
error "Missing mandatory positional parameter."
|
||||
flags_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${FLAGS_staging_dir}" = "${staging_dir_opt_placeholder}" ] ; then
|
||||
FLAGS_staging_dir="${DEFAULT_STAGING_ROOT}prefix-${FLAGS_board}/${name}"
|
||||
fi
|
||||
if [ "${FLAGS_final_dir}" = "${final_dir_opt_placeholder}" ] ; then
|
||||
FLAGS_final_dir="${SCRIPTS_DIR}/__prefix__/${FLAGS_board}/${name}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Helper functions
|
||||
#
|
||||
|
||||
function check_force_dirs() {
|
||||
local what="${1}"
|
||||
local dir="${2}"
|
||||
|
||||
if [ -e "${dir}" ] ; then
|
||||
if [ "${FLAGS_force}" = "${FLAGS_FALSE}" ] ; then
|
||||
error "${what} directory '${dir}' already exists! Use --force to remove and to re-create prefix."
|
||||
exit 1
|
||||
else
|
||||
warn "Removing ${what} directory '${dir}' as requested ('--force' option)."
|
||||
sudo rm -rf "${dir}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
# --
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
|
||||
set_prefix_vars "${name}" "${prefix}"
|
||||
prefix_repo="$(dirname "$(EPREFIX="" portageq get_repo_path / portage-stable)")/prefix-overlay"
|
||||
|
||||
if [ "${FLAGS_uninstall}" = "${FLAGS_TRUE}" ] ; then
|
||||
warn "Removing prefix '${name}' and all associated direcroties and wrappers."
|
||||
sudo rm -vrf "${STAGINGDIR}" "${FINALDIR}"
|
||||
# TODO: cover all portage tools, not just emerge
|
||||
sudo rm -vf "$(emerge_name with-path)"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -e "${CB_ROOT}/bin/cb-bootstrap" ] ; then
|
||||
error "Cross-boss not found at '${CB_ROOT}'"
|
||||
error "Please make sure cross-boss is available (i.e. git clone https://github.com/chewi/cross-boss)."
|
||||
error "See PREFIX.md for more information."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
info "Installing SDK prerequisites and creating prefix directories"
|
||||
|
||||
check_force_dirs "staging" "${STAGINGDIR}"
|
||||
check_force_dirs "installation" "${FINALDIR}"
|
||||
|
||||
setup_prefix_dirs "${prefix_repo}" 2>&1 | lineprepend "Prefix directories"
|
||||
|
||||
create_make_conf "staging"
|
||||
create_make_conf "final"
|
||||
|
||||
install_prereqs "${prefix_repo}" 2>&1 | lineprepend "SDK prereqs"
|
||||
|
||||
# --
|
||||
|
||||
info "Bootstrapping staging environment in '${STAGINGROOT}'".
|
||||
sudo env EPREFIX="${EPREFIX}" "${CB_ROOT}"/bin/cb-bootstrap "${STAGINGROOT}" 2>&1 | lineprepend "cb-bootstrap"
|
||||
|
||||
info "Extracting GCC libraries to installation root / final."
|
||||
extract_gcc_libs 2>&1 | lineprepend "GCC libs for final"
|
||||
|
||||
# TODO: cover all portage tools, not just emerge
|
||||
info "Creating wrappers"
|
||||
create_emerge_wrapper
|
||||
|
||||
info "Emerging installation root foundational dependencies."
|
||||
$(emerge_name) prefix/prefix-final | lineprepend "final init"
|
||||
|
||||
info "Done. Use '$(emerge_name)' to emerge packages into the prefix."
|
||||
Loading…
x
Reference in New Issue
Block a user