Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 532390 | Differences between
and this patch

Collapse All | Expand All

(-)/var/portage/sys-libs/newlib/newlib-9999.ebuild (-2 / +63 lines)
Lines 29-38 Link Here
29
29
30
LICENSE="NEWLIB LIBGLOSS GPL-2"
30
LICENSE="NEWLIB LIBGLOSS GPL-2"
31
SLOT="0"
31
SLOT="0"
32
IUSE="nls threads unicode crosscompile_opts_headers-only"
32
IUSE="nls threads unicode crosscompile_opts_headers-only newlib-nano newlib-supplied-syscalls"
33
RESTRICT="strip"
33
RESTRICT="strip"
34
34
35
NEWLIBBUILD="${WORKDIR}/build"
35
NEWLIBBUILD="${WORKDIR}/build"
36
NEWLIBNANOBUILD="${WORKDIR}/build.nano"
37
NEWLIBNANOTMPINSTALL="${WORKDIR}/nano_tmp_install"
38
39
CFLAGS_FULL="-ffunction-sections -fdata-sections"
40
CFLAGS_NANO="-Os -ffunction-sections -fdata-sections"
36
41
37
pkg_setup() {
42
pkg_setup() {
38
	# Reject newlib-on-glibc type installs
43
	# Reject newlib-on-glibc type installs
Lines 52-81 Link Here
52
	# we should fix this ...
57
	# we should fix this ...
53
	unset LDFLAGS
58
	unset LDFLAGS
54
	CHOST=${CTARGET} strip-unsupported-flags
59
	CHOST=${CTARGET} strip-unsupported-flags
60
	CCASFLAGS_ORIG="${CCASFLAGS}"
61
	CFLAGS_ORIG="${CFLAGS}"
55
62
56
	local myconf=""
63
	local myconf=""
57
	[[ ${CTARGET} == "spu" ]] \
64
	[[ ${CTARGET} == "spu" ]] \
58
		&& myconf="${myconf} --disable-newlib-multithread" \
65
		&& myconf="${myconf} --disable-newlib-multithread" \
59
		|| myconf="${myconf} $(use_enable threads newlib-multithread)"
66
		|| myconf="${myconf} $(use_enable threads newlib-multithread)"
67
	myconf="${myconf} $(use_enable newlib-supplied-syscalls)"
60
68
61
	mkdir -p "${NEWLIBBUILD}"
69
	mkdir -p "${NEWLIBBUILD}"
62
	cd "${NEWLIBBUILD}"
70
	cd "${NEWLIBBUILD}"
63
71
	export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
72
	export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
64
	ECONF_SOURCE=${S} \
73
	ECONF_SOURCE=${S} \
65
	econf \
74
	econf \
66
		$(use_enable unicode newlib-mb) \
75
		$(use_enable unicode newlib-mb) \
67
		$(use_enable nls) \
76
		$(use_enable nls) \
77
		--enable-newlib-io-long-long \
78
		--enable-newlib-register-fini \
68
		${myconf}
79
		${myconf}
80
81
	# Build newlib-nano beside newlib (original)
82
	# Based on https://tracker.debian.org/media/packages/n/newlib/rules-2.1.0%2Bgit20140818.1a8323b-2
83
	if use newlib-nano ; then
84
		mkdir -p "${NEWLIBNANOBUILD}"
85
		cd "${NEWLIBNANOBUILD}"
86
		export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
87
		export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
88
		ECONF_SOURCE=${S} \
89
		econf \
90
			$(use_enable unicode newlib-mb) \
91
			$(use_enable nls) \
92
			--enable-newlib-reent-small \
93
			--disable-newlib-fvwrite-in-streamio \
94
			--disable-newlib-fseek-optimization \
95
			--disable-newlib-wide-orient \
96
			--enable-newlib-nano-malloc \
97
			--disable-newlib-unbuf-stream-opt \
98
			--enable-lite-exit \
99
			--enable-newlib-global-atexit \
100
			--enable-newlib-nano-formatted-io \
101
			${myconf}
102
	fi
69
}
103
}
70
104
71
src_compile() {
105
src_compile() {
106
	export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
107
	export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
72
	emake -C "${NEWLIBBUILD}"
108
	emake -C "${NEWLIBBUILD}"
109
	if use newlib-nano ; then
110
		export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
111
		export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
112
		emake -C "${NEWLIBNANOBUILD}"
113
	fi
73
}
114
}
74
115
75
src_install() {
116
src_install() {
76
	cd "${NEWLIBBUILD}"
117
	cd "${NEWLIBBUILD}"
77
	emake -j1 DESTDIR="${D}" install
118
	emake -j1 DESTDIR="${D}" install
78
#	env -uRESTRICT CHOST=${CTARGET} prepallstrip
119
#	env -uRESTRICT CHOST=${CTARGET} prepallstrip
120
121
	if use newlib-nano ; then
122
		cd "${NEWLIBNANOBUILD}"
123
		emake -j1 DESTDIR="${NEWLIBNANOTMPINSTALL}" install
124
		# Rename nano lib* files to lib*_nano and move to the real ${D}
125
		# Avoid dependency on perl-rename by using a for loop instead.
126
		local nanolibfiles=""
127
		nanolibfiles=$(find "${NEWLIBNANOTMPINSTALL}" -regex ".*/lib\(c\|g\|rdimon\)\.a" -print)
128
		for f in ${nanolibfiles}; do
129
			local l="${f##${NEWLIBNANOTMPINSTALL}}"
130
			echo mv "${f}" "${D}/${l%%\.a}_nano.a"
131
			mv "${f}" "${D}/${l%%\.a}_nano.a"
132
		done
133
		# Move nano's version of newlib.h to nano/newlib.h
134
		mkdir -p ${D}/usr/${CTARGET}/include/nano
135
		mv ${NEWLIBNANOTMPINSTALL}/usr/${CTARGET}/include/newlib.h \
136
			${D}/usr/${CTARGET}/include/nano/newlib.h
137
138
	fi
139
79
	# minor hack to keep things clean
140
	# minor hack to keep things clean
80
	rm -fR "${D}"/usr/share/info
141
	rm -fR "${D}"/usr/share/info
81
	rm -fR "${D}"/usr/info
142
	rm -fR "${D}"/usr/info

Return to bug 532390