Patches for aports can be sent to this list

5

[alpine-aports] [PATCH 1/6] testing/binutils-cross-embedded: New aport

Marian Buschsieweke
Details
Message ID
<20190310090125.4589-1-marian.buschsieweke@ovgu.de>
Sender timestamp
1552208480
DKIM signature
missing
Download raw message
Patch: +101 -0
binutils for bare metal targets
---
 testing/binutils-cross-embedded/APKBUILD | 101 +++++++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 testing/binutils-cross-embedded/APKBUILD

diff --git a/testing/binutils-cross-embedded/APKBUILD b/testing/binutils-cross-embedded/APKBUILD
new file mode 100644
index 0000000000..a503e63344
--- /dev/null
+++ b/testing/binutils-cross-embedded/APKBUILD
@@ -0,0 +1,101 @@
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Based on binutils-avr
+_pkgbase=binutils
+_targets="
+	arm-none-eabi
+	mips-mti-elf
+	msp430-elf
+	"
+pkgname="$_pkgbase-cross-embedded"
+pkgver=2.32
+pkgrel=0
+pkgdesc="Tools necessary to build programs for embedded targets"
+url="http://www.gnu.org/software/${_pkgbase}/"
+makedepends="gettext libtool autoconf automake bison zlib-dev"
+arch="all"
+license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
+for target in $_targets; do
+	targetnorm="${target//-/_}"
+	subpackages="${_pkgbase}-${target}:${targetnorm} ${subpackages}"
+done
+source="http://ftp.gnu.org/gnu/${_pkgbase}/${_pkgbase}-${pkgver}.tar.bz2"
+
+builddir="$srcdir/${_pkgbase}-$pkgver"
+
+build() {
+	for target in $_targets; do
+		workingdir="${srcdir}/build-${target}"
+		mkdir "$workingdir"
+		cd "$workingdir"
+		"$builddir"/configure \
+			--target=${target} \
+			--with-sysroot=/usr/$target \
+			--prefix=/usr/ \
+			--infodir=/deleteme/info \
+			--htmldir=/deleteme/html \
+			--pdfdir=/deleteme/pdf \
+			--mandir=/deleteme/man \
+			--with-gnu-as \
+			--with-gnu-ld \
+			--enable-deterministic-archieves \
+			--enable-interwork \
+			--enable-multilib \
+			--enable-plugins \
+			--enable-ld=default \
+			--disable-nls
+		make tooldir=/usr -j 16
+	done
+}
+
+check() {
+	for target in $_targets; do
+		workingdir="${srcdir}/build-${target}"
+		cd "$workingdir"
+		make check
+	done
+}
+
+package() {
+	for target in $_targets; do
+		depends="$depends $_pkgbase-$target"
+	done
+	mkdir -p "${pkgdir}"
+}
+
+_install_subpkg() {
+	target="${subpkgname#${_pkgbase}-}"
+	pkgdesc="Tools necessary to build programs for ${target}"
+	workingdir="${srcdir}/build-${target}"
+	cd "$workingdir"
+	make install DESTDIR="$subpkgdir"
+	rm -rf "$subpkgdir"/deleteme
+	for bin in ar as nm objcopy objdump ranlib strip readelf; do
+		rm -f "$subpkgdir"/usr/bin/"$bin"
+	done
+}
+
+arm_none_eabi() {
+	_install_subpkg
+}
+
+avr() {
+	_install_subpkg
+}
+
+mips_mti_elf() {
+	_install_subpkg
+}
+
+msp430_elf() {
+	_install_subpkg
+}
+
+xtensa_esp32_elf() {
+	_install_subpkg
+}
+
+xtensa_lx106_elf() {
+	_install_subpkg
+}
+
+sha512sums="99ec7ed2b5ebfd3ac16cecb1567ec4a72f81ac30717002d601708f7547b2f8122ffcce076c986f22894aede33c54c73012210a4e973ba9b6e2d87a242a2bee12  binutils-2.32.tar.bz2"
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 2/6] testing/gcc-cross-embedded-stage1: New aport

Marian Buschsieweke
Details
Message ID
<20190310090125.4589-2-marian.buschsieweke@ovgu.de>
In-Reply-To
<20190310090125.4589-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1552208481
DKIM signature
missing
Download raw message
Patch: +145 -0
Intermediate step in building a cross toolchain for bare metal targets.

This is working around cyclic dependencies between GCC and newlib. The
build order is this:

1. binutils-cross-embedded (final package)
2. gcc-cross-embedded-stage1 (intermediate step, needed for step 3)
3. newlib-stage1 (intermediate step, needed for step 4)
4. gcc-cross-embedded (final package)
5. newlib (final package)
---
 testing/gcc-cross-embedded-stage1/APKBUILD | 145 +++++++++++++++++++++
 1 file changed, 145 insertions(+)
 create mode 100644 testing/gcc-cross-embedded-stage1/APKBUILD

diff --git a/testing/gcc-cross-embedded-stage1/APKBUILD b/testing/gcc-cross-embedded-stage1/APKBUILD
new file mode 100644
index 0000000000..22b38c8c2e
--- /dev/null
+++ b/testing/gcc-cross-embedded-stage1/APKBUILD
@@ -0,0 +1,145 @@
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Based upon Alpine's avr-gcc and Arch Linux's arm-none-eabi-gcc, to which
+# the following people contributed:
+# Contributor: Pedro Filipe <xpecex@outlook.com>
+# Contributor: Stefan Wagner <stw@bit-strickerei.de>
+# Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
+# Contributor: Martin Schmölzer <mschmoelzer@gmail.com>
+_pkgbase=gcc
+_targets="
+	arm-none-eabi
+	mips-mti-elf
+	msp430-elf
+	"
+pkgname="$_pkgbase-cross-embedded-stage1"
+pkgver=8.3.0
+pkgrel=0
+pkgdesc="The GNU Compiler Collection for embedded targets"
+url="http://gcc.gnu.org"
+depends="gcc"
+makedepends="bash linux-headers gmp-dev mpfr-dev mpc1-dev zlib-dev"
+arch="all"
+license="GPL-2.0 GPL-3.0-or-later LGPL-2.0"
+for target in $_targets; do
+	targetnorm="${target//-/_}"
+	subpackages="${_pkgbase}-${target}-stage1:${targetnorm} ${subpackages}"
+	makedepends="$makedepends binutils-$target"
+done
+
+_islver=0.20
+source="
+	https://mirrors.kernel.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
+	http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2
+	"
+options="!check"
+
+builddir="$srcdir/$_pkgbase-$pkgver"
+
+prepare() {
+	cd "$builddir"
+	# link isl for in-tree build
+	ln -s "$srcdir"/isl-"$_islver" isl
+
+	# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
+	for dir in libiberty gcc; do
+		sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" $dir/configure
+	done
+}
+
+_build_gcc() {
+	"$builddir"/configure \
+		--target=$target \
+		--prefix=/usr \
+		--with-sysroot=/usr/$target \
+		--with-native-system-header-dir=/include \
+		--with-headers=/usr/$target/include \
+		--with-python-dir=share/gcc-$target \
+		--libexecdir=/usr/lib \
+		--infodir=/deleteme/info \
+		--htmldir=/deleteme/html \
+		--pdfdir=/deleteme/pdf \
+		--mandir=/deleteme/man \
+		--enable-languages=c \
+		--enable-plugins \
+		--enable-gnu-indirect-function \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-multilib \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--disable-werror \
+		--with-gmp \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
+		--with-isl \
+		--with-libelf \
+		--with-mpc \
+		--with-mpfr \
+		--with-newlib \
+		--with-system-zlib \
+		--with-pkgversion='Alpine Linux' \
+		--without-headers
+	make INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0' -j8
+}
+
+build() {
+	for target in $_targets; do
+		workingdir="${srcdir}/build-${target}"
+		mkdir "$workingdir"
+		cd "$workingdir"
+		export CFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections'
+		export CXXFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections'
+		_build_gcc
+	done
+}
+
+package() {
+	for target in $_targets; do
+		depends="$depends $_pkgbase-$target"
+	done
+	mkdir -p "${pkgdir}"
+}
+
+_install_subpkg() {
+	target="${subpkgname#${_pkgbase}-}"
+	target="${target%-stage1}"
+	pkgdesc="The GNU Compiler Collection for $target targets"
+	depends="$depends binutils-$target"
+	workingdir="${srcdir}/build-${target}"
+	cd "$workingdir"
+	make install DESTDIR="$subpkgdir" -j1
+
+	# Delete documentation. (The user can use the host GCC doc instead)
+	rm -rf "$subpkgdir"/deleteme
+	# Delete libcc1.so*, which is already part of the host's gcc
+	rm -f "$subpkgdir"/usr/lib/libcc1.so*
+
+	# Strip libs using target binutils
+	find "$subpkgdir"/usr/lib -type f -name "*.a" -exec /usr/bin/$target-strip --strip-debug '{}' \;
+
+	# Strip executables using host binutils
+	find "$subpkgdir"/usr/bin -type f -executable -exec strip '{}' \;
+}
+
+arm_none_eabi() {
+	_install_subpkg
+}
+
+mips_mti_elf() {
+	_install_subpkg
+}
+
+msp430_elf() {
+	_install_subpkg
+}
+
+sha512sums="1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8dfe7e10be2276b4f62c357659ce2902f239f60a8648548231b4b5802  gcc-8.3.0.tar.xz
+afe2e159b74646a26449268637403d271f9e3f6410d8cc1c9cffca41370c4357b165dea844db0c2a654591f954e54710dda650c8088abd4711406aa6302da950  isl-0.20.tar.bz2"
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 3/6] testing/newlib-stage1: New aport

Marian Buschsieweke
Details
Message ID
<20190310090125.4589-3-marian.buschsieweke@ovgu.de>
In-Reply-To
<20190310090125.4589-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1552208482
DKIM signature
missing
Download raw message
Patch: +144 -0
Intermediate step in building a cross toolchain for bare metal targets.

This is working around cyclic dependencies between GCC and newlib. The
build order is this:

1. binutils-cross-embedded (final package)
2. gcc-cross-embedded-stage1 (intermediate step, needed for step 3)
3. newlib-stage1 (intermediate step, needed for step 4)
4. gcc-cross-embedded (final package)
5. newlib (final package)
---
 testing/newlib-stage1/APKBUILD | 144 +++++++++++++++++++++++++++++++++
 1 file changed, 144 insertions(+)
 create mode 100644 testing/newlib-stage1/APKBUILD

diff --git a/testing/newlib-stage1/APKBUILD b/testing/newlib-stage1/APKBUILD
new file mode 100644
index 0000000000..930074a883
--- /dev/null
+++ b/testing/newlib-stage1/APKBUILD
@@ -0,0 +1,144 @@
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+
+_pkgbase=newlib
+_targets="
+	arm-none-eabi
+	mips-mti-elf
+	msp430-elf
+	"
+pkgname="$_pkgbase-stage1"
+pkgver="3.0.0.20180831"
+pkgrel=0
+pkgdesc="A C standard library implementation intended for use on embedded systems"
+url="http://www.sourceware.org/newlib/"
+makedepends="texinfo"
+arch="all"
+license="BSD"
+source="
+	ftp://sourceware.org/pub/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz
+	"
+options="!check"
+
+for target in $_targets; do
+	targetnorm="${target//-/_}"
+	subpackages="${_pkgbase}-${target}-stage1:${targetnorm} ${subpackages}"
+	makedepends="binutils-${target} gcc-${target}-stage1 ${makedepends}"
+done
+
+builddir="$srcdir/$_pkgbase-$pkgver"
+
+# This package installes two version of the newlib library to remain compatible
+# with projects expecting the GNU ARM Embedded Toolchain [1]. The nano version
+# appends the postix "_nano" to the libaries. The is not an arbitrary choice,
+# it matches the specs in "/usr/arm-none-eabi/lib/nano.specs", which is
+# part of the default newlib installation.
+# [1]: https://launchpad.net/gcc-arm-embedded/
+
+build() {
+	for target in $_targets; do
+		mkdir "${builddir}/build-$target" "${builddir}/build-$target-nano"
+		# nano version
+		cd "${builddir}/build-$target-nano"
+		"$builddir"/configure \
+				--target=$target \
+				--prefix=/usr/ \
+				--infodir=/deleteme/info \
+				--mandir=/deleteme/man \
+				--htmldir=/deleteme/html \
+				--pdfdir=/deleteme/pdf \
+				--disable-newlib-supplied-syscalls \
+				--disable-nls \
+				--disable-newlib-fseek-optimization \
+				--disable-newlib-fvwrite-in-streamio \
+				--disable-newlib-unbuf-stream-opt \
+				--disable-newlib-wide-orient \
+				--enable-lite-exit \
+				--enable-newlib-global-atexit \
+				--enable-newlib-nano-formatted-io \
+				--enable-newlib-nano-malloc \
+				--enable-newlib-reent-small \
+				CC_FOR_TARGET="$target"-gcc \
+				GCC_FOR_TARGET="$target"-gcc \
+				AR_FOR_TARGET="$target"-ar \
+				AS_FOR_TARGET="$target"-as \
+				LD_FOR_TARGET="$target"-ld \
+				NM_FOR_TARGET="$target"-nm \
+				OBJDUMP_FOR_TARGET="$target"-objdump \
+				RANLIB_FOR_TARGET="$target"-ranlib \
+				READELF_FOR_TARGET="$target"-readelf \
+				STRIP_FOR_TARGET="$target"-strip \
+				CFLAGS="-Os -ffunction-sections -fdata-sections -fshort-wchar"
+		make
+
+		# regular version
+		cd "${builddir}/build-$target"
+		"$builddir"/configure \
+				--host=$CHOST \
+				--target=$target \
+				--prefix=/usr \
+				--infodir=/deleteme/info \
+				--mandir=/deleteme/man \
+				--htmldir=/deleteme/html \
+				--pdfdir=/deleteme/pdf \
+				--disable-newlib-supplied-syscalls \
+				--disable-nls \
+				--enable-newlib-io-long-long \
+				--enable-newlib-register-fini \
+				CC_FOR_TARGET="$target"-gcc \
+				GCC_FOR_TARGET="$target"-gcc \
+				AR_FOR_TARGET="$target"-ar \
+				AS_FOR_TARGET="$target"-as \
+				LD_FOR_TARGET="$target"-ld \
+				NM_FOR_TARGET="$target"-nm \
+				OBJDUMP_FOR_TARGET="$target"-objdump \
+				RANLIB_FOR_TARGET="$target"-ranlib \
+				READELF_FOR_TARGET="$target"-readelf \
+				STRIP_FOR_TARGET="$target"-strip \
+				CFLAGS="-O2 -ffunction-sections -fdata-sections -pipe"
+		make
+	done
+}
+
+package() {
+	for target in $_targets; do
+		depends="$depends $_pkgbase-$target"
+	done
+	mkdir -p "$pkgdir"
+}
+
+_install_subpkg() {
+	pkgdesc="A C standard library implementation intended for ${target}"
+	target="${subpkgname#$_pkgbase-}"
+	target="${target%-stage1}"
+	mkdir -p "$subpkgdir"
+	# install nano version
+	cd "${builddir}/build-${target}-nano"
+	make -j1 DESTDIR="$subpkgdir" install
+	# rename nano version libs
+	cd "${subpkgdir}/usr/$target/lib"
+	for file in $(find . -regex ".*\(c\|g\|rdimon\)\.a"); do
+		mv "$file" "${file%.a}_nano.a"
+	done
+	mkdir -p "${subpkgdir}/usr/$target/include/nano"
+	mv "${subpkgdir}/usr/$target/include/newlib.h" \
+	   "${subpkgdir}/usr/$target/include/nano/"
+
+	# install regular version
+	cd "${builddir}/build-${target}"
+	make -j1 DESTDIR="$subpkgdir" install
+	rm -rf "${subpkgdir}/deleteme"
+}
+
+arm_none_eabi() {
+	_install_subpkg
+}
+
+mips_mti_elf() {
+	_install_subpkg
+}
+
+msp430_elf() {
+	_install_subpkg
+}
+
+sha512sums="c195111ac61458fccbd700345cd8ed7806776b3d16557e9a86fbcdf0ff5f544bff7eb701e84defb3f6b4d6fc00674163fa89aead1b171ed3281470a4f6306d1f  newlib-3.0.0.20180831.tar.gz"
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 4/6] testing/gcc-cross-embedded: New aport

Marian Buschsieweke
Details
Message ID
<20190310090125.4589-4-marian.buschsieweke@ovgu.de>
In-Reply-To
<20190310090125.4589-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1552208483
DKIM signature
missing
Download raw message
Patch: +166 -0
Cross compilers for bare metal targets. This package contains the
subpackages gcc-arm-none-eabi, gcc-mips-mti-elf, and gcc-msp430-elf.
The bare metal ARM toolchain is tested and fully functional, the others
are a proof of concept and not tested (due to lack of hardware).
---
 testing/gcc-cross-embedded/APKBUILD | 166 ++++++++++++++++++++++++++++
 1 file changed, 166 insertions(+)
 create mode 100644 testing/gcc-cross-embedded/APKBUILD

diff --git a/testing/gcc-cross-embedded/APKBUILD b/testing/gcc-cross-embedded/APKBUILD
new file mode 100644
index 0000000000..1237e2b3d0
--- /dev/null
+++ b/testing/gcc-cross-embedded/APKBUILD
@@ -0,0 +1,166 @@
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+# Based upon Alpine's avr-gcc and Arch Linux's arm-none-eabi-gcc, to which
+# the following people contributed:
+# Contributor: Pedro Filipe <xpecex@outlook.com>
+# Contributor: Stefan Wagner <stw@bit-strickerei.de>
+# Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
+# Contributor: Martin Schmölzer <mschmoelzer@gmail.com>
+_pkgbase=gcc
+_targets="
+	arm-none-eabi
+	mips-mti-elf
+	msp430-elf
+	"
+pkgname="$_pkgbase-cross-embedded"
+pkgver=8.3.0
+pkgrel=0
+pkgdesc="The GNU Compiler Collection for embedded targets"
+url="http://gcc.gnu.org"
+depends="gcc"
+makedepends="bash linux-headers gmp-dev mpfr-dev mpc1-dev zlib-dev"
+arch="all"
+license="GPL-2.0 GPL-3.0-or-later LGPL-2.0"
+for target in $_targets; do
+	targetnorm="${target//-/_}"
+	subpackages="${_pkgbase}-${target}:${targetnorm} ${subpackages}"
+	makedepends="$makedepends binutils-$target newlib-$target-stage1"
+done
+
+_islver=0.20
+source="https://mirrors.kernel.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
+	http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2"
+
+options="!check"
+
+builddir="$srcdir/$_pkgbase-$pkgver"
+
+prepare() {
+	cd "$builddir"
+	# link isl for in-tree build
+	ln -s "$srcdir"/isl-"$_islver" isl
+
+	# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
+	for dir in libiberty gcc; do
+		sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" $dir/configure
+	done
+}
+
+_build_gcc() {
+	"$builddir"/configure \
+		--target=$target \
+		--prefix=/usr \
+		--with-sysroot=/usr/$target \
+		--with-native-system-header-dir=/include \
+		--with-headers=/usr/$target/include \
+		--with-python-dir=share/gcc-$target \
+		--libexecdir=/usr/lib \
+		--infodir=/deleteme/info \
+		--htmldir=/deleteme/html \
+		--pdfdir=/deleteme/pdf \
+		--mandir=/deleteme/man \
+		--enable-languages=c,c++ \
+		--enable-plugins \
+		--enable-gnu-indirect-function \
+		--disable-decimal-float \
+		--disable-libffi \
+		--disable-libgomp \
+		--disable-libmudflap \
+		--disable-libquadmath \
+		--disable-libssp \
+		--disable-libstdcxx-pch \
+		--disable-nls \
+		--disable-shared \
+		--disable-threads \
+		--disable-tls \
+		--disable-werror \
+		--with-gmp \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
+		--with-isl \
+		--with-libelf \
+		--with-mpc \
+		--with-mpfr \
+		--with-multilib-list=rmprofile \
+		--with-newlib \
+		--with-system-zlib \
+		--with-pkgversion='Alpine Linux'
+	make INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
+}
+
+build() {
+	for target in $_targets; do
+		# Build "regular" variant
+		workingdir="${srcdir}/build-${target}"
+		mkdir "$workingdir"
+		cd "$workingdir"
+		export CFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections'
+		export CXXFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections'
+		_build_gcc
+
+		# Rebuild without exceptions to generate nano variant of libstc++
+		workingdir="${srcdir}/build-${target}-nano"
+		mkdir "$workingdir"
+		cd "$workingdir"
+		export CFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections  -fno-exceptions'
+		export CXXFLAGS_FOR_TARGET='-pipe -Os -ffunction-sections -fdata-sections  -fno-exceptions'
+		_build_gcc
+	done
+}
+
+package() {
+	for target in $_targets; do
+		depends="$depends $_pkgbase-$target"
+	done
+	mkdir -p "${pkgdir}"
+}
+
+_install_subpkg() {
+	target="${subpkgname#${_pkgbase}-}"
+	pkgdesc="The GNU Compiler Collection for $target targets"
+	depends="$depends binutils-$target"
+	workingdir="${srcdir}/build-${target}"
+	cd "$workingdir"
+	make install DESTDIR="$subpkgdir" -j1
+
+	# install nano-variant into temporary folder to obtain libstdc++ from there
+	workingdir="${srcdir}/build-${target}-nano"
+	cd "$workingdir"
+	make install DESTDIR="$subpkgdir-nano" -j1
+
+	# Fetch libstdc++ from nano variant
+	multilibs=$($subpkgdir/usr/bin/$target-gcc -print-multi-lib 2>/dev/null)
+	for multilib in $multilibs; do
+		dir="${multilib%%;*}"
+		from_dir=$subpkgdir-nano/usr/$target/lib/$dir
+		to_dir=$subpkgdir/usr/$target/lib/$dir
+		cp -f $from_dir/libstdc++.a $to_dir/libstdc++_nano.a
+		cp -f $from_dir/libsupc++.a $to_dir/libsupc++_nano.a
+	done
+
+	# Delete documentation. (The user can use the host GCC doc instead)
+	rm -rf "$subpkgdir"/deleteme
+	# Delete libcc1.so*, which is already part of the host's gcc
+	rm -f "$subpkgdir"/usr/lib/libcc1.so*
+
+	# Strip libs using target binutils
+	find "$subpkgdir"/usr/lib -type f -name "*.a" -exec /usr/bin/$target-strip --strip-debug '{}' \;
+
+	# Strip executables using host binutils
+	find "$subpkgdir"/usr/bin -type f -executable -exec strip '{}' \;
+}
+
+arm_none_eabi() {
+	_install_subpkg
+}
+
+mips_mti_elf() {
+	_install_subpkg
+}
+
+msp430_elf() {
+	_install_subpkg
+}
+
+sha512sums="1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8dfe7e10be2276b4f62c357659ce2902f239f60a8648548231b4b5802  gcc-8.3.0.tar.xz
+afe2e159b74646a26449268637403d271f9e3f6410d8cc1c9cffca41370c4357b165dea844db0c2a654591f954e54710dda650c8088abd4711406aa6302da950  isl-0.20.tar.bz2"
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 5/6] testing/newlib: New aport

Marian Buschsieweke
Details
Message ID
<20190310090125.4589-5-marian.buschsieweke@ovgu.de>
In-Reply-To
<20190310090125.4589-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1552208484
DKIM signature
missing
Download raw message
Patch: +143 -0
C library for embedded targets
---
 testing/newlib/APKBUILD | 143 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 143 insertions(+)
 create mode 100644 testing/newlib/APKBUILD

diff --git a/testing/newlib/APKBUILD b/testing/newlib/APKBUILD
new file mode 100644
index 0000000000..f0cdfb92aa
--- /dev/null
+++ b/testing/newlib/APKBUILD
@@ -0,0 +1,143 @@
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+
+_pkgbase=newlib
+_targets="
+	mips-mti-elf
+	msp430-elf
+	arm-none-eabi
+	"
+pkgname="$_pkgbase"
+pkgver="3.0.0.20180831"
+pkgrel=0
+pkgdesc="A C standard library implementation intended for use on embedded systems"
+url="http://www.sourceware.org/newlib/"
+makedepends="texinfo"
+arch="all"
+license="BSD"
+source="
+	ftp://sourceware.org/pub/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz
+	"
+options="!check"
+
+for target in $_targets; do
+	targetnorm="${target//-/_}"
+	subpackages="${_pkgbase}-${target}:${targetnorm} ${subpackages}"
+	depends="binutils-${target} gcc-${target} ${depends}"
+done
+
+builddir="$srcdir/$_pkgbase-$pkgver"
+
+# This package installes two version of the newlib library to remain compatible
+# with projects expecting the GNU ARM Embedded Toolchain [1]. The nano version
+# appends the postix "_nano" to the libaries. The is not an arbitrary choice,
+# it matches the specs in "/usr/arm-none-eabi/lib/nano.specs", which is
+# part of the default newlib installation.
+# [1]: https://launchpad.net/gcc-arm-embedded/
+
+build() {
+	for target in $_targets; do
+		mkdir "${builddir}/build-$target" "${builddir}/build-$target-nano"
+		# nano version
+		cd "${builddir}/build-$target-nano"
+		"$builddir"/configure \
+				--target=$target \
+				--prefix=/usr/ \
+				--infodir=/deleteme/info \
+				--mandir=/deleteme/man \
+				--htmldir=/deleteme/html \
+				--pdfdir=/deleteme/pdf \
+				--disable-newlib-supplied-syscalls \
+				--disable-nls \
+				--disable-newlib-fseek-optimization \
+				--disable-newlib-fvwrite-in-streamio \
+				--disable-newlib-unbuf-stream-opt \
+				--disable-newlib-wide-orient \
+				--enable-lite-exit \
+				--enable-newlib-global-atexit \
+				--enable-newlib-nano-formatted-io \
+				--enable-newlib-nano-malloc \
+				--enable-newlib-reent-small \
+				CC_FOR_TARGET="$target"-gcc \
+				GCC_FOR_TARGET="$target"-gcc \
+				AR_FOR_TARGET="$target"-ar \
+				AS_FOR_TARGET="$target"-as \
+				LD_FOR_TARGET="$target"-ld \
+				NM_FOR_TARGET="$target"-nm \
+				OBJDUMP_FOR_TARGET="$target"-objdump \
+				RANLIB_FOR_TARGET="$target"-ranlib \
+				READELF_FOR_TARGET="$target"-readelf \
+				STRIP_FOR_TARGET="$target"-strip \
+				CFLAGS="-Os -ffunction-sections -fdata-sections -fshort-wchar"
+		make
+
+		# regular version
+		cd "${builddir}/build-$target"
+		"$builddir"/configure \
+				--host=$CHOST \
+				--target=$target \
+				--prefix=/usr \
+				--infodir=/deleteme/info \
+				--mandir=/deleteme/man \
+				--htmldir=/deleteme/html \
+				--pdfdir=/deleteme/pdf \
+				--disable-newlib-supplied-syscalls \
+				--disable-nls \
+				--enable-newlib-io-long-long \
+				--enable-newlib-register-fini \
+				CC_FOR_TARGET="$target"-gcc \
+				GCC_FOR_TARGET="$target"-gcc \
+				AR_FOR_TARGET="$target"-ar \
+				AS_FOR_TARGET="$target"-as \
+				LD_FOR_TARGET="$target"-ld \
+				NM_FOR_TARGET="$target"-nm \
+				OBJDUMP_FOR_TARGET="$target"-objdump \
+				RANLIB_FOR_TARGET="$target"-ranlib \
+				READELF_FOR_TARGET="$target"-readelf \
+				STRIP_FOR_TARGET="$target"-strip \
+				CFLAGS="-O2 -ffunction-sections -fdata-sections -pipe"
+		make
+	done
+}
+
+package() {
+	for target in $_targets; do
+		depends="$depends $_pkgbase-$target"
+	done
+	mkdir -p "$pkgdir"
+}
+
+_install_subpkg() {
+	pkgdesc="A C standard library implementation intended for ${target}"
+	target="${subpkgname#$_pkgbase-}"
+	mkdir -p "$subpkgdir"
+	# install nano version
+	cd "${builddir}/build-${target}-nano"
+	make -j1 DESTDIR="$subpkgdir" install
+	# rename nano version libs
+	cd "${subpkgdir}/usr/$target/lib"
+	for file in $(find . -regex ".*\(c\|g\|rdimon\)\.a"); do
+		mv "$file" "${file%.a}_nano.a"
+	done
+	mkdir -p "${subpkgdir}/usr/$target/include/nano"
+	mv "${subpkgdir}/usr/$target/include/newlib.h" \
+	   "${subpkgdir}/usr/$target/include/nano/"
+
+	# install regular version
+	cd "${builddir}/build-${target}"
+	make -j1 DESTDIR="$subpkgdir" install
+	rm -rf "${subpkgdir}/deleteme"
+}
+
+arm_none_eabi() {
+	_install_subpkg
+}
+
+mips_mti_elf() {
+	_install_subpkg
+}
+
+msp430_elf() {
+	_install_subpkg
+}
+
+sha512sums="c195111ac61458fccbd700345cd8ed7806776b3d16557e9a86fbcdf0ff5f544bff7eb701e84defb3f6b4d6fc00674163fa89aead1b171ed3281470a4f6306d1f  newlib-3.0.0.20180831.tar.gz"
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 6/6] testing/gdb-embedded: New aport

Marian Buschsieweke
Details
Message ID
<20190310090125.4589-6-marian.buschsieweke@ovgu.de>
In-Reply-To
<20190310090125.4589-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1552208485
DKIM signature
missing
Download raw message
Patch: +102 -0
GDB for embedded targets
---
 testing/gdb-embedded/APKBUILD | 102 ++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 testing/gdb-embedded/APKBUILD

diff --git a/testing/gdb-embedded/APKBUILD b/testing/gdb-embedded/APKBUILD
new file mode 100644
index 0000000000..f5584ecd41
--- /dev/null
+++ b/testing/gdb-embedded/APKBUILD
@@ -0,0 +1,102 @@
+# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+_pkgbase=gdb
+_targets="
+	arm-none-eabi
+	avr
+	mips-mti-elf
+	msp430-elf
+	"
+pkgname="$_pkgbase-embedded"
+pkgver=8.2.1
+pkgrel=0
+pkgdesc="The GNU Debugger for embedded targets"
+url="https://www.sourceware.org/gdb/"
+arch="all"
+license="GPL-2.0-only GPL-2.0-or-later GPL-3.0-only GPL-3.0-or-later LGPL-2.1-only"
+depends="gdb"
+makedepends="
+	autoconf
+	automake
+	expat-dev
+	libtool
+	linux-headers
+	ncurses-dev
+	perl
+	python3-dev
+	readline-dev
+	texinfo
+	zlib-dev
+	"
+options="!check"
+source="https://ftp.gnu.org/gnu/$_pkgbase/$_pkgbase-$pkgver.tar.xz"
+for target in $_targets; do
+	targetnorm="${target//-/_}"
+	subpackages="${_pkgbase}-${target}:${targetnorm} ${subpackages}"
+done
+builddir="$srcdir"/$_pkgbase-$pkgver
+
+build () {
+	for target in $_targets; do
+		mkdir -p "$srcdir/build/$target"
+		cd "$srcdir/build/$target"
+
+		"$builddir/configure" \
+			--target=$target \
+			--prefix=/usr \
+			--mandir=/deleteme/man \
+			--infodir=/deleteme/info \
+			--pdfdir=/deleteme/pdf \
+			--htmldir=/deleteme/html \
+			--disable-nls \
+			--disable-werror \
+			--enable-interwork \
+			--enable-languages=c,c++ \
+			--enable-multilib \
+			--with-python=/usr/bin/python3 \
+			--with-system-gdbinit=/etc/gdb/gdbinit \
+			--with-system-readline \
+			--with-system-zlib
+		make
+	done
+}
+
+package() {
+	for target in $_targets; do
+		depends="$depends $_pkgbase-$target"
+	done
+	mkdir -p "$pkgdir"
+}
+
+_install_subpkg() {
+	target="${subpkgname#${_pkgbase}-}"
+	pkgdesc="The GNU Debugger for $target"
+	cd "$srcdir/build/$target"
+	make DESTDIR="$subpkgdir" install
+
+	rm -rf "$subpkgdir"/deleteme
+
+	# those are provided by gdb
+	rm -rf "$subpkgdir"/usr/share
+	# those are provided by binutils
+	rm -rf "$subpkgdir"/usr/include
+	rm -rf "$subpkgdir"/usr/lib
+}
+
+arm_none_eabi() {
+	_install_subpkg
+}
+
+avr() {
+	_install_subpkg
+}
+
+mips_mti_elf() {
+	_install_subpkg
+}
+
+msp430_elf() {
+	_install_subpkg
+}
+
+
+sha512sums="2aa81cfd389bb48c35d7d9f95cc10e88b4f7ad4597bdde0f8f1fd312f60f10d9fb2cc6e5a9355227d89ff328f7feb0fc411a69394560cafeb9fa75d35d896d11  gdb-8.2.1.tar.xz"
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---