summaryrefslogtreecommitdiff
path: root/cross/xtensa-esp32-elf-gcc/Makefile.common
blob: d3179154edea7e9d7c2c2be4734e5a9e8278c04a (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
# $NetBSD: Makefile.common,v 1.3 2022/07/22 02:01:54 tnn Exp $

# used by cross/xtensa-esp32-elf-gcc/Makefile
# used by cross/xtensa-esp32s2-elf-gcc/Makefile
# used by cross/xtensa-esp32s3-elf-gcc/Makefile

# We could use the upstream GCC distfile, but Espressif has important vendor
# patches in their branch and it seems not worth the maintenance overhead to
# extract them and put them in pkgsrc.
#DISTNAME=		gcc-8.3.0
#MASTER_SITES=		${MASTER_SITE_GNU:=gcc/gcc-${PKGVERSION_NOREV}/}
#EXTRACT_SUFX=		.tar.xz

DISTNAME=		espressif-gcc-8.4.0
PKGNAME=		${DISTNAME:C/.*gcc/xtensa-${ESP32_TYPE}-elf-gcc/}
CATEGORIES=		cross
MASTER_SITES=		${MASTER_SITE_GITHUB:=espressif/}
GITHUB_PROJECT=		gcc
GITHUB_TAG=		f9333cfc1a790dff864aea3478cb862cc442be30
# Espressif overlays
DISTFILES=		${DEFAULT_DISTFILES}
DISTFILES+=		crosstool-NG-esp-2021r2-patch3.tar.gz
SITES.crosstool-NG-esp-2021r2-patch3.tar.gz=	\
	-https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/crosstool-NG-esp-2021r2-patch3.tar.gz
# Custom ESP32 newlib
DISTFILES+=		newlib-${NEWLIBVER}.tar.gz
NEWLIBVER=		esp32-2021r2-patch3_newlib-3_3_0-9e1cbb81
SITES.newlib-${NEWLIBVER}.tar.gz= \
	-https://github.com/espressif/newlib-esp32/archive/9e1cbb8144de573e8c2e8425b671a04d379bd166.tar.gz

MAINTAINER=		pkgsrc-users@NetBSD.org
HOMEPAGE=		https://github.com/espressif/gcc
COMMENT=		Cross GCC for Espressif ${ESP32_TYPE:tu} bare metal environment
LICENSE=		gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3

DEPENDS+=	xtensa-${ESP32_TYPE}-elf-binutils>=2.35.2:../../cross/xtensa-${ESP32_TYPE}-elf-binutils

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

PATCHDIR=	${.CURDIR}/../../cross/xtensa-esp32-elf-gcc/patches
DISTINFO_FILE=	${.CURDIR}/../../cross/xtensa-esp32-elf-gcc/distinfo
DESCR_SRC=	${.CURDIR}/../../cross/xtensa-esp32-elf-gcc/DESCR

# 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-${ESP32_TYPE}-elf
MKPIE_SUPPORTED=	no

# This is based on "gcc -v" output from the binary release
# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz
CONFIGURE_ARGS+=	--target=xtensa-${ESP32_TYPE}-elf
CONFIGURE_ARGS+=	--with-local-prefix=${GNU_CONFIGURE_PREFIX}/xtensa-${ESP32_TYPE}-elf
CONFIGURE_ARGS+=	--with-headers=${GNU_CONFIGURE_PREFIX}/xtensa-${ESP32_TYPE}-elf/include
CONFIGURE_ARGS+=	--with-newlib
CONFIGURE_ARGS+=	--enable-threads=no
CONFIGURE_ARGS+=	--disable-shared
CONFIGURE_ARGS+=	--disable-__cxa_atexit
CONFIGURE_ARGS+=	--enable-cxx-flags="-ffunction-sections"
CONFIGURE_ARGS+=	--disable-libgomp
CONFIGURE_ARGS+=	--disable-libmudflap
CONFIGURE_ARGS+=	--disable-libmpx
CONFIGURE_ARGS+=	--disable-libssp
CONFIGURE_ARGS+=	--disable-libquadmath
CONFIGURE_ARGS+=	--disable-libquadmath-support
CONFIGURE_ARGS+=	--enable-lto
CONFIGURE_ARGS+=	--enable-target-optspace
CONFIGURE_ARGS+=	--without-long-double-128
CONFIGURE_ARGS+=	--disable-nls
CONFIGURE_ARGS+=	--enable-multiarch
CONFIGURE_ARGS+=	--enable-languages=c,c++
CONFIGURE_ARGS+=	--disable-libstdcxx-verbose
CONFIGURE_ARGS+=	--enable-threads=posix
CONFIGURE_ARGS+=	--enable-gcov-custom-rtio
CONFIGURE_ARGS+=	--enable-libstdcxx-time=yes

CONFIGURE_ARGS+=	--disable-bootstrap

# configry for newlib
CONFIGURE_ARGS+=	--enable-newlib-io-float
CONFIGURE_ARGS+=	--disable-newlib-io-long-double
CONFIGURE_ARGS+=	--disable-newlib-supplied-syscalls
CONFIGURE_ARGS+=	--enable-newlib-io-pos-args
CONFIGURE_ARGS+=	--enable-newlib-io-c99-formats
CONFIGURE_ARGS+=	--enable-newlib-io-long-long
CONFIGURE_ARGS+=	--disable-newlib-register-fini
CONFIGURE_ARGS+=	--disable-newlib-nano-malloc
CONFIGURE_ARGS+=	--disable-newlib-nano-formatted-io
CONFIGURE_ARGS+=	--enable-newlib-atexit-dynamic-alloc
CONFIGURE_ARGS+=	--disable-newlib-global-atexit
CONFIGURE_ARGS+=	--disable-lite-exit
CONFIGURE_ARGS+=	--enable-newlib-reent-small
CONFIGURE_ARGS+=	--enable-newlib-multithread
CONFIGURE_ARGS+=	--disable-newlib-retargetable-locking
CONFIGURE_ARGS+=	--disable-newlib-wide-orient
CONFIGURE_ARGS+=	--enable-newlib-fseek-optimization
CONFIGURE_ARGS+=	--enable-newlib-fvwrite-in-streamio
CONFIGURE_ARGS+=	--enable-newlib-unbuf-stream-opt
CONFIGURE_ARGS+=	--enable-target-optspace
CONFIGURE_ARGS+=	--enable-newlib-long-time_t
CONFIGURE_ARGS+=	--enable-newlib-nano-malloc
CONFIGURE_ARGS+=	--enable-newlib-retargetable-locking
CONFIGURE_ARGS+=	--enable-newlib-iconv

CHECK_PORTABILITY_SKIP+=	contrib/*

post-extract:
	mv ${WRKDIR}/newlib-*/newlib ${WRKSRC}/newlib
	mv ${WRKDIR}/newlib-*/libgloss ${WRKSRC}/libgloss
	${CP} -r ${WRKDIR}/overlays/xtensa_${ESP32_TYPE}/gcc/. ${WRKSRC}/.
	${CP} -r ${WRKDIR}/overlays/xtensa_${ESP32_TYPE}/newlib/. ${WRKSRC}/.

pre-configure:
	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}

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