diff options
author | ehaupt <ehaupt@FreeBSD.org> | 2011-03-29 22:15:03 +0800 |
---|---|---|
committer | ehaupt <ehaupt@FreeBSD.org> | 2011-03-29 22:15:03 +0800 |
commit | b69a3d211ffb82a6d16dc7752b7d5fcd44252ceb (patch) | |
tree | 4082414dae2c4264aa51a9300a4aa8daad24870f /devel/ccache | |
parent | a39992a3725df0cae5b2f2e90beaa02bb1c413a5 (diff) | |
download | freebsd-ports-gnome-b69a3d211ffb82a6d16dc7752b7d5fcd44252ceb.tar.gz freebsd-ports-gnome-b69a3d211ffb82a6d16dc7752b7d5fcd44252ceb.tar.zst freebsd-ports-gnome-b69a3d211ffb82a6d16dc7752b7d5fcd44252ceb.zip |
Only create symlinks for existing compiler. This functionality is outsourced
into a script which can be run manually after installing or deinstalling
additional compiler.
PR: 155568 (based on)
Diffstat (limited to 'devel/ccache')
-rw-r--r-- | devel/ccache/Makefile | 60 | ||||
-rw-r--r-- | devel/ccache/files/ccache-howto-freebsd.txt.in | 6 | ||||
-rw-r--r-- | devel/ccache/files/ccache-update-links.sh.in | 56 | ||||
-rw-r--r-- | devel/ccache/files/pkg-message.in | 2 |
4 files changed, 75 insertions, 49 deletions
diff --git a/devel/ccache/Makefile b/devel/ccache/Makefile index ce7160c773c8..014d936dd7fe 100644 --- a/devel/ccache/Makefile +++ b/devel/ccache/Makefile @@ -7,7 +7,7 @@ PORTNAME= ccache PORTVERSION= 3.1.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= http://samba.org/ftp/ccache/ CRITICAL @@ -15,77 +15,49 @@ MAINTAINER= ehaupt@FreeBSD.org COMMENT= A tool to minimize the compile time of C/C++ programs LICENSE= GPLv3 -LICENSE_FILE= ${WRKSRC}/GPL-3.0.txt GNU_CONFIGURE= yes -MAN1= ccache.1 -PLIST_FILES= bin/ccache - -PORTDOCS= * - -.if !defined(WITHOUT_COMPILER_LINKS) HOWTO= ccache-howto-freebsd.txt CCLINKDIR= libexec/ccache -PLIST_DIRS= ${CCLINKDIR}/world ${CCLINKDIR} -SUB_FILES= ${HOWTO} pkg-message -.endif +SUB_FILES= ${HOWTO} world-ccache pkg-message ccache-update-links.sh + +MAN1= ccache.1 + +PORTDOCS= ccache-howto-freebsd.txt MANUAL.html .include <bsd.port.pre.mk> -.if !defined(WITHOUT_COMPILER_LINKS) +PLIST_SUB+= CCLINKDIR="${CCLINKDIR}" + .if ${ARCH}=="i386" CCACHE_COMPILERS+= icc icpc .endif GNU_COMPILERS+= 34 42 43 44 45 46 CCACHE_COMPILERS+= cc c++ gcc g++ ${GNU_COMPILERS:S|^|gcc|} ${GNU_COMPILERS:S|^|g++|} CCACHE_COMPILERS+= clang clang++ llvm-gcc llvm-c++ llvm-g++ -.if defined(EXTRA_COMPILERS) -CCACHE_COMPILERS+= ${EXTRA_COMPILERS} -.endif -PLIST_FILES+= ${CCACHE_COMPILERS:S|^|${CCLINKDIR}/|} \ - ${CCACHE_COMPILERS:S|^|${CCLINKDIR}/world/|} \ - ${CCLINKDIR}/world/ccache -SUB_FILES+= world-ccache SUB_LIST+= CCACHE_COMPILERS="${CCACHE_COMPILERS}" \ CCLINKDIR="${CCLINKDIR}" \ ICCPREFIX="${LOCALBASE}/intel_cc_80/bin" \ HOWTO="${HOWTO}" -.endif - -pre-everything:: -.if !defined(WITHOUT_COMPILER_LINKS) - @${ECHO_MSG} "===> Ccache will install compiler links in ${PREFIX}/libexec/ccache" - @${ECHO_MSG} "===> Links that will be created are" - @${ECHO_MSG} "===> ${CCACHE_COMPILERS}" - @${ECHO_MSG} "===>" - @${ECHO_MSG} "===> You may add more by EXTRA_COMPILERS=\"Ccompiler1 C++compiler1 etc..\"" - @${ECHO_MSG} "===>" - @${ECHO_MSG} "===> You can disable compiler links by defining" - @${ECHO_MSG} "===> WITHOUT_COMPILER_LINKS" - @${ECHO_MSG} "===>" -.endif do-install: ${INSTALL_PROGRAM} ${WRKSRC}/ccache ${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1 -.if !defined(WITHOUT_COMPILER_LINKS) @${MKDIR} ${PREFIX}/${CCLINKDIR}/world - ${INSTALL_SCRIPT} ${WRKDIR}/world-ccache ${PREFIX}/${CCLINKDIR}/world/ccache -.for link in ${CCACHE_COMPILERS} - ${LN} -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${link} - ${LN} -sf ccache ${PREFIX}/${CCLINKDIR}/world/${link} -.endfor -.endif + ${INSTALL_SCRIPT} ${WRKDIR}/world-ccache \ + ${PREFIX}/${CCLINKDIR}/world/ccache + ${INSTALL_SCRIPT} ${WRKDIR}/ccache-update-links.sh \ + ${PREFIX}/bin/ccache-update-links .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/MANUAL.html ${DOCSDIR} -.if !defined(WITHOUT_COMPILER_LINKS) ${INSTALL_DATA} ${WRKDIR}/${HOWTO} ${DOCSDIR} .endif -.endif -.if !defined(WITHOUT_COMPILER_LINKS) + +post-install: + @${ECHO_CMD} "Create compiler links..." + @${PREFIX}/bin/ccache-update-links -v @${CAT} ${PKGMESSAGE} -.endif .include <bsd.port.post.mk> diff --git a/devel/ccache/files/ccache-howto-freebsd.txt.in b/devel/ccache/files/ccache-howto-freebsd.txt.in index 6306573de59b..f95ef1beb9e5 100644 --- a/devel/ccache/files/ccache-howto-freebsd.txt.in +++ b/devel/ccache/files/ccache-howto-freebsd.txt.in @@ -46,10 +46,8 @@ reset PATH=$CCACHE_PATH and try again. -- -Ccache has installed links for the following compilers -%%CCACHE_COMPILERS%% -in %%PREFIX%%/%%CCLINKDIR%% -and %%PREFIX%%/%%CCLINKDIR%%/world +Make sure you run 'ccache-update-links' after you install/uninstall +additional compiers in order to create/remove compiler links. Clang will return a lot of 'unused argument' warnings: they are harmless. Just add this to /etc/make.conf if you want to hide them: diff --git a/devel/ccache/files/ccache-update-links.sh.in b/devel/ccache/files/ccache-update-links.sh.in new file mode 100644 index 000000000000..66ebd2d092ff --- /dev/null +++ b/devel/ccache/files/ccache-update-links.sh.in @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Author: Emanuel Haupt <ehaupt@FreeBSD.org> +# +# $FreeBSD$ +# + +CCACHE_COMPILERS="%%CCACHE_COMPILERS%% ${EXTRA_COMPILERS}" +CCLINKDIR="%%CCLINKDIR%%" +PREFIX="%%PREFIX%%" + +usage() { + cat << "EOUSAGE" +Usage: ccache-update-links [hv] + +ccache-update-links maintains symlinks needed by ccache to work with additional +compilers. + + -h, --help this help + -v verbose + +EOUSAGE +} + +case "$1" +in + -h|--help) + usage + ;; +esac + +# create compiler links +for comp in ${CCACHE_COMPILERS} +do + if [ -f "${PREFIX}/bin/${comp}" ] || [ -f "/usr/bin/${comp}" ]; then + if [ ! -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then + [ "$1" = "-v" ] && echo "create symlink for ${comp}" + ln -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${comp} + fi + + if [ ! -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then + [ "$1" = "-v" ] && echo "create symlink for ${comp} (world)" + ln -sf ccache ${PREFIX}/${CCLINKDIR}/world/${comp} + fi + else + if [ -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then + [ "$1" = "-v" ] && echo "remove symlink for ${comp}" + rm -f ${PREFIX}/${CCLINKDIR}/${comp} + fi + + if [ -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then + [ "$1" = "-v" ] && echo "remove symlink for ${comp} (world)" + rm -f ${PREFIX}/${CCLINKDIR}/world/${comp} + fi + fi +done diff --git a/devel/ccache/files/pkg-message.in b/devel/ccache/files/pkg-message.in index c521d705ed7e..32206a545012 100644 --- a/devel/ccache/files/pkg-message.in +++ b/devel/ccache/files/pkg-message.in @@ -1,5 +1,5 @@ -=== NOTE === +NOTE: Please read %%DOCSDIR%%/%%HOWTO%% for information on using ccache with FreeBSD ports and src. |