summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaman <perfinion@gentoo.org>2018-03-14 23:33:11 +0800
committerJason Zaman <perfinion@gentoo.org>2018-03-15 00:06:18 +0800
commit791f828192341cfdbe896cd266b9e786ecb84e2e (patch)
tree7d6f2d079e3db45c2989ee94df27167c213eb994 /sys-libs/newlib
parentnet-fs/samba: addc and ads USE flags now require winbind as well. (diff)
downloadgentoo-791f828192341cfdbe896cd266b9e786ecb84e2e.tar.gz
gentoo-791f828192341cfdbe896cd266b9e786ecb84e2e.tar.bz2
gentoo-791f828192341cfdbe896cd266b9e786ecb84e2e.zip
sys-libs/newlib: Add support for newlib-nano
Closes: https://bugs.gentoo.org/532390 Package-Manager: Portage-2.3.24, Repoman-2.3.6
Diffstat (limited to 'sys-libs/newlib')
-rw-r--r--sys-libs/newlib/metadata.xml9
-rw-r--r--sys-libs/newlib/newlib-2.5.0.ebuild66
-rw-r--r--sys-libs/newlib/newlib-9999.ebuild66
3 files changed, 130 insertions, 11 deletions
diff --git a/sys-libs/newlib/metadata.xml b/sys-libs/newlib/metadata.xml
index 5025963793d5..b0a7c56f4a9d 100644
--- a/sys-libs/newlib/metadata.xml
+++ b/sys-libs/newlib/metadata.xml
@@ -2,10 +2,13 @@
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
-<email>lu_zero@gentoo.org</email>
+ <email>lu_zero@gentoo.org</email>
</maintainer>
<maintainer type="project">
-<email>toolchain@gentoo.org</email>
-<name>Gentoo Toolchain Project</name>
+ <email>toolchain@gentoo.org</email>
+ <name>Gentoo Toolchain Project</name>
</maintainer>
+<use>
+ <flag name="nano">Build additional newlib-nano library</flag>
+</use>
</pkgmetadata>
diff --git a/sys-libs/newlib/newlib-2.5.0.ebuild b/sys-libs/newlib/newlib-2.5.0.ebuild
index 51c3318e2020..e59c79299cbf 100644
--- a/sys-libs/newlib/newlib-2.5.0.ebuild
+++ b/sys-libs/newlib/newlib-2.5.0.ebuild
@@ -28,10 +28,15 @@ HOMEPAGE="https://sourceware.org/newlib/"
LICENSE="NEWLIB LIBGLOSS GPL-2"
SLOT="0"
-IUSE="nls threads unicode headers-only"
+IUSE="nls threads unicode headers-only nano"
RESTRICT="strip"
NEWLIBBUILD="${WORKDIR}/build"
+NEWLIBNANOBUILD="${WORKDIR}/build.nano"
+NEWLIBNANOTMPINSTALL="${WORKDIR}/nano_tmp_install"
+
+CFLAGS_FULL="-ffunction-sections -fdata-sections"
+CFLAGS_NANO="-Os -ffunction-sections -fdata-sections"
pkg_setup() {
# Reject newlib-on-glibc type installs
@@ -47,6 +52,8 @@ src_configure() {
# we should fix this ...
unset LDFLAGS
CHOST=${CTARGET} strip-unsupported-flags
+ CCASFLAGS_ORIG="${CCASFLAGS}"
+ CFLAGS_ORIG="${CFLAGS}"
local myconf=(
# Disable legacy syscall stub code in newlib. These have been
@@ -61,22 +68,73 @@ src_configure() {
mkdir -p "${NEWLIBBUILD}"
cd "${NEWLIBBUILD}"
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
ECONF_SOURCE=${S} \
econf \
$(use_enable unicode newlib-mb) \
$(use_enable nls) \
"${myconf[@]}"
+
+ # Build newlib-nano beside newlib (original)
+ # Based on https://tracker.debian.org/media/packages/n/newlib/rules-2.1.0%2Bgit20140818.1a8323b-2
+ if use nano ; then
+ mkdir -p "${NEWLIBNANOBUILD}" || die
+ cd "${NEWLIBNANOBUILD}" || die
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ --enable-newlib-reent-small \
+ --disable-newlib-fvwrite-in-streamio \
+ --disable-newlib-fseek-optimization \
+ --disable-newlib-wide-orient \
+ --enable-newlib-nano-malloc \
+ --disable-newlib-unbuf-stream-opt \
+ --enable-lite-exit \
+ --enable-newlib-global-atexit \
+ --enable-newlib-nano-formatted-io \
+ ${myconf}
+ fi
}
src_compile() {
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
emake -C "${NEWLIBBUILD}"
+
+ if use nano ; then
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
+ emake -C "${NEWLIBNANOBUILD}"
+ fi
}
src_install() {
- cd "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}" || die
emake -j1 DESTDIR="${D}" install
# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+
+ if use nano ; then
+ cd "${NEWLIBNANOBUILD}" || die
+ emake -j1 DESTDIR="${NEWLIBNANOTMPINSTALL}" install
+ # Rename nano lib* files to lib*_nano and move to the real ${D}
+ local nanolibfiles=""
+ nanolibfiles=$(find "${NEWLIBNANOTMPINSTALL}" -regex ".*/lib\(c\|g\|rdimon\)\.a" -print)
+ for f in ${nanolibfiles}; do
+ local l="${f##${NEWLIBNANOTMPINSTALL}}"
+ mv -v "${f}" "${D}/${l%%\.a}_nano.a" || die
+ done
+
+ # Move newlib-nano's version of newlib.h to newlib-nano/newlib.h
+ mkdir -p "${D}/usr/${CTARGET}/include/newlib-nano" || die
+ mv "${NEWLIBNANOTMPINSTALL}/usr/${CTARGET}/include/newlib.h" \
+ "${D}/usr/${CTARGET}/include/newlib-nano/newlib.h" || die
+ fi
+
# minor hack to keep things clean
- rm -fR "${D}"/usr/share/info
- rm -fR "${D}"/usr/info
+ rm -rf "${D}"/usr/share/info || die
+ rm -rf "${D}"/usr/info || die
}
diff --git a/sys-libs/newlib/newlib-9999.ebuild b/sys-libs/newlib/newlib-9999.ebuild
index 51c3318e2020..e59c79299cbf 100644
--- a/sys-libs/newlib/newlib-9999.ebuild
+++ b/sys-libs/newlib/newlib-9999.ebuild
@@ -28,10 +28,15 @@ HOMEPAGE="https://sourceware.org/newlib/"
LICENSE="NEWLIB LIBGLOSS GPL-2"
SLOT="0"
-IUSE="nls threads unicode headers-only"
+IUSE="nls threads unicode headers-only nano"
RESTRICT="strip"
NEWLIBBUILD="${WORKDIR}/build"
+NEWLIBNANOBUILD="${WORKDIR}/build.nano"
+NEWLIBNANOTMPINSTALL="${WORKDIR}/nano_tmp_install"
+
+CFLAGS_FULL="-ffunction-sections -fdata-sections"
+CFLAGS_NANO="-Os -ffunction-sections -fdata-sections"
pkg_setup() {
# Reject newlib-on-glibc type installs
@@ -47,6 +52,8 @@ src_configure() {
# we should fix this ...
unset LDFLAGS
CHOST=${CTARGET} strip-unsupported-flags
+ CCASFLAGS_ORIG="${CCASFLAGS}"
+ CFLAGS_ORIG="${CFLAGS}"
local myconf=(
# Disable legacy syscall stub code in newlib. These have been
@@ -61,22 +68,73 @@ src_configure() {
mkdir -p "${NEWLIBBUILD}"
cd "${NEWLIBBUILD}"
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
ECONF_SOURCE=${S} \
econf \
$(use_enable unicode newlib-mb) \
$(use_enable nls) \
"${myconf[@]}"
+
+ # Build newlib-nano beside newlib (original)
+ # Based on https://tracker.debian.org/media/packages/n/newlib/rules-2.1.0%2Bgit20140818.1a8323b-2
+ if use nano ; then
+ mkdir -p "${NEWLIBNANOBUILD}" || die
+ cd "${NEWLIBNANOBUILD}" || die
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ --enable-newlib-reent-small \
+ --disable-newlib-fvwrite-in-streamio \
+ --disable-newlib-fseek-optimization \
+ --disable-newlib-wide-orient \
+ --enable-newlib-nano-malloc \
+ --disable-newlib-unbuf-stream-opt \
+ --enable-lite-exit \
+ --enable-newlib-global-atexit \
+ --enable-newlib-nano-formatted-io \
+ ${myconf}
+ fi
}
src_compile() {
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
emake -C "${NEWLIBBUILD}"
+
+ if use nano ; then
+ export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
+ export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
+ emake -C "${NEWLIBNANOBUILD}"
+ fi
}
src_install() {
- cd "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}" || die
emake -j1 DESTDIR="${D}" install
# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+
+ if use nano ; then
+ cd "${NEWLIBNANOBUILD}" || die
+ emake -j1 DESTDIR="${NEWLIBNANOTMPINSTALL}" install
+ # Rename nano lib* files to lib*_nano and move to the real ${D}
+ local nanolibfiles=""
+ nanolibfiles=$(find "${NEWLIBNANOTMPINSTALL}" -regex ".*/lib\(c\|g\|rdimon\)\.a" -print)
+ for f in ${nanolibfiles}; do
+ local l="${f##${NEWLIBNANOTMPINSTALL}}"
+ mv -v "${f}" "${D}/${l%%\.a}_nano.a" || die
+ done
+
+ # Move newlib-nano's version of newlib.h to newlib-nano/newlib.h
+ mkdir -p "${D}/usr/${CTARGET}/include/newlib-nano" || die
+ mv "${NEWLIBNANOTMPINSTALL}/usr/${CTARGET}/include/newlib.h" \
+ "${D}/usr/${CTARGET}/include/newlib-nano/newlib.h" || die
+ fi
+
# minor hack to keep things clean
- rm -fR "${D}"/usr/share/info
- rm -fR "${D}"/usr/info
+ rm -rf "${D}"/usr/share/info || die
+ rm -rf "${D}"/usr/info || die
}