Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-28 Thread Vadim Zhukov
2013/11/28 Juan Francisco Cantero Hurtado i...@juanfra.info:
 On Wed, Nov 27, 2013 at 11:00:29PM +, Stuart Henderson wrote:
 On 2013/11/27 23:56, Juan Francisco Cantero Hurtado wrote:
  On Wed, Nov 27, 2013 at 07:38:32PM +, 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.mk27 Nov 2013 20:42:08 -  1.6
+++ lang/clang/clang.port.mk28 Nov 2013 17:46:11 -
@@ -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



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-28 Thread Juan Francisco Cantero Hurtado
On Thu, Nov 28, 2013 at 09:48:59PM +0400, Vadim Zhukov wrote:
 2013/11/28 Juan Francisco Cantero Hurtado i...@juanfra.info:
  On Wed, Nov 27, 2013 at 11:00:29PM +, Stuart Henderson wrote:
  On 2013/11/27 23:56, Juan Francisco Cantero Hurtado wrote:
   On Wed, Nov 27, 2013 at 07:38:32PM +, 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.

OK to the patch. Works for me.

The same changes within gcc4.port.mk doesn't work. I can't find where is
the problem :(

 
 --
   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 -  1.6
 +++ lang/clang/clang.port.mk  28 Nov 2013 17:46:11 -
 @@ -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
 

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Vadim Zhukov
 CCache won't work for non-base C/C++ compilers, so don't even try
 to do it. Okays, objections?

Oops, better version for GCC 4.8.
--
zhuk@


Index: clang/clang.port.mk
===
RCS file: /cvs/ports/lang/clang/clang.port.mk,v
retrieving revision 1.5
diff -u -p -r1.5 clang.port.mk
--- clang/clang.port.mk 21 Jun 2013 23:00:30 -  1.5
+++ clang/clang.port.mk 27 Nov 2013 09:06:25 -
@@ -29,6 +29,8 @@ _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
Index: gcc/4.6/gcc4.port.mk
===
RCS file: /cvs/ports/lang/gcc/4.6/gcc4.port.mk,v
retrieving revision 1.9
diff -u -p -r1.9 gcc4.port.mk
--- gcc/4.6/gcc4.port.mk18 Apr 2012 18:41:22 -  1.9
+++ gcc/4.6/gcc4.port.mk27 Nov 2013 09:06:25 -
@@ -35,6 +35,9 @@ _MODGCC4_LINKS =
 .  if ${MODGCC4_LANGS:L:Mc}
 BUILD_DEPENDS += lang/gcc/4.6=4.6,4.7
 _MODGCC4_LINKS += egcc gcc egcc cc
+
+# not supported
+NO_CCACHE =Yes
 .  endif
 
 .  if ${MODGCC4_LANGS:L:Mc++}
@@ -45,6 +48,9 @@ LIB_DEPENDS += ${MODGCC4_CPPLIBDEP}
 MODGCC4_CPPWANTLIB = estdc++=14
 WANTLIB += ${MODGCC4_CPPWANTLIB}
 _MODGCC4_LINKS += eg++ g++ eg++ c++
+
+# not supported
+NO_CCACHE =Yes
 .  endif
 
 .  if ${MODGCC4_LANGS:L:Mfortran}
Index: gcc/4.8/gcc4.port.mk
===
RCS file: /cvs/ports/lang/gcc/4.8/gcc4.port.mk,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 gcc4.port.mk
--- gcc/4.8/gcc4.port.mk8 Apr 2013 08:20:19 -   1.1.1.1
+++ gcc/4.8/gcc4.port.mk27 Nov 2013 09:06:25 -
@@ -35,6 +35,9 @@ _MODGCC4_LINKS =
 .  if ${MODGCC4_LANGS:L:Mc}
 BUILD_DEPENDS += lang/gcc/4.8=4.8,4.9
 _MODGCC4_LINKS += egcc gcc egcc cc
+
+# not supported
+NO_CCACHE =Yes
 .  endif
 
 .  if ${MODGCC4_LANGS:L:Mc++}
@@ -45,6 +48,9 @@ LIB_DEPENDS += ${MODGCC4_CPPLIBDEP}
 MODGCC4_CPPWANTLIB = estdc++=16
 WANTLIB += ${MODGCC4_CPPWANTLIB}
 _MODGCC4_LINKS += eg++ g++ eg++ c++
+
+# not supported
+NO_CCACHE =Yes
 .  endif
 
 .  if ${MODGCC4_LANGS:L:Mfortran}



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Stuart Henderson
On 2013/11/27 13:05, Vadim Zhukov wrote:
 CCache won't work for non-base C/C++ compilers, so don't even try
 to do it. Okays, objections?
 
 --
 zhuk@

Ok for now, though in those cases you might want to investigate setting
CC/CXX to ccache egcc, etc. I didn't use that method for the general
case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC}
but this might be manageable if it's just for ports using non-base
compilers.



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Juan Francisco Cantero Hurtado
On Wed, Nov 27, 2013 at 09:24:33AM +, Stuart Henderson wrote:
 On 2013/11/27 13:05, Vadim Zhukov wrote:
  CCache won't work for non-base C/C++ compilers, so don't even try
  to do it. Okays, objections?
  

The ports framework only uses ccache with base gcc. I don't know why you
need add NO_CCACHE to ports-gcc/clang. Look bsd.port.mk line 2453:

.if ${USE_CCACHE:L} == yes  ${NO_CCACHE:L} == no
@${ECHO_MSG} ===  Enabling ccache for
${FULLPKGNAME}${_MASTER}
@ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/gcc
@ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/g++
@ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/cc
@ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/c++
.endif

ccache is pretty intelligent, ignores unknown languages or compiler
options.

 
 Ok for now, though in those cases you might want to investigate setting
 CC/CXX to ccache egcc, etc. I didn't use that method for the general
 case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC}
 but this might be manageable if it's just for ports using non-base
 compilers.
 

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.

MAKE_FLAGS= CC=${CC} uses cc from PATH=${WRKDIR}/bin. Don't worry.


-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Stuart Henderson
On 2013/11/27 18:28, Juan Francisco Cantero Hurtado wrote:
 On Wed, Nov 27, 2013 at 09:24:33AM +, Stuart Henderson wrote:
  On 2013/11/27 13:05, Vadim Zhukov wrote:
   CCache won't work for non-base C/C++ compilers, so don't even try
   to do it. Okays, objections?
   
 
 The ports framework only uses ccache with base gcc. I don't know why you
 need add NO_CCACHE to ports-gcc/clang. Look bsd.port.mk line 2453:
 
 .if ${USE_CCACHE:L} == yes  ${NO_CCACHE:L} == no
   @${ECHO_MSG} ===  Enabling ccache for
 ${FULLPKGNAME}${_MASTER}
   @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/gcc
   @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/g++
   @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/cc
   @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/c++
 .endif
 
 ccache is pretty intelligent, ignores unknown languages or compiler
 options.
 
  
  Ok for now, though in those cases you might want to investigate setting
  CC/CXX to ccache egcc, etc. I didn't use that method for the general
  case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC}
  but this might be manageable if it's just for ports using non-base
  compilers.
  
 
 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.

Hmm yes, a script could work. Needs to use exec though.

 MAKE_FLAGS= CC=${CC} uses cc from PATH=${WRKDIR}/bin. Don't worry.

The problem I was referring to with quoting issues is like this,

CC= ccache $somecompiler
MAKE_FLAGS= CC=${CC}

or with similar cases in 3rd party makefiles inside ports.



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Vadim Zhukov
2013/11/27 Juan Francisco Cantero Hurtado i...@juanfra.info:
 On Wed, Nov 27, 2013 at 09:24:33AM +, Stuart Henderson wrote:
 On 2013/11/27 13:05, Vadim Zhukov wrote:
  CCache won't work for non-base C/C++ compilers, so don't even try
  to do it. Okays, objections?
 

 The ports framework only uses ccache with base gcc. I don't know why you
 need add NO_CCACHE to ports-gcc/clang. Look bsd.port.mk line 2453:

 .if ${USE_CCACHE:L} == yes  ${NO_CCACHE:L} == no
 @${ECHO_MSG} ===  Enabling ccache for
 ${FULLPKGNAME}${_MASTER}
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/gcc
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/g++
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/cc
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/c++
 .endif

 ccache is pretty intelligent, ignores unknown languages or compiler
 options.

Yes. gcc4.port.mk and clang.port.mk overwrite
${WRKDIR}/bin/{cc,c++,...} that are written by bsd.port.mk when
USE_CCACHE is enabled. But this gives you false sense that ccache
works, while it does not. This is bad.

 Ok for now, though in those cases you might want to investigate setting
 CC/CXX to ccache egcc, etc. I didn't use that method for the general
 case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC}
 but this might be manageable if it's just for ports using non-base
 compilers.


 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.
And there are ports that have both C and C++ sources to be built.

 MAKE_FLAGS= CC=${CC} uses cc from PATH=${WRKDIR}/bin. Don't worry.

Yes, I know that.

--
  WBR,
  Vadim Zhukov



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Vadim Zhukov
2013/11/27 Vadim Zhukov persg...@gmail.com:
 2013/11/27 Juan Francisco Cantero Hurtado i...@juanfra.info:
 On Wed, Nov 27, 2013 at 09:24:33AM +, Stuart Henderson wrote:
 On 2013/11/27 13:05, Vadim Zhukov wrote:
  CCache won't work for non-base C/C++ compilers, so don't even try
  to do it. Okays, objections?
 

 The ports framework only uses ccache with base gcc. I don't know why you
 need add NO_CCACHE to ports-gcc/clang. Look bsd.port.mk line 2453:

 .if ${USE_CCACHE:L} == yes  ${NO_CCACHE:L} == no
 @${ECHO_MSG} ===  Enabling ccache for
 ${FULLPKGNAME}${_MASTER}
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/gcc
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/g++
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/cc
 @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/c++
 .endif

 ccache is pretty intelligent, ignores unknown languages or compiler
 options.

 Yes. gcc4.port.mk and clang.port.mk overwrite
 ${WRKDIR}/bin/{cc,c++,...} that are written by bsd.port.mk when
 USE_CCACHE is enabled. But this gives you false sense that ccache
 works, while it does not. This is bad.

 Ok for now, though in those cases you might want to investigate setting
 CC/CXX to ccache egcc, etc. I didn't use that method for the general
 case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC}
 but this might be manageable if it's just for ports using non-base
 compilers.


 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.
 And there are ports that have both C and C++ sources to be built.

Missed the script part, sorry. Yes, this could work but, as sthen@
pointed out, it'll require additional exec(2). Still thinking about
it...



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Stuart Henderson
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



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Juan Francisco Cantero Hurtado
On Wed, Nov 27, 2013 at 10:53:29PM +0400, Vadim Zhukov wrote:
 2013/11/27 Juan Francisco Cantero Hurtado i...@juanfra.info:
  On Wed, Nov 27, 2013 at 09:24:33AM +, Stuart Henderson wrote:
  On 2013/11/27 13:05, Vadim Zhukov wrote:
   CCache won't work for non-base C/C++ compilers, so don't even try
   to do it. Okays, objections?
  
 
  The ports framework only uses ccache with base gcc. I don't know why you
  need add NO_CCACHE to ports-gcc/clang. Look bsd.port.mk line 2453:
 
  .if ${USE_CCACHE:L} == yes  ${NO_CCACHE:L} == no
  @${ECHO_MSG} ===  Enabling ccache for
  ${FULLPKGNAME}${_MASTER}
  @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/gcc
  @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/g++
  @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/cc
  @ln -s ${LOCALBASE}/bin/ccache ${WRKDIR}/bin/c++
  .endif
 
  ccache is pretty intelligent, ignores unknown languages or compiler
  options.
 
 Yes. gcc4.port.mk and clang.port.mk overwrite
 ${WRKDIR}/bin/{cc,c++,...} that are written by bsd.port.mk when
 USE_CCACHE is enabled. But this gives you false sense that ccache
 works, while it does not. This is bad.

Now I understand the patches. OK for me.

 
  Ok for now, though in those cases you might want to investigate setting
  CC/CXX to ccache egcc, etc. I didn't use that method for the general
  case as I was worried about quoting issues e.g. MAKE_FLAGS= CC=${CC}
  but this might be manageable if it's just for ports using non-base
  compilers.
 
 
  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.
 And there are ports that have both C and C++ sources to be built.
 
  MAKE_FLAGS= CC=${CC} uses cc from PATH=${WRKDIR}/bin. Don't worry.
 
 Yes, I know that.
 
 --
   WBR,
   Vadim Zhukov
 

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Juan Francisco Cantero Hurtado
On Wed, Nov 27, 2013 at 07:38:32PM +, 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



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Stuart Henderson
On 2013/11/27 23:56, Juan Francisco Cantero Hurtado wrote:
 On Wed, Nov 27, 2013 at 07:38:32PM +, 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 +=



Re: Force NO_CCACHE for gcc4.port.mk and clang.port.mk

2013-11-27 Thread Juan Francisco Cantero Hurtado
On Wed, Nov 27, 2013 at 11:00:29PM +, Stuart Henderson wrote:
 On 2013/11/27 23:56, Juan Francisco Cantero Hurtado wrote:
  On Wed, Nov 27, 2013 at 07:38:32PM +, 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.

-- 
Juan Francisco Cantero Hurtado http://juanfra.info