aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authormarino <marino@FreeBSD.org>2015-11-30 08:15:39 +0800
committermarino <marino@FreeBSD.org>2015-11-30 08:15:39 +0800
commite4baaf1ad63bb8c5570ce2db813b1fffbce1abc7 (patch)
tree3f79e9eacef428835dfcecd5e6e8756fb8bb41df /lang
parent9f51ce41b6a11b5a8ba72aecc576b30d4cd61f7b (diff)
downloadfreebsd-ports-gnome-e4baaf1ad63bb8c5570ce2db813b1fffbce1abc7.tar.gz
freebsd-ports-gnome-e4baaf1ad63bb8c5570ce2db813b1fffbce1abc7.tar.zst
freebsd-ports-gnome-e4baaf1ad63bb8c5570ce2db813b1fffbce1abc7.zip
Add gnatdroid-x86 (3 new ports), X-compiler to Android-x86
Similar to lang/gnatdroid-armv7, lang/gnatdroid-x86 is a cross-compiler targetting Android. The former targets ARMv7 processors while the latter targets Android on x86 (32-bit). The latter also runs on Virtualbox as a bonus. The new ports are implemented as slaves to the ARMv7 versions. The GNAT ACATS were run, and it passed every test except CXG2024, "accuracy of multiplication and division of mixed decimal and binary fixed point numbers". subtest 13: expected -51.00 got 50.0 subtest 14: expected 51.0 got 50.0 This is probably a rounding error unique to 32-bit x86. Overall this version passed better than gnatdroid-armv7 because unwind is supported, enabling check check support. Also added: lang/gnatdroid-sysroot-x86 (KitKat and Lollipop API) lang/gnatdroid-binutils-x86 Despite the desciption, C++, Fortran and Objective-C should also work well (in addition to advertised C and Ada frontends). === The gnatdroid-x86 port builds a C/Ada cross-compiler based on GCC 4.9 that targets the Android operating system (up to version 5.0, API level 21) running on x86 or x86_64 architecture (version 7). This produces binaries that run natively on x86-based Android devices.
Diffstat (limited to 'lang')
-rw-r--r--lang/Makefile3
-rw-r--r--lang/gcc-aux/Makefile.version1
-rw-r--r--lang/gcc-aux/files/diff-ada70
-rw-r--r--lang/gcc-aux/files/diff-ada-testsuite6
-rw-r--r--lang/gcc-aux/files/diff-cxx23
-rw-r--r--lang/gcc-aux/files/patch-libstdc++-v3_config_os_bionic_ctype__base.h21
-rw-r--r--lang/gnatdroid-armv7/Makefile43
-rw-r--r--lang/gnatdroid-armv7/pkg-descr8
-rw-r--r--lang/gnatdroid-binutils-x86/Makefile18
-rw-r--r--lang/gnatdroid-binutils-x86/pkg-descr5
-rw-r--r--lang/gnatdroid-binutils-x86/pkg-plist95
-rw-r--r--lang/gnatdroid-binutils/Makefile19
-rw-r--r--lang/gnatdroid-sysroot-x86/Makefile49
-rw-r--r--lang/gnatdroid-sysroot-x86/distinfo4
-rw-r--r--lang/gnatdroid-sysroot-x86/files/extra-21-stat.h10
-rw-r--r--lang/gnatdroid-sysroot-x86/files/extra-stat.h12
-rw-r--r--lang/gnatdroid-sysroot-x86/pkg-descr6
-rw-r--r--lang/gnatdroid-x86/Makefile21
-rw-r--r--lang/gnatdroid-x86/pkg-descr6
19 files changed, 346 insertions, 74 deletions
diff --git a/lang/Makefile b/lang/Makefile
index 952a98023def..b8d321871ab7 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -105,7 +105,10 @@
SUBDIR += gnat_util
SUBDIR += gnatdroid-armv7
SUBDIR += gnatdroid-binutils
+ SUBDIR += gnatdroid-binutils-x86
SUBDIR += gnatdroid-sysroot
+ SUBDIR += gnatdroid-sysroot-x86
+ SUBDIR += gnatdroid-x86
SUBDIR += gnu-cobol
SUBDIR += gnustep-base
SUBDIR += go
diff --git a/lang/gcc-aux/Makefile.version b/lang/gcc-aux/Makefile.version
index 277fede90eba..3ff1600d4fc4 100644
--- a/lang/gcc-aux/Makefile.version
+++ b/lang/gcc-aux/Makefile.version
@@ -7,6 +7,7 @@ SNAPSHOT= 20150626
MAIN_PR= 0
UTIL_PR= 0
ARMV7_PR= 1
+X86_PR= 0
# Snapshot naming pattern
#IDENTIFICATION= gcc-${GCC_BRANCH}-${SNAPSHOT}
diff --git a/lang/gcc-aux/files/diff-ada b/lang/gcc-aux/files/diff-ada
index aeeb2e3c8246..b2483b4b358c 100644
--- a/lang/gcc-aux/files/diff-ada
+++ b/lang/gcc-aux/files/diff-ada
@@ -2358,17 +2358,6 @@
/*---------------------- PPC AIX/PPC Lynx 178/Older Darwin ------------------*/
#elif ((defined (_POWER) && defined (_AIX)) || \
(defined (__powerpc__) && defined (__Lynx__) && !defined(__ELF__)) || \
---- gcc/ada/gcc-interface/Make-lang.in.orig
-+++ gcc/ada/gcc-interface/Make-lang.in
-@@ -584,7 +584,7 @@
- ada/widechar.o
-
- # Language-independent object files.
--ADA_BACKEND = $(BACKEND) attribs.o
-+ADA_BACKEND = $(BACKEND2) attribs.o
-
- # List of target dependent sources, overridden below as necessary
- TARGET_ADA_SRCS =
--- gcc/ada/gcc-interface/Makefile.in.orig
+++ gcc/ada/gcc-interface/Makefile.in
@@ -1044,6 +1044,7 @@
@@ -2410,7 +2399,47 @@
THREADSLIB = -lposix4 -lthread
MISCLIB = -lposix4 -lnsl -lsocket
SO_OPTS = -Wl,-h,
-@@ -1330,8 +1332,11 @@
+@@ -1266,6 +1268,39 @@
+ LIBRARY_VERSION := $(LIB_VERSION)
+ endif
+
++# x86 android
++ifeq ($(strip $(filter-out %86 linux-android,$(target_cpu) $(target_os))),)
++ LIBGNAT_TARGET_PAIRS = \
++ a-intnam.ads<a-intnam-linux.ads \
++ g-socthi.adb<g-socthi-bsd.adb \
++ s-inmaop.adb<s-inmaop-posix.adb \
++ s-intman.adb<s-intman-posix.adb \
++ s-linux.ads<s-linux-android.ads \
++ s-osinte.adb<s-osinte-android.adb \
++ s-osinte.ads<s-osinte-android.ads \
++ s-osprim.adb<s-osprim-posix.adb \
++ s-taprop.adb<s-taprop-posix.adb \
++ s-taspri.ads<s-taspri-posix.ads \
++ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
++ $(ATOMICS_TARGET_PAIRS) \
++ $(X86_TARGET_PAIRS) \
++ system.ads<system-linux-x86.ads
++
++ TOOLS_TARGET_PAIRS = \
++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
++ indepsw.adb<indepsw-gnu.adb
++
++ EXTRA_LIBGNAT_OBJS=
++ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
++ EXTRA_GNATRTL_NONTASKING_OBJS=
++ EH_MECHANISM=-gcc
++ THREADSLIB=
++ MISCLIB=
++ GMEM_LIB=
++ GNATLIB_SHARED = gnatlib-shared-dual
++ LIBRARY_VERSION := $(LIB_VERSION)
++endif
++
+ # x86 kfreebsd
+ ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
+ LIBGNAT_TARGET_PAIRS = \
+@@ -1330,8 +1365,11 @@
ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-freebsd.ads \
@@ -2422,7 +2451,7 @@
s-osinte.adb<s-osinte-freebsd.adb \
s-osinte.ads<s-osinte-freebsd.ads \
s-osprim.adb<s-osprim-posix.adb \
-@@ -1346,6 +1351,8 @@
+@@ -1346,6 +1384,8 @@
mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
GNATLIB_SHARED = gnatlib-shared-dual
@@ -2431,7 +2460,7 @@
EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
EH_MECHANISM=-gcc
-@@ -1359,8 +1366,11 @@
+@@ -1359,8 +1399,11 @@
ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-freebsd.ads \
@@ -2443,7 +2472,7 @@
s-osinte.adb<s-osinte-freebsd.adb \
s-osinte.ads<s-osinte-freebsd.ads \
s-osprim.adb<s-osprim-posix.adb \
-@@ -1375,6 +1385,181 @@
+@@ -1375,6 +1418,181 @@
mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
GNATLIB_SHARED = gnatlib-shared-dual
@@ -2625,6 +2654,17 @@
EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
EH_MECHANISM=-gcc
+--- gcc/ada/gcc-interface/Make-lang.in.orig
++++ gcc/ada/gcc-interface/Make-lang.in
+@@ -584,7 +584,7 @@
+ ada/widechar.o
+
+ # Language-independent object files.
+-ADA_BACKEND = $(BACKEND) attribs.o
++ADA_BACKEND = $(BACKEND2) attribs.o
+
+ # List of target dependent sources, overridden below as necessary
+ TARGET_ADA_SRCS =
--- gnattools/configure.ac.orig
+++ gnattools/configure.ac
@@ -79,11 +79,27 @@
diff --git a/lang/gcc-aux/files/diff-ada-testsuite b/lang/gcc-aux/files/diff-ada-testsuite
index c94e9a3e5764..722ddc4d963a 100644
--- a/lang/gcc-aux/files/diff-ada-testsuite
+++ b/lang/gcc-aux/files/diff-ada-testsuite
@@ -126,7 +126,7 @@
+gccflags="-O2"
+gnatflags="-gnatws"
+tabtarget="/data/local/testsuite"
-+STRIP="arm-aux-linux-androideabi-strip"
++STRIP="@REMOTE_TARGET@-strip"
+
+target_run () {
+ # Run on rooted tablet (port 22 vs port 2222)
@@ -180,8 +180,8 @@
+fi
+
+target_gnatmake () {
-+ echo gnatmake-cross --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
-+ gnatmake-cross --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
++ echo gnatmake-cross --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\" -fPIE -pie
++ gnatmake-cross --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC" -fPIE -pie
+}
+
+target_gcc () {
diff --git a/lang/gcc-aux/files/diff-cxx b/lang/gcc-aux/files/diff-cxx
index 428975bd98ed..51aae24bdc6d 100644
--- a/lang/gcc-aux/files/diff-cxx
+++ b/lang/gcc-aux/files/diff-cxx
@@ -970,9 +970,30 @@
+ dragonfly*)
+ os_include_dir="os/bsd/dragonfly"
+ ;;
-+ linux-androideabi)
++ linux-android*)
+ os_include_dir="os/bionic"
+ ;;
bsd*)
# Plain BSD attempts to share FreeBSD files.
os_include_dir="os/bsd/freebsd"
+--- libstdc++-v3/config/os/bionic/ctype_base.h.orig
++++ libstdc++-v3/config/os/bionic/ctype_base.h
+@@ -40,6 +40,18 @@
+ // Non-standard typedefs.
+ typedef const int* __to_type;
+
++#ifdef _CTYPE_U
++#define _U _CTYPE_U
++#define _L _CTYPE_L
++#define _D _CTYPE_D
++#define _S _CTYPE_S
++#define _P _CTYPE_P
++#define _C _CTYPE_C
++#define _X _CTYPE_X
++#define _B _CTYPE_B
++#define _N _CTYPE_D
++#endif
++
+ // NB: Offsets into ctype<char>::_M_table force a particular size
+ // on the mask type. Because of this, we don't use an enum.
+ typedef char mask;
diff --git a/lang/gcc-aux/files/patch-libstdc++-v3_config_os_bionic_ctype__base.h b/lang/gcc-aux/files/patch-libstdc++-v3_config_os_bionic_ctype__base.h
deleted file mode 100644
index 531c67e6dfa1..000000000000
--- a/lang/gcc-aux/files/patch-libstdc++-v3_config_os_bionic_ctype__base.h
+++ /dev/null
@@ -1,21 +0,0 @@
---- libstdc++-v3/config/os/bionic/ctype_base.h.orig 2014-01-02 22:30:10 UTC
-+++ libstdc++-v3/config/os/bionic/ctype_base.h
-@@ -40,6 +40,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- // Non-standard typedefs.
- typedef const int* __to_type;
-
-+#ifdef _CTYPE_U
-+#define _U _CTYPE_U
-+#define _L _CTYPE_L
-+#define _D _CTYPE_D
-+#define _S _CTYPE_S
-+#define _P _CTYPE_P
-+#define _C _CTYPE_C
-+#define _X _CTYPE_X
-+#define _B _CTYPE_B
-+#define _N _CTYPE_D
-+#endif
-+
- // NB: Offsets into ctype<char>::_M_table force a particular size
- // on the mask type. Because of this, we don't use an enum.
- typedef char mask;
diff --git a/lang/gnatdroid-armv7/Makefile b/lang/gnatdroid-armv7/Makefile
index 66f74ff323f7..2c601662485d 100644
--- a/lang/gnatdroid-armv7/Makefile
+++ b/lang/gnatdroid-armv7/Makefile
@@ -1,22 +1,22 @@
# Created by: John Marino <marino@FreeBSD.org>
# $FreeBSD$
-PORTNAME= armv7
+PORTNAME?= armv7
PORTVERSION= ${SNAPSHOT}
-PORTREVISION= ${ARMV7_PR}
+PORTREVISION?= ${ARMV7_PR}
CATEGORIES= lang
MASTER_SITES= GCC/releases/gcc-${GCC_VERSION}
PKGNAMEPREFIX= gnatdroid-
DISTFILES= ${IDENTIFICATION}.tar.bz2
-MAINTAINER= marino@FreeBSD.org
-COMMENT= C/Ada cross-compiler, target: Android ARMv7
+MAINTAINER?= marino@FreeBSD.org
+COMMENT?= C/Ada cross-compiler, target: Android ARMv7
LICENSE= GPLv3 GPLv3RLE
LICENSE_COMB= multi
-BUILD_DEPENDS= gnatdroid-sysroot>=19:${PORTSDIR}/lang/gnatdroid-sysroot \
- gnatdroid-binutils>=2.21:${PORTSDIR}/lang/gnatdroid-binutils
+BUILD_DEPENDS= ${SYSROOT}>=19:${PORTSDIR}/lang/${SYSROOT} \
+ ${GDBINUTILS}>=2.21:${PORTSDIR}/lang/${GDBINUTILS}
RUN_DEPENDS:= ${BUILD_DEPENDS}
NO_LICENSES_INSTALL= yes
@@ -34,21 +34,24 @@ OPTIONS_SUB= yes
FORT_DESC= Also build Fortran language
OBJC_DESC= Also build Objective-C language
-DROID_TARGET= arm-aux-linux-androideabi
-DROID_ARCH= armv7-a
-ARMVERSION= ARMv7
-FPU= neon
+DROID_TARGET?= arm-aux-linux-androideabi
+CPUVERSION?= ARMv7
+ARG_ARCH?= --with-arch=armv7-a
+ARG_FPU?= --with-fpu=neon
+ARG_FLOATSOFT?= --with-float=soft
ALL_TARGET= all
GARCH= ${ARCH:S/amd64/x86_64/}
BITS= ${GARCH:S/x86_64/64/:S/i386/32/}
-OS_LABEL4VERS= [${OPSYS}${BITS} x Android ${ARMVERSION}]
+OS_LABEL4VERS= [${OPSYS}${BITS} x Android ${CPUVERSION}]
WRKSRC= ${WRKDIR}/${IDENTIFICATION}
BUILD_WRKSRC= ${WRKDIR}/build
PATCHDIR= ${.CURDIR}/../gcc-aux/files
CFG_SCRIPT= ${WRKSRC}/configure
REVFILE= ${WRKSRC}/gcc/REVISION
-SRPREFIX= ${LOCALBASE}/android
-PREFIX= ${SRPREFIX}/${ARMVERSION}
+SRPREFIX?= ${LOCALBASE}/android
+PREFIX= ${SRPREFIX}/${CPUVERSION}
+SYSROOT?= gnatdroid-sysroot
+GDBINUTILS?= gnatdroid-binutils
PLIST_SUB+= TARGET="${DROID_TARGET}"
PLIST_SUB+= GCCVERS="${GCC_VERSION}"
SUB_FILES= pkg-message
@@ -59,10 +62,6 @@ CROSS= gnat gnatbind gnatchop gnatclean gnatfind gnatkr \
.include <bsd.port.options.mk>
-.if ${OPSYS} == FreeBSD && ${OSREL:R:M8}
-BROKEN= multiple definition of __x86.get_pc_thunk.cx on FreeBSD 8
-.endif
-
.if ${PORT_OPTIONS:MFORT}
LANGS+= fortran
APPLY_DIFFS+= fortran
@@ -72,21 +71,21 @@ APPLY_DIFFS+= fortran
LANGS+= objc
.endif
-INSTALL_ENV= ${MAKE_ENV:C/^PATH=/&${SRPREFIX}\/${ARMVERSION}\/bin:/}
+INSTALL_ENV= ${MAKE_ENV:C/^PATH=/&${SRPREFIX}\/${CPUVERSION}\/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+= --with-arch=${DROID_ARCH}
+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+= --with-float=soft
-ADA_CONFIG_ARGS+= --with-fpu=${FPU}
+ADA_CONFIG_ARGS+= ${ARG_FLOATSOFT}
+ADA_CONFIG_ARGS+= ${ARG_FPU}
ADA_CONFIG_ARGS+= --enable-target-optspace
ADA_CONFIG_ARGS+= --enable-threads=posix
ADA_CONFIG_ARGS+= --enable-cxx-flags=-frtti
@@ -114,6 +113,8 @@ post-extract:
.endfor
@(cd ${WRKSRC}/gcc/testsuite/ada/acats && \
${CP} run_remote.sh 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
diff --git a/lang/gnatdroid-armv7/pkg-descr b/lang/gnatdroid-armv7/pkg-descr
index 0d702cebad4d..88102e336862 100644
--- a/lang/gnatdroid-armv7/pkg-descr
+++ b/lang/gnatdroid-armv7/pkg-descr
@@ -1,6 +1,6 @@
-The gnatdroid-armv7 port builds a C/Ada cross-compiler based on GCC 4.7 that
-targets the Android operating system (version 4.4, API level 19) running on
-ARM architecture (version 7). This produces binaries that run natively on
-Android devices built with Cortex-A series chips.
+The gnatdroid-armv7 port builds a C/Ada cross-compiler based on GCC 4.9
+that targets the Android operating system (up to version 5.0, API level
+21) running on ARM architecture (version 7). This produces binaries that
+run natively on Android devices built with Cortex-A series chips.
WWW: http://www.dragonlace.net
diff --git a/lang/gnatdroid-binutils-x86/Makefile b/lang/gnatdroid-binutils-x86/Makefile
new file mode 100644
index 000000000000..1ebf21f14688
--- /dev/null
+++ b/lang/gnatdroid-binutils-x86/Makefile
@@ -0,0 +1,18 @@
+# Created by: John Marino <marino@FreeBSD.org>
+# $FreeBSD$
+
+PORTREVISION= 0
+PKGNAMESUFFIX= -x86
+
+MAINTAINER= marino@FreeBSD.org
+COMMENT= Infrastructure for C/Ada Android cross-compiler (x86)
+
+BRANCH2= x86_32
+XCCTARGET= i686-aux-linux-android
+PREFIX= ${LOCALBASE}/android-x86
+SYSROOT= gnatdroid-sysroot-x86
+MASTERDIR= ${.CURDIR}/../../lang/gnatdroid-binutils
+PLIST= ${.CURDIR}/pkg-plist
+DESCR= ${.CURDIR}/pkg-descr
+
+.include "${MASTERDIR}/Makefile"
diff --git a/lang/gnatdroid-binutils-x86/pkg-descr b/lang/gnatdroid-binutils-x86/pkg-descr
new file mode 100644
index 000000000000..0527a132905a
--- /dev/null
+++ b/lang/gnatdroid-binutils-x86/pkg-descr
@@ -0,0 +1,5 @@
+This package is a dependency of lang/gnatdroid-x86. It provides the
+cross-tools required to build the GNAT FreeBSD->x86 cross-compiler that
+is gnatdroid, as well as any binaries that it produces.
+
+WWW: http://www.dragonlace.net
diff --git a/lang/gnatdroid-binutils-x86/pkg-plist b/lang/gnatdroid-binutils-x86/pkg-plist
new file mode 100644
index 000000000000..ab0740ba6754
--- /dev/null
+++ b/lang/gnatdroid-binutils-x86/pkg-plist
@@ -0,0 +1,95 @@
+%%BRANCH2%%/bin/%%TARGET%%-addr2line
+%%BRANCH2%%/bin/%%TARGET%%-ar
+%%BRANCH2%%/bin/%%TARGET%%-as
+%%BRANCH2%%/bin/%%TARGET%%-c++filt
+%%BRANCH2%%/bin/%%TARGET%%-elfedit
+%%BRANCH2%%/bin/%%TARGET%%-gprof
+%%BRANCH2%%/bin/%%TARGET%%-ld
+%%BRANCH2%%/bin/%%TARGET%%-ld.bfd
+%%BRANCH2%%/bin/%%TARGET%%-nm
+%%BRANCH2%%/bin/%%TARGET%%-objcopy
+%%BRANCH2%%/bin/%%TARGET%%-objdump
+%%BRANCH2%%/bin/%%TARGET%%-ranlib
+%%BRANCH2%%/bin/%%TARGET%%-readelf
+%%BRANCH2%%/bin/%%TARGET%%-size
+%%BRANCH2%%/bin/%%TARGET%%-strings
+%%BRANCH2%%/bin/%%TARGET%%-strip
+%%BRANCH2%%/%%TARGET%%/bin/ar
+%%BRANCH2%%/%%TARGET%%/bin/as
+%%BRANCH2%%/%%TARGET%%/bin/ld
+%%BRANCH2%%/%%TARGET%%/bin/ld.bfd
+%%BRANCH2%%/%%TARGET%%/bin/nm
+%%BRANCH2%%/%%TARGET%%/bin/objcopy
+%%BRANCH2%%/%%TARGET%%/bin/objdump
+%%BRANCH2%%/%%TARGET%%/bin/ranlib
+%%BRANCH2%%/%%TARGET%%/bin/strip
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.x
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xbn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xd
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xdc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xdw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xr
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xs
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xsc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xsw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xu
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf32_x86_64.xw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.x
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xbn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xd
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xdc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xdw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xr
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xs
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xsc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xsw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xu
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_i386.xw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.x
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xbn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xd
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xdc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xdw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xr
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xs
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xsc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xsw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xu
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_k1om.xw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.x
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xbn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xd
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xdc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xdw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xr
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xs
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xsc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xsw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xu
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_l1om.xw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.x
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xbn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xd
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xdc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xdw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xr
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xs
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xsc
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xsw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xu
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/elf_x86_64.xw
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/i386linux.x
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/i386linux.xbn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/i386linux.xn
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/i386linux.xr
+%%BRANCH2%%/%%TARGET%%/lib/ldscripts/i386linux.xu
diff --git a/lang/gnatdroid-binutils/Makefile b/lang/gnatdroid-binutils/Makefile
index b705cf3b7892..43c52f4e98a3 100644
--- a/lang/gnatdroid-binutils/Makefile
+++ b/lang/gnatdroid-binutils/Makefile
@@ -3,18 +3,18 @@
PORTNAME= binutils
PORTVERSION= 2.25.1
-PORTREVISION= 1
+PORTREVISION?= 1
CATEGORIES= lang
MASTER_SITES= SOURCEWARE/binutils/releases
PKGNAMEPREFIX= gnatdroid-
-MAINTAINER= marino@FreeBSD.org
-COMMENT= Infrastructure for C/Ada Android cross-compiler
+MAINTAINER?= marino@FreeBSD.org
+COMMENT?= Infrastructure for C/Ada Android cross-compiler (ARMv7)
LICENSE= GPLv3 LGPL3
LICENSE_COMB= multi
-BUILD_DEPENDS= gnatdroid-sysroot>=19:${PORTSDIR}/lang/gnatdroid-sysroot \
+BUILD_DEPENDS= ${SYSROOT}>=19:${PORTSDIR}/lang/${SYSROOT} \
${LOCALBASE}/lib/libgmp.so:${PORTSDIR}/math/gmp \
${LOCALBASE}/lib/libmpfr.so:${PORTSDIR}/math/mpfr
RUN_DEPENDS:= ${BUILD_DEPENDS}
@@ -26,14 +26,15 @@ NO_MTREE= yes
NO_LICENSES_INSTALL= yes
WRKSRC= ${WRKDIR}/binutils-${PORTVERSION}
-PREFIX= ${LOCALBASE}/android
-BRANCH2= ARMv7
+PREFIX?= ${LOCALBASE}/android
+BRANCH2?= ARMv7
BR2_PREFIX= ${PREFIX}/${BRANCH2}
-ARMTARGET= arm-aux-linux-androideabi
-PLIST_SUB+= TARGET="${ARMTARGET}"
+XCCTARGET?= arm-aux-linux-androideabi
+SYSROOT?= gnatdroid-sysroot
+PLIST_SUB+= TARGET="${XCCTARGET}"
PLIST_SUB+= BRANCH2="${BRANCH2}"
-CONFIGURE_ARGS+= --target=${ARMTARGET}
+CONFIGURE_ARGS+= --target=${XCCTARGET}
CONFIGURE_ARGS+= --prefix=${BR2_PREFIX}
CONFIGURE_ARGS+= --with-sysroot=${PREFIX}
CONFIGURE_ARGS+= --with-gmp=${LOCALBASE}
diff --git a/lang/gnatdroid-sysroot-x86/Makefile b/lang/gnatdroid-sysroot-x86/Makefile
new file mode 100644
index 000000000000..7635658bfe78
--- /dev/null
+++ b/lang/gnatdroid-sysroot-x86/Makefile
@@ -0,0 +1,49 @@
+# Created by: John Marino <marino@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= sysroot
+PORTVERSION= 21
+CATEGORIES= lang
+MASTER_SITES= http://downloads.dragonlace.net/src/
+PKGNAMEPREFIX= gnatdroid-
+PKGNAMESUFFIX= -x86
+DISTNAME= android-${API}-x86
+
+MAINTAINER= marino@FreeBSD.org
+COMMENT= Android sysroots for C/Ada Android cross-compiler (x86)
+
+USES= tar:bzip2
+NO_BUILD= yes
+NO_MTREE= yes
+
+PREFIX= ${LOCALBASE}/android-x86
+STAT_PATCH= ${FILESDIR}/extra-stat.h
+EXTRA_PATCHES= ${STAT_PATCH}
+
+OPTIONS_SINGLE= SG1
+OPTIONS_SINGLE_SG1= KITKAT LOLLIPOP
+OPTIONS_DEFAULT= KITKAT
+
+KITKAT_DESC= Android 4.4 - API level 19 - Kitkat
+LOLLIPOP_DESC= Android 5.0 - API level 21 - Lollipop
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MKITKAT}
+API= 19
+.elif ${PORT_OPTIONS:MLOLLIPOP}
+API= 21
+STAT_PATCH= ${FILESDIR}/extra-21-stat.h
+.else
+IGNORE= the API option is improperly selected
+.endif
+
+do-install:
+ @${MKDIR} ${STAGEDIR}${PREFIX}
+ (cd ${WRKSRC} && ${COPYTREE_SHARE} usr ${STAGEDIR}${PREFIX})
+
+post-install:
+ @(cd ${STAGEDIR}${PREFIX}; ${FIND} usr \( -type f -or -type l \) | \
+ ${SORT} >> ${TMPPLIST})
+
+.include <bsd.port.mk>
diff --git a/lang/gnatdroid-sysroot-x86/distinfo b/lang/gnatdroid-sysroot-x86/distinfo
new file mode 100644
index 000000000000..080de4d4162e
--- /dev/null
+++ b/lang/gnatdroid-sysroot-x86/distinfo
@@ -0,0 +1,4 @@
+SHA256 (android-19-x86.tar.bz2) = 35c5e6fdebe54373d2103e500034d620fbda8a7b79148fc6a5e507a25ff17f24
+SIZE (android-19-x86.tar.bz2) = 5554684
+SHA256 (android-21-x86.tar.bz2) = 48c306569d4d27ba595c930bfe3ac69208868b2a1d2598b57e8f8ded293a7478
+SIZE (android-21-x86.tar.bz2) = 7261178
diff --git a/lang/gnatdroid-sysroot-x86/files/extra-21-stat.h b/lang/gnatdroid-sysroot-x86/files/extra-21-stat.h
new file mode 100644
index 000000000000..eb9e17a669ba
--- /dev/null
+++ b/lang/gnatdroid-sysroot-x86/files/extra-21-stat.h
@@ -0,0 +1,10 @@
+--- usr/include/linux/stat.h.orig 2014-10-15 02:53:49 UTC
++++ usr/include/linux/stat.h
+@@ -57,5 +57,7 @@
+ #define S_IWOTH 00002
+ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ #define S_IXOTH 00001
++#define S_IREAD S_IRUSR
++#define S_IWRITE S_IWUSR
+ #endif
+ #endif
diff --git a/lang/gnatdroid-sysroot-x86/files/extra-stat.h b/lang/gnatdroid-sysroot-x86/files/extra-stat.h
new file mode 100644
index 000000000000..b64e0da88117
--- /dev/null
+++ b/lang/gnatdroid-sysroot-x86/files/extra-stat.h
@@ -0,0 +1,12 @@
+--- usr/include/linux/stat.h.orig 2011-07-17 20:54:19.000000000 +0200
++++ usr/include/linux/stat.h 2011-07-17 20:55:15.000000000 +0200
+@@ -39,6 +39,9 @@
+ #define S_IWUSR 00200
+ #define S_IXUSR 00100
+
++#define S_IREAD S_IRUSR
++#define S_IWRITE S_IWUSR
++
+ #define S_IRWXG 00070
+ #define S_IRGRP 00040
+ #define S_IWGRP 00020
diff --git a/lang/gnatdroid-sysroot-x86/pkg-descr b/lang/gnatdroid-sysroot-x86/pkg-descr
new file mode 100644
index 000000000000..78bbb0dbf5bf
--- /dev/null
+++ b/lang/gnatdroid-sysroot-x86/pkg-descr
@@ -0,0 +1,6 @@
+This package is used by lang/gnatdroid to install the system root of
+Android 2.2 to 5.0 (API Level 8 to API Level 21) of the x86 architecture.
+The x86 cross-tools are built using these files, which in turn is required
+for the GNAT FreeBSD->Android(x86) cross-compiler that is gnatdroid.
+
+WWW: http://www.dragonlace.net
diff --git a/lang/gnatdroid-x86/Makefile b/lang/gnatdroid-x86/Makefile
new file mode 100644
index 000000000000..782730d4ada8
--- /dev/null
+++ b/lang/gnatdroid-x86/Makefile
@@ -0,0 +1,21 @@
+# Created by: John Marino <marino@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= x86
+PORTREVISION= ${X86_PR}
+
+MAINTAINER= marino@FreeBSD.org
+COMMENT= C/Ada cross-compiler, target: Android x86
+
+DROID_TARGET= i686-aux-linux-android
+CPUVERSION= x86_32
+ARG_ARCH= # don't specify
+ARG_FPU= # don't specify
+ARG_FLOATSOFT= # don't specify
+SRPREFIX= ${LOCALBASE}/android-x86
+SYSROOT= gnatdroid-sysroot-x86
+GDBINUTILS= gnatdroid-binutils-x86
+MASTERDIR= ${.CURDIR}/../../lang/gnatdroid-armv7
+DESCR= ${.CURDIR}/pkg-descr
+
+.include "${MASTERDIR}/Makefile"
diff --git a/lang/gnatdroid-x86/pkg-descr b/lang/gnatdroid-x86/pkg-descr
new file mode 100644
index 000000000000..fca4dc45487f
--- /dev/null
+++ b/lang/gnatdroid-x86/pkg-descr
@@ -0,0 +1,6 @@
+The gnatdroid-x86 port builds a C/Ada cross-compiler based on GCC 4.9
+that targets the Android operating system (up to version 5.0, API level
+21) running on x86 or x86_64 architecture (version 7). This produces
+binaries that run natively on x86-based Android devices.
+
+WWW: http://www.dragonlace.net