blob: 693e1773f65e45801337c0c06e3f87b9f2d2f3a7 (
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
PORTNAME= gcc-msp430-ti-toolchain
PORTVERSION= ${TI_VERSION}.${RELEASE_DATE}
PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= GCC/releases/gcc-${GCC_REL_VERSION}:gcc \
SOURCEWARE/binutils/releases:binutils \
ftp://sources.redhat.com/pub/:newlib \
GNU/gdb:gdb \
SOURCEWARE/newlib:newlib \
http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/${TI_VERSION:S/./_/g}/export/:tipatch \
http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/${TI_VERSION:S/./_/g}/export/:tisupport \
http://www.ti.com/lit/ug/slau${DOC_VERSION}/:tidocs
DISTFILES= gcc-${GCC_REL_VERSION}.tar.xz:gcc \
binutils-${BINUTILS_VERSION}.tar.bz2:binutils \
gdb-${GDB_VERSION}.tar.xz:gdb \
newlib-${NEWLIB_VERSION}.tar.gz:newlib \
msp430-gcc-${PATCHSET_VERSION}-source-patches.tar.bz2:tipatch \
msp430-gcc-support-files-${SUPPORT_VERSION}.zip:tisupport \
slau${DOC_VERSION}.pdf:tidocs
EXTRACT_ONLY= gcc-${GCC_REL_VERSION}.tar.xz \
binutils-${BINUTILS_VERSION}.tar.bz2 \
gdb-${GDB_VERSION}.tar.xz \
newlib-${NEWLIB_VERSION}.tar.gz \
msp430-gcc-${PATCHSET_VERSION}-source-patches.tar.bz2 \
msp430-gcc-support-files-${SUPPORT_VERSION}.zip
MAINTAINER= lev@FreeBSD.org
COMMENT= Complete gcc-based toolcahin for TI MSP430 uC
LICENSE= GPLv2 LGPL20 LGPL21 GPLv3 LGPL3
LICENSE_COMB= multi
BUILD_DEPENDS= objdump:devel/binutils
LIB_DEPENDS= libgmp.so:math/gmp \
libmpfr.so:math/mpfr \
libmpc.so:math/mpc \
libisl.so:devel/isl
# Akami tarpitting fetch by user agent
FETCH_BEFORE_ARGS= --user-agent=Wget/1.20.3
USES= bison compiler cpe gmake iconv libtool makeinfo ncurses \
tar:bzip2
USE_CSTD= gnu89
GNU_CONFIGURE= yes
TI_VERSION= 9.2.0.0
GCC_REL_VERSION= 9.2.0
GCC_VERSION= 9.2.0
SUPPORT_VERSION= 1.210
BINUTILS_VERSION= 2.34
GDB_VERSION= 9.1
NEWLIB_VERSION= 2.4.0
PATCHSET_VERSION= 9.2.0.50
DOC_VERSION= 646f
RELEASE_DATE= 20200612
TARGET= msp430-elf
CPE_PRODUCT= gcc
CPE_VENDOR= gnu
CPE_VERSION= ${GCC_REL_VERSION}
PATCH_WRKSRC= ${WRKDIR}
MANPREFIX= ${PREFIX}/${PORTNAME}-${TI_VERSION}
DOCSDIR= ${PREFIX}/${PORTNAME}-${TI_VERSION}/docs
PLIST_SUB+= TARGET=${TARGET} GCC_VERSION=${GCC_VERSION} \
TI_VERSION=${TI_VERSION} DOC_VERSION=${DOC_VERSION}
DIST_PATCH_ARGS=--forward --force --quiet --remove-empty-files --strip=0
UNNEEDED_HOST_FILES= lib/lib${TARGET}-sim.a
UNNEEDED_HOST_DIRS= lib/gcc/${TARGET}/${GCC_VERSION}/plugin/include/ada \
lib/gcc/${TARGET}/${GCC_VERSION}/plugin/include/java \
lib/gcc/${TARGET}/${GCC_VERSION}/plugin/include/objc \
include info man share
BUILD_DIR= ${WRKDIR}/build
INTERIM_WORLD= ${WRKDIR}/install
INTERIM_PREFIX= ${INTERIM_WORLD}/${PORTNAME}-${TI_VERSION}
MAKE_ENV= PATH="${PATH}:${INTERIM_PREFIX}/bin"
CONFIGURE_ENV= PATH="${PATH}:${INTERIM_PREFIX}/bin"
GCC_DIRS_FROM_NEWLIB= libgloss newlib
CONFIGURE_ARGS_COMMON= --prefix=${INTERIM_PREFIX} \
--target=msp430-elf \
--enable-languages=c,c++ \
--disable-nls \
--enable-initfini-array
pre-patch:
@${ECHO_MSG} "===> Apply distribution patches..."
@${ECHO_MSG} "====> Patch gcc"
@cd ${WRKDIR}/gcc-${GCC_REL_VERSION} && \
${PATCH} ${DIST_PATCH_ARGS} < ${WRKDIR}/msp430-gcc-${PATCHSET_VERSION}-source-patches/gcc-${GCC_REL_VERSION:S/./_/g}-release.patch
@${ECHO_MSG} "====> Patch binutils"
@cd ${WRKDIR}/binutils-${BINUTILS_VERSION} && \
${MKDIR} sim/testsuite/sim/msp430 && \
${PATCH} ${DIST_PATCH_ARGS} < ${WRKDIR}/msp430-gcc-${PATCHSET_VERSION}-source-patches/binutils-${BINUTILS_VERSION:S/./_/g}.patch
@${ECHO_MSG} "====> Patch gdb"
@cd ${WRKDIR}/gdb-${GDB_VERSION} && \
${MKDIR} gas/config ld/emultempl && \
${PATCH} ${DIST_PATCH_ARGS} < ${WRKDIR}/msp430-gcc-${PATCHSET_VERSION}-source-patches/gdb-${GDB_VERSION}-release.patch
@${ECHO_MSG} "====> Patch newlib"
@cd ${WRKDIR}/newlib-${NEWLIB_VERSION} && \
${PATCH} ${DIST_PATCH_ARGS} < ${WRKDIR}/msp430-gcc-${PATCHSET_VERSION}-source-patches/newlib-${NEWLIB_VERSION:S/./_/g}.patch
do-configure:
.for _DIR in ${GCC_DIRS_FROM_NEWLIB}
@${LN} -fns ${WRKDIR}/newlib-${NEWLIB_VERSION}/${_DIR} ${WRKDIR}/gcc-${GCC_REL_VERSION}/${_DIR}
.endfor
@${RM} -r ${BUILD_DIR}
@${MKDIR} ${BUILD_DIR}
@${RM} -r ${INTERIM_PREFIX}
@${MKDIR} ${INTERIM_PREFIX}
do-build:
# Build & install binutils
${MKDIR} ${BUILD_DIR}/binutils
@cd ${BUILD_DIR}/binutils && \
${MAKE_ENV} ${CONFIGURE_ENV} ${WRKDIR}/binutils-${BINUTILS_VERSION}/configure \
${CONFIGURE_ARGS_COMMON} \
--disable-sim \
--disable-gdb \
--disable-werror \
--with-pkgversion="FreeBSD Ports Collection" \
--with-system-zlib
@cd ${BUILD_DIR}/binutils && \
${DO_MAKE_BUILD}
@cd ${BUILD_DIR}/binutils && \
${SETENV} ${MAKE_ENV} ${FAKEROOT} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install DESTDIR=''
# Build & install gcc & newlib
@${MKDIR} ${BUILD_DIR}/gcc
@cd ${BUILD_DIR}/gcc && \
${MAKE_ENV} ${CONFIGURE_ENV} ${WRKDIR}/gcc-${GCC_REL_VERSION}/configure \
${CONFIGURE_ARGS_COMMON} \
--enable-target-optspace \
--enable-newlib-nano-formatted-io \
--with-gmp=${PREFIX} \
--with-mprf=${PREFIX} \
--with-mpc=${PREFIX} \
--with-isl=${PREFIX} \
--with-pkgversion="FreeBSD Ports Collection" \
--with-system-zlib
@cd ${BUILD_DIR}/gcc && \
${DO_MAKE_BUILD}
@cd ${BUILD_DIR}/gcc && \
${SETENV} ${MAKE_ENV} ${FAKEROOT} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install DESTDIR=''
# Build & install gdb
@${MKDIR} ${BUILD_DIR}/gdb
@cd ${BUILD_DIR}/gdb && \
${MAKE_ENV} ${CONFIGURE_ENV} ${WRKDIR}/gdb-${GDB_VERSION}/configure \
${CONFIGURE_ARGS_COMMON} \
--disable-binutils \
--disable-gas \
--disable-ld \
--disable-gprof \
--disable-etc \
--without-mpfr \
--without-lzma \
--with-python=no \
--with-pkgversion="FreeBSD Ports Collection" \
--with-system-zlib
@cd ${BUILD_DIR}/gdb && \
${DO_MAKE_BUILD}
@cd ${BUILD_DIR}/gdb && \
${SETENV} ${MAKE_ENV} ${FAKEROOT} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} install DESTDIR=''
# Strip binaries
.if !defined(DEBUG)
@for bin in $$(${FIND} ${INTERIM_PREFIX}/bin -type f -name ${TARGET}-\*) ; do \
if ! ${FILE} $$bin | ${GREP} -qs ': ELF' ; then continue ; fi ; \
${STRIP_CMD} $${bin} ; \
done
@for bin in $$(${FIND} ${INTERIM_PREFIX}/${TARGET}/bin -type f -maxdepth 1 -mindepth 1) ; do \
if ! ${FILE} $$bin | ${GREP} -qs ': ELF' ; then continue ; fi ; \
${STRIP_CMD} $${bin} ; \
done
@for bin in $$(${FIND} ${INTERIM_PREFIX}/libexec/gcc/${TARGET}/${GCC_VERSION} -type f) ; do \
if ! ${FILE} $$bin | ${GREP} -qs ': ELF' ; then continue ; fi ; \
${STRIP_CMD} $${bin} ; \
done
@${STRIP_CMD} ${INTERIM_PREFIX}/lib/libcc1.so.0
@for bin in $$(${FIND} ${INTERIM_PREFIX}/lib/gcc/${TARGET}/${GCC_VERSION} -perm +111 -and ! -type d) ; do \
if ! ${FILE} $$bin | ${GREP} -qs ': ELF' ; then continue ; fi ; \
${STRIP_CMD} $${bin} ; \
done
.endif
do-install:
@${TAR} -cf - -C ${INTERIM_WORLD} ${PORTNAME}-${TI_VERSION} | ${TAR} -xf - -C ${STAGEDIR}${PREFIX}
@${ECHO_MSG} "Remove unneeded host files..."
@for f in ${UNNEEDED_HOST_FILES} ; do \
${RM} "${STAGEDIR}${PREFIX}/$$f" ; \
done
@for f in ${UNNEEDED_HOST_DIRS} ; do \
${RM} -r "${STAGEDIR}${PREFIX}/$$f" ; \
done
@${ECHO_MSG} "Install devices' headers and linker scripts..."
@${MKDIR} ${STAGEDIR}${PREFIX}/include
cd ${WRKDIR}/msp430-gcc-support-files && \
${TAR} cf - . | \
${TAR} xf - -C ${STAGEDIR}${PREFIX}/${PORTNAME}-${TI_VERSION}
@${ECHO_MSG} "Install minimal documentation..."
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/slau${DOC_VERSION}.pdf \
${STAGEDIR}${DOCSDIR}/slau${DOC_VERSION}.pdf
${INSTALL_DATA} ${FILESDIR}/watchdog.txt ${STAGEDIR}${DOCSDIR}/watchdog.txt
.include <bsd.port.mk>
|