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

(-)a/sys-libs/newlib/newlib-9999.ebuild (-2 / +62 lines)
Lines 29-38 HOMEPAGE="http://sourceware.org/newlib/" 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"
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-57 src_configure() { 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" ]] \
Lines 60-81 src_configure() { Link Here
60
67
61
	mkdir -p "${NEWLIBBUILD}"
68
	mkdir -p "${NEWLIBBUILD}"
62
	cd "${NEWLIBBUILD}"
69
	cd "${NEWLIBBUILD}"
63
70
	export "CFLAGS=${CFLAGS_ORIG} ${CFLAGS_FULL}"
71
	export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
64
	ECONF_SOURCE=${S} \
72
	ECONF_SOURCE=${S} \
65
	econf \
73
	econf \
66
		$(use_enable unicode newlib-mb) \
74
		$(use_enable unicode newlib-mb) \
67
		$(use_enable nls) \
75
		$(use_enable nls) \
76
		--enable-newlib-io-long-long \
77
		--enable-newlib-register-fini \
68
		${myconf}
78
		${myconf}
79
80
	# Build newlib-nano beside newlib (original)
81
	# Based on https://tracker.debian.org/media/packages/n/newlib/rules-2.1.0%2Bgit20140818.1a8323b-2
82
	if use newlib-nano ; then
83
		mkdir -p "${NEWLIBNANOBUILD}"
84
		cd "${NEWLIBNANOBUILD}"
85
		export "CFLAGS=${CFLAGS_ORIG} ${CFLAGS_NANO}"
86
		export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
87
		ECONF_SOURCE=${S} \
88
		econf \
89
			$(use_enable unicode newlib-mb) \
90
			$(use_enable nls) \
91
			--enable-newlib-reent-small \
92
			--disable-newlib-fvwrite-in-streamio \
93
			--disable-newlib-fseek-optimization \
94
			--disable-newlib-wide-orient \
95
			--enable-newlib-nano-malloc \
96
			--disable-newlib-unbuf-stream-opt \
97
			--enable-lite-exit \
98
			--enable-newlib-global-atexit \
99
			--enable-newlib-nano-formatted-io \
100
			${myconf}
101
	fi
69
}
102
}
70
103
71
src_compile() {
104
src_compile() {
105
	export "CFLAGS=${CFLAGS_ORIG} ${CFLAGS_FULL}"
106
	export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
72
	emake -C "${NEWLIBBUILD}"
107
	emake -C "${NEWLIBBUILD}"
108
	if use newlib-nano ; then
109
		export "CFLAGS=${CFLAGS_ORIG} ${CFLAGS_NANO}"
110
		export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
111
		emake -C "${NEWLIBNANOBUILD}"
112
	fi
73
}
113
}
74
114
75
src_install() {
115
src_install() {
76
	cd "${NEWLIBBUILD}"
116
	cd "${NEWLIBBUILD}"
77
	emake -j1 DESTDIR="${D}" install
117
	emake -j1 DESTDIR="${D}" install
78
#	env -uRESTRICT CHOST=${CTARGET} prepallstrip
118
#	env -uRESTRICT CHOST=${CTARGET} prepallstrip
119
120
	if use newlib-nano ; then
121
		cd "${NEWLIBNANOBUILD}"
122
		emake -j1 DESTDIR="${NEWLIBNANOTMPINSTALL}" install
123
		# Rename nano lib* files to lib*_nano and move to the real ${D}
124
		# Avoid dependency on perl-rename by using a for loop instead.
125
		local nanolibfiles=""
126
		nanolibfiles=$(find "${NEWLIBNANOTMPINSTALL}" -regex ".*/lib\(c\|g\|rdimon\)\.a" -print)
127
		for f in ${nanolibfiles}; do
128
			local l="${f##${NEWLIBNANOTMPINSTALL}}"
129
			echo mv "${f}" "${D}/${l%%\.a}_nano.a"
130
			mv "${f}" "${D}/${l%%\.a}_nano.a"
131
		done
132
		# Move nano's version of newlib.h to nano/newlib.h
133
		mkdir -p ${D}/usr/${CTARGET}/include/nano
134
		mv ${NEWLIBNANOTMPINSTALL}/usr/${CTARGET}/include/newlib.h \
135
			${D}/usr/${CTARGET}/include/nano/newlib.h
136
137
	fi
138
79
	# minor hack to keep things clean
139
	# minor hack to keep things clean
80
	rm -fR "${D}"/usr/share/info
140
	rm -fR "${D}"/usr/share/info
81
	rm -fR "${D}"/usr/info
141
	rm -fR "${D}"/usr/info

Return to bug 532390