2013/11/28 Juan Francisco Cantero Hurtado <i...@juanfra.info>:
> On Wed, Nov 27, 2013 at 11:00:29PM +0000, Stuart Henderson wrote:
>> On 2013/11/27 23:56, Juan Francisco Cantero Hurtado wrote:
>> > On Wed, Nov 27, 2013 at 07:38:32PM +0000, Stuart Henderson wrote:
>> > > On 2013/11/27 22:53, Vadim Zhukov wrote:
>> > > > > Why not add support for ports-gcc/clang?. The symlinks only works 
>> > > > > with
>> > > > > base-gcc but ccache can work with any compiler using
>> > > > > "CCACHE_CC=mycompiler". I think a script in ${WRKDIR}/bin with
>> > > > > "CCACHE_CC=mycompiler ccache $@" inside or something similar should 
>> > > > > be
>> > > > > enough.
>> > > >
>> > > > Won't work for more than one language: either C or C++, but not both.
>> > >
>> > > something like (untested)
>> > >
>> > > .if !empty(_MODGCC4_LINKS)
>> > > .  for _src _dest in ${_MODGCC4_LINKS}
>> > > .    if ${USE_CCACHE:L} == "yes"
>> > > printf '#!/bin/sh\nexec CCACHE_CC="${_src}" ccache $@\n' > 
>> > > ${WRKDIR}/bin/${_dest}
>> > > chmod +x ${WRKDIR}/bin/${_dest}
>> > > .    else
>> > > MODGCC4_post-patch += ln -sf ${LOCALBASE}/bin/${_src} 
>> > > ${WRKDIR}/bin/${_dest};
>> > > .    endif
>> > > .  endfor
>> > > .endif
>> > >
>> >
>> > *** Parse error in /usr/ports/www/webkit: Need an operator in '''
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:81)
>> > *** Parse error: Need an operator in '/bin/gcc'
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:82)
>> > *** Parse error: Need an operator in '''
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:81)
>> > *** Parse error: Need an operator in '/bin/cc'
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:82)
>> > *** Parse error: Need an operator in '''
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:81)
>> > *** Parse error: Need an operator in '/bin/g++'
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:82)
>> > *** Parse error: Need an operator in '''
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:81)
>> > *** Parse error: Need an operator in '/bin/c++'
>> > (/usr/ports/lang/gcc/4.6/gcc4.port.mk:82)
>> >
>> > Line 81 is the printf.
>> >
>> > --
>> > Juan Francisco Cantero Hurtado http://juanfra.info
>> >
>>
>> Oh yes, that needs some "MODGCC4_post-patch +="
>>
>
> MODGCC4_post-patch += printf '#!/bin/sh\nexec CCACHE_CC="${_src}" ccache 
> $@\n' > ${WRKDIR}/bin/${_dest}
> MODGCC4_post-patch += chmod +x ${WRKDIR}/bin/${_dest}
>
> or
>
> MODGCC4_post-patch += printf '#!/bin/sh\nexec CCACHE_CC="${_src}" ccache 
> $@\n' > ${WRKDIR}/bin/${_dest}; chmod +x ${WRKDIR}/bin/${_dest}
>
> These lines don't work. Webkit uses ccache with system-gcc.

I had success with x11/vlc, Clang and the following patch.
If the idea is welcome, I can do and run more changes/tests.

--
  WBR,
  Vadim Zhukov


Index: lang/clang/clang.port.mk
===================================================================
RCS file: /cvs/ports/lang/clang/clang.port.mk,v
retrieving revision 1.6
diff -u -p -r1.6 clang.port.mk
--- lang/clang/clang.port.mk    27 Nov 2013 20:42:08 -0000      1.6
+++ lang/clang/clang.port.mk    28 Nov 2013 17:46:11 -0000
@@ -29,21 +29,29 @@ _MODCLANG_ARCH_USES = Yes
 
 _MODCLANG_LINKS =
 .if ${_MODCLANG_ARCH_USES:L} == "yes"
-# not supported for all languages Clang supports
-NO_CCACHE =    Yes
 
 BUILD_DEPENDS += devel/llvm>=${MODCLANG_VERSION}
 _MODCLANG_LINKS = clang gcc clang cc
 
-.if ${MODCLANG_LANGS:L:Mc++}
+.  if ${MODCLANG_LANGS:L:Mc++}
 _MODCLANG_LINKS += clang++ g++ clang++ c++
-.endif
+.  endif
 .endif
 
 .if !empty(_MODCLANG_LINKS)
-.  for _src _dest in ${_MODCLANG_LINKS}
+.  if "${USE_CCACHE:L}" == "yes" && "${NO_CCACHE:L}" != "yes"
+.    for _src _dest in ${_MODCLANG_LINKS}
+MODCLANG_post-patch += rm -f ${WRKDIR}/bin/${_dest};
+MODCLANG_post-patch += echo '\#!/bin/sh' >${WRKDIR}/bin/${_dest};
+MODCLANG_post-patch += echo exec ccache ${LOCALBASE}/bin/${_src} \"\$$@\"
+MODCLANG_post-patch += >>${WRKDIR}/bin/${_dest};
+MODCLANG_post-patch += chmod +x ${WRKDIR}/bin/${_dest};
+.    endfor
+.  else
+.    for _src _dest in ${_MODCLANG_LINKS}
 MODCLANG_post-patch += ln -sf ${LOCALBASE}/bin/${_src} ${WRKDIR}/bin/${_dest};
-.  endfor
+.    endfor
+.  endif
 .endif
 
 SUBST_VARS+=   MODCLANG_VERSION

Reply via email to