aboutsummaryrefslogtreecommitdiffstats
path: root/lang/gnatdroid-armv5/Makefile
blob: 4c591862700d75b76efe79703110e92a9dcbaf7c (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
176
177
178
179
180
181
182
183
184
# New ports collection makefile for:    gnatdroid-armv5
# Date created:             2011-07-20
# Whom:                 John Marino <draco@marino>
#
# $FreeBSD$
#

PORTNAME=   armv5
PORTVERSION=    ${SNAPSHOT}
CATEGORIES= lang
MASTER_SITES=   ${MASTER_SITE_GCC}
MASTER_SITE_SUBDIR= releases/gcc-${GCC_VERSION}
PKGNAMEPREFIX=  gnatdroid-
DISTNAME=   arm-gnat-${PORTVERSION}
DISTFILES=  gcc-core-${GCC_VERSION}.tar.bz2 \
        gcc-ada-${GCC_VERSION}.tar.bz2 \
        gcc-testsuite-${GCC_VERSION}.tar.bz2

MAINTAINER= draco@marino.st
COMMENT=    C/Ada cross-compiler, target: Android ARMv5

BUILD_DEPENDS=  gnatdroid-sysroot>=9:${PORTSDIR}/lang/gnatdroid-sysroot \
        gnatdroid-binutils>=2.21:${PORTSDIR}/lang/gnatdroid-binutils \
        gnat-aux>=20110325:${PORTSDIR}/lang/gnat-aux
RUN_DEPENDS:=   gnatdroid-sysroot>=9:${PORTSDIR}/lang/gnatdroid-sysroot \
        gnatdroid-binutils>=2.21:${PORTSDIR}/lang/gnatdroid-binutils

.include "${.CURDIR}/../gnat-aux/Makefile.common"

LANGS=      c ada
APPLY_DIFFS=    core ada ada-testsuite gcc-testsuite
NO_MTREE=   YES

# Disable C++ until arm.cc/no-rtti issue resolved for libsupc++
#OPTIONS+=  CXX    "Also build C++ language" off

OPTIONS+=   FORT   "Also build Fortran language" off
OPTIONS+=   OBJC   "Also build Objective-C language" off

DROID_TARGET=       arm-android-eabi
DROID_ARCH=     armv5te
ARMVERSION=     ARMv5
FPU=            vfp
WRKSRC=         ${WRKDIR}/gcc-${GCC_VERSION}
BUILDDIR=       ${WRKDIR}/build
FILESDIR=       ${.CURDIR}/../gnat-aux/files
CFG_SCRIPT=     ${WRKSRC}/configure
REVFILE=        ${WRKSRC}/gcc/REVISION
SRPREFIX=       ${LOCALBASE}/android9
PREFIX=         ${SRPREFIX}/${ARMVERSION}
FULL_GNATGCC=       ${LOCALBASE}/bin/gnatgcc
INSTALLDIRS=        lib/gcc libexec/gcc share
INSTALLDIRS+=       ${DROID_TARGET}/lib/armv7-a
INSTALLDIRS+=       ${DROID_TARGET}/lib/thumb
PLIST_SUB+=     TARGET="${DROID_TARGET}"
PLIST_SUB+=     GCCVERS="${GCC_VERSION}"

ADA_CONFIGURE_ENV=  CC=${FULL_GNATGCC}

.include <bsd.port.pre.mk>
.include <bsd.port.options.mk>

.if ${ARCH} == "amd64"
OS_LABEL4VERS=  "[FreeBSD64 x Android ${ARMVERSION}]"
.else
OS_LABEL4VERS=  "[FreeBSD32 x Android ${ARMVERSION}]"
.endif

###########
##  C++  ##
###########

.if defined(WITH_CXX)
LANGS+=     c++
APPLY_DIFFS+=   cxx cxx-testsuite
DISTFILES+= gcc-g++-${GCC_VERSION}.tar.bz2
INSTALLDIRS+=   include/c++/${GCC_VERSION}
PLIST_SUB+= CXX=""
.else
PLIST_SUB+= CXX="@comment "
.endif

###############
##  Fortran  ##
###############

.if defined(WITH_FORT)
LANGS+=     fortran
APPLY_DIFFS+=   fortran
DISTFILES+= gcc-fortran-${GCC_VERSION}.tar.bz2
PLIST_SUB+= FRT=""
.else
PLIST_SUB+= FRT="@comment "
.endif

###################
##  Objective-C  ##
###################

.if defined(WITH_OBJC)
LANGS+=     objc
DISTFILES+= gcc-objc-${GCC_VERSION}.tar.bz2
.endif

CONFIGURE_ARGS=     --enable-languages=${LANGS:Q}
CONFIGURE_ARGS+=    --target=${DROID_TARGET}
CONFIGURE_ARGS+=    --program-prefix=${DROID_TARGET}-
CONFIGURE_ARGS+=    --prefix=${PREFIX}
CONFIGURE_ARGS+=    --with-arch=${DROID_ARCH}
CONFIGURE_ARGS+=    --with-system-zlib
CONFIGURE_ARGS+=    --with-gmp=${LOCALBASE}
CONFIGURE_ARGS+=    --with-mpfr=${LOCALBASE}
CONFIGURE_ARGS+=    --with-mpc=${LOCALBASE}
CONFIGURE_ARGS+=    --with-libiconv-prefix=${LOCALBASE}
CONFIGURE_ARGS+=    --with-sysroot=${SRPREFIX}
CONFIGURE_ARGS+=    --with-float=soft
CONFIGURE_ARGS+=    --with-fpu=${FPU}
CONFIGURE_ARGS+=    --enable-target-optspace
CONFIGURE_ARGS+=    --enable-threads=posix
CONFIGURE_ARGS+=    --disable-bootstrap
CONFIGURE_ARGS+=    --disable-shared
CONFIGURE_ARGS+=    --disable-libssp
CONFIGURE_ARGS+=    --disable-libgomp
CONFIGURE_ARGS+=    --disable-libmudflap
CONFIGURE_ARGS+=    --disable-libquadmath
CONFIGURE_ARGS+=    --disable-sjlj-exceptions
CONFIGURE_ARGS+=    --disable-tls
CONFIGURE_ARGS+=    --disable-nls

post-extract:
    # Personalize GNAT for each different machine
    @${ECHO} "-=> GNAT AUX ${OS_LABEL4VERS}" > ${REVFILE}

    # Create new directories in preparation of applying diff files
.if defined(WITH_CXX)
    ${MKDIR} ${WRKSRC}/libstdc++-v3/config/locale/dragonfly
    ${MKDIR} ${WRKSRC}/libstdc++-v3/config/os/bsd/dragonfly
.endif

    # Apply required composite diff files
.for suffix in ${APPLY_DIFFS}
    @${ECHO} "Applying composite patch diff-${suffix}"
    @${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-${suffix}
.endfor

do-configure:
    ${MKDIR} ${BUILDDIR}
    cd ${BUILDDIR} && ${SETENV} ${ADA_CONFIGURE_ENV} \
    ${CFG_SCRIPT} ${CONFIGURE_ARGS}

do-build:
    cd ${BUILDDIR} && ${GMAKE} ${_MAKE_JOBS} all

do-install:
    cd ${BUILDDIR} && ${GMAKE} install-strip DESTDIR=${DESTDIR}
    ${MV} ${PREFIX}/bin/${DROID_TARGET}-gcc \
       ${PREFIX}/bin/${DROID_TARGET}-gnatgcc
    ${MV} ${PREFIX}/${DROID_TARGET}/bin/gcc \
       ${PREFIX}/${DROID_TARGET}/bin/gnatgcc
.if defined(WITH_FORT)
    ${MV} ${PREFIX}/bin/${DROID_TARGET}-gfortran \
       ${PREFIX}/bin/${DROID_TARGET}-gnatgfortran
    ${MV} ${PREFIX}/${DROID_TARGET}/bin/gfortran \
       ${PREFIX}/${DROID_TARGET}/bin/gnatgfortran
.endif

post-install:
.for d in ${INSTALLDIRS}
    cd ${PREFIX}; ${FIND} $d \( -type f -or -type l \) | ${SORT} >> ${TMPPLIST}
    cd ${PREFIX}; ${FIND} $d -type d | ${SORT} -dr | \
       ${SED} -e 's/^/@dirrm /g' >> ${TMPPLIST}
.endfor
    @${ECHO} "@dirrm include" >> ${TMPPLIST}
    @${ECHO} "@dirrm libexec" >> ${TMPPLIST}
    @${ECHO} "@dirrm lib" >> ${TMPPLIST}

    @${ECHO} "============================================================"
    @${ECHO} "  Add to path: ${PREFIX}/bin"
    @${ECHO} "  All binaries have prefix of ${DROID_TARGET}-"
    @${ECHO} "  e.g. ${DROID_TARGET}-gnatgcc"
    @${ECHO} "       ${DROID_TARGET}-gnatmake"
    @${ECHO} "============================================================"

.include <bsd.port.post.mk>