summaryrefslogtreecommitdiff
path: root/lang/gcc3/Makefile.common
blob: 518dd9a980a41ede0b2a2a1dbd3e4343df861561 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# $NetBSD: Makefile.common,v 1.17 2005/05/22 20:08:09 jlam Exp $

GCC_VERSION=	3.3.5
DISTNAME=	gcc-${GCC_VERSION}
CATEGORIES=	lang
MASTER_SITES=	${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
EXTRACT_SUFX=	.tar.bz2

MAINTAINER=	tech-pkg@NetBSD.org
HOMEPAGE=	http://www.gnu.org/software/gcc/gcc.html

NOT_FOR_PLATFORM=	Darwin-*-* Interix-*-*

USE_PKGINSTALL=		yes
USE_TOOLS+=		gmake
MAKEFLAGS+=		GMAKE_LOCALE=no
HAS_CONFIGURE=		yes

PATCHDIR=		${.CURDIR}/../../lang/gcc3/patches
DISTINFO_FILE=		${.CURDIR}/../../lang/gcc3/distinfo

.include "../../mk/bsd.prefs.mk"

# Make location overridable, to allow ping-pong bootstraps.
GCC3_DEFAULT_SUBPREFIX=		gcc3
GCC3_INSTALLTO_SUBPREFIX?=	${GCC3_DEFAULT_SUBPREFIX}
.if ${GCC3_INSTALLTO_SUBPREFIX} != ${GCC3_DEFAULT_SUBPREFIX}
GCC3_PKGMODIF=		_${GCC3_INSTALLTO_SUBPREFIX}
.endif

GCC_SUBPREFIX=		${GCC3_INSTALLTO_SUBPREFIX}
GCC_PREFIX=		${PREFIX}/${GCC_SUBPREFIX}
CONFIGURE_ARGS+=	--prefix=${GCC_PREFIX}
PLIST_SUBST+=		GCC_SUBPREFIX=${GCC_SUBPREFIX}
FILES_SUBST+=		GCC_PREFIX=${GCC_PREFIX}
FILES_SUBST+=		PKGNAME=${PKGNAME}
MESSAGE_SUBST+=		GCC_PREFIX=${GCC_PREFIX}

BUILDLINK_PASSTHRU_RPATHDIRS+=	${GCC_PREFIX}

.if defined(INFO_FILES)
INFO_DIR=	${GCC_SUBPREFIX}/info
.endif

# These come from $WRKSRC/Makefile.in
ALL_GCC=	all-gcc
ALL_GCC_C=	$$(ALL_GCC) all-target-newlib all-target-libgloss
ALL_GCC_CXX=	$$(ALL_GCC_C) all-target-libstdc++-v3

# Support threads and building of crt*.o on post-1.6 -current.
# Use buildlink to avoid a GNU pth package.
.if ${OPSYS} == "NetBSD" && exists(/usr/include/pthread.h)
GCC_PLATFORM=		${MACHINE_GNU_ARCH}--netbsdelf2.0
PTHREAD_OPTS+=		require native
.  include "../../mk/pthread.buildlink3.mk"
.else
GCC_PLATFORM=		${MACHINE_GNU_PLATFORM}
.endif
CONFIGURE_ARGS+=	--host=${GCC_PLATFORM}
PLIST_SUBST+=		GCC_PLATFORM=${GCC_PLATFORM}

.if ${OPSYS} == "AIX"
CONFIGURE_ARGS+=    --disable-aix64
.endif

.if ${OPSYS} == "NetBSD"
.  if !defined(USE_BINUTILS)
AS_PATH:=   ${AS}
.    for _dir_ in ${PATH:C/\:/ /g}
.      if empty(AS_PATH:M/*)
.        if exists(${_dir_}/${AS})
AS_PATH:=   ${_dir_}/${AS}
.        endif
.      endif
.    endfor
.    if !empty(AS_PATH:M${LOCALBASE}/*)
USE_BINUTILS=	YES
.    else
AS_VERSION!=	${AS_PATH} --version | ${AWK} '{			\
		    split($$3, v, /[.]/);				\
		    printf "%02d%02d%02d%02d\n",v[1],v[2],v[3],v[4];	\
		    exit;						\
		}'
USE_BINUTILS!=	${TEST} ${AS_VERSION} -lt 02130201 && ${ECHO} YES || ${ECHO} NO
.    endif
MAKEFLAGS+=	USE_BINUTILS=${USE_BINUTILS}
.  endif
.endif

.if defined(USE_BINUTILS) && !empty(USE_BINUTILS:M[yY][eE][sS])
DEPENDS+=		binutils>=2.13.2.1:../../devel/binutils
EVAL_PREFIX+=		BINUTILS_PREFIX=binutils
BINUTILS_PREFIX_DEFAULT= ${LOCALBASE}
CONFIGURE_ARGS+=	--with-as=${BINUTILS_PREFIX}/${MACHINE_GNU_PLATFORM}/bin/as
.endif

OPSYSVARS+=			GCC_SHARED_ARG
GCC_SHARED_ARG.${OPSYS}?=	--disable-shared
GCC_SHARED_ARG.FreeBSD=		--enable-shared
GCC_SHARED_ARG.IRIX=		--enable-shared
GCC_SHARED_ARG.Linux=		--enable-shared
GCC_SHARED_ARG.NetBSD=		--enable-shared
GCC_SHARED_ARG.SunOS=		--enable-shared
CONFIGURE_ARGS+=		${GCC_SHARED_ARG}

# gcc3 sub-packages must be built with gcc3.
.if defined(PKGNAME) && empty(PKGNAME:Mgcc3-c-[0-9]*)
ONLY_FOR_COMPILER+=	gcc
PKGSRC_COMPILER:=	gcc ${PKGSRC_COMPILER}
GCC_REQD+=		${GCC_VERSION}
.endif

.include "../../mk/compiler.mk"

.if ${OPSYS} == "IRIX"
.  if !empty(PKGSRC_COMPILER:Mmipspro*)
CONFIGURE_ENV+= SGI_ABI="n32"
MAKE_ENV+=	SGI_ABI="n32"
.  endif
.endif

GCC_ARCHSUBDIR=	${GCC_SUBPREFIX}/lib/gcc-lib/${GCC_PLATFORM}/${GCC_VERSION}
GCC_ARCHDIR=	${PREFIX}/${GCC_ARCHSUBDIR}

.if defined(INSTLIBS)
WRAPPEES+=		LIBTOOL

.PHONY: scrub-libtool-archives
post-build: scrub-libtool-archives
scrub-libtool-archives:
.  for lafile in ${INSTLIBS}
	${LIBTOOL} --mode=unwrap -o ${WRKSRC}/${GCC_PLATFORM}/${lafile}
.  endfor
.endif

# Create the directories for the build, patch the ltconfig script to
# always use "sunos" shared library numbering (for consistent PLISTs
# across platforms), and touch all the necessary files so that they're
# not regenerated after the configure script is run.
#
pre-configure:
	${MKDIR} ${BUILD_DIRS}
	cd ${WRKSRC}; for file in ltconfig boehm-gc/ltconfig; do	\
		${MV} -f $$file $$file.bak;				\
		${SED} -e "s|\(version_type\)=linux|\1=sunos|g"		\
			$$file.bak > $$file;				\
		${CHMOD} +x $$file;					\
	done
	cd ${WRKSRC} && contrib/gcc_update --touch