-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sys-config/ltoize: Add overrides for flag-o-matic
Add an experimental USE flag to override strip-flags and replace-flags in flag-o-matic. Address #57 Signed-off-by: Shane Peelar <[email protected]>
- Loading branch information
1 parent
368af73
commit 7e8739f
Showing
6 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
sys-config/ltoize 0.2: A configuration for portage to make building with LTO easy. | ||
dev-lang/python 2.7.15-r1 3.4.8-r2 3.5.5-r2 3.6.6-r1 3.7.0-r1: An interpreted, interactive, object-oriented programming language | ||
media-libs/x264 0.0.20170701-r1: A free library for encoding X264/AVC streams | ||
media-video/x264-encoder 0.0.20170701-r1: A free commandline encoder for X264/AVC streams | ||
sys-config/ltoize 0.8.1 0.8.2 0.9.0: A configuration for portage to make building with LTO easy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
LTOOverrideFlagOMatic() | ||
{ | ||
strip-flags() | ||
{ | ||
ewarn "lto-overlay: strip-flags OVERRIDDEN" | ||
} | ||
|
||
replace-flags() | ||
{ | ||
ewarn "lto-overlay: replace-flags OVERRIDDEN" | ||
} | ||
} | ||
|
||
BashrcdPhase prepare LTOOverrideFlagOMatic | ||
BashrcdPhase configure LTOOverrideFlagOMatic | ||
BashrcdPhase compile LTOOverrideFlagOMatic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Copyright 1999-2018 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=7 | ||
|
||
inherit toolchain-funcs | ||
|
||
DESCRIPTION="A configuration for portage to make building with LTO easy." | ||
HOMEPAGE="https://github.com/InBetweenNames/gentooLTO" | ||
KEYWORDS="~amd64 ~x86" | ||
|
||
SRC_URI="" | ||
|
||
LICENSE="GPL-2+" | ||
SLOT="0" | ||
IUSE="override-flagomatic" | ||
|
||
#portage-bashrc-mv can be obtained from mv overlay | ||
DEPEND=">=sys-devel/gcc-4.9.4:* >=sys-devel/binutils-2.28.1:* app-portage/portage-bashrc-mv[cflags] >=sys-devel/gcc-config-1.9.1" | ||
#DEPEND="graphite ? ( gcc[graphite] )" | ||
|
||
RDEPEND="${DEPEND}" | ||
|
||
#Test binutils and gcc version | ||
|
||
pkg_setup() { | ||
|
||
ACTIVE_GCC=$(gcc-fullversion) | ||
|
||
if ver_test "${ACTIVE_GCC}" -lt 8.2.0; then | ||
ewarn "Warning: Active GCC version < 7.2.0, it is recommended that you use the newest GCC if you want LTO." | ||
if [ "${I_KNOW_WHAT_I_AM_DOING}" != "y" ]; then | ||
eerror "Aborting LTOize installation due to older GCC -- set I_KNOW_WHAT_I_AM_DOING=y if you want to override this behaviour." | ||
die | ||
else | ||
ewarn "I_KNOW_WHAT_I_AM_DOING=y -- continuing anyway" | ||
fi | ||
fi | ||
|
||
if [ -f "${PORTAGE_CONFIGROOT%/}/etc/portage/package.cflags" ]; then | ||
eerror "${PORTAGE_CONFIGROOT%/}/etc/portage/package.cflags is a file not a directory. Please convert package.cflags to a directory with the current contents of package.cflags being moved to a file inside it." | ||
die | ||
fi | ||
|
||
} | ||
|
||
pkg_preinst() { | ||
|
||
GENTOOLTO_PORTDIR=$(portageq get_repo_path ${PORTAGE_CONFIGROOT} lto-overlay) | ||
LTO_PORTAGE_DIR="${GENTOOLTO_PORTDIR}/${CATEGORY}/${PN}/files" | ||
|
||
ACTIVE_GCC=$(gcc-fullversion) | ||
|
||
#Insert make.conf sample... | ||
|
||
elog "Installing make.conf.lto sample for make.conf modifications" | ||
dosym "${LTO_PORTAGE_DIR}/make.conf.lto" "${PORTAGE_CONFIGROOT%/}/etc/portage/make.conf.lto" | ||
|
||
elog "Installing ltoworkarounds.conf package.cflags overrides" | ||
dosym "${LTO_PORTAGE_DIR}/package.cflags/ltoworkarounds.conf" "${PORTAGE_CONFIGROOT%/}/etc/portage/package.cflags/ltoworkarounds.conf" | ||
|
||
#elog "Installing patches to help certain software build with this configuration (installed as symlinks)" | ||
#for i in $(ls ${LTO_PORTAGE_DIR}/patches); do | ||
# dosym "${LTO_PORTAGE_DIR}/patches/$i" "${PORTAGE_CONFIGROOT%/}/etc/portage/patches/$i" | ||
#done | ||
|
||
elog "Installing bashrc.d hook symlink to apply LTO patches directly from lto-overlay" | ||
dosym "${LTO_PORTAGE_DIR}/bashrc.d/41-lto-patch.sh" "${PORTAGE_CONFIGROOT%/}/etc/portage/bashrc.d/41-lto-patch.sh" | ||
|
||
if use override-flagomatic; then | ||
ewarn "Installing bashrc.d hook to override strip-flags and replace-flags functions in flag-o-matic. This is an experimental feature!" | ||
dosym "${LTO_PORTAGE_DIR}/bashrc.d/42-lto-flag-o-matic.sh" "${PORTAGE_CONFIGROOT%/}/etc/portage/bashrc.d/42-lto-flag-o-matic.sh" | ||
fi | ||
|
||
} | ||
|
||
pkg_postinst() | ||
{ | ||
elog "If you have not done so, you will need to modify your make.conf settings to enable LTO building on your system." | ||
elog "A symlink has been placed in ${PORTAGE_CONFIGROOT%/}/etc/portage/make.conf.lto that can be used as a basis for these modifications." | ||
elog "lto-overlay and ltoize are part of a project to help find undefined behaviour in C and C++ programs through the use of aggressive compiler optimizations." | ||
elog "One of the aims of this project is also to improve the performance of linux distributions through these mechanisms as well." | ||
elog "Occasionally, you will experience breakage due to LTO problems. These are documented in the README.md of this repository." | ||
elog "If you add an override for a particular package, please consider sending a pull request upstream so that other users of this repository can benefit." | ||
ewarn "You will require a complete system rebuild in order to gain the benefits of LTO system-wide." | ||
echo | ||
elog "Please consider reading the README.md at the root of this repository before attempting to rebuild your system to familiarize yourself with the goals of this project and potential pitfalls you could run into." | ||
echo | ||
ewarn "This is an experimental project and should not be used on a stable system in its current state." | ||
|
||
BINUTILS_VER=$(binutils-config ${CHOST} -c | sed -e "s/.*-//") | ||
|
||
if ver_test "${BINUTILS_VER}" -lt 2.31.1; then | ||
ewarn "Warning: active binutils version < 2.31.1, it is recommended that you use the newest binutils for LTO." | ||
fi | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters