mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-22 06:51:26 +02:00
Merge pull request #1352 from marineam/ccache
Fix building GCC with ccache
This commit is contained in:
commit
0cc352c838
1
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/Manifest
vendored
Normal file
1
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/Manifest
vendored
Normal file
@ -0,0 +1 @@
|
||||
DIST ccache-3.2.2.tar.xz 300808 SHA256 4f0d99699f24d198494addca0f41a93b0150cdfd01491f15a5d7eb02c7c2a0ca SHA512 fc438f3b00baa41076eee3e5783ea53a208eb348343e587c6f729f7e98462cd20c720fe323fe08f271bc14dae48f7828cef769882f028f3772992989b87b075d WHIRLPOOL 095a125e869910644622b98b7720a01ccc235fbeb8c84ec52017fe52f82fe7b8122584c3e5fa4d39c1344e9c062517a1edb46c3e64fe649e845ed5c1fb455c5a
|
70
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/ccache-3.2.2-r1.ebuild
vendored
Normal file
70
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/ccache-3.2.2-r1.ebuild
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/dev-util/ccache/ccache-3.2.2.ebuild,v 1.1 2015/05/11 03:06:48 vapier Exp $
|
||||
|
||||
EAPI=5
|
||||
|
||||
inherit eutils readme.gentoo
|
||||
|
||||
DESCRIPTION="fast compiler cache"
|
||||
HOMEPAGE="http://ccache.samba.org/"
|
||||
SRC_URI="http://samba.org/ftp/ccache/${P}.tar.xz"
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris"
|
||||
IUSE=""
|
||||
|
||||
DEPEND="app-arch/xz-utils
|
||||
sys-libs/zlib"
|
||||
RDEPEND="${DEPEND}
|
||||
sys-apps/gentoo-functions"
|
||||
|
||||
src_prepare() {
|
||||
# make sure we always use system zlib
|
||||
rm -rf zlib || die
|
||||
epatch "${FILESDIR}"/${PN}-3.1.7-no-perl.patch #421609
|
||||
epatch "${FILESDIR}"/${PN}-3.1.10-size-on-disk.patch #456178
|
||||
epatch "${FILESDIR}"/${PN}-3.2.2-save-temps.patch
|
||||
sed \
|
||||
-e "/^EPREFIX=/s:'':'${EPREFIX}':" \
|
||||
"${FILESDIR}"/ccache-config-3 > ccache-config || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
DOCS=( AUTHORS.txt MANUAL.txt NEWS.txt README.txt )
|
||||
default
|
||||
|
||||
dobin ccache-config
|
||||
|
||||
DOC_CONTENTS="
|
||||
To use ccache with **non-Portage** C compiling, add
|
||||
${EPREFIX}/usr/lib/ccache/bin to the beginning of your path, before ${EPREFIX}usr/bin.
|
||||
Portage 2.0.46-r11+ will automatically take advantage of ccache with
|
||||
no additional steps. If this is your first install of ccache, type
|
||||
something like this to set a maximum cache size of 2GB:\\n
|
||||
# ccache -M 2G\\n
|
||||
If you are upgrading from an older version than 3.x you should clear all of your caches like so:\\n
|
||||
# CCACHE_DIR='${CCACHE_DIR:-${PORTAGE_TMPDIR}/ccache}' ccache -C\\n
|
||||
ccache now supports sys-devel/clang and dev-lang/icc, too!"
|
||||
|
||||
readme.gentoo_create_doc
|
||||
}
|
||||
|
||||
pkg_prerm() {
|
||||
if [[ -z ${REPLACED_BY_VERSION} ]] ; then
|
||||
"${EROOT}"/usr/bin/ccache-config --remove-links
|
||||
"${EROOT}"/usr/bin/ccache-config --remove-links ${CHOST}
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
"${EROOT}"/usr/bin/ccache-config --install-links
|
||||
"${EROOT}"/usr/bin/ccache-config --install-links ${CHOST}
|
||||
|
||||
# nuke broken symlinks from previous versions that shouldn't exist
|
||||
rm -f "${EROOT}"/usr/lib/ccache/bin/${CHOST}-cc || die
|
||||
rm -rf "${EROOT}"/usr/lib/ccache.backup || die
|
||||
|
||||
readme.gentoo_print_elog
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
https://bugs.gentoo.org/56178
|
||||
|
||||
stick to the size of files on disk rather than their byte size.
|
||||
this func is only used for stats management, so this should be safe.
|
||||
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -845,12 +845,7 @@ file_size(struct stat *st)
|
||||
#ifdef _WIN32
|
||||
return (st->st_size + 1023) & ~1023;
|
||||
#else
|
||||
- size_t size = st->st_blocks * 512;
|
||||
- if ((size_t)st->st_size > size) {
|
||||
- /* probably a broken stat() call ... */
|
||||
- size = (st->st_size + 1023) & ~1023;
|
||||
- }
|
||||
- return size;
|
||||
+ return st->st_blocks * 512;
|
||||
#endif
|
||||
}
|
||||
|
15
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/files/ccache-3.1.7-no-perl.patch
vendored
Normal file
15
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/files/ccache-3.1.7-no-perl.patch
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
avoid weak perl usage in tests
|
||||
|
||||
https://bugs.gentoo.org/421609
|
||||
|
||||
--- a/test.sh
|
||||
+++ b/test.sh
|
||||
@@ -1466,7 +1466,7 @@
|
||||
mkdir -p $dir
|
||||
i=0
|
||||
while [ $i -lt 10 ]; do
|
||||
- perl -e 'print "A" x 4017' >$dir/result$i-4017.o
|
||||
+ printf '%4017s' '' | tr ' ' 'A' >$dir/result$i-4017.o
|
||||
touch $dir/result$i-4017.stderr
|
||||
touch $dir/result$i-4017.d
|
||||
if [ $i -gt 5 ]; then
|
38
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/files/ccache-3.2.2-save-temps.patch
vendored
Normal file
38
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/files/ccache-3.2.2-save-temps.patch
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
From 13259a28a6ace55f9397b2066173fecc4b296833 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Marineau <michael.marineau@coreos.com>
|
||||
Date: Thu, 9 Jul 2015 13:13:33 -0700
|
||||
Subject: [PATCH] Bail out on --save-temps, an alias for -save-temps
|
||||
|
||||
---
|
||||
NEWS.txt | 2 ++
|
||||
compopt.c | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/NEWS.txt b/NEWS.txt
|
||||
index c1e121d..19b0ae2 100644
|
||||
--- a/NEWS.txt
|
||||
+++ b/NEWS.txt
|
||||
@@ -18,6 +18,8 @@ Bug fixes
|
||||
|
||||
- Avoid calling `exit()` inside an exit handler.
|
||||
|
||||
+- Bail out on compiler option --save-temps in addition to -save-temps.
|
||||
+
|
||||
|
||||
ccache 3.2.2
|
||||
------------
|
||||
diff --git a/compopt.c b/compopt.c
|
||||
index 26e1591..0fc9161 100644
|
||||
--- a/compopt.c
|
||||
+++ b/compopt.c
|
||||
@@ -33,6 +33,7 @@ struct compopt {
|
||||
|
||||
static const struct compopt compopts[] = {
|
||||
{"--param", TAKES_ARG},
|
||||
+ {"--save-temps", TOO_HARD},
|
||||
{"--serialize-diagnostics", TAKES_ARG | TAKES_PATH},
|
||||
{"-A", TAKES_ARG},
|
||||
{"-D", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG},
|
||||
--
|
||||
2.3.6
|
||||
|
97
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/files/ccache-config-3
vendored
Normal file
97
sdk_container/src/third_party/coreos-overlay/dev-util/ccache/files/ccache-config-3
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ccache-config - helper script for ccache and its ebuild
|
||||
#
|
||||
# Copyright 2003-2014 Superlucidity Services, LLC
|
||||
# Copyright 2013-2014 Gentoo Foundation
|
||||
# This program licensed under the GNU GPL version 2.
|
||||
#
|
||||
# This script developed by Zachary T Welch at Superlucidity Services, LLC
|
||||
# it was cloned from the distcc-config script
|
||||
#
|
||||
# Additional features to come; this provides a starting point
|
||||
|
||||
EPREFIX=''
|
||||
|
||||
. "${EPREFIX}"/lib/gentoo/functions.sh 2>/dev/null || {
|
||||
ebegin() { echo " * $* ..."; }
|
||||
eend() {
|
||||
local r=${1:-$?}
|
||||
[ ${r} -eq 0 ] && echo " [ OK ]" || echo " [ !! ]"
|
||||
return $r
|
||||
}
|
||||
}
|
||||
|
||||
LIBDIR="lib"
|
||||
|
||||
# this should be getopt'd someday (override with CC_QUIET=1)
|
||||
CC_VERBOSE=1
|
||||
unset _CC_QUIET
|
||||
c_quiet() {
|
||||
[ -n "${CC_QUIET:-${_CC_QUIET}}" ] || [ -z "${CC_VERBOSE}" ]
|
||||
}
|
||||
|
||||
c_ebegin() { c_quiet || ebegin "$@" ; }
|
||||
c_eend() { c_quiet || eend "$@" ; }
|
||||
|
||||
###
|
||||
# the following functions manage the ccache symlinks
|
||||
# they allow the user or other scripts (namely gcc-config) to
|
||||
# automatically update ccache's links when upgrading toolchains
|
||||
#
|
||||
cc_path() {
|
||||
echo ${ROOT%/}${EPREFIX}/usr/${LIBDIR}/ccache/bin/$1
|
||||
}
|
||||
cc_remove_link() {
|
||||
local t=$(cc_path "$1")
|
||||
if [ -L ${t} ]; then
|
||||
c_ebegin "Removing ${t}"
|
||||
rm -f "${t}"
|
||||
c_eend
|
||||
|
||||
# Trim the empty dir if possible. #517242
|
||||
t=${t%/*}
|
||||
if rmdir "${t}" 2>/dev/null; then
|
||||
rmdir "${t%/*}" 2>/dev/null
|
||||
fi
|
||||
:
|
||||
fi
|
||||
}
|
||||
cc_install_link() {
|
||||
# Search the PATH for the specified compiler
|
||||
# then create shadow link in /usr/lib/ccache/bin to ccache
|
||||
|
||||
if command -v "$1" >/dev/null ; then
|
||||
# first be sure any old link is removed
|
||||
_CC_QUIET=1
|
||||
cc_remove_link "$1"
|
||||
unset _CC_QUIET
|
||||
|
||||
# then create the new link
|
||||
local t=$(cc_path "$1")
|
||||
c_ebegin "Creating ccache shadow link ${t}"
|
||||
mkdir -p -m 0755 "${t%/*}" && ln -s "${EPREFIX}"/usr/bin/ccache "${t}"
|
||||
c_eend
|
||||
fi
|
||||
}
|
||||
cc_links() {
|
||||
local a
|
||||
for a in gcc cc c++ g++ icc icpc clang clang++ ; do
|
||||
"cc_${1}_link" "${2}${2:+-}${a}"
|
||||
done
|
||||
}
|
||||
|
||||
###
|
||||
# main routine
|
||||
|
||||
case $1 in
|
||||
--install-links )
|
||||
cc_links install "$2"
|
||||
;;
|
||||
--remove-links )
|
||||
cc_links remove "$2"
|
||||
;;
|
||||
* )
|
||||
echo "usage: $0 {--install-links|--remove-links} [ CHOST ]"
|
||||
;;
|
||||
esac
|
@ -109,6 +109,3 @@ dev-util/checkbashisms
|
||||
|
||||
# Avoid cross compile error with amd64 stable (elfutils-0.158).
|
||||
=dev-libs/elfutils-0.161 ~amd64
|
||||
|
||||
# Avoid locking bugs that bit us in the 3.1.x series.
|
||||
=dev-util/ccache-3.2.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user