PATCH (revised) for gcc34 (for building ports)

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Fri Apr 15 23:15:24 PDT 2005


On Fri, Apr 15, 2005 at 12:26:57PM -0700, walt wrote:
> Asmodai, you sneaky guy -- you could have told me about the obvious
> error in my previous patch ;o)  A moment of thought should have told
> me that the cc_version for gcc2 would not be correct for gcc34 -- but
> alas, I wasted hours in place of that one moment of thought.  This
> updated patch uses the cc_version from FreeBSD-current, but it still
> does not fix all the ports compilation problems, only some.
> 
> 
> --- gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h.orig	2005-04-11 10:26:13.000000000 -0700
> +++ gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h	2005-04-11 10:43:33.000000000 -0700
> @@ -63,13 +63,17 @@
>  	else								\
>  	  builtin_define ("__DragonFly__");			       	\
>  	builtin_define ("__DragonFly_cc_version=100001");		\
> +	builtin_define ("__FreeBSD__=4");				\
> +	builtin_define ("__DragonFly_cc_version=100001");		\
> +	builtin_define ("__FreeBSD_cc_version=600001");			\
>  	builtin_define_std ("unix");					\
>  	builtin_define ("__KPRINTF_ATTRIBUTE__");		       	\
>  	builtin_define ("__GCC_VISIBILITY__=1");			\
>  	builtin_assert ("system=unix");					\
>  	builtin_assert ("system=bsd");					\
>  	builtin_assert ("system=DragonFly");				\
> -	DFBSD_TARGET_CPU_CPP_BUILTINS();					\
> +	builtin_assert ("system=FreeBSD");				\
> +	DFBSD_TARGET_CPU_CPP_BUILTINS();				\
>      }									\

Can't you do this with a wrapper? All of these above can be tweaked
by overriding the specs.

$ CCVER=gcc2 gcc -dumpspecs | grep -A1 predefines | tee predefines
*predefines:
-Di386 -Acpu(i386) -Amachine(i386) -D__DragonFly__=1 -D__DragonFly_cc_version=100001 -D__FreeBSD__=4 -D__FreeBSD_cc_version=460001 -Dunix -Asystem(unix) -Asystem(FreeBSD) -Asystem(DragonFly)

(probably __DragonFly__ and __DragonFly_cc_version may be wrong, so
you'll need to adjust it later)

$ CCVER=gcc34 -dumpspecs > ~/specs34
$ cat predefines >> ~/specs34
$ mkdir ~/bin
$ cat > ~/bin/gcc
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
cmd=`basename $0`
case `$cmd -dumpversion`; in
2*)
	exec $cmd ${1+$@};;
*)
	exec $cmd -specs=$HOME/specs34 ${1+$@};;
esac

$ chmod +x ~/bin/gcc
$ for c in g++ cc c++; do ln ~/bin/gcc ~/bin/$c; done

Now, put $HOME/bin at the beginning of $PATH and you're done.
The remaining things to consider include:
- `sysctl kern.osreldate`
- /usr/include tree incompatibility





More information about the Submit mailing list