summaryrefslogtreecommitdiff
path: root/cross/xtensa-lx106-elf-gcc/Makefile
blob: 82858465a5c660e674f7a2907ce96e69dbd32a8c (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
# $NetBSD: Makefile,v 1.1 2019/09/20 15:20:20 bouyer Exp $

# using configure options and sources from
# https://github.com/earlephilhower/esp-quick-toolchain

DISTNAME=		gcc-xtensa-4.8.2
PKGNAME=		${DISTNAME:C/gcc-xtensa/xtensa-lx106-elf-gcc/}
CATEGORIES=		cross
MASTER_SITES=		${MASTER_SITE_GITHUB:=jcmvbkbc/}
GITHUB_PROJECT=		gcc-xtensa
GITHUB_TAG=		a0936f8b396491bc7894c8bc5e80971cc9138e94

DIST_SUBDIR=		${PKGNAME}

# Custom xtensa newlib       
DISTFILES=		${DEFAULT_DISTFILES}
DISTFILES+=		newlib-${NEWLIBVER}.tar.gz
NEWLIBVER=		xtensa-2_2_0-lock-arduino_20190913
SITES.newlib-${NEWLIBVER}.tar.gz= -https://github.com/earlephilhower/newlib-xtensa/archive/b350aadd0c7f44d5ec867494a795a0eed972ee9a.tar.gz

# extra patches
.for _p in \
    gcc-ctype-inline-pgmread.patch  \
    gcc-docs.patch  \
    gcc-enable-mforcel32-eh.patch  \
    gcc-exception-emergency.patch  \
    gcc-exception-what-to-pmem.patch  \
    gcc-file-shortname.patch  \
    gcc-fix-defaults-h-gcc7.patch  \
    gcc-fix-elfos-h-gcc7.patch  \
    gcc-gmpn_invert_limb.patch  \
    gcc-libc_name_p-fix.patch  \
    gcc-mforce-l32-jcmvbkbc.patch  \
    gcc-osx-malloc.patch  \
    gcc-stdcsupp-safe.patch  \
    gcc-unwind-safe.patch
PATCHFILES+= ${_p}
.endfor
PATCH_SITES+= https://raw.githubusercontent.com/earlephilhower/esp-quick-toolchain/master/patches/gcc4.8/

PATCHFILES+= gcc-001-jump-tables-in-text-section-earlephilhower.patch
PATCH_SITES+= https://github.com/earlephilhower/esp-quick-toolchain/raw/master/patches/
PATCH_DIST_STRIP= -p1

MAINTAINER=		bouyer@NetBSD.org
HOMEPAGE=		https://github.com/espressif/gcc
COMMENT=		Cross GCC for Espressif ESP8266 bare metal environment
LICENSE=		gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3

DEPENDS+=	xtensa-lx106-elf-binutils-[0-9]*:../../cross/xtensa-lx106-elf-binutils

FILESDIR=	${.CURDIR}/../../cross/xtensa-lx106-elf-binutils/files

GNU_CONFIGURE=		yes
INFO_FILES=		yes
USE_LANGUAGES+=		c c++
USE_TOOLS+=		bash gmake makeinfo perl

# for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33549
# use makeinfo from pkgsrc/devel/gtexinfo.
TOOL_DEPENDS+=		gtexinfo>=5.1:../../devel/gtexinfo
_TOOLS_USE_PKGSRC.makeinfo= yes

OBJDIR=			../build
CONFIGURE_DIRS=		${OBJDIR}
CONFIGURE_SCRIPT=	${WRKSRC}/configure
CONFIG_SHELL=		${TOOLS_PATH.bash}
WRAPPER_SHELL=		${TOOLS_PATH.bash}
GNU_CONFIGURE_PREFIX=	${PREFIX}/xtensa-lx106-elf

CONFIGURE_ARGS+=	--enable-languages=c,c++
CONFIGURE_ARGS+=	--target=xtensa-lx106-elf
CONFIGURE_ARGS+=	--disable-shared
CONFIGURE_ARGS+=	--with-newlib
CONFIGURE_ARGS+=	--enable-threads=no
CONFIGURE_ARGS+=	--disable-__cxa_atexit
CONFIGURE_ARGS+=	--disable-libgomp
CONFIGURE_ARGS+=	--disable-libmudflap
CONFIGURE_ARGS+=	--disable-nls
CONFIGURE_ARGS+=	--disable-multilib
CONFIGURE_ARGS+=	--disable-bootstrap
CONFIGURE_ARGS+=	--enable-languages=c,c++
CONFIGURE_ARGS+=	--enable-lto
CONFIGURE_ARGS+=	--enable-static=yes
CONFIGURE_ARGS+=	--disable-libstdcxx-verbose

post-extract:
	${LN} -s ${WRKDIR}/newlib-*/newlib ${WRKSRC}/newlib
	${LN} -s ${WRKDIR}/newlib-*/libgloss ${WRKSRC}/libgloss

pre-configure:
	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
	${CP} ${FILESDIR}/xtensa-config.h ${WRKSRC}/include/xtensa-config.h

.include "../../devel/gmp/buildlink3.mk"
.include "../../math/mpfr/buildlink3.mk"
.include "../../math/mpcomplex/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"