View | Details | Raw Unified | Return to bug 252088 | Differences between
and this patch

Collapse All | Expand All

(-)b/devel/ccache-devel/Makefile (+105 lines)
Added Link Here
1
# Created by: Dominic Marks <d.marks@student.umist.ac.uk>
2
3
PORTNAME=	ccache
4
PORTVERSION=	4.3
5
CATEGORIES=	devel
6
PKGNAMESUFFIX=	-devel
7
8
PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
9
10
MAINTAINER=	rozhuk.im@gmail.com
11
COMMENT=	Tool to minimize the compile time of C/C++ programs
12
13
LICENSE=	GPLv3+
14
LICENSE_FILE=	${WRKSRC}/GPL-3.0.txt
15
16
USES=		cmake:noninja pathfix shebangfix compiler:c++11-lang
17
CONFLICTS_INSTALL?=	ccache-[0-9]* ccache-static-[0-9]* \
18
		ccache-memcached-[0-9]* ccache-memcached-static-[0-9]*
19
20
PORTDOCS=	AUTHORS.adoc AUTHORS.html MANUAL.html MANUAL.adoc \
21
		NEWS.adoc NEWS.html
22
23
USE_GITHUB=	yes
24
SUB_FILES=	world-ccache ccache-update-links.sh ccache_clean
25
# Prevent infinite recursion.
26
NO_CCACHE_DEPEND=	yes
27
28
LIB_DEPENDS+=	libzstd.so:archivers/zstd
29
30
# /bin/bash -> /bin/sh to reduce tests dep.
31
SHEBANG_FILES=	test/*
32
SHEBANG_GLOB=	*.sh *.bash
33
bash_CMD=	/bin/sh
34
35
CMAKE_OFF=	WARNINGS_AS_ERRORS \
36
		ENABLE_IPO \
37
		ZSTD_FROM_INTERNET \
38
		ENABLE_TRACING \
39
		STATIC_LINK
40
41
OPTIONS_DEFINE=	DOCS CLANGLINK LLVMLINK STATIC TEST
42
OPTIONS_DEFAULT=CLANGLINK LLVMLINK
43
OPTIONS_SUB=	yes
44
45
DOCS_BUILD_DEPENDS=	a2x:textproc/asciidoc
46
DOCS_ALL_TARGET=	all doc
47
DOCS_USES=		perl5
48
49
CLANGLINK_DESC=	Create clang compiler links if clang is installed
50
LLVMLINK_DESC=	Create llvm compiler links if llvm is installed
51
52
STATIC_LDFLAGS=	-static
53
54
TEST_CMAKE_BOOL=ENABLE_TESTING
55
TEST_TARGET=	check
56
57
.include <bsd.port.pre.mk>
58
59
CCLINKDIR=		libexec/ccache
60
PLIST_SUB+=		CCLINKDIR="${CCLINKDIR}"
61
62
.if ${ARCH}=="i386"
63
CCACHE_COMPILERS+=	icc icpc
64
.endif
65
66
GNU_COMPILERS+=		34 42 43 44 45 46 47 48 49 5 6 7 8 9 10 11 12
67
CCACHE_COMPILERS+=	cc c++ CC gcc g++ ${GNU_COMPILERS:S|^|gcc|} \
68
			${GNU_COMPILERS:S|^|g++|} \
69
			${GNU_COMPILERS:S|^|cpp|}
70
71
.if ${PORT_OPTIONS:MCLANGLINK}
72
CLANG_COMPILERS+=	33 34 35 36 37 38 39 40 50 60 70 80 90 10 11 12 -devel
73
CCACHE_COMPILERS+=	clang clang++ ${CLANG_COMPILERS:S|^|clang|} \
74
			${CLANG_COMPILERS:S|^|clang++|} \
75
			${CLANG_COMPILERS:S|^|cpp|}
76
.endif
77
78
.if ${PORT_OPTIONS:MLLVMLINK}
79
CCACHE_COMPILERS+=	llvm-gcc llvm-c++ llvm-g++
80
.endif
81
82
CCACHE_COMPILERS+=	${EXTRA_COMPILERS}
83
SUB_LIST+=		CCACHE_COMPILERS="${CCACHE_COMPILERS}" \
84
			CCLINKDIR="${CCLINKDIR}"
85
86
post-patch-DOCS-off:
87
	@${REINPLACE_CMD} -e 's|add_subdirectory(doc)||g' \
88
		${WRKSRC}/CMakeLists.txt
89
90
post-install:
91
	${MKDIR} ${STAGEDIR}${PREFIX}/${CCLINKDIR}/world
92
	${INSTALL_SCRIPT} ${WRKDIR}/world-ccache \
93
		${STAGEDIR}${PREFIX}/${CCLINKDIR}/world/ccache
94
	${INSTALL_SCRIPT} ${WRKDIR}/ccache-update-links.sh \
95
		${STAGEDIR}${PREFIX}/bin/ccache-update-links
96
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
97
	${INSTALL_SCRIPT} ${WRKDIR}/ccache_clean \
98
		${STAGEDIR}${PREFIX}/etc/periodic/daily
99
100
post-install-DOCS-on:
101
	${MKDIR} ${STAGEDIR}${DOCSDIR}
102
	${INSTALL_DATA} ${BUILD_WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR}
103
	${INSTALL_DATA} ${WRKSRC}/doc/*.adoc ${STAGEDIR}${DOCSDIR}
104
105
.include <bsd.port.post.mk>
(-)b/devel/ccache-devel/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1628533564
2
SHA256 (ccache-ccache-4.3_GH0.tar.gz) = b9789c42e52c73e99428f311a34def9ffec3462736439afd12dbacc7987c1533
3
SIZE (ccache-ccache-4.3_GH0.tar.gz) = 593767
(-)b/devel/ccache-devel/files/ccache-update-links.sh.in (+72 lines)
Added Link Here
1
#!/bin/sh
2
#
3
# Author: Emanuel Haupt <ehaupt@FreeBSD.org>
4
#
5
# $FreeBSD: head/devel/ccache/files/ccache-update-links.sh.in 435560 2017-03-06 17:50:14Z bdrewery $
6
#
7
8
CCACHE_COMPILERS="%%CCACHE_COMPILERS%% ${EXTRA_COMPILERS}"
9
CCLINKDIR="%%CCLINKDIR%%"
10
PREFIX="%%PREFIX%%"
11
12
usage() {
13
	cat << "EOUSAGE"
14
Usage: ccache-update-links [hv]
15
16
ccache-update-links maintains symlinks needed by ccache to work with additional
17
compilers.
18
19
    -h, --help   this help
20
    -v           verbose
21
22
EOUSAGE
23
}
24
25
case "$1"
26
in
27
	-h|--help)
28
	usage
29
	;;
30
esac
31
32
strip_path() {
33
	local IFS=":"
34
	local path
35
	set -- ${PATH}
36
	while [ $# -gt 0 ]; do
37
		if ! [ "${1}" = "${PREFIX}/libexec/ccache" ]; then
38
			path="${path}${path:+:}${1}"
39
		fi
40
		shift
41
	done
42
	echo "${path}"
43
}
44
45
# Remove ccache wrappers from PATH
46
PATH=$(strip_path)
47
48
# create compiler links
49
for comp in ${CCACHE_COMPILERS}
50
do
51
	if command -v "${comp}" >/dev/null; then
52
		if [ ! -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then
53
			[ "$1" = "-v" ] && echo "create symlink for ${comp}"
54
        		ln -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${comp}
55
		fi
56
57
		if [ ! -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then
58
			[ "$1" = "-v" ] && echo "create symlink for ${comp} (world)"
59
        		ln -sf ccache ${PREFIX}/${CCLINKDIR}/world/${comp}
60
		fi
61
	else
62
		if [ -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then
63
			[ "$1" = "-v" ] && echo "remove symlink for ${comp}"
64
			rm -f ${PREFIX}/${CCLINKDIR}/${comp}
65
		fi
66
67
		if [ -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then
68
			[ "$1" = "-v" ] && echo "remove symlink for ${comp} (world)"
69
			rm -f ${PREFIX}/${CCLINKDIR}/world/${comp}
70
		fi
71
	fi
72
done
(-)b/devel/ccache-devel/files/ccache_clean.in (+71 lines)
Added Link Here
1
#!/bin/sh
2
#
3
# Copyright (c) 2020 Rozhuk Ivan <rozhuk.im@gmail.com>
4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
8
# are met:
9
# 1. Redistributions of source code must retain the above copyright
10
#    notice, this list of conditions and the following disclaimer.
11
# 2. Redistributions in binary form must reproduce the above copyright
12
#    notice, this list of conditions and the following disclaimer in the
13
#    documentation and/or other materials provided with the distribution.
14
#
15
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
# SUCH DAMAGE.
26
#
27
# $FreeBSD$
28
#
29
30
if [ -r /etc/defaults/periodic.conf ]; then
31
	. /etc/defaults/periodic.conf
32
	source_periodic_confs
33
fi
34
35
36
case "${daily_ccache_clean_enable:-YES}" in
37
[Nn][Oo])
38
	;;
39
*)
40
	SYS_CCACHE_DIR=`make -V CCACHE_DIR`
41
	if [ -z "${SYS_CCACHE_DIR}" ]; then
42
		SYS_CCACHE_DIR='/var/cache/ccache'
43
	fi
44
	if [ -d "${SYS_CCACHE_DIR}" ]; then
45
		echo "ccache dir: ${SYS_CCACHE_DIR}"
46
		env CCACHE_DIR="${SYS_CCACHE_DIR}" \
47
			/usr/bin/nice -n 15 \
48
				%%PREFIX%%/bin/ccache --cleanup
49
	fi
50
51
	_USERS_HOME_DIRS=`pw usershow -a | awk -F":" '{print $9}' | sort -u`
52
	for _USER_HOME in ${_USERS_HOME_DIRS}; do
53
		if [ -d "${_USER_HOME}/.ccache" ]; then
54
			echo "ccache dir: ${_USER_HOME}/.ccache"
55
			env CCACHE_DIR="${_USER_HOME}/.ccache" \
56
				/usr/bin/nice -n 15 \
57
					%%PREFIX%%/bin/ccache --cleanup
58
		fi
59
		if [ -d "${_USER_HOME}/.cache/ccache" ]; then
60
			echo "ccache dir: ${_USER_HOME}/.cache/ccache"
61
			env CCACHE_DIR="${_USER_HOME}/.cache/ccache" \
62
			    CCACHE_CONFIGPATH="${_USER_HOME}/.config/ccache/ccache.conf" \
63
				/usr/bin/nice -n 15 \
64
					%%PREFIX%%/bin/ccache --cleanup
65
		fi
66
	done
67
	;;
68
esac
69
70
71
exit 0
(-)b/devel/ccache-devel/files/world-ccache.in (+9 lines)
Added Link Here
1
#!/bin/sh
2
3
[ "${0##*/}" = "ccache" ] &&
4
    printf "Please, use one of the compiler links in\n%%PREFIX%%/%%CCLINKDIR%%/world\nto invoke ccache\n" >&2 &&
5
    exit 1
6
7
unset CCACHE_PATH
8
export CCACHE_COMPILERCHECK=content
9
exec %%PREFIX%%/%%CCLINKDIR%%/${0##*/} "$@"
(-)b/devel/ccache-devel/pkg-descr (+6 lines)
Added Link Here
1
ccache is a compiler cache.  It acts as a caching pre-processor to C/C++
2
compilers, using the -E compiler switch and a hash to detect when a
3
compilation can be satisfied from cache.  This often results in a 5 to 10
4
times speedup in common compilations.
5
6
WWW: https://ccache.samba.org/
(-)b/devel/ccache-devel/pkg-plist (+9 lines)
Added Link Here
1
etc/periodic/daily/ccache_clean
2
bin/ccache
3
bin/ccache-update-links
4
%%PORTDOCS%%man/man1/ccache.1.gz
5
%%PORTDOCS%%%%DOCSDIR%%/LICENSE.html
6
%%CCLINKDIR%%/world/ccache
7
@postexec echo "Create compiler links..."
8
@postexec %D/bin/ccache-update-links -v
9
@preunexec find %D/%%CCLINKDIR%% -type l -exec rm -f {} \;

Return to bug 252088