blob: a37d99a9bb8564f11a48d8080f8c4001346b1f9a (
plain) (
blame)
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
|
# Created by: John Marino <marino@FreeBSD.org>
# $FreeBSD$
PORTNAME?= armv7
PORTVERSION= ${SNAPSHOT}
PORTREVISION?= ${ARMV7_PR}
CATEGORIES= lang
MASTER_SITES= GCC/releases/gcc-${GCC_VERSION}
PKGNAMEPREFIX?= gnatdroid-
DISTFILES= ${IDENTIFICATION}.tar.xz
MAINTAINER?= jamie@catflap.org
COMMENT?= C/Ada cross-compiler, target: Android ARMv7
BROKEN= unfetchable
LICENSE= GPLv3 GPLv3RLE
LICENSE_COMB= multi
BUILD_DEPENDS= ${SYSROOT}>=0:lang/${SYSROOT} \
${GDBINUTILS}>=2.21:lang/${GDBINUTILS}
RUN_DEPENDS:= ${BUILD_DEPENDS}
NO_LICENSES_INSTALL= yes
AUXPORT= gcc6-aux
.include "${.CURDIR}/../${AUXPORT}/Makefile.common"
USES+= ada:6 gmake
LANGS= c c++ ada
APPLY_DIFFS= core ada cxx ada-testsuite
NO_MTREE= YES
DISTINFO_FILE= ${.CURDIR}/../${AUXPORT}/distinfo
OPTIONS_DEFINE= FORT OBJC
OPTIONS_SUB= yes
FORT_DESC= Also build Fortran language
OBJC_DESC= Also build Objective-C language
DROID_TARGET?= arm-aux-linux-androideabi
CPUVERSION?= ARMv7
ARG_ARCH?= --with-arch=armv7-a
ARG_FPU?= --with-fpu=neon
ARG_FLOATSOFT?= --with-float=soft
ARG_TARGET_SPECIFIC?= --enable-target-optspace \
--enable-cxx-flags=-frtti \
--disable-sjlj-exceptions \
--disable-tls
ALL_TARGET= all
GARCH= ${ARCH:S/amd64/x86_64/}
BITS= ${GARCH:S/x86_64/64/:S/i386/32/}
LABEL_TARGET?= Android ${CPUVERSION}
OS_LABEL4VERS= [${OPSYS}${BITS} x ${LABEL_TARGET}]
WRKSRC= ${WRKDIR}/${IDENTIFICATION}
BUILD_WRKSRC= ${WRKDIR}/build
DIFFDIR= ${.CURDIR}/../${AUXPORT}/files
CFG_SCRIPT= ${WRKSRC}/configure
REVFILE= ${WRKSRC}/gcc/REVISION
SRPREFIX?= ${LOCALBASE}/android
GNATPREFIX?= ${SRPREFIX}/${CPUVERSION}
PREFIX= ${GNATPREFIX}
SYSROOT?= gnatdroid-sysroot
GDBINUTILS?= gnatdroid-binutils
PLIST_SUB+= TARGET="${DROID_TARGET}"
PLIST_SUB+= GCCVERS="${GCC_VERSION}"
SUB_FILES= pkg-message
SUB_LIST= TARGET="${DROID_TARGET}"
EXTRA_PATCHES= ${FILESDIR}/acats.diff
CROSS= gnat gnatbind gnatchop gnatclean gnatfind gnatkr \
gnatlink gnatls gnatmake gnatprep gnatxref
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MFORT}
LANGS+= fortran
.endif
.if ${PORT_OPTIONS:MOBJC}
LANGS+= objc
.endif
INSTALL_ENV= ${MAKE_ENV:C/^PATH=/&${PREFIX}\/bin:/}
ADA_CONFIG_ARGS= --enable-languages=${LANGS:Q}
ADA_CONFIG_ARGS+= --target=${DROID_TARGET}
ADA_CONFIG_ARGS+= --program-prefix=${DROID_TARGET}-
ADA_CONFIG_ARGS+= --prefix=${PREFIX}
ADA_CONFIG_ARGS+= ${ARG_ARCH}
ADA_CONFIG_ARGS+= --with-system-zlib
ADA_CONFIG_ARGS+= --with-gmp=${LOCALBASE}
ADA_CONFIG_ARGS+= --with-mpfr=${LOCALBASE}
ADA_CONFIG_ARGS+= --with-mpc=${LOCALBASE}
ADA_CONFIG_ARGS+= ${ICONV_CONFIGURE_ARG}
ADA_CONFIG_ARGS+= --with-sysroot=${SRPREFIX}
ADA_CONFIG_ARGS+= ${ARG_FLOATSOFT}
ADA_CONFIG_ARGS+= ${ARG_FPU}
ADA_CONFIG_ARGS+= ${ARG_TARGET_SPECIFIC}
ADA_CONFIG_ARGS+= --enable-threads=posix
ADA_CONFIG_ARGS+= --enable-checking=release
ADA_CONFIG_ARGS+= --disable-bootstrap
ADA_CONFIG_ARGS+= --disable-shared
ADA_CONFIG_ARGS+= --disable-libssp
ADA_CONFIG_ARGS+= --disable-libgomp
ADA_CONFIG_ARGS+= --disable-libmudflap
ADA_CONFIG_ARGS+= --disable-libquadmath
ADA_CONFIG_ARGS+= --disable-libsanitizer
ADA_CONFIG_ARGS+= --disable-libitm
ADA_CONFIG_ARGS+= --disable-libcc1
ADA_CONFIG_ARGS+= --disable-nls
post-extract:
# Personalize GNAT for each different machine
@${ECHO} "-=> GNAT AUX ${OS_LABEL4VERS}" > ${REVFILE}
# Apply required composite diff files
.for suffix in ${APPLY_DIFFS}
@${ECHO} "Applying composite patch diff-${suffix}"
@${PATCH} -d ${WRKSRC} -s -E < ${DIFFDIR}/diff-${suffix}
.endfor
@(cd ${WRKSRC}/gcc/testsuite/ada/acats && \
${CP} run_remote.sh run_all.sh)
@${CHMOD} 755 ${WRKSRC}/gcc/testsuite/ada/acats/run_all.sh
${REINPLACE_CMD} -e 's|@REMOTE_TARGET@|${DROID_TARGET}|' \
${WRKSRC}/gcc/testsuite/ada/acats/run_all.sh
${REINPLACE_CMD} -e 's|<syscall.h>|<sys/syscall.h>|' \
${WRKSRC}/libstdc++-v3/libsupc++/guard.cc
post-patch:
# Update LINK_SPEC to add gcc-aux lib runpath in every binary
@${ECHO} "Configuring LINK_SPEC runpath"
@${REINPLACE_CMD} -e 's;\@PREFIX\@;${LOCALBASE};' \
-e 's;\@GCCAUX\@;${AUXPORT};' \
${WRKSRC}/gcc/config/dragonfly.h \
${WRKSRC}/gcc/config/i386/freebsd64.h \
${WRKSRC}/gcc/config/i386/freebsd.h \
${WRKSRC}/gcc/config/aarch64/aarch64-freebsd.h
do-configure:
${MKDIR} ${BUILD_WRKSRC}
(cd ${BUILD_WRKSRC} && ${SETENV} ${CONFIGURE_ENV} \
${CFG_SCRIPT} ${ADA_CONFIG_ARGS})
do-install:
# Buggy makefile; seems to have forgotten this is a cross compiler
# Manually rename products so it doesn't rebuild them with new name
.for X in ${CROSS}
. if !exists(${BUILD_WRKSRC}/gcc/${X})
${CP} -a ${BUILD_WRKSRC}/gcc/${X}-cross ${BUILD_WRKSRC}/gcc/${X}
. endif
.endfor
(cd ${BUILD_WRKSRC} && ${SETENV} ${INSTALL_ENV} \
${MAKE_CMD} install-strip DESTDIR=${STAGEDIR})
${MV} ${STAGEDIR}${PREFIX}/bin/ada \
${STAGEDIR}${PREFIX}/bin/${DROID_TARGET}-ada
post-stage:
.for loop in A B
(cd ${STAGEDIR}${PREFIX}; ${FIND} * -type d -empty | \
${SORT} -dr | ${XARGS} ${RMDIR})
.endfor
(cd ${STAGEDIR}${PREFIX}; \
${FIND} * \( -type f -or -type l \) | ${SORT} | \
${SED} -e '/^bin\//d' -e '/^${DROID_TARGET}\/bin\//d' \
>> ${TMPPLIST})
acats: build
(cd ${BUILD_WRKSRC}/gcc && ${SETENV} \
PATH=${LOCALBASE}/${AUXPORT}/bin:${PATH}:${PREFIX}/bin \
${GMAKE} -sk check-acats)
gnatdg: build
(cd ${BUILD_WRKSRC}/gcc && ${SETENV} \
PATH=${LOCALBASE}/${AUXPORT}/bin:${PATH}:${PREFIX}/bin \
${GMAKE} -sk check-gnat RUNTESTFLAGS=--target_board=gnatdroid6)
.include <bsd.port.mk>
|