diff options
-rw-r--r-- | mk/vars.mk | 3 | ||||
-rw-r--r-- | target/config/Config.in.libc | 23 | ||||
-rw-r--r-- | toolchain/Makefile | 4 | ||||
-rw-r--r-- | toolchain/gcc/Makefile | 8 | ||||
-rw-r--r-- | toolchain/newlib/Makefile | 39 | ||||
-rw-r--r-- | toolchain/newlib/Makefile.inc | 18 | ||||
-rw-r--r-- | toolchain/newlib/patches/2.2.0/disable-docs.patch | 14 | ||||
-rw-r--r-- | toolchain/newlib/patches/2.2.0/fix-tooldir.patch | 12 |
8 files changed, 120 insertions, 1 deletions
diff --git a/mk/vars.mk b/mk/vars.mk index 16f6c37c5..29826cf5b 100644 --- a/mk/vars.mk +++ b/mk/vars.mk @@ -75,6 +75,9 @@ GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_LINUXTYPE)-$ ifeq ($(ADK_TARGET_ARCH_C6X),y) GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_TARGET_LINUXTYPE) endif +ifeq ($(ADK_TARGET_LIB_NEWLIB),y) +GNU_TARGET_NAME:= $(ADK_TARGET_CPU_ARCH)-$(ADK_VENDOR)-$(ADK_TARGET_SUFFIX) +endif TARGET_CROSS:= $(TOOLCHAIN_DIR)/usr/bin/$(GNU_TARGET_NAME)- TARGET_COMPILER_PREFIX?=${TARGET_CROSS} CONFIGURE_TRIPLE:= --build=${GNU_HOST_NAME} \ diff --git a/target/config/Config.in.libc b/target/config/Config.in.libc index 63bd73b5a..4dc29b38e 100644 --- a/target/config/Config.in.libc +++ b/target/config/Config.in.libc @@ -47,6 +47,13 @@ config ADK_TARGET_LIB_GLIBC help http://www.gnu.org/libc +config ADK_TARGET_LIB_NEWLIB + bool "newlib C library" + select ADK_TARGET_WITHOUT_CXX + select ADK_TARGET_LIB_WITHOUT_THREADS + help + https://sourceware.org/newlib/ + endchoice choice @@ -103,11 +110,20 @@ config ADK_TARGET_LIB_MUSL_GIT bool "git" depends on ADK_TARGET_LIB_MUSL +config ADK_TARGET_LIB_NEWLIB_2_2_0 + bool "2.2.0" + depends on ADK_TARGET_LIB_NEWLIB + +config ADK_TARGET_LIB_NEWLIB_GIT + bool "git" + depends on ADK_TARGET_LIB_NEWLIB + endchoice choice prompt "Threading" depends on ADK_TARGET_LIB_UCLIBC_NG && !ADK_TARGET_WITHOUT_THREADS +depends on ADK_TARGET_LIB_NEWLIB config ADK_TARGET_LIB_WITH_THREADS bool "enable threads" @@ -134,6 +150,7 @@ config ADK_TARGET_LIBC default "uclibc-ng" if ADK_TARGET_LIB_UCLIBC_NG default "glibc" if ADK_TARGET_LIB_GLIBC default "musl" if ADK_TARGET_LIB_MUSL + default "newlib" if ADK_TARGET_LIB_NEWLIB config ADK_LIBC_VERSION string @@ -146,9 +163,11 @@ config ADK_LIBC_VERSION default "2.22" if ADK_TARGET_LIB_GLIBC_2_22 default "2.21" if ADK_TARGET_LIB_GLIBC_2_21 default "2.20" if ADK_TARGET_LIB_GLIBC_2_20 + default "2.2.0" if ADK_TARGET_LIB_NEWLIB_2_2_0 default "git" if ADK_TARGET_LIB_UCLIBC_NG_GIT || \ ADK_TARGET_LIB_MUSL_GIT || \ - ADK_TARGET_LIB_GLIBC_GIT + ADK_TARGET_LIB_GLIBC_GIT || \ + ADK_TARGET_LIB_NEWLIB_GIT config ADK_TARGET_LIB_UCLIBC_NG_1_0 bool @@ -181,3 +200,5 @@ config ADK_TARGET_SUFFIX default "musl32" if ADK_TARGET_LIB_MUSL && ADK_TARGET_ABI_32 && ADK_LINUX_64 default "muslx32" if ADK_TARGET_LIB_MUSL && ADK_TARGET_ABI_X32 && ADK_LINUX_64 default "musl" if ADK_TARGET_LIB_MUSL + default "eabi" if ADK_TARGET_LIB_NEWLIB && ADK_TARGET_ARCH_ARM + default "elf" if ADK_TARGET_LIB_NEWLIB diff --git a/toolchain/Makefile b/toolchain/Makefile index e81b2b073..088f563e3 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -26,6 +26,10 @@ ifeq ($(ADK_TARGET_LIB_MUSL),y) TARGETS+=musl CLIB:=musl endif +ifeq ($(ADK_TARGET_LIB_NEWLIB),y) +TARGETS+=newlib +CLIB:=newlib +endif ifeq ($(ADK_TARGET_BINFMT_FLAT),y) TARGETS+=elf2flt diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index 079ddd0e5..d5375751c 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -56,6 +56,10 @@ GCC_CONFOPTS:= --prefix=$(TOOLCHAIN_DIR)/usr \ --without-isl \ --disable-nls +ifeq ($(ADK_TARGET_LIB_NEWLIB),y) +GCC_FINAL_CONFOPTS:= --with-newlib +endif + ifeq ($(ADK_TARGET_WITH_NPTL),y) GCC_FINAL_CONFOPTS:= --enable-tls --enable-threads --enable-libatomic endif @@ -255,6 +259,10 @@ else PATH='$(TARGET_PATH)' \ $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install-gcc install-target-libgcc endif + # required for newlib + (cd $(TOOLCHAIN_DIR)/usr/bin && \ + ln -sf $(GNU_TARGET_NAME)-gcc $(GNU_TARGET_NAME)-cc \ + ) ifeq ($(ADK_TARGET_ARCH_M68K),y) # create gcc wrapper for uClinux/m68k echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc diff --git a/toolchain/newlib/Makefile b/toolchain/newlib/Makefile new file mode 100644 index 000000000..246927667 --- /dev/null +++ b/toolchain/newlib/Makefile @@ -0,0 +1,39 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(ADK_TOPDIR)/rules.mk +include ../rules.mk +include Makefile.inc +include ${ADK_TOPDIR}/mk/buildhlp.mk + +$(WRKBUILD)/.configured: + (cd $(WRKBUILD); \ + CC='' \ + CFLAGS='' \ + LDFLAGS='' \ + have_doc='' \ + ./configure --prefix=/usr \ + --target=$(GNU_TARGET_NAME) \ + --enable-newlib-io-long-long \ + --enable-newlib-register-fini \ + --disable-newlib-supplied-syscalls \ + --disable-nls \ + ) + touch $@ + +$(WRKBUILD)/.compiled: + PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \ + CC='' \ + CFLAGS='$(TARGET_CFLAGS)' \ + all + touch $@ + +$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled + PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \ + CC='' \ + CFLAGS='$(TARGET_CFLAGS)' \ + DESTDIR=$(STAGING_TARGET_DIR) \ + install + touch $@ + +include ${ADK_TOPDIR}/mk/toolchain.mk diff --git a/toolchain/newlib/Makefile.inc b/toolchain/newlib/Makefile.inc new file mode 100644 index 000000000..3809ccc98 --- /dev/null +++ b/toolchain/newlib/Makefile.inc @@ -0,0 +1,18 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +PKG_NAME:= newlib +ifeq ($(ADK_LIBC_VERSION),git) +PKG_VERSION:= git +PKG_RELEASE:= 1 +PKG_SITES:= git://sourceware.org/git/newlib-cygwin.git +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz +endif +ifeq ($(ADK_TARGET_LIB_NEWLIB_2_2_0),y) +PKG_VERSION:= 2.2.0 +PKG_RELEASE:= 1 +PKG_HASH:= c1d53fd1765d955ac513aa6e2f576455ee7507072d400314495c8a8a26ebc8ec +PKG_SITES:= ftp://sourceware.org/pub/newlib/ +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}-1.tar.gz +WRKDIST= $(WRKDIR)/${PKG_NAME}-${PKG_VERSION}-1 +endif diff --git a/toolchain/newlib/patches/2.2.0/disable-docs.patch b/toolchain/newlib/patches/2.2.0/disable-docs.patch new file mode 100644 index 000000000..3b500b61c --- /dev/null +++ b/toolchain/newlib/patches/2.2.0/disable-docs.patch @@ -0,0 +1,14 @@ +diff -Nur newlib-2.2.0-1.orig/etc/Makefile.in newlib-2.2.0-1/etc/Makefile.in +--- newlib-2.2.0-1.orig/etc/Makefile.in 2010-11-20 20:37:57.000000000 +0100 ++++ newlib-2.2.0-1/etc/Makefile.in 2015-12-03 14:23:44.043820971 +0100 +@@ -63,8 +63,8 @@ + PDFFILES = standards.pdf configure.pdf + HTMLFILES = standards.html configure.html + +-all: info +-install install-strip: install-info ++all: ++install install-strip: + + uninstall: + diff --git a/toolchain/newlib/patches/2.2.0/fix-tooldir.patch b/toolchain/newlib/patches/2.2.0/fix-tooldir.patch new file mode 100644 index 000000000..652f7494b --- /dev/null +++ b/toolchain/newlib/patches/2.2.0/fix-tooldir.patch @@ -0,0 +1,12 @@ +diff -Nur newlib-2.2.0-1.orig/configure newlib-2.2.0-1/configure +--- newlib-2.2.0-1.orig/configure 2014-07-05 23:09:07.000000000 +0200 ++++ newlib-2.2.0-1/configure 2015-11-25 06:33:11.461178398 +0100 +@@ -6985,7 +6985,7 @@ + + # Some systems (e.g., one of the i386-aix systems the gas testers are + # using) don't handle "\$" correctly, so don't use it here. +-tooldir='${exec_prefix}'/${target_noncanonical} ++tooldir='${exec_prefix}' + build_tooldir=${tooldir} + + # Create a .gdbinit file which runs the one in srcdir |