summaryrefslogtreecommitdiff
path: root/lang/gcc34-ada/Makefile
blob: d2d211183dce6d46e309ced250c7bc238b96cd29 (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# $NetBSD: Makefile,v 1.8 2004/08/11 22:45:00 shannonjr Exp $
#

DISTNAME=	gcc-${GCC_VERSION}
PKGNAME=	gcc34-ada-${GCC_VERSION}
PKGREVISION=	4
CATEGORIES=	lang
MASTER_SITES=	${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
EXTRACT_SUFX=	.tar.bz2

MAINTAINER=	shannonjr@NetBSD.org
HOMEPAGE=	http://www.gnu.org/software/gcc/gcc.html
COMMENT=	This is the gcc 3.4 Ada compiler

BUILD_USES_MSGFMT=	YES

GCC_VERSION=		3.4.1

USE_BUILDLINK3=		YES
USE_PKGINSTALL=		YES
USE_GNU_TOOLS+=		make
HAS_CONFIGURE=		YES
CONFIGURE_ARGS+=	--enable-languages="c,ada"
PLIST_SRC=	${WRKDIR}/PLIST_DYNAMIC

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

# Determine whether to use binutils
.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} --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.14:../../devel/binutils
CONFIGURE_ARGS+=	--with-as=${LOCALBASE}/bin/as
CONFIGURE_ARGS+=	--with-ld=${LOCALBASE}/bin/ld
CONFIGURE_ARGS+=	--with-gnu-as
CONFIGURE_ARGS+=	--with-gnu-ld
.endif

# Ada bootstrap compiler section
# An Ada compiler is required to build the Ada compiler. You
# may specify:
#USE_GCC34	=# Define to use gcc34
# You may also specify the path of a gcc/gnat Ada compiler
# outside of the pkgsrc system by specifying the full path
# of the compiler (example) below:
#ALT_GCC=	prefix/bin/gcc
.if defined(ALT_GCC)
.	if exists(${ALT_GCC})
ALT_GCC_RTS!=	${ALT_GCC} --print-file-name=adalib
.        if !empty(ALT_GCC_RTS)
RALT_GCC_RTS=	${ALT_GCC_RTS:S%${LOCALBASE}%%:S%/%%}
.        else
PKG_SKIP_REASON=	"${ALT_GCC} does not appear to be an Ada compiler"
.        endif
.	else
PKG_SKIP_REASON=	"Missing bootstrap Ada compiler"
.	endif
.endif
.if !defined(USE_GCC34) && !defined(ALT_GCC)
PKG_SKIP_REASON=	"An Ada bootstrap compiler must be specified"
.endif

# Make location overridable, to allow ping-pong bootstraps.
GCC34_DEFAULT_SUBPREFIX=	gcc34-ada
GCC34_INSTALLTO_SUBPREFIX?=	${GCC34_DEFAULT_SUBPREFIX}
.if ${GCC34_INSTALLTO_SUBPREFIX} != ${GCC34_DEFAULT_SUBPREFIX}
GCC34_PKGMODIF=		${GCC34_INSTALLTO_SUBPREFIX}
.endif

GCC_SUBPREFIX=		${GCC34_INSTALLTO_SUBPREFIX}
GCC_PREFIX=		${PREFIX}/${GCC_SUBPREFIX}
GCC_PLATFORM=		${LOWER_ARCH}--${LOWER_OPSYS}${APPEND_ELF}${LOWER_OS_VERSION:C/[_a-z].*//}
CONFIGURE_ARGS+=	--host=${GCC_PLATFORM}
GCC_ARCHSUBDIR=		${GCC_SUBPREFIX}/lib/gcc/${GCC_PLATFORM}/${GCC_VERSION}
GCC_ARCHDIR=		${PREFIX}/${GCC_ARCHSUBDIR}
PLIST_SUBST+=		GCC_SUBPREFIX=${GCC_SUBPREFIX}
FILES_SUBST+=		GCC_PREFIX=${GCC_PREFIX}
FILES_SUBST+=		PKGNAME=${PKGNAME}
MESSAGE_SUBST+=		GCC_PREFIX=${GCC_PREFIX}
CONFIGURE_ARGS+=	--prefix=${GCC_PREFIX}
PTHREAD_OPTS+=		require native
CPPFLAGS+=	-I${BUILDLINK_DIR}/include
CFLAGS+=	-I${BUILDLINK_DIR}/include
CONFIGURE_ARGS+=	--with-system-zlib
CONFIGURE_ARGS+=	--enable-long-long
CONFIGURE_ARGS+=	--enable-threads=gnat
GCC_DIR=	${WRKDIR}/.gcc

post-patch:
	(cd files; \
	${CP} adasignal.c ${WRKSRC}/gcc/ada; \
	${CP} ada_lwp_self.c ${WRKSRC}/gcc/ada; \
	${CP} dummy_pthreads.c ${WRKSRC}/gcc/ada; \
	for i in *.adb *.ads ; do \
		${CP} $$i ${WRKSRC}/gcc/ada; \
	done )

.if defined(USE_GCC34)
pre-configure:
.include "../../lang/gcc34/preconfigure.mk"
.elif defined(ALT_GCC)
pre-configure:
	(${TEST} -d ${WRKDIR}/.gcc/bin/ || ${MKDIR} ${WRKDIR}/.gcc/bin/)
	(cd ${WRKDIR}/.buildlink && ${MKDIR} ${RALT_GCC_RTS} && \
	cd ${RALT_GCC_RTS} && ${LN} -sf ${ALT_GCC_RTS}/libgnat.a .)
	(cd ${ALT_GCC:H} && \
	files=`${FIND} . -type f \( -perm -0100 \)` && \
	cd ${GCC_DIR}/bin/ && \
	for file in ${ALT_GCC:T} $${files} ; do \
		${ECHO} '#!${TOOLS_SHELL}' > $${file}; \
		${ECHO} -n "exec ${ALT_GCC:H}/$${file} " >>$${file}; \
		${ECHO} '"$$@"' >>$${file}; \
		${CHMOD} +x $${file}; \
	done )
.endif

do-configure:
	((${TEST} -d ${WRKDIR}/obj || ${MKDIR} ${WRKDIR}/obj) && \
	 (cd ${WRKDIR}/obj && ${SETENV} ${CONFIGURE_ENV} ${WRKSRC}/configure ${CONFIGURE_ARGS}))

do-build:
	(cd ${WRKDIR}/obj && ${SETENV} ${MAKE_ENV} ${GMAKE} bootstrap)
	(cd ${WRKDIR}/obj/gcc && ${SETENV} ${MAKE_ENV} ${GMAKE} gnatlib_and_tools)

do-test:
.if (${MACHINE_GNU_ARCH} == "x86_64")
	(cd files && ${CP} netbsd64macro.dfs ${WRKSRC}/gcc/testsuite/ada/acats/support/macro.dfs)
.endif
	(cd ${WRKDIR}/obj/gcc && ${GMAKE} check-ada)

do-install:
	(cd ${WRKDIR}/obj && ${SETENV} ${MAKE_ENV} ${GMAKE} install \
	 && ${TEST} -f ${GCC_PREFIX}/bin/cc || ${LN} -f ${GCC_PREFIX}/bin/gcc ${GCC_PREFIX}/bin/cc)
	(SPECPATH=`${GCC_PREFIX}/bin/gcc -print-file-name=specs` && \
	for EXPANDEDSPECPATH in $${SPECPATH} ; do \
		SPECDIR=`${DIRNAME} $${EXPANDEDSPECPATH}`; \
		${ECHO} $${SPECDIR}/adainclude > $${SPECDIR}/ada_source_path;	\
		${ECHO} $${SPECDIR}/adalib > $${SPECDIR}/ada_object_path;	\
	done )

post-install:
	@${SED} ${FILES_SUBST_SED} ${FILESDIR}/ada > ${WRKDIR}/ada
	${ECHO} '"$$@"' >> ${WRKDIR}/ada
	${INSTALL_DATA} ${WRKDIR}/ada ${LOCALBASE}/bin/ada
	${CHMOD} +x ${WRKDIR}/ada ${LOCALBASE}/bin/ada
	${CP} -f ${PKGDIR}/PLIST ${PLIST_SRC}
	${FIND} ${GCC_PREFIX} \( -type f -o -type l \) -print	\
		| ${SORT} | ${SED} -e "s,${PREFIX}/,,g"	\
		>> ${PLIST_SRC}
	${FIND} ${GCC_PREFIX} -type d -print	\
		| ${SORT} -r | ${SED} -e "s,${PREFIX}/,@dirrm ,g"	\
		>> ${PLIST_SRC}

.if defined(USE_GCC34)
BUILDLINK_DEPMETHOD.gcc34=	build
.include "../../lang/gcc34/buildlink3.mk"
.endif
.include "../../converters/libiconv/buildlink3.mk"
.include "../../devel/gettext-lib/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"