Thu Apr 2 23:50:25 2015 UTC ()
Append LIBABISUFFIX to the GCC library path.  Fixes Linux and SunOS
multilib systems where it is the default, no change on other platforms.


(jperkin)
diff -r1.157 -r1.158 pkgsrc/mk/compiler/gcc.mk

cvs diff -r1.157 -r1.158 pkgsrc/mk/compiler/gcc.mk (switch to unified diff)

--- pkgsrc/mk/compiler/gcc.mk 2015/04/02 23:42:15 1.157
+++ pkgsrc/mk/compiler/gcc.mk 2015/04/02 23:50:25 1.158
@@ -1,892 +1,892 @@ @@ -1,892 +1,892 @@
1# $NetBSD: gcc.mk,v 1.157 2015/04/02 23:42:15 jperkin Exp $ 1# $NetBSD: gcc.mk,v 1.158 2015/04/02 23:50:25 jperkin Exp $
2# 2#
3# This is the compiler definition for the GNU Compiler Collection. 3# This is the compiler definition for the GNU Compiler Collection.
4# 4#
5# User-settable variables: 5# User-settable variables:
6# 6#
7# GCCBASE 7# GCCBASE
8# If using a native GCC and the compiler is not in $PATH then 8# If using a native GCC and the compiler is not in $PATH then
9# this should be set to the base installation directory. 9# this should be set to the base installation directory.
10# 10#
11# USE_NATIVE_GCC 11# USE_NATIVE_GCC
12# When set to "yes", the native gcc is used, no matter which 12# When set to "yes", the native gcc is used, no matter which
13# compiler version a package requires. 13# compiler version a package requires.
14# 14#
15# USE_PKGSRC_GCC 15# USE_PKGSRC_GCC
16# When set to "yes", use an appropriate version of GCC from 16# When set to "yes", use an appropriate version of GCC from
17# pkgsrc based on GCC_REQD instead of the native compiler. 17# pkgsrc based on GCC_REQD instead of the native compiler.
18# 18#
19# USE_PKGSRC_GCC_RUNTIME 19# USE_PKGSRC_GCC_RUNTIME
20# When set to "yes", the runtime gcc libraries (libgcc, libstdc++ 20# When set to "yes", the runtime gcc libraries (libgcc, libstdc++
21# etc) will be used from pkgsrc rather than the native compiler. 21# etc) will be used from pkgsrc rather than the native compiler.
22# 22#
23# Package-settable variables: 23# Package-settable variables:
24# 24#
25# GCC_REQD 25# GCC_REQD
26# The minimum version of the GNU Compiler Collection that is 26# The minimum version of the GNU Compiler Collection that is
27# required to build this package. Setting this variable doesn't 27# required to build this package. Setting this variable doesn't
28# change the compiler that is used for building packages. See 28# change the compiler that is used for building packages. See
29# ONLY_FOR_COMPILER for that purpose. This is a list of version 29# ONLY_FOR_COMPILER for that purpose. This is a list of version
30# numbers, of which the maximum version is the definitive one. 30# numbers, of which the maximum version is the definitive one.
31# 31#
32# This variable can also be set by the user when USE_PKGSRC_GCC 32# This variable can also be set by the user when USE_PKGSRC_GCC
33# is in effect to ensure that a specific compiler is used for 33# is in effect to ensure that a specific compiler is used for
34# packages which do not specify a higher version. 34# packages which do not specify a higher version.
35# 35#
36# USE_GCC_RUNTIME 36# USE_GCC_RUNTIME
37# Packages which build shared libraries but do not use libtool to 37# Packages which build shared libraries but do not use libtool to
38# do so should define this variable. It is used to determine whether 38# do so should define this variable. It is used to determine whether
39# the gcc runtime should be depended upon when a user has enabled 39# the gcc runtime should be depended upon when a user has enabled
40# USE_PKGSRC_GCC_RUNTIME. 40# USE_PKGSRC_GCC_RUNTIME.
41# 41#
42# System-defined variables: 42# System-defined variables:
43# 43#
44# CC_VERSION 44# CC_VERSION
45# A string of the form "gcc-4.3.2" 45# A string of the form "gcc-4.3.2"
46# 46#
47# CC_VERSION_STRING 47# CC_VERSION_STRING
48# The same(?) as CC_VERSION. FIXME: What's the difference between 48# The same(?) as CC_VERSION. FIXME: What's the difference between
49# the two? 49# the two?
50# 50#
51# Keywords: gcc 51# Keywords: gcc
52# 52#
53 53
54.if !defined(COMPILER_GCC_MK) 54.if !defined(COMPILER_GCC_MK)
55COMPILER_GCC_MK= defined 55COMPILER_GCC_MK= defined
56 56
57_VARGROUPS+= gcc 57_VARGROUPS+= gcc
58_USER_VARS.gcc= USE_NATIVE_GCC USE_PKGSRC_GCC 58_USER_VARS.gcc= USE_NATIVE_GCC USE_PKGSRC_GCC
59_PKG_VARS.gcc= GCC_REQD 59_PKG_VARS.gcc= GCC_REQD
60_SYS_VARS.gcc= CC_VERSION CC_VERSION_STRING LANGUAGES.gcc 60_SYS_VARS.gcc= CC_VERSION CC_VERSION_STRING LANGUAGES.gcc
61_DEF_VARS.gcc= \ 61_DEF_VARS.gcc= \
62 CCPATH CPPPATH CXXPATH \ 62 CCPATH CPPPATH CXXPATH \
63 F77PATH FCPATH \ 63 F77PATH FCPATH \
64 ADAPATH GMKPATH GLKPATH GDBPATH CHPPATH GLSPATH GNTPATH PRPPATH \ 64 ADAPATH GMKPATH GLKPATH GDBPATH CHPPATH GLSPATH GNTPATH PRPPATH \
65 IMAKEOPTS \ 65 IMAKEOPTS \
66 LDFLAGS \ 66 LDFLAGS \
67 PKG_CC PKG_CPP PKG_CXX PKG_FC \ 67 PKG_CC PKG_CPP PKG_CXX PKG_FC \
68 PKG_ADA PKG_GMK PKG_GLK PKG_GDB PKG_CHP PKG_GLK PKG_GNT PKG_PRP \ 68 PKG_ADA PKG_GMK PKG_GLK PKG_GDB PKG_CHP PKG_GLK PKG_GNT PKG_PRP \
69 _CC _COMPILER_RPATH_FLAG _COMPILER_STRIP_VARS \ 69 _CC _COMPILER_RPATH_FLAG _COMPILER_STRIP_VARS \
70 _GCCBINDIR _GCC_ARCHDIR _GCC_BIN_PREFIX _GCC_CC \ 70 _GCCBINDIR _GCC_ARCHDIR _GCC_BIN_PREFIX _GCC_CC \
71 _GCC_CPP _GCC_CXX _GCC_DEPENDENCY _GCC_DEPENDS \ 71 _GCC_CPP _GCC_CXX _GCC_DEPENDENCY _GCC_DEPENDS \
72 _GCC_FC _GCC_LDFLAGS _GCC_LIBDIRS _GCC_PKG \ 72 _GCC_FC _GCC_LDFLAGS _GCC_LIBDIRS _GCC_PKG \
73 _GCC_PKGBASE _GCC_PKGSRCDIR _GCC_PKG_SATISFIES_DEP \ 73 _GCC_PKGBASE _GCC_PKGSRCDIR _GCC_PKG_SATISFIES_DEP \
74 _GCC_PREFIX _GCC_REQD _GCC_STRICTEST_REQD _GCC_SUBPREFIX \ 74 _GCC_PREFIX _GCC_REQD _GCC_STRICTEST_REQD _GCC_SUBPREFIX \
75 _GCC_TEST_DEPENDS _GCC_NEEDS_A_FORTRAN _GCC_VARS _GCC_VERSION \ 75 _GCC_TEST_DEPENDS _GCC_NEEDS_A_FORTRAN _GCC_VARS _GCC_VERSION \
76 _GCC_VERSION_STRING \ 76 _GCC_VERSION_STRING \
77 _GCC_ADA _GCC_GMK _GCC_GLK _GCC_GDB _GCC_CHP _GCC_GLS _GCC_GNT _GCC_PRP \ 77 _GCC_ADA _GCC_GMK _GCC_GLK _GCC_GDB _GCC_CHP _GCC_GLS _GCC_GNT _GCC_PRP \
78 _IGNORE_GCC _IGNORE_GCC3CXX _IGNORE_GCC3F77 _IGNORE_GCC3OBJC \ 78 _IGNORE_GCC _IGNORE_GCC3CXX _IGNORE_GCC3F77 _IGNORE_GCC3OBJC \
79 _IS_BUILTIN_GCC \ 79 _IS_BUILTIN_GCC \
80 _LANGUAGES.gcc \ 80 _LANGUAGES.gcc \
81 _LINKER_RPATH_FLAG \ 81 _LINKER_RPATH_FLAG \
82 _NEED_GCC2 _NEED_GCC3 _NEED_GCC34 _NEED_GCC44 _NEED_NEWER_GCC \ 82 _NEED_GCC2 _NEED_GCC3 _NEED_GCC34 _NEED_GCC44 _NEED_NEWER_GCC \
83 _PKGSRC_GCC_VERSION \ 83 _PKGSRC_GCC_VERSION \
84 _USE_GCC_SHLIB _USE_PKGSRC_GCC \ 84 _USE_GCC_SHLIB _USE_PKGSRC_GCC \
85 _WRAP_EXTRA_ARGS.CC 85 _WRAP_EXTRA_ARGS.CC
86 86
87.include "../../mk/bsd.prefs.mk" 87.include "../../mk/bsd.prefs.mk"
88 88
89USE_NATIVE_GCC?= no 89USE_NATIVE_GCC?= no
90USE_PKGSRC_GCC?= no 90USE_PKGSRC_GCC?= no
91USE_PKGSRC_GCC_RUNTIME?=no 91USE_PKGSRC_GCC_RUNTIME?=no
92 92
93GCC_REQD+= 2.8.0 93GCC_REQD+= 2.8.0
94 94
95# gcc2 doesn't support c99 and amd64 95# gcc2 doesn't support c99 and amd64
96.if !empty(USE_LANGUAGES:Mc99) || ${MACHINE_ARCH} == "x86_64" 96.if !empty(USE_LANGUAGES:Mc99) || ${MACHINE_ARCH} == "x86_64"
97GCC_REQD+= 3.0 97GCC_REQD+= 3.0
98.endif 98.endif
99 99
100# Only one compiler defined here supports Ada: lang/gcc-aux 100# Only one compiler defined here supports Ada: lang/gcc-aux
101# If the Ada language is requested, force lang/gcc-aux to be selected 101# If the Ada language is requested, force lang/gcc-aux to be selected
102.if !empty(USE_LANGUAGES:Mada) 102.if !empty(USE_LANGUAGES:Mada)
103GCC_REQD+= 20120614 103GCC_REQD+= 20120614
104.endif 104.endif
105 105
106# _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc 106# _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc
107# without the PKGREVISIONs. 107# without the PKGREVISIONs.
108_GCC_DIST_NAME:= gcc49 108_GCC_DIST_NAME:= gcc49
109.include "../../lang/${_GCC_DIST_NAME}/version.mk" 109.include "../../lang/${_GCC_DIST_NAME}/version.mk"
110_GCC_DIST_VERSION:= ${${_GCC_DIST_NAME:tu}_DIST_VERSION} 110_GCC_DIST_VERSION:= ${${_GCC_DIST_NAME:tu}_DIST_VERSION}
111 111
112# _GCC2_PATTERNS matches N s.t. N <= 2.95.3. 112# _GCC2_PATTERNS matches N s.t. N <= 2.95.3.
113_GCC2_PATTERNS= [0-1].* 2.[0-9] 2.[0-9].* 2.[1-8][0-9] 2.[1-8][0-9].* \ 113_GCC2_PATTERNS= [0-1].* 2.[0-9] 2.[0-9].* 2.[1-8][0-9] 2.[1-8][0-9].* \
114 2.9[0-4] 2.9[0-4].* 2.95 2.95.[0-3] 114 2.9[0-4] 2.9[0-4].* 2.95 2.95.[0-3]
115 115
116# _GCC3_PATTERNS matches N s.t. 2.95.3 < N < 3.4. 116# _GCC3_PATTERNS matches N s.t. 2.95.3 < N < 3.4.
117_GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \ 117_GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \
118 2.[1-9][0-9][0-9]* 3.[0-3] 3.[0-3].* 118 2.[1-9][0-9][0-9]* 3.[0-3] 3.[0-3].*
119 119
120# _GCC34_PATTERNS matches N s.t. 3.4 <= N < 4. 120# _GCC34_PATTERNS matches N s.t. 3.4 <= N < 4.
121_GCC34_PATTERNS= 3.[4-9] 3.[4-9].* 3.[1-9][0-9]* 121_GCC34_PATTERNS= 3.[4-9] 3.[4-9].* 3.[1-9][0-9]*
122 122
123# _GCC44_PATTERNS matches N s.t. 4.4 <= N < 4.5. 123# _GCC44_PATTERNS matches N s.t. 4.4 <= N < 4.5.
124_GCC44_PATTERNS= 4.4 4.4.* 124_GCC44_PATTERNS= 4.4 4.4.*
125 125
126# _GCC45_PATTERNS matches N s.t. 4.5 <= N < 4.6. 126# _GCC45_PATTERNS matches N s.t. 4.5 <= N < 4.6.
127_GCC45_PATTERNS= 4.5 4.5.* 127_GCC45_PATTERNS= 4.5 4.5.*
128 128
129# _GCC46_PATTERNS matches N s.t. 4.6 <= N < 4.7. 129# _GCC46_PATTERNS matches N s.t. 4.6 <= N < 4.7.
130_GCC46_PATTERNS= 4.6 4.6.* 130_GCC46_PATTERNS= 4.6 4.6.*
131 131
132# _GCC47_PATTERNS matches N s.t. 4.7 <= N < 4.8. 132# _GCC47_PATTERNS matches N s.t. 4.7 <= N < 4.8.
133_GCC47_PATTERNS= 4.7 4.7.* 133_GCC47_PATTERNS= 4.7 4.7.*
134 134
135# _GCC48_PATTERNS matches N s.t. 4.8 <= N < 4.9. 135# _GCC48_PATTERNS matches N s.t. 4.8 <= N < 4.9.
136_GCC48_PATTERNS= 4.8 4.8.* 136_GCC48_PATTERNS= 4.8 4.8.*
137 137
138# _GCC49_PATTERNS matches N s.t. 4.9 <= N < 4.10. 138# _GCC49_PATTERNS matches N s.t. 4.9 <= N < 4.10.
139_GCC49_PATTERNS= 4.9 4.9.* 139_GCC49_PATTERNS= 4.9 4.9.*
140 140
141# _GCC_AUX_PATTERNS matches 8-digit date YYYYMMDD* 141# _GCC_AUX_PATTERNS matches 8-digit date YYYYMMDD*
142_GCC_AUX_PATTERNS= 20[1-2][0-9][0-1][0-9][0-3][0-9]* 142_GCC_AUX_PATTERNS= 20[1-2][0-9][0-1][0-9][0-3][0-9]*
143 143
144# _CC is the full path to the compiler named by ${CC} if it can be found. 144# _CC is the full path to the compiler named by ${CC} if it can be found.
145.if !defined(_CC) 145.if !defined(_CC)
146_CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} 146_CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
147. if !empty(GCCBASE) && exists(${GCCBASE}/bin) 147. if !empty(GCCBASE) && exists(${GCCBASE}/bin)
148_EXTRA_CC_DIRS= ${GCCBASE}/bin 148_EXTRA_CC_DIRS= ${GCCBASE}/bin
149. endif 149. endif
150. for _dir_ in ${_EXTRA_CC_DIRS} ${PATH:C/\:/ /g} 150. for _dir_ in ${_EXTRA_CC_DIRS} ${PATH:C/\:/ /g}
151. if empty(_CC:M/*) 151. if empty(_CC:M/*)
152. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}) 152. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
153_CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} 153_CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
154. endif 154. endif
155. endif 155. endif
156. endfor 156. endfor
157MAKEFLAGS+= _CC=${_CC:Q} 157MAKEFLAGS+= _CC=${_CC:Q}
158.endif 158.endif
159 159
160.if !defined(_GCC_VERSION) 160.if !defined(_GCC_VERSION)
161# 161#
162# FIXME: Ideally we'd use PKGSRC_SETENV here, but not enough of the tools 162# FIXME: Ideally we'd use PKGSRC_SETENV here, but not enough of the tools
163# infrastructure is loaded for SETENV to be defined when mk/compiler.mk is 163# infrastructure is loaded for SETENV to be defined when mk/compiler.mk is
164# included first. LC_ALL is required here for similar reasons, as ALL_ENV 164# included first. LC_ALL is required here for similar reasons, as ALL_ENV
165# is not defined at this stage. 165# is not defined at this stage.
166# 166#
167_GCC_VERSION_STRING!= \ 167_GCC_VERSION_STRING!= \
168 ( env LC_ALL=C ${_CC} -v 2>&1 | ${GREP} 'gcc version') 2>/dev/null || ${ECHO} 0 168 ( env LC_ALL=C ${_CC} -v 2>&1 | ${GREP} 'gcc version') 2>/dev/null || ${ECHO} 0
169. if !empty(_GCC_VERSION_STRING:Megcs*) 169. if !empty(_GCC_VERSION_STRING:Megcs*)
170_GCC_VERSION= 2.8.1 # egcs is considered to be gcc-2.8.1. 170_GCC_VERSION= 2.8.1 # egcs is considered to be gcc-2.8.1.
171. elif !empty(DRAGONFLY_CCVER) && ${OPSYS} == "DragonFly" 171. elif !empty(DRAGONFLY_CCVER) && ${OPSYS} == "DragonFly"
172_GCC_VERSION!= env CCVER=${DRAGONFLY_CCVER} ${_CC} -dumpversion 172_GCC_VERSION!= env CCVER=${DRAGONFLY_CCVER} ${_CC} -dumpversion
173. elif !empty(_GCC_VERSION_STRING:Mgcc*) 173. elif !empty(_GCC_VERSION_STRING:Mgcc*)
174_GCC_VERSION!= ${_CC} -dumpversion 174_GCC_VERSION!= ${_CC} -dumpversion
175. else 175. else
176_GCC_VERSION= 0 176_GCC_VERSION= 0
177. endif 177. endif
178.endif 178.endif
179_GCC_PKG= gcc-${_GCC_VERSION:C/-.*$//} 179_GCC_PKG= gcc-${_GCC_VERSION:C/-.*$//}
180 180
181.if !empty(_CC:M${LOCALBASE}/*) 181.if !empty(_CC:M${LOCALBASE}/*)
182_IS_BUILTIN_GCC= NO 182_IS_BUILTIN_GCC= NO
183GCC_REQD+= ${_GCC_VERSION} 183GCC_REQD+= ${_GCC_VERSION}
184.else 184.else
185. if !empty(_CC:M/*) 185. if !empty(_CC:M/*)
186# 186#
187# GCC in older versions of Darwin report "Apple Computer ... based on gcc 187# GCC in older versions of Darwin report "Apple Computer ... based on gcc
188# version ...", so we can't just grep for "^gcc". 188# version ...", so we can't just grep for "^gcc".
189# 189#
190. if ${_GCC_VERSION} != "0" 190. if ${_GCC_VERSION} != "0"
191_IS_BUILTIN_GCC= YES 191_IS_BUILTIN_GCC= YES
192. else 192. else
193_IS_BUILTIN_GCC= NO 193_IS_BUILTIN_GCC= NO
194. endif 194. endif
195. else 195. else
196_IS_BUILTIN_GCC= NO 196_IS_BUILTIN_GCC= NO
197. endif 197. endif
198.endif 198.endif
199 199
200# Distill the GCC_REQD list into a single _GCC_REQD value that is the 200# Distill the GCC_REQD list into a single _GCC_REQD value that is the
201# highest version of GCC required. 201# highest version of GCC required.
202# 202#
203_GCC_STRICTEST_REQD?= none 203_GCC_STRICTEST_REQD?= none
204.for _version_ in ${GCC_REQD} 204.for _version_ in ${GCC_REQD}
205. for _pkg_ in gcc-${_version_} 205. for _pkg_ in gcc-${_version_}
206. if ${_GCC_STRICTEST_REQD} == "none" 206. if ${_GCC_STRICTEST_REQD} == "none"
207_GCC_PKG_SATISFIES_DEP= YES 207_GCC_PKG_SATISFIES_DEP= YES
208. for _vers_ in ${GCC_REQD} 208. for _vers_ in ${GCC_REQD}
209. if !empty(_GCC_PKG_SATISFIES_DEP:M[yY][eE][sS]) 209. if !empty(_GCC_PKG_SATISFIES_DEP:M[yY][eE][sS])
210_GCC_PKG_SATISFIES_DEP!= \ 210_GCC_PKG_SATISFIES_DEP!= \
211 if ${PKG_ADMIN} pmatch 'gcc>=${_vers_}' ${_pkg_} 2>/dev/null; then \ 211 if ${PKG_ADMIN} pmatch 'gcc>=${_vers_}' ${_pkg_} 2>/dev/null; then \
212 ${ECHO} "YES"; \ 212 ${ECHO} "YES"; \
213 else \ 213 else \
214 ${ECHO} "NO"; \ 214 ${ECHO} "NO"; \
215 fi 215 fi
216. endif 216. endif
217. endfor 217. endfor
218. if !empty(_GCC_PKG_SATISFIES_DEP:M[yY][eE][sS]) 218. if !empty(_GCC_PKG_SATISFIES_DEP:M[yY][eE][sS])
219_GCC_STRICTEST_REQD= ${_version_} 219_GCC_STRICTEST_REQD= ${_version_}
220. endif 220. endif
221. endif 221. endif
222. endfor 222. endfor
223.endfor 223.endfor
224_GCC_REQD= ${_GCC_STRICTEST_REQD} 224_GCC_REQD= ${_GCC_STRICTEST_REQD}
225 225
226# Determine whether we require GCC-2.x or GCC-3.x by examining _GCC_REQD. 226# Determine whether we require GCC-2.x or GCC-3.x by examining _GCC_REQD.
227_NEED_GCC2?= no 227_NEED_GCC2?= no
228.for _pattern_ in ${_GCC2_PATTERNS} 228.for _pattern_ in ${_GCC2_PATTERNS}
229. if !empty(_GCC_REQD:M${_pattern_}) 229. if !empty(_GCC_REQD:M${_pattern_})
230_NEED_GCC2= yes 230_NEED_GCC2= yes
231. endif 231. endif
232.endfor 232.endfor
233_NEED_GCC3?= no 233_NEED_GCC3?= no
234.for _pattern_ in ${_GCC3_PATTERNS} 234.for _pattern_ in ${_GCC3_PATTERNS}
235. if !empty(_GCC_REQD:M${_pattern_}) 235. if !empty(_GCC_REQD:M${_pattern_})
236_NEED_GCC3= yes 236_NEED_GCC3= yes
237. endif 237. endif
238.endfor 238.endfor
239_NEED_GCC34?= no 239_NEED_GCC34?= no
240.for _pattern_ in ${_GCC34_PATTERNS} 240.for _pattern_ in ${_GCC34_PATTERNS}
241. if !empty(_GCC_REQD:M${_pattern_}) 241. if !empty(_GCC_REQD:M${_pattern_})
242_NEED_GCC34= yes 242_NEED_GCC34= yes
243. endif 243. endif
244.endfor 244.endfor
245_NEED_GCC44?= no 245_NEED_GCC44?= no
246.for _pattern_ in ${_GCC44_PATTERNS} 246.for _pattern_ in ${_GCC44_PATTERNS}
247. if !empty(_GCC_REQD:M${_pattern_}) 247. if !empty(_GCC_REQD:M${_pattern_})
248_NEED_GCC44= yes 248_NEED_GCC44= yes
249. endif 249. endif
250.endfor 250.endfor
251_NEED_GCC45?= no 251_NEED_GCC45?= no
252.for _pattern_ in ${_GCC45_PATTERNS} 252.for _pattern_ in ${_GCC45_PATTERNS}
253. if !empty(_GCC_REQD:M${_pattern_}) 253. if !empty(_GCC_REQD:M${_pattern_})
254_NEED_GCC45= yes 254_NEED_GCC45= yes
255. endif 255. endif
256.endfor 256.endfor
257_NEED_GCC46?= no 257_NEED_GCC46?= no
258.for _pattern_ in ${_GCC46_PATTERNS} 258.for _pattern_ in ${_GCC46_PATTERNS}
259. if !empty(_GCC_REQD:M${_pattern_}) 259. if !empty(_GCC_REQD:M${_pattern_})
260_NEED_GCC46= yes 260_NEED_GCC46= yes
261. endif 261. endif
262.endfor 262.endfor
263_NEED_GCC47?= no 263_NEED_GCC47?= no
264.for _pattern_ in ${_GCC47_PATTERNS} 264.for _pattern_ in ${_GCC47_PATTERNS}
265. if !empty(_GCC_REQD:M${_pattern_}) 265. if !empty(_GCC_REQD:M${_pattern_})
266_NEED_GCC47= yes 266_NEED_GCC47= yes
267. endif 267. endif
268.endfor 268.endfor
269_NEED_GCC48?= no 269_NEED_GCC48?= no
270.for _pattern_ in ${_GCC48_PATTERNS} 270.for _pattern_ in ${_GCC48_PATTERNS}
271. if !empty(_GCC_REQD:M${_pattern_}) 271. if !empty(_GCC_REQD:M${_pattern_})
272_NEED_GCC48= yes 272_NEED_GCC48= yes
273. endif 273. endif
274.endfor 274.endfor
275_NEED_GCC49?= no 275_NEED_GCC49?= no
276.for _pattern_ in ${_GCC49_PATTERNS} 276.for _pattern_ in ${_GCC49_PATTERNS}
277. if !empty(_GCC_REQD:M${_pattern_}) 277. if !empty(_GCC_REQD:M${_pattern_})
278_NEED_GCC49= yes 278_NEED_GCC49= yes
279. endif 279. endif
280.endfor 280.endfor
281_NEED_GCC_AUX?= no 281_NEED_GCC_AUX?= no
282.for _pattern_ in ${_GCC_AUX_PATTERNS} 282.for _pattern_ in ${_GCC_AUX_PATTERNS}
283. if !empty(_GCC_REQD:M${_pattern_}) 283. if !empty(_GCC_REQD:M${_pattern_})
284_NEED_GCC_AUX= yes 284_NEED_GCC_AUX= yes
285_NEED_NEWER_GCC=NO 285_NEED_NEWER_GCC=NO
286. endif 286. endif
287.endfor 287.endfor
288.if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \ 288.if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \
289 !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \ 289 !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \
290 !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) && \ 290 !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) && \
291 !empty(_NEED_GCC47:M[nN][oO]) && !empty(_NEED_GCC48:M[nN][oO]) && \ 291 !empty(_NEED_GCC47:M[nN][oO]) && !empty(_NEED_GCC48:M[nN][oO]) && \
292 !empty(_NEED_GCC49:M[nN][oO]) && !empty(_NEED_GCC_AUX:M[nN][oO]) 292 !empty(_NEED_GCC49:M[nN][oO]) && !empty(_NEED_GCC_AUX:M[nN][oO])
293_NEED_GCC49= yes 293_NEED_GCC49= yes
294.endif 294.endif
295 295
296# Assume by default that GCC will only provide a C compiler. 296# Assume by default that GCC will only provide a C compiler.
297LANGUAGES.gcc?= c 297LANGUAGES.gcc?= c
298.if !empty(_NEED_GCC2:M[yY][eE][sS]) 298.if !empty(_NEED_GCC2:M[yY][eE][sS])
299LANGUAGES.gcc= c c++ fortran77 objc 299LANGUAGES.gcc= c c++ fortran77 objc
300.elif !empty(_NEED_GCC3:M[yY][eE][sS]) 300.elif !empty(_NEED_GCC3:M[yY][eE][sS])
301LANGUAGES.gcc= c c++ fortran77 java objc 301LANGUAGES.gcc= c c++ fortran77 java objc
302.elif !empty(_NEED_GCC34:M[yY][eE][sS]) 302.elif !empty(_NEED_GCC34:M[yY][eE][sS])
303LANGUAGES.gcc= c c++ fortran77 objc 303LANGUAGES.gcc= c c++ fortran77 objc
304.elif !empty(_NEED_GCC44:M[yY][eE][sS]) 304.elif !empty(_NEED_GCC44:M[yY][eE][sS])
305LANGUAGES.gcc= c c++ fortran fortran77 java objc 305LANGUAGES.gcc= c c++ fortran fortran77 java objc
306.elif !empty(_NEED_GCC45:M[yY][eE][sS]) 306.elif !empty(_NEED_GCC45:M[yY][eE][sS])
307LANGUAGES.gcc= c c++ fortran fortran77 java objc 307LANGUAGES.gcc= c c++ fortran fortran77 java objc
308.elif !empty(_NEED_GCC46:M[yY][eE][sS]) 308.elif !empty(_NEED_GCC46:M[yY][eE][sS])
309LANGUAGES.gcc= c c++ fortran fortran77 java objc 309LANGUAGES.gcc= c c++ fortran fortran77 java objc
310.elif !empty(_NEED_GCC47:M[yY][eE][sS]) 310.elif !empty(_NEED_GCC47:M[yY][eE][sS])
311LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++ 311LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
312.elif !empty(_NEED_GCC48:M[yY][eE][sS]) 312.elif !empty(_NEED_GCC48:M[yY][eE][sS])
313LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++ 313LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
314.elif !empty(_NEED_GCC49:M[yY][eE][sS]) 314.elif !empty(_NEED_GCC49:M[yY][eE][sS])
315LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++ 315LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
316.elif !empty(_NEED_GCC_AUX:M[yY][eE][sS]) 316.elif !empty(_NEED_GCC_AUX:M[yY][eE][sS])
317LANGUAGES.gcc= c c++ fortran fortran77 objc ada 317LANGUAGES.gcc= c c++ fortran fortran77 objc ada
318.endif 318.endif
319_LANGUAGES.gcc= # empty 319_LANGUAGES.gcc= # empty
320.for _lang_ in ${USE_LANGUAGES} 320.for _lang_ in ${USE_LANGUAGES}
321_LANGUAGES.gcc+= ${LANGUAGES.gcc:M${_lang_}} 321_LANGUAGES.gcc+= ${LANGUAGES.gcc:M${_lang_}}
322.endfor 322.endfor
323 323
324.if !empty(USE_LANGUAGES:Mc99) 324.if !empty(USE_LANGUAGES:Mc99)
325_WRAP_EXTRA_ARGS.CC+= -std=gnu99 325_WRAP_EXTRA_ARGS.CC+= -std=gnu99
326CWRAPPERS_APPEND.cc+= -std=gnu99 326CWRAPPERS_APPEND.cc+= -std=gnu99
327.endif 327.endif
328 328
329# GCC has this annoying behaviour where it advocates in a multi-line 329# GCC has this annoying behaviour where it advocates in a multi-line
330# banner the use of "#include" over "#import" when including headers. 330# banner the use of "#include" over "#import" when including headers.
331# This generates a huge number of warnings when building practically all 331# This generates a huge number of warnings when building practically all
332# Objective-C code where it is convention to use "#import". Suppress 332# Objective-C code where it is convention to use "#import". Suppress
333# the warning if we're building Objective-C code using GCC. 333# the warning if we're building Objective-C code using GCC.
334# 334#
335.if !empty(_LANGUAGES.gcc:Mobjc) 335.if !empty(_LANGUAGES.gcc:Mobjc)
336CFLAGS+= -Wno-import 336CFLAGS+= -Wno-import
337.endif 337.endif
338 338
339.if !empty(_NEED_GCC2:M[yY][eE][sS]) 339.if !empty(_NEED_GCC2:M[yY][eE][sS])
340# 340#
341# We require gcc-2.x in the lang/gcc directory. 341# We require gcc-2.x in the lang/gcc directory.
342# 342#
343_GCC_PKGBASE= gcc 343_GCC_PKGBASE= gcc
344. if !empty(PKGPATH:Mlang/gcc) 344. if !empty(PKGPATH:Mlang/gcc)
345_IGNORE_GCC= yes 345_IGNORE_GCC= yes
346MAKEFLAGS+= _IGNORE_GCC=yes 346MAKEFLAGS+= _IGNORE_GCC=yes
347. endif 347. endif
348. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 348. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
349_GCC_PKGSRCDIR= ../../lang/gcc 349_GCC_PKGSRCDIR= ../../lang/gcc
350_GCC_DEPENDENCY= gcc>=${_GCC_REQD}:../../lang/gcc 350_GCC_DEPENDENCY= gcc>=${_GCC_REQD}:../../lang/gcc
351. if !empty(_LANGUAGES.gcc:Mc++) || \ 351. if !empty(_LANGUAGES.gcc:Mc++) || \
352 !empty(_LANGUAGES.gcc:Mfortran77) || \ 352 !empty(_LANGUAGES.gcc:Mfortran77) || \
353 !empty(_LANGUAGES.gcc:Mobjc) 353 !empty(_LANGUAGES.gcc:Mobjc)
354_USE_GCC_SHLIB?= yes 354_USE_GCC_SHLIB?= yes
355. endif 355. endif
356. endif 356. endif
357.elif !empty(_NEED_GCC3:M[yY][eE][sS]) 357.elif !empty(_NEED_GCC3:M[yY][eE][sS])
358# 358#
359# We require gcc-3.x in the lang/gcc3-* directories. 359# We require gcc-3.x in the lang/gcc3-* directories.
360# 360#
361_GCC_PKGBASE= gcc3-c 361_GCC_PKGBASE= gcc3-c
362. if !empty(PKGPATH:Mlang/gcc3-c) 362. if !empty(PKGPATH:Mlang/gcc3-c)
363_IGNORE_GCC= yes 363_IGNORE_GCC= yes
364MAKEFLAGS+= _IGNORE_GCC=yes 364MAKEFLAGS+= _IGNORE_GCC=yes
365. endif 365. endif
366. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc:Mc) 366. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc:Mc)
367_GCC_PKGSRCDIR= ../../lang/gcc3-c 367_GCC_PKGSRCDIR= ../../lang/gcc3-c
368_GCC_DEPENDENCY= gcc3-c>=${_GCC_REQD}:../../lang/gcc3-c 368_GCC_DEPENDENCY= gcc3-c>=${_GCC_REQD}:../../lang/gcc3-c
369. endif 369. endif
370.elif !empty(_NEED_GCC34:M[yY][eE][sS]) 370.elif !empty(_NEED_GCC34:M[yY][eE][sS])
371# 371#
372# We require gcc-3.4.x in the lang/gcc34 directory. 372# We require gcc-3.4.x in the lang/gcc34 directory.
373# 373#
374_GCC_PKGBASE= gcc34 374_GCC_PKGBASE= gcc34
375. if !empty(PKGPATH:Mlang/gcc34) 375. if !empty(PKGPATH:Mlang/gcc34)
376_IGNORE_GCC= yes 376_IGNORE_GCC= yes
377MAKEFLAGS+= _IGNORE_GCC=yes 377MAKEFLAGS+= _IGNORE_GCC=yes
378. endif 378. endif
379. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 379. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
380_GCC_PKGSRCDIR= ../../lang/gcc34 380_GCC_PKGSRCDIR= ../../lang/gcc34
381_GCC_DEPENDENCY= gcc34>=${_GCC_REQD}:../../lang/gcc34 381_GCC_DEPENDENCY= gcc34>=${_GCC_REQD}:../../lang/gcc34
382. if !empty(_LANGUAGES.gcc:Mc++) || \ 382. if !empty(_LANGUAGES.gcc:Mc++) || \
383 !empty(_LANGUAGES.gcc:Mfortran77) || \ 383 !empty(_LANGUAGES.gcc:Mfortran77) || \
384 !empty(_LANGUAGES.gcc:Mobjc) 384 !empty(_LANGUAGES.gcc:Mobjc)
385_USE_GCC_SHLIB?= yes 385_USE_GCC_SHLIB?= yes
386. endif 386. endif
387. endif 387. endif
388.elif !empty(_NEED_GCC44:M[yY][eE][sS]) 388.elif !empty(_NEED_GCC44:M[yY][eE][sS])
389# 389#
390# We require gcc-4.4.x in the lang/gcc44 directory. 390# We require gcc-4.4.x in the lang/gcc44 directory.
391# 391#
392_GCC_PKGBASE= gcc44 392_GCC_PKGBASE= gcc44
393. if !empty(PKGPATH:Mlang/gcc44) 393. if !empty(PKGPATH:Mlang/gcc44)
394_IGNORE_GCC= yes 394_IGNORE_GCC= yes
395MAKEFLAGS+= _IGNORE_GCC=yes 395MAKEFLAGS+= _IGNORE_GCC=yes
396. endif 396. endif
397. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 397. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
398_GCC_PKGSRCDIR= ../../lang/gcc44 398_GCC_PKGSRCDIR= ../../lang/gcc44
399_GCC_DEPENDENCY= gcc44>=${_GCC_REQD}:../../lang/gcc44 399_GCC_DEPENDENCY= gcc44>=${_GCC_REQD}:../../lang/gcc44
400. if !empty(_LANGUAGES.gcc:Mc++) || \ 400. if !empty(_LANGUAGES.gcc:Mc++) || \
401 !empty(_LANGUAGES.gcc:Mfortran) || \ 401 !empty(_LANGUAGES.gcc:Mfortran) || \
402 !empty(_LANGUAGES.gcc:Mfortran77) || \ 402 !empty(_LANGUAGES.gcc:Mfortran77) || \
403 !empty(_LANGUAGES.gcc:Mobjc) 403 !empty(_LANGUAGES.gcc:Mobjc)
404_USE_GCC_SHLIB?= yes 404_USE_GCC_SHLIB?= yes
405. endif 405. endif
406. endif 406. endif
407.elif !empty(_NEED_GCC45:M[yY][eE][sS]) 407.elif !empty(_NEED_GCC45:M[yY][eE][sS])
408# 408#
409# We require gcc-4.5.x in the lang/gcc45 directory. 409# We require gcc-4.5.x in the lang/gcc45 directory.
410# 410#
411_GCC_PKGBASE= gcc45 411_GCC_PKGBASE= gcc45
412. if !empty(PKGPATH:Mlang/gcc45) 412. if !empty(PKGPATH:Mlang/gcc45)
413_IGNORE_GCC= yes 413_IGNORE_GCC= yes
414MAKEFLAGS+= _IGNORE_GCC=yes 414MAKEFLAGS+= _IGNORE_GCC=yes
415. endif 415. endif
416. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 416. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
417_GCC_PKGSRCDIR= ../../lang/gcc45 417_GCC_PKGSRCDIR= ../../lang/gcc45
418_GCC_DEPENDENCY= gcc45>=${_GCC_REQD}:../../lang/gcc45 418_GCC_DEPENDENCY= gcc45>=${_GCC_REQD}:../../lang/gcc45
419. if !empty(_LANGUAGES.gcc:Mc++) || \ 419. if !empty(_LANGUAGES.gcc:Mc++) || \
420 !empty(_LANGUAGES.gcc:Mfortran) || \ 420 !empty(_LANGUAGES.gcc:Mfortran) || \
421 !empty(_LANGUAGES.gcc:Mfortran77) || \ 421 !empty(_LANGUAGES.gcc:Mfortran77) || \
422 !empty(_LANGUAGES.gcc:Mobjc) 422 !empty(_LANGUAGES.gcc:Mobjc)
423_USE_GCC_SHLIB?= yes 423_USE_GCC_SHLIB?= yes
424. endif 424. endif
425. endif 425. endif
426.elif !empty(_NEED_GCC46:M[yY][eE][sS]) 426.elif !empty(_NEED_GCC46:M[yY][eE][sS])
427# 427#
428# We require gcc-4.6.x in the lang/gcc46 directory. 428# We require gcc-4.6.x in the lang/gcc46 directory.
429# 429#
430_GCC_PKGBASE= gcc46 430_GCC_PKGBASE= gcc46
431. if !empty(PKGPATH:Mlang/gcc46) 431. if !empty(PKGPATH:Mlang/gcc46)
432_IGNORE_GCC= yes 432_IGNORE_GCC= yes
433MAKEFLAGS+= _IGNORE_GCC=yes 433MAKEFLAGS+= _IGNORE_GCC=yes
434. endif 434. endif
435. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 435. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
436_GCC_PKGSRCDIR= ../../lang/gcc46 436_GCC_PKGSRCDIR= ../../lang/gcc46
437_GCC_DEPENDENCY= gcc46>=${_GCC_REQD}:../../lang/gcc46 437_GCC_DEPENDENCY= gcc46>=${_GCC_REQD}:../../lang/gcc46
438. if !empty(_LANGUAGES.gcc:Mc++) || \ 438. if !empty(_LANGUAGES.gcc:Mc++) || \
439 !empty(_LANGUAGES.gcc:Mfortran) || \ 439 !empty(_LANGUAGES.gcc:Mfortran) || \
440 !empty(_LANGUAGES.gcc:Mfortran77) || \ 440 !empty(_LANGUAGES.gcc:Mfortran77) || \
441 !empty(_LANGUAGES.gcc:Mobjc) 441 !empty(_LANGUAGES.gcc:Mobjc)
442_USE_GCC_SHLIB?= yes 442_USE_GCC_SHLIB?= yes
443. endif 443. endif
444. endif 444. endif
445.elif !empty(_NEED_GCC47:M[yY][eE][sS]) 445.elif !empty(_NEED_GCC47:M[yY][eE][sS])
446# 446#
447# We require gcc-4.7.x in the lang/gcc47 directory. 447# We require gcc-4.7.x in the lang/gcc47 directory.
448# 448#
449_GCC_PKGBASE= gcc47 449_GCC_PKGBASE= gcc47
450. if !empty(PKGPATH:Mlang/gcc47) 450. if !empty(PKGPATH:Mlang/gcc47)
451_IGNORE_GCC= yes 451_IGNORE_GCC= yes
452MAKEFLAGS+= _IGNORE_GCC=yes 452MAKEFLAGS+= _IGNORE_GCC=yes
453. endif 453. endif
454. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 454. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
455_GCC_PKGSRCDIR= ../../lang/gcc47 455_GCC_PKGSRCDIR= ../../lang/gcc47
456_GCC_DEPENDENCY= gcc47>=${_GCC_REQD}:../../lang/gcc47 456_GCC_DEPENDENCY= gcc47>=${_GCC_REQD}:../../lang/gcc47
457. if !empty(_LANGUAGES.gcc:Mc++) || \ 457. if !empty(_LANGUAGES.gcc:Mc++) || \
458 !empty(_LANGUAGES.gcc:Mfortran) || \ 458 !empty(_LANGUAGES.gcc:Mfortran) || \
459 !empty(_LANGUAGES.gcc:Mfortran77) || \ 459 !empty(_LANGUAGES.gcc:Mfortran77) || \
460 !empty(_LANGUAGES.gcc:Mgo) || \ 460 !empty(_LANGUAGES.gcc:Mgo) || \
461 !empty(_LANGUAGES.gcc:Mobjc) || \ 461 !empty(_LANGUAGES.gcc:Mobjc) || \
462 !empty(_LANGUAGES.gcc:Mobj-c++) 462 !empty(_LANGUAGES.gcc:Mobj-c++)
463_USE_GCC_SHLIB?= yes 463_USE_GCC_SHLIB?= yes
464. endif 464. endif
465. endif 465. endif
466.elif !empty(_NEED_GCC48:M[yY][eE][sS]) 466.elif !empty(_NEED_GCC48:M[yY][eE][sS])
467# 467#
468# We require gcc-4.8.x in the lang/gcc48 directory. 468# We require gcc-4.8.x in the lang/gcc48 directory.
469# 469#
470_GCC_PKGBASE= gcc48 470_GCC_PKGBASE= gcc48
471. if !empty(PKGPATH:Mlang/gcc48) 471. if !empty(PKGPATH:Mlang/gcc48)
472_IGNORE_GCC= yes 472_IGNORE_GCC= yes
473MAKEFLAGS+= _IGNORE_GCC=yes 473MAKEFLAGS+= _IGNORE_GCC=yes
474. endif 474. endif
475. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 475. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
476_GCC_PKGSRCDIR= ../../lang/gcc48 476_GCC_PKGSRCDIR= ../../lang/gcc48
477_GCC_DEPENDENCY= gcc48>=${_GCC_REQD}:../../lang/gcc48 477_GCC_DEPENDENCY= gcc48>=${_GCC_REQD}:../../lang/gcc48
478. if !empty(_LANGUAGES.gcc:Mc++) || \ 478. if !empty(_LANGUAGES.gcc:Mc++) || \
479 !empty(_LANGUAGES.gcc:Mfortran) || \ 479 !empty(_LANGUAGES.gcc:Mfortran) || \
480 !empty(_LANGUAGES.gcc:Mfortran77) || \ 480 !empty(_LANGUAGES.gcc:Mfortran77) || \
481 !empty(_LANGUAGES.gcc:Mgo) || \ 481 !empty(_LANGUAGES.gcc:Mgo) || \
482 !empty(_LANGUAGES.gcc:Mobjc) || \ 482 !empty(_LANGUAGES.gcc:Mobjc) || \
483 !empty(_LANGUAGES.gcc:Mobj-c++) 483 !empty(_LANGUAGES.gcc:Mobj-c++)
484_USE_GCC_SHLIB?= yes 484_USE_GCC_SHLIB?= yes
485. endif 485. endif
486. endif 486. endif
487.elif !empty(_NEED_GCC49:M[yY][eE][sS]) 487.elif !empty(_NEED_GCC49:M[yY][eE][sS])
488# 488#
489# We require gcc-4.9.x in the lang/gcc49-* directory. 489# We require gcc-4.9.x in the lang/gcc49-* directory.
490# 490#
491_GCC_PKGBASE= gcc49 491_GCC_PKGBASE= gcc49
492. if !empty(PKGPATH:Mlang/gcc49) 492. if !empty(PKGPATH:Mlang/gcc49)
493_IGNORE_GCC= yes 493_IGNORE_GCC= yes
494MAKEFLAGS+= _IGNORE_GCC=yes 494MAKEFLAGS+= _IGNORE_GCC=yes
495. endif 495. endif
496. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 496. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
497_GCC_PKGSRCDIR= ../../lang/gcc49 497_GCC_PKGSRCDIR= ../../lang/gcc49
498_GCC_DEPENDENCY= gcc49>=${_GCC_REQD}:../../lang/gcc49 498_GCC_DEPENDENCY= gcc49>=${_GCC_REQD}:../../lang/gcc49
499. if !empty(_LANGUAGES.gcc:Mc++) || \ 499. if !empty(_LANGUAGES.gcc:Mc++) || \
500 !empty(_LANGUAGES.gcc:Mfortran) || \ 500 !empty(_LANGUAGES.gcc:Mfortran) || \
501 !empty(_LANGUAGES.gcc:Mfortran77) || \ 501 !empty(_LANGUAGES.gcc:Mfortran77) || \
502 !empty(_LANGUAGES.gcc:Mgo) || \ 502 !empty(_LANGUAGES.gcc:Mgo) || \
503 !empty(_LANGUAGES.gcc:Mobjc) || \ 503 !empty(_LANGUAGES.gcc:Mobjc) || \
504 !empty(_LANGUAGES.gcc:Mobj-c++) 504 !empty(_LANGUAGES.gcc:Mobj-c++)
505_USE_GCC_SHLIB?= yes 505_USE_GCC_SHLIB?= yes
506. endif 506. endif
507. endif 507. endif
508.elif !empty(_NEED_GCC_AUX:M[yY][eE][sS]) 508.elif !empty(_NEED_GCC_AUX:M[yY][eE][sS])
509# 509#
510# We require Ada-capable compiler in the lang/gcc-aux directory. 510# We require Ada-capable compiler in the lang/gcc-aux directory.
511# 511#
512_GCC_PKGBASE= gcc-aux 512_GCC_PKGBASE= gcc-aux
513. if !empty(PKGPATH:Mlang/gcc-aux) 513. if !empty(PKGPATH:Mlang/gcc-aux)
514_IGNORE_GCC= yes 514_IGNORE_GCC= yes
515MAKEFLAGS+= _IGNORE_GCC=yes 515MAKEFLAGS+= _IGNORE_GCC=yes
516. endif 516. endif
517. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 517. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
518_GCC_PKGSRCDIR= ../../lang/gcc-aux 518_GCC_PKGSRCDIR= ../../lang/gcc-aux
519_GCC_DEPENDENCY= gcc-aux>=${_GCC_REQD}:../../lang/gcc-aux 519_GCC_DEPENDENCY= gcc-aux>=${_GCC_REQD}:../../lang/gcc-aux
520. if !empty(_LANGUAGES.gcc:Mc++) || \ 520. if !empty(_LANGUAGES.gcc:Mc++) || \
521 !empty(_LANGUAGES.gcc:Mfortran) || \ 521 !empty(_LANGUAGES.gcc:Mfortran) || \
522 !empty(_LANGUAGES.gcc:Mfortran77) || \ 522 !empty(_LANGUAGES.gcc:Mfortran77) || \
523 !empty(_LANGUAGES.gcc:Mada) || \ 523 !empty(_LANGUAGES.gcc:Mada) || \
524 !empty(_LANGUAGES.gcc:Mobjc) 524 !empty(_LANGUAGES.gcc:Mobjc)
525_USE_GCC_SHLIB?= yes 525_USE_GCC_SHLIB?= yes
526. endif 526. endif
527. endif 527. endif
528.endif 528.endif
529_GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD} 529_GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD}
530 530
531.if !empty(_NEED_GCC3:M[yY][eE][sS]) 531.if !empty(_NEED_GCC3:M[yY][eE][sS])
532. if !empty(PKGPATH:Mlang/gcc3-c++) 532. if !empty(PKGPATH:Mlang/gcc3-c++)
533_IGNORE_GCC3CXX= yes 533_IGNORE_GCC3CXX= yes
534MAKEFLAGS+= _IGNORE_GCC3CXX=yes 534MAKEFLAGS+= _IGNORE_GCC3CXX=yes
535. endif 535. endif
536. if !defined(_IGNORE_GCC3CXX) && !empty(_LANGUAGES.gcc:Mc++) 536. if !defined(_IGNORE_GCC3CXX) && !empty(_LANGUAGES.gcc:Mc++)
537_GCC_PKGSRCDIR+= ../../lang/gcc3-c++ 537_GCC_PKGSRCDIR+= ../../lang/gcc3-c++
538_GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++ 538_GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++
539_USE_GCC_SHLIB?= yes 539_USE_GCC_SHLIB?= yes
540. endif 540. endif
541. if !empty(PKGPATH:Mlang/gcc3-f77) 541. if !empty(PKGPATH:Mlang/gcc3-f77)
542_IGNORE_GCC3F77= yes 542_IGNORE_GCC3F77= yes
543MAKEFLAGS+= _IGNORE_GCC3F77=yes 543MAKEFLAGS+= _IGNORE_GCC3F77=yes
544. endif 544. endif
545. if !defined(_IGNORE_GCC3F77) && !empty(_LANGUAGES.gcc:Mfortran77) 545. if !defined(_IGNORE_GCC3F77) && !empty(_LANGUAGES.gcc:Mfortran77)
546_GCC_PKGSRCDIR+= ../../lang/gcc3-f77 546_GCC_PKGSRCDIR+= ../../lang/gcc3-f77
547_GCC_DEPENDENCY+= gcc3-f77>=${_GCC_REQD}:../../lang/gcc3-f77 547_GCC_DEPENDENCY+= gcc3-f77>=${_GCC_REQD}:../../lang/gcc3-f77
548_USE_GCC_SHLIB?= yes 548_USE_GCC_SHLIB?= yes
549. endif 549. endif
550. if !empty(PKGPATH:Mlang/gcc3-objc) 550. if !empty(PKGPATH:Mlang/gcc3-objc)
551_IGNORE_GCC3OBJC= yes 551_IGNORE_GCC3OBJC= yes
552MAKEFLAGS+= _IGNORE_GCC3OBJC=yes 552MAKEFLAGS+= _IGNORE_GCC3OBJC=yes
553. endif 553. endif
554. if !defined(_IGNORE_GCC3OBJC) && !empty(_LANGUAGES.gcc:Mobjc) 554. if !defined(_IGNORE_GCC3OBJC) && !empty(_LANGUAGES.gcc:Mobjc)
555_GCC_PKGSRCDIR+= ../../lang/gcc3-objc 555_GCC_PKGSRCDIR+= ../../lang/gcc3-objc
556_GCC_DEPENDENCY+= gcc3-objc>=${_GCC_REQD}:../../lang/gcc3-objc 556_GCC_DEPENDENCY+= gcc3-objc>=${_GCC_REQD}:../../lang/gcc3-objc
557_USE_GCC_SHLIB?= yes 557_USE_GCC_SHLIB?= yes
558. endif 558. endif
559.endif 559.endif
560 560
561# When not using the GNU linker, gcc will always link shared libraries against 561# When not using the GNU linker, gcc will always link shared libraries against
562# the shared version of libgcc, and so _USE_GCC_SHLIB needs to be enabled on 562# the shared version of libgcc, and so _USE_GCC_SHLIB needs to be enabled on
563# platforms with non-GNU linkers, such as SunOS. 563# platforms with non-GNU linkers, such as SunOS.
564# 564#
565# However, we cannot simply do this by default as it will create circular 565# However, we cannot simply do this by default as it will create circular
566# dependencies in packages which are required to build gcc itself, and so we 566# dependencies in packages which are required to build gcc itself, and so we
567# enable it based on USE_LIBTOOL for the majority of packages, and support 567# enable it based on USE_LIBTOOL for the majority of packages, and support
568# USE_GCC_RUNTIME for packages which create shared libraries but do not use 568# USE_GCC_RUNTIME for packages which create shared libraries but do not use
569# libtool to do so. 569# libtool to do so.
570# 570#
571.if ${OPSYS} == "SunOS" && (defined(USE_LIBTOOL) || defined(USE_GCC_RUNTIME)) 571.if ${OPSYS} == "SunOS" && (defined(USE_LIBTOOL) || defined(USE_GCC_RUNTIME))
572_USE_GCC_SHLIB= yes 572_USE_GCC_SHLIB= yes
573.endif 573.endif
574 574
575.if !empty(USE_NATIVE_GCC:M[yY][eE][sS]) && !empty(_IS_BUILTIN_GCC:M[yY][eE][sS]) 575.if !empty(USE_NATIVE_GCC:M[yY][eE][sS]) && !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
576_USE_PKGSRC_GCC= no 576_USE_PKGSRC_GCC= no
577.elif !empty(USE_PKGSRC_GCC:M[yY][eE][sS]) 577.elif !empty(USE_PKGSRC_GCC:M[yY][eE][sS])
578# For environments where there is an external gcc too, but pkgsrc 578# For environments where there is an external gcc too, but pkgsrc
579# should use the pkgsrc one for consistency. 579# should use the pkgsrc one for consistency.
580_USE_PKGSRC_GCC= yes 580_USE_PKGSRC_GCC= yes
581.endif 581.endif
582 582
583.if defined(_IGNORE_GCC) 583.if defined(_IGNORE_GCC)
584_USE_PKGSRC_GCC= NO 584_USE_PKGSRC_GCC= NO
585.endif 585.endif
586 586
587.if !defined(_USE_PKGSRC_GCC) 587.if !defined(_USE_PKGSRC_GCC)
588_USE_PKGSRC_GCC= YES 588_USE_PKGSRC_GCC= YES
589. if !empty(_IS_BUILTIN_GCC:M[yY][eE][sS]) 589. if !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
590_GCC_TEST_DEPENDS= gcc>=${_GCC_REQD} 590_GCC_TEST_DEPENDS= gcc>=${_GCC_REQD}
591_USE_PKGSRC_GCC!= \ 591_USE_PKGSRC_GCC!= \
592 if ${PKG_ADMIN} pmatch '${_GCC_TEST_DEPENDS}' ${_GCC_PKG} 2>/dev/null; then \ 592 if ${PKG_ADMIN} pmatch '${_GCC_TEST_DEPENDS}' ${_GCC_PKG} 2>/dev/null; then \
593 ${ECHO} "NO"; \ 593 ${ECHO} "NO"; \
594 else \ 594 else \
595 ${ECHO} "YES"; \ 595 ${ECHO} "YES"; \
596 fi 596 fi
597. endif 597. endif
598.endif 598.endif
599 599
600# Check if any of the versions of GCC in pkgsrc can satisfy the _GCC_REQD 600# Check if any of the versions of GCC in pkgsrc can satisfy the _GCC_REQD
601# requirement. 601# requirement.
602# 602#
603.if !defined(_NEED_NEWER_GCC) 603.if !defined(_NEED_NEWER_GCC)
604_PKGSRC_GCC_VERSION= ${_GCC_PKGBASE}-${_GCC_DIST_VERSION} 604_PKGSRC_GCC_VERSION= ${_GCC_PKGBASE}-${_GCC_DIST_VERSION}
605_NEED_NEWER_GCC!= \ 605_NEED_NEWER_GCC!= \
606 if ${PKG_ADMIN} pmatch '${_GCC_DEPENDS}' ${_PKGSRC_GCC_VERSION} 2>/dev/null; then \ 606 if ${PKG_ADMIN} pmatch '${_GCC_DEPENDS}' ${_PKGSRC_GCC_VERSION} 2>/dev/null; then \
607 ${ECHO} "NO"; \ 607 ${ECHO} "NO"; \
608 else \ 608 else \
609 ${ECHO} "YES"; \ 609 ${ECHO} "YES"; \
610 fi 610 fi
611#MAKEFLAGS+= _NEED_NEWER_GCC=${_NEED_NEWER_GCC} 611#MAKEFLAGS+= _NEED_NEWER_GCC=${_NEED_NEWER_GCC}
612.endif 612.endif
613.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) && \ 613.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) && \
614 !empty(_NEED_NEWER_GCC:M[yY][eE][sS]) 614 !empty(_NEED_NEWER_GCC:M[yY][eE][sS])
615PKG_FAIL_REASON= "Unable to satisfy dependency: ${_GCC_DEPENDS}" 615PKG_FAIL_REASON= "Unable to satisfy dependency: ${_GCC_DEPENDS}"
616.endif 616.endif
617 617
618# GNU ld option used to set the rpath 618# GNU ld option used to set the rpath
619_LINKER_RPATH_FLAG= -R 619_LINKER_RPATH_FLAG= -R
620 620
621# GCC passes rpath directives to the linker using "-Wl,-R". 621# GCC passes rpath directives to the linker using "-Wl,-R".
622_COMPILER_RPATH_FLAG= -Wl,${_LINKER_RPATH_FLAG} 622_COMPILER_RPATH_FLAG= -Wl,${_LINKER_RPATH_FLAG}
623 623
624.if !empty(MACHINE_ARCH:Mmips*) 624.if !empty(MACHINE_ARCH:Mmips*)
625_COMPILER_ABI_FLAG.32= -mabi=n32 # ABI == "32" == "n32" 625_COMPILER_ABI_FLAG.32= -mabi=n32 # ABI == "32" == "n32"
626_COMPILER_ABI_FLAG.n32= -mabi=n32 626_COMPILER_ABI_FLAG.n32= -mabi=n32
627_COMPILER_ABI_FLAG.o32= -mabi=32 627_COMPILER_ABI_FLAG.o32= -mabi=32
628_COMPILER_ABI_FLAG.64= -mabi=64 628_COMPILER_ABI_FLAG.64= -mabi=64
629 629
630. if defined(ABI) && !empty(ABI) 630. if defined(ABI) && !empty(ABI)
631MABIFLAG= ${_COMPILER_ABI_FLAG.${ABI}} 631MABIFLAG= ${_COMPILER_ABI_FLAG.${ABI}}
632. endif 632. endif
633.endif 633.endif
634 634
635.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) 635.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
636# 636#
637# Ensure that the correct rpath is passed to the linker if we need to 637# Ensure that the correct rpath is passed to the linker if we need to
638# link against gcc shared libs. 638# link against gcc shared libs.
639# 639#
640_GCC_SUBPREFIX!= \ 640_GCC_SUBPREFIX!= \
641 if ${PKG_INFO} -qe ${_GCC_PKGBASE}; then \ 641 if ${PKG_INFO} -qe ${_GCC_PKGBASE}; then \
642 ${PKG_INFO} -f ${_GCC_PKGBASE} | \ 642 ${PKG_INFO} -f ${_GCC_PKGBASE} | \
643 ${GREP} "File:.*bin/gcc" | \ 643 ${GREP} "File:.*bin/gcc" | \
644 ${GREP} -v "/gcc[0-9][0-9]*-.*" | \ 644 ${GREP} -v "/gcc[0-9][0-9]*-.*" | \
645 ${SED} -e "s/.*File: *//;s/bin\/gcc.*//;q"; \ 645 ${SED} -e "s/.*File: *//;s/bin\/gcc.*//;q"; \
646 else \ 646 else \
647 case ${_CC} in \ 647 case ${_CC} in \
648 ${LOCALBASE}/*) \ 648 ${LOCALBASE}/*) \
649 subprefix="${_CC:H:S/\/bin$//:S/${LOCALBASE}\///:S/${LOCALBASE}//}"; \ 649 subprefix="${_CC:H:S/\/bin$//:S/${LOCALBASE}\///:S/${LOCALBASE}//}"; \
650 case "$${subprefix}" in \ 650 case "$${subprefix}" in \
651 "") ${ECHO} "$${subprefix}" ;; \ 651 "") ${ECHO} "$${subprefix}" ;; \
652 *) ${ECHO} "$${subprefix}/" ;; \ 652 *) ${ECHO} "$${subprefix}/" ;; \
653 esac; \ 653 esac; \
654 ;; \ 654 ;; \
655 *) \ 655 *) \
656 ${ECHO} "_GCC_SUBPREFIX_not_found/"; \ 656 ${ECHO} "_GCC_SUBPREFIX_not_found/"; \
657 ;; \ 657 ;; \
658 esac; \ 658 esac; \
659 fi 659 fi
660_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX} 660_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX}
661_GCC_ARCHDIR!= \ 661_GCC_ARCHDIR!= \
662 if [ -x ${_GCC_PREFIX}bin/gcc ]; then \ 662 if [ -x ${_GCC_PREFIX}bin/gcc ]; then \
663 ${DIRNAME} `${_GCC_PREFIX}bin/gcc ${MABIFLAG} -print-libgcc-file-name 2>/dev/null`; \ 663 ${DIRNAME} `${_GCC_PREFIX}bin/gcc ${MABIFLAG} -print-libgcc-file-name 2>/dev/null`; \
664 else \ 664 else \
665 ${ECHO} "_GCC_ARCHDIR_not_found"; \ 665 ${ECHO} "_GCC_ARCHDIR_not_found"; \
666 fi 666 fi
667. if empty(_GCC_ARCHDIR:M*not_found*) 667. if empty(_GCC_ARCHDIR:M*not_found*)
668. if defined(MABIFLAG) && !empty(MABIFLAG) 668. if defined(MABIFLAG) && !empty(MABIFLAG)
669_GCC_PREFIX:= ${_GCC_ARCHDIR:H:H:H:H:H}/ 669_GCC_PREFIX:= ${_GCC_ARCHDIR:H:H:H:H:H}/
670_GCC_SUBPREFIX:= ${_GCC_ARCHDIR:H:H:H:H:H:T}/ 670_GCC_SUBPREFIX:= ${_GCC_ARCHDIR:H:H:H:H:H:T}/
671. endif 671. endif
672. endif 672. endif
673_GCC_LIBDIRS= ${_GCC_ARCHDIR} 673_GCC_LIBDIRS= ${_GCC_ARCHDIR}
674. if empty(USE_PKGSRC_GCC_RUNTIME:M[Yy][Ee][Ss]) 674. if empty(USE_PKGSRC_GCC_RUNTIME:M[Yy][Ee][Ss])
675_GCC_LIBDIRS+= ${_GCC_PREFIX}lib 675_GCC_LIBDIRS+= ${_GCC_PREFIX}lib${LIBABISUFFIX}
676. endif 676. endif
677_GCC_LDFLAGS= # empty 677_GCC_LDFLAGS= # empty
678. for _dir_ in ${_GCC_LIBDIRS:N*not_found*} 678. for _dir_ in ${_GCC_LIBDIRS:N*not_found*}
679_GCC_LDFLAGS+= -L${_dir_} ${COMPILER_RPATH_FLAG}${_dir_} 679_GCC_LDFLAGS+= -L${_dir_} ${COMPILER_RPATH_FLAG}${_dir_}
680. endfor 680. endfor
681LDFLAGS+= ${_GCC_LDFLAGS} 681LDFLAGS+= ${_GCC_LDFLAGS}
682.endif 682.endif
683 683
684# Point the variables that specify the compiler to the installed 684# Point the variables that specify the compiler to the installed
685# GCC executables. 685# GCC executables.
686# 686#
687_GCC_DIR= ${WRKDIR}/.gcc 687_GCC_DIR= ${WRKDIR}/.gcc
688_GCC_VARS= # empty 688_GCC_VARS= # empty
689 689
690.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) 690.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
691_GCCBINDIR= ${_GCC_PREFIX}bin 691_GCCBINDIR= ${_GCC_PREFIX}bin
692.elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS]) 692.elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
693_GCCBINDIR= ${_CC:H} 693_GCCBINDIR= ${_CC:H}
694.endif 694.endif
695.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) 695.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
696_GCC_BIN_PREFIX= ${MACHINE_GNU_PLATFORM}- 696_GCC_BIN_PREFIX= ${MACHINE_GNU_PLATFORM}-
697.endif 697.endif
698.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc) 698.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc)
699_GCC_VARS+= CC 699_GCC_VARS+= CC
700_GCC_CC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gcc 700_GCC_CC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gcc
701_ALIASES.CC= cc gcc 701_ALIASES.CC= cc gcc
702CCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc 702CCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc
703PKG_CC:= ${_GCC_CC} 703PKG_CC:= ${_GCC_CC}
704.endif 704.endif
705.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp) 705.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp)
706_GCC_VARS+= CPP 706_GCC_VARS+= CPP
707_GCC_CPP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}cpp 707_GCC_CPP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}cpp
708_ALIASES.CPP= cpp 708_ALIASES.CPP= cpp
709CPPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp 709CPPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp
710PKG_CPP:= ${_GCC_CPP} 710PKG_CPP:= ${_GCC_CPP}
711.endif 711.endif
712.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++) 712.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++)
713_GCC_VARS+= CXX 713_GCC_VARS+= CXX
714_GCC_CXX= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g++ 714_GCC_CXX= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g++
715_ALIASES.CXX= c++ g++ 715_ALIASES.CXX= c++ g++
716CXXPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++ 716CXXPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++
717PKG_CXX:= ${_GCC_CXX} 717PKG_CXX:= ${_GCC_CXX}
718.endif 718.endif
719.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77) 719.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77)
720_GCC_VARS+= FC 720_GCC_VARS+= FC
721_GCC_FC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g77 721_GCC_FC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g77
722_ALIASES.FC= f77 g77 722_ALIASES.FC= f77 g77
723FC= g77 723FC= g77
724FCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77 724FCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77
725F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77 725F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77
726PKG_FC:= ${_GCC_FC} 726PKG_FC:= ${_GCC_FC}
727PKGSRC_FORTRAN?= g77 727PKGSRC_FORTRAN?= g77
728.endif 728.endif
729.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran) 729.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran)
730_GCC_VARS+= FC 730_GCC_VARS+= FC
731_GCC_FC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gfortran 731_GCC_FC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gfortran
732_ALIASES.FC= gfortran 732_ALIASES.FC= gfortran
733FC= gfortran 733FC= gfortran
734FCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran 734FCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran
735F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran 735F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gfortran
736PKG_FC:= ${_GCC_FC} 736PKG_FC:= ${_GCC_FC}
737PKGSRC_FORTRAN?= gfortran 737PKGSRC_FORTRAN?= gfortran
738.endif 738.endif
739.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}ada) 739.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}ada)
740_GCC_VARS+= ADA GMK GLK GBD CHP PRP GLS GNT 740_GCC_VARS+= ADA GMK GLK GBD CHP PRP GLS GNT
741_GCC_ADA= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}ada 741_GCC_ADA= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}ada
742_GCC_GMK= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatmake 742_GCC_GMK= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatmake
743_GCC_GLK= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatlink 743_GCC_GLK= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatlink
744_GCC_GBD= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatbind 744_GCC_GBD= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatbind
745_GCC_CHP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatchop 745_GCC_CHP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatchop
746_GCC_PRP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatprep 746_GCC_PRP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatprep
747_GCC_GLS= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatls 747_GCC_GLS= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnatls
748_GCC_GNT= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnat 748_GCC_GNT= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gnat
749_ALIASES.ADA= ada 749_ALIASES.ADA= ada
750_ALIASES.GMK= gnatmake 750_ALIASES.GMK= gnatmake
751_ALIASES.GLK= gnatlink 751_ALIASES.GLK= gnatlink
752_ALIASES.GBD= gnatbind 752_ALIASES.GBD= gnatbind
753_ALIASES.CHP= gnatchop 753_ALIASES.CHP= gnatchop
754_ALIASES.PRP= gnatprep 754_ALIASES.PRP= gnatprep
755_ALIASES.GLS= gnatls 755_ALIASES.GLS= gnatls
756_ALIASES.GNT= gnat 756_ALIASES.GNT= gnat
757ADAPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}ada 757ADAPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}ada
758GMKPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatmake 758GMKPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatmake
759GLKPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatlink 759GLKPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatlink
760GBDPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatbind 760GBDPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatbind
761CHPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatchop 761CHPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatchop
762PRPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatprep 762PRPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatprep
763GLSPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatls 763GLSPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnatls
764GNTPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnat 764GNTPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gnat
765PKG_ADA:= ${_GCC_ADA} 765PKG_ADA:= ${_GCC_ADA}
766PKG_GMK:= ${_GCC_GMK} 766PKG_GMK:= ${_GCC_GMK}
767PKG_GLK:= ${_GCC_GLK} 767PKG_GLK:= ${_GCC_GLK}
768PKG_GBD:= ${_GCC_GBD} 768PKG_GBD:= ${_GCC_GBD}
769PKG_CHP:= ${_GCC_CHP} 769PKG_CHP:= ${_GCC_CHP}
770PKG_PRP:= ${_GCC_PRP} 770PKG_PRP:= ${_GCC_PRP}
771PKG_GLS:= ${_GCC_GLS} 771PKG_GLS:= ${_GCC_GLS}
772PKG_GNT:= ${_GCC_GNT} 772PKG_GNT:= ${_GCC_GNT}
773PKGSRC_ADA?= ada 773PKGSRC_ADA?= ada
774PKGSRC_GMK?= gnatmake 774PKGSRC_GMK?= gnatmake
775PKGSRC_GLK?= gnatlink 775PKGSRC_GLK?= gnatlink
776PKGSRC_GBD?= gnatbind 776PKGSRC_GBD?= gnatbind
777PKGSRC_CHP?= gnatchop 777PKGSRC_CHP?= gnatchop
778PKGSRC_PRP?= gnatprep 778PKGSRC_PRP?= gnatprep
779PKGSRC_GLS?= gnatls 779PKGSRC_GLS?= gnatls
780PKGSRC_GNT?= gnat 780PKGSRC_GNT?= gnat
781.endif 781.endif
782_COMPILER_STRIP_VARS+= ${_GCC_VARS} 782_COMPILER_STRIP_VARS+= ${_GCC_VARS}
783 783
784# Pass the required flags to imake to tell it we're using gcc on Solaris. 784# Pass the required flags to imake to tell it we're using gcc on Solaris.
785.if ${OPSYS} == "SunOS" 785.if ${OPSYS} == "SunOS"
786IMAKEOPTS+= -DHasGcc2=YES -DHasGcc2ForCplusplus=YES 786IMAKEOPTS+= -DHasGcc2=YES -DHasGcc2ForCplusplus=YES
787.endif 787.endif
788 788
789.if ${OPSYS} == "Darwin" || ${OPSYS} == "Linux" || ${OPSYS} == "SunOS" 789.if ${OPSYS} == "Darwin" || ${OPSYS} == "Linux" || ${OPSYS} == "SunOS"
790_COMPILER_ABI_FLAG.32= -m32 790_COMPILER_ABI_FLAG.32= -m32
791_COMPILER_ABI_FLAG.64= -m64 791_COMPILER_ABI_FLAG.64= -m64
792.endif 792.endif
793 793
794.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) 794.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
795. if exists(${CCPATH}) 795. if exists(${CCPATH})
796CC_VERSION_STRING!= ${CCPATH} -v 2>&1 796CC_VERSION_STRING!= ${CCPATH} -v 2>&1
797CC_VERSION!= \ 797CC_VERSION!= \
798 if ${CCPATH} -dumpversion > /dev/null 2>&1; then \ 798 if ${CCPATH} -dumpversion > /dev/null 2>&1; then \
799 ${ECHO} "gcc-`${CCPATH} -dumpversion`"; \ 799 ${ECHO} "gcc-`${CCPATH} -dumpversion`"; \
800 else \ 800 else \
801 ${ECHO} "gcc-${_GCC_REQD}"; \ 801 ${ECHO} "gcc-${_GCC_REQD}"; \
802 fi 802 fi
803 803
804. else 804. else
805CC_VERSION_STRING= ${CC_VERSION} 805CC_VERSION_STRING= ${CC_VERSION}
806CC_VERSION= gcc-${_GCC_REQD} 806CC_VERSION= gcc-${_GCC_REQD}
807. endif 807. endif
808.else 808.else
809CC_VERSION_STRING= ${CC_VERSION} 809CC_VERSION_STRING= ${CC_VERSION}
810CC_VERSION= ${_GCC_PKG} 810CC_VERSION= ${_GCC_PKG}
811.endif 811.endif
812 812
813# Prepend the path to the compiler to the PATH. 813# Prepend the path to the compiler to the PATH.
814.if !empty(_LANGUAGES.gcc) 814.if !empty(_LANGUAGES.gcc)
815PREPEND_PATH+= ${_GCC_DIR}/bin 815PREPEND_PATH+= ${_GCC_DIR}/bin
816.endif 816.endif
817 817
818# Add the dependency on GCC. 818# Add the dependency on GCC.
819.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) 819.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
820. for _dir_ in ${_GCC_PKGSRCDIR} 820. for _dir_ in ${_GCC_PKGSRCDIR}
821. include "${_dir_}/buildlink3.mk" 821. include "${_dir_}/buildlink3.mk"
822. endfor 822. endfor
823.endif 823.endif
824 824
825# Add dependency on GCC libraries if requested. 825# Add dependency on GCC libraries if requested.
826.if (defined(_USE_GCC_SHLIB) && !empty(_USE_GCC_SHLIB:M[Yy][Ee][Ss])) && !empty(USE_PKGSRC_GCC_RUNTIME:M[Yy][Ee][Ss]) 826.if (defined(_USE_GCC_SHLIB) && !empty(_USE_GCC_SHLIB:M[Yy][Ee][Ss])) && !empty(USE_PKGSRC_GCC_RUNTIME:M[Yy][Ee][Ss])
827# Special case packages which are themselves a dependency of gcc runtime. 827# Special case packages which are themselves a dependency of gcc runtime.
828. if empty(PKGPATH:Mdevel/libtool-base) && empty(PKGPATH:Mdevel/binutils) && empty(PKGPATH:Mlang/gcc??) 828. if empty(PKGPATH:Mdevel/libtool-base) && empty(PKGPATH:Mdevel/binutils) && empty(PKGPATH:Mlang/gcc??)
829. if !empty(CC_VERSION:Mgcc-4.6*) 829. if !empty(CC_VERSION:Mgcc-4.6*)
830. include "../../lang/gcc46-libs/buildlink3.mk" 830. include "../../lang/gcc46-libs/buildlink3.mk"
831. elif !empty(CC_VERSION:Mgcc-4.7*) 831. elif !empty(CC_VERSION:Mgcc-4.7*)
832. include "../../lang/gcc47-libs/buildlink3.mk" 832. include "../../lang/gcc47-libs/buildlink3.mk"
833. elif !empty(CC_VERSION:Mgcc-4.8*) 833. elif !empty(CC_VERSION:Mgcc-4.8*)
834. include "../../lang/gcc48-libs/buildlink3.mk" 834. include "../../lang/gcc48-libs/buildlink3.mk"
835. elif !empty(CC_VERSION:Mgcc-4.9*) 835. elif !empty(CC_VERSION:Mgcc-4.9*)
836. include "../../lang/gcc49-libs/buildlink3.mk" 836. include "../../lang/gcc49-libs/buildlink3.mk"
837. else 837. else
838PKG_FAIL_REASON= "No USE_PKGSRC_GCC_RUNTIME support for ${CC_VERSION}" 838PKG_FAIL_REASON= "No USE_PKGSRC_GCC_RUNTIME support for ${CC_VERSION}"
839. endif 839. endif
840. endif 840. endif
841.endif 841.endif
842 842
843.for _var_ in ${_GCC_VARS} 843.for _var_ in ${_GCC_VARS}
844. if !target(${_GCC_${_var_}}) 844. if !target(${_GCC_${_var_}})
845override-tools: ${_GCC_${_var_}} 845override-tools: ${_GCC_${_var_}}
846${_GCC_${_var_}}: 846${_GCC_${_var_}}:
847 ${RUN}${MKDIR} ${.TARGET:H} 847 ${RUN}${MKDIR} ${.TARGET:H}
848. if !empty(COMPILER_USE_SYMLINKS:M[Yy][Ee][Ss]) 848. if !empty(COMPILER_USE_SYMLINKS:M[Yy][Ee][Ss])
849 ${RUN}${RM} -f ${.TARGET} 849 ${RUN}${RM} -f ${.TARGET}
850 ${RUN}${LN} -s ${_GCCBINDIR}/${.TARGET:T} ${.TARGET} 850 ${RUN}${LN} -s ${_GCCBINDIR}/${.TARGET:T} ${.TARGET}
851. else 851. else
852 ${RUN} \ 852 ${RUN} \
853 (${ECHO} '#!${TOOLS_SHELL}'; \ 853 (${ECHO} '#!${TOOLS_SHELL}'; \
854 ${ECHO} 'exec ${_GCCBINDIR}/${.TARGET:T} "$$@"'; \ 854 ${ECHO} 'exec ${_GCCBINDIR}/${.TARGET:T} "$$@"'; \
855 ) > ${.TARGET} 855 ) > ${.TARGET}
856 ${RUN}${CHMOD} +x ${.TARGET} 856 ${RUN}${CHMOD} +x ${.TARGET}
857. endif 857. endif
858. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//} 858. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
859 ${RUN} \ 859 ${RUN} \
860 if [ ! -x "${_alias_}" ]; then \ 860 if [ ! -x "${_alias_}" ]; then \
861 ${LN} -f -s ${.TARGET:T} ${_alias_}; \ 861 ${LN} -f -s ${.TARGET:T} ${_alias_}; \
862 fi 862 fi
863. endfor 863. endfor
864. endif 864. endif
865.endfor 865.endfor
866 866
867# On systems without a Fortran compiler, pull one in if needed. 867# On systems without a Fortran compiler, pull one in if needed.
868# The default is g95 as it supports a modern dialect, but it can 868# The default is g95 as it supports a modern dialect, but it can
869# be overridden in mk.conf to use only f2c. 869# be overridden in mk.conf to use only f2c.
870# 870#
871PKGSRC_FORTRAN?=g95 871PKGSRC_FORTRAN?=g95
872 872
873_GCC_NEEDS_A_FORTRAN= no 873_GCC_NEEDS_A_FORTRAN= no
874.if empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) && !exists(${FCPATH}) 874.if empty(_USE_PKGSRC_GCC:M[yY][eE][sS]) && !exists(${FCPATH})
875_GCC_NEEDS_A_FORTRAN= yes 875_GCC_NEEDS_A_FORTRAN= yes
876.else 876.else
877. for _pattern_ in 0.* 1.[0-4] 1.[0-4].* 877. for _pattern_ in 0.* 1.[0-4] 1.[0-4].*
878. if !empty(MACHINE_PLATFORM:MNetBSD-${_pattern_}-*) 878. if !empty(MACHINE_PLATFORM:MNetBSD-${_pattern_}-*)
879_GCC_NEEDS_A_FORTRAN= yes 879_GCC_NEEDS_A_FORTRAN= yes
880. endif 880. endif
881. endfor 881. endfor
882.endif 882.endif
883.if !empty(_GCC_NEEDS_A_FORTRAN:M[yY][eE][sS]) 883.if !empty(_GCC_NEEDS_A_FORTRAN:M[yY][eE][sS])
884. include "../../mk/compiler/${PKGSRC_FORTRAN}.mk" 884. include "../../mk/compiler/${PKGSRC_FORTRAN}.mk"
885.endif 885.endif
886 886
887.if ${OPSYS} == "Interix" && !empty(_GCCBINDIR:M/opt/gcc.*) 887.if ${OPSYS} == "Interix" && !empty(_GCCBINDIR:M/opt/gcc.*)
888COMPILER_INCLUDE_DIRS= ${_GCCBINDIR:H}/include ${_OPSYS_INCLUDE_DIRS} 888COMPILER_INCLUDE_DIRS= ${_GCCBINDIR:H}/include ${_OPSYS_INCLUDE_DIRS}
889COMPILER_LIB_DIRS= ${_GCCBINDIR:H}/lib ${_OPSYS_LIB_DIRS} 889COMPILER_LIB_DIRS= ${_GCCBINDIR:H}/lib ${_OPSYS_LIB_DIRS}
890.endif 890.endif
891 891
892.endif # COMPILER_GCC_MK 892.endif # COMPILER_GCC_MK