Index: Makefile =================================================================== RCS file: /home/pcvs/ports/devel/ccache/Makefile,v retrieving revision 1.59 diff -u -r1.59 Makefile --- Makefile 28 Feb 2011 13:39:53 -0000 1.59 +++ Makefile 28 Mar 2011 14:22:55 -0000 @@ -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 @@ 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 -.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}/sbin/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}/sbin/ccache-update-links -v @${CAT} ${PKGMESSAGE} -.endif .include Index: pkg-plist =================================================================== RCS file: pkg-plist diff -N pkg-plist --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg-plist 28 Mar 2011 14:22:55 -0000 @@ -0,0 +1,7 @@ +bin/ccache +sbin/ccache-update-links +%%CCLINKDIR%%/world/ccache +@exec %D/sbin/ccache-update-links -v +@unexec find %D/%%CCLINKDIR%% -type l -exec rm -f {} \; +@unexec rmdir %D/%%CCLINKDIR%%/world +@unexec rmdir %D/%%CCLINKDIR%% Index: files/ccache-howto-freebsd.txt.in =================================================================== RCS file: /home/pcvs/ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v retrieving revision 1.14 diff -u -r1.14 ccache-howto-freebsd.txt.in --- files/ccache-howto-freebsd.txt.in 28 Feb 2011 13:39:53 -0000 1.14 +++ files/ccache-howto-freebsd.txt.in 28 Mar 2011 14:22:55 -0000 @@ -46,10 +46,8 @@ -- -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: Index: files/ccache-update-links.sh.in =================================================================== RCS file: files/ccache-update-links.sh.in diff -N files/ccache-update-links.sh.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/ccache-update-links.sh.in 28 Mar 2011 14:22:55 -0000 @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Author: Emanuel Haupt +# +# $FreeBSD$ +# + +CCACHE_COMPILERS="%%CCACHE_COMPILERS%% ${EXTRA_COMPILERS}" +CCLINKDIR="%%CCLINKDIR%%" +PREFIX="%%PREFIX%%" + +usage() { + cat << "EOUSAGE" +Usage: ccache-update-links [hv] + -h this help + -v verbose +EOUSAGE +} + +case "$1" +in + -h) + 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 ${PREFIX}/${CCLINKDIR}/${comp}" + ln -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${comp} + fi + + if [ ! -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then + [ "$1" = "-v" ] && echo "Create ${PREFIX}/${CCLINKDIR}/world/${comp}" + ln -sf ccache ${PREFIX}/${CCLINKDIR}/world/${comp} + fi + else + if [ -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then + [ "$1" = "-v" ] && echo "Remove ${PREFIX}/${CCLINKDIR}/${comp}" + rm -f ${PREFIX}/${CCLINKDIR}/${comp} + fi + + if [ -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then + [ "$1" = "-v" ] && echo "Remove ${PREFIX}/${CCLINKDIR}/world/${comp}" + rm -f ${PREFIX}/${CCLINKDIR}/world/${comp} + fi + fi +done