Mon Apr 16 05:03:03 2012 UTC ()
Add support for gcc-4.7


(sbd)
diff -r1.117 -r1.118 pkgsrc/mk/compiler/gcc.mk

cvs diff -r1.117 -r1.118 pkgsrc/mk/compiler/gcc.mk (expand / switch to unified diff)

--- pkgsrc/mk/compiler/gcc.mk 2012/04/16 05:00:44 1.117
+++ pkgsrc/mk/compiler/gcc.mk 2012/04/16 05:03:03 1.118
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: gcc.mk,v 1.117 2012/04/16 05:00:44 sbd Exp $ 1# $NetBSD: gcc.mk,v 1.118 2012/04/16 05:03:03 sbd 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# USE_NATIVE_GCC 7# USE_NATIVE_GCC
8# When set to "yes", the native gcc is used, no matter which 8# When set to "yes", the native gcc is used, no matter which
9# compiler version a package requires. 9# compiler version a package requires.
10# 10#
11# USE_PKGSRC_GCC 11# USE_PKGSRC_GCC
12# Force using the appropriate version of GCC from pkgsrc based on 12# Force using the appropriate version of GCC from pkgsrc based on
13# GCC_REQD instead of the native compiler. 13# GCC_REQD instead of the native compiler.
14# 14#
@@ -75,47 +75,51 @@ _DEF_VARS.gcc= \ @@ -75,47 +75,51 @@ _DEF_VARS.gcc= \
75USE_NATIVE_GCC?= no 75USE_NATIVE_GCC?= no
76USE_PKGSRC_GCC?= no 76USE_PKGSRC_GCC?= no
77 77
78GCC_REQD+= 2.8.0 78GCC_REQD+= 2.8.0
79 79
80# gcc2 doesn't support c99 and amd64 80# gcc2 doesn't support c99 and amd64
81.if !empty(USE_LANGUAGES:Mc99) || ${MACHINE_ARCH} == "x86_64" 81.if !empty(USE_LANGUAGES:Mc99) || ${MACHINE_ARCH} == "x86_64"
82GCC_REQD+= 3.0 82GCC_REQD+= 3.0
83.endif 83.endif
84 84
85# _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc 85# _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc
86# without the PKGREVISIONs. 86# without the PKGREVISIONs.
87# 87#
88_GCC_DIST_VERSION= 4.6.3 88.include "../../lang/gcc47/version.mk"
 89_GCC_DIST_VERSION:= ${GCC_DIST_VERSION}
89 90
90# _GCC2_PATTERNS matches N s.t. N <= 2.95.3. 91# _GCC2_PATTERNS matches N s.t. N <= 2.95.3.
91_GCC2_PATTERNS= [0-1].* 2.[0-9] 2.[0-9].* 2.[1-8][0-9] 2.[1-8][0-9].* \ 92_GCC2_PATTERNS= [0-1].* 2.[0-9] 2.[0-9].* 2.[1-8][0-9] 2.[1-8][0-9].* \
92 2.9[0-4] 2.9[0-4].* 2.95 2.95.[0-3] 93 2.9[0-4] 2.9[0-4].* 2.95 2.95.[0-3]
93 94
94# _GCC3_PATTERNS matches N s.t. 2.95.3 < N < 3.4. 95# _GCC3_PATTERNS matches N s.t. 2.95.3 < N < 3.4.
95_GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \ 96_GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \
96 2.[1-9][0-9][0-9]* 3.[0-3] 3.[0-3].* 97 2.[1-9][0-9][0-9]* 3.[0-3] 3.[0-3].*
97 98
98# _GCC34_PATTERNS matches N s.t. 3.4 <= N < 4. 99# _GCC34_PATTERNS matches N s.t. 3.4 <= N < 4.
99_GCC34_PATTERNS= 3.[4-9] 3.[4-9].* 3.[1-9][0-9]* 100_GCC34_PATTERNS= 3.[4-9] 3.[4-9].* 3.[1-9][0-9]*
100 101
101# _GCC44_PATTERNS matches N s.t. 4.4 <= N < 4.5. 102# _GCC44_PATTERNS matches N s.t. 4.4 <= N < 4.5.
102_GCC44_PATTERNS= 4.4 4.4.* 103_GCC44_PATTERNS= 4.4 4.4.*
103 104
104# _GCC45_PATTERNS matches N s.t. 4.5 <= N < 4.6. 105# _GCC45_PATTERNS matches N s.t. 4.5 <= N < 4.6.
105_GCC45_PATTERNS= 4.5 4.5.* 106_GCC45_PATTERNS= 4.5 4.5.*
106 107
107# _GCC46_PATTERNS matches N s.t. 4.6 <= N. 108# _GCC46_PATTERNS matches N s.t. 4.6 <= N < 4.7.
108_GCC46_PATTERNS= 4.[6-9] 4.[6-9].* 4.[1-9][0-9]* [4-9]* 109_GCC46_PATTERNS= 4.6 4.6.*
 110
 111# _GCC46_PATTERNS matches N s.t. 4.7 <= N.
 112_GCC47_PATTERNS= 4.[7-9] 4.[7-9].* 4.[1-9][0-9]* [4-9]*
109 113
110# _CC is the full path to the compiler named by ${CC} if it can be found. 114# _CC is the full path to the compiler named by ${CC} if it can be found.
111.if !defined(_CC) 115.if !defined(_CC)
112_CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} 116_CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
113. for _dir_ in ${PATH:C/\:/ /g} 117. for _dir_ in ${PATH:C/\:/ /g}
114. if empty(_CC:M/*) 118. if empty(_CC:M/*)
115. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}) 119. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
116_CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} 120_CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
117. endif 121. endif
118. endif 122. endif
119. endfor 123. endfor
120MAKEFLAGS+= _CC=${_CC:Q} 124MAKEFLAGS+= _CC=${_CC:Q}
121.endif 125.endif
@@ -214,46 +218,54 @@ _NEED_GCC44= yes @@ -214,46 +218,54 @@ _NEED_GCC44= yes
214.endfor 218.endfor
215_NEED_GCC45?= no 219_NEED_GCC45?= no
216.for _pattern_ in ${_GCC45_PATTERNS} 220.for _pattern_ in ${_GCC45_PATTERNS}
217. if !empty(_GCC_REQD:M${_pattern_}) 221. if !empty(_GCC_REQD:M${_pattern_})
218_NEED_GCC45= yes 222_NEED_GCC45= yes
219. endif 223. endif
220.endfor 224.endfor
221_NEED_GCC46?= no 225_NEED_GCC46?= no
222.for _pattern_ in ${_GCC46_PATTERNS} 226.for _pattern_ in ${_GCC46_PATTERNS}
223. if !empty(_GCC_REQD:M${_pattern_}) 227. if !empty(_GCC_REQD:M${_pattern_})
224_NEED_GCC46= yes 228_NEED_GCC46= yes
225. endif 229. endif
226.endfor 230.endfor
 231.for _pattern_ in ${_GCC47_PATTERNS}
 232. if !empty(_GCC_REQD:M${_pattern_})
 233_NEED_GCC47= yes
 234. endif
 235.endfor
227.if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \ 236.if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \
228 !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \ 237 !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \
229 !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) 238 !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) && \
230_NEED_GCC46= yes 239 !empty(_NEED_GCC47:M[nN][oO])
 240_NEED_GCC47= yes
231.endif 241.endif
232 242
233# Assume by default that GCC will only provide a C compiler. 243# Assume by default that GCC will only provide a C compiler.
234LANGUAGES.gcc?= c 244LANGUAGES.gcc?= c
235.if !empty(_NEED_GCC2:M[yY][eE][sS]) 245.if !empty(_NEED_GCC2:M[yY][eE][sS])
236LANGUAGES.gcc= c c++ fortran fortran77 objc 246LANGUAGES.gcc= c c++ fortran fortran77 objc
237.elif !empty(_NEED_GCC3:M[yY][eE][sS]) 247.elif !empty(_NEED_GCC3:M[yY][eE][sS])
238LANGUAGES.gcc= c c++ fortran fortran77 java objc 248LANGUAGES.gcc= c c++ fortran fortran77 java objc
239.elif !empty(_NEED_GCC34:M[yY][eE][sS]) 249.elif !empty(_NEED_GCC34:M[yY][eE][sS])
240LANGUAGES.gcc= c c++ fortran fortran77 objc 250LANGUAGES.gcc= c c++ fortran fortran77 objc
241.elif !empty(_NEED_GCC44:M[yY][eE][sS]) 251.elif !empty(_NEED_GCC44:M[yY][eE][sS])
242LANGUAGES.gcc= c c++ fortran fortran77 java objc 252LANGUAGES.gcc= c c++ fortran fortran77 java objc
243.elif !empty(_NEED_GCC45:M[yY][eE][sS]) 253.elif !empty(_NEED_GCC45:M[yY][eE][sS])
244LANGUAGES.gcc= c c++ fortran fortran77 java objc 254LANGUAGES.gcc= c c++ fortran fortran77 java objc
245.elif !empty(_NEED_GCC46:M[yY][eE][sS]) 255.elif !empty(_NEED_GCC46:M[yY][eE][sS])
246LANGUAGES.gcc= c c++ fortran fortran77 java objc 256LANGUAGES.gcc= c c++ fortran fortran77 java objc
 257.elif !empty(_NEED_GCC47:M[yY][eE][sS])
 258LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++
247.endif 259.endif
248_LANGUAGES.gcc= # empty 260_LANGUAGES.gcc= # empty
249.for _lang_ in ${USE_LANGUAGES} 261.for _lang_ in ${USE_LANGUAGES}
250_LANGUAGES.gcc+= ${LANGUAGES.gcc:M${_lang_}} 262_LANGUAGES.gcc+= ${LANGUAGES.gcc:M${_lang_}}
251.endfor 263.endfor
252 264
253.if !empty(USE_LANGUAGES:Mc99) 265.if !empty(USE_LANGUAGES:Mc99)
254_WRAP_EXTRA_ARGS.CC+= -std=gnu99 266_WRAP_EXTRA_ARGS.CC+= -std=gnu99
255.endif 267.endif
256 268
257# GCC has this annoying behaviour where it advocates in a multi-line 269# GCC has this annoying behaviour where it advocates in a multi-line
258# banner the use of "#include" over "#import" when including headers. 270# banner the use of "#include" over "#import" when including headers.
259# This generates a huge number of warnings when building practically all 271# This generates a huge number of warnings when building practically all
@@ -362,26 +374,47 @@ _GCC_PKGBASE= gcc46 @@ -362,26 +374,47 @@ _GCC_PKGBASE= gcc46
362_IGNORE_GCC= yes 374_IGNORE_GCC= yes
363MAKEFLAGS+= _IGNORE_GCC=yes 375MAKEFLAGS+= _IGNORE_GCC=yes
364. endif 376. endif
365. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) 377. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
366_GCC_PKGSRCDIR= ../../lang/gcc46 378_GCC_PKGSRCDIR= ../../lang/gcc46
367_GCC_DEPENDENCY= gcc46>=${_GCC_REQD}:../../lang/gcc46 379_GCC_DEPENDENCY= gcc46>=${_GCC_REQD}:../../lang/gcc46
368. if !empty(_LANGUAGES.gcc:Mc++) || \ 380. if !empty(_LANGUAGES.gcc:Mc++) || \
369 !empty(_LANGUAGES.gcc:Mfortran) || \ 381 !empty(_LANGUAGES.gcc:Mfortran) || \
370 !empty(_LANGUAGES.gcc:Mfortran77) || \ 382 !empty(_LANGUAGES.gcc:Mfortran77) || \
371 !empty(_LANGUAGES.gcc:Mobjc) 383 !empty(_LANGUAGES.gcc:Mobjc)
372_USE_GCC_SHLIB?= yes 384_USE_GCC_SHLIB?= yes
373. endif 385. endif
374. endif 386. endif
 387.elif !empty(_NEED_GCC47:M[yY][eE][sS])
 388#
 389# We require gcc-4.7.x in the lang/gcc47 directory.
 390#
 391_GCC_PKGBASE= gcc47
 392. if !empty(PKGPATH:Mlang/gcc47)
 393_IGNORE_GCC= yes
 394MAKEFLAGS+= _IGNORE_GCC=yes
 395. endif
 396. if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc)
 397_GCC_PKGSRCDIR= ../../lang/gcc47
 398_GCC_DEPENDENCY= gcc47>=${_GCC_REQD}:../../lang/gcc47
 399. if !empty(_LANGUAGES.gcc:Mc++) || \
 400 !empty(_LANGUAGES.gcc:Mfortran) || \
 401 !empty(_LANGUAGES.gcc:Mfortran77) || \
 402 !empty(_LANGUAGES.gcc:Mgo) || \
 403 !empty(_LANGUAGES.gcc:Mobjc) || \
 404 !empty(_LANGUAGES.gcc:Mobj-c++)
 405_USE_GCC_SHLIB?= yes
 406. endif
 407. endif
375.endif 408.endif
376_GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD} 409_GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD}
377 410
378.if !empty(_NEED_GCC3:M[yY][eE][sS]) 411.if !empty(_NEED_GCC3:M[yY][eE][sS])
379. if !empty(PKGPATH:Mlang/gcc3-c++) 412. if !empty(PKGPATH:Mlang/gcc3-c++)
380_IGNORE_GCC3CXX= yes 413_IGNORE_GCC3CXX= yes
381MAKEFLAGS+= _IGNORE_GCC3CXX=yes 414MAKEFLAGS+= _IGNORE_GCC3CXX=yes
382. endif 415. endif
383. if !defined(_IGNORE_GCC3CXX) && !empty(_LANGUAGES.gcc:Mc++) 416. if !defined(_IGNORE_GCC3CXX) && !empty(_LANGUAGES.gcc:Mc++)
384_GCC_PKGSRCDIR+= ../../lang/gcc3-c++ 417_GCC_PKGSRCDIR+= ../../lang/gcc3-c++
385_GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++ 418_GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++
386_USE_GCC_SHLIB?= yes 419_USE_GCC_SHLIB?= yes
387. endif 420. endif