diff options
122 files changed, 8037 insertions, 1444 deletions
diff --git a/arm-riscos-gnueabi/.gitignore b/arm-riscos-gnueabi/.gitignore new file mode 100644 index 0000000..e6483c4 --- /dev/null +++ b/arm-riscos-gnueabi/.gitignore @@ -0,0 +1,2 @@ +builddir +sources diff --git a/arm-riscos-gnueabi/Makefile b/arm-riscos-gnueabi/Makefile new file mode 100644 index 0000000..11b93c6 --- /dev/null +++ b/arm-riscos-gnueabi/Makefile @@ -0,0 +1,201 @@ +# Use a tested trunk version of GCCSDK +UPSTREAM_GCCSDK_VERSION := 7698 +UPSTREAM_GCCSDK_TARBALL := gccsdk$(UPSTREAM_GCCSDK_VERSION).tar.gz +UPSTREAM_GCCSDK_URI := svn://svn.riscos.info/gccsdk/trunk/autobuilder/develop/gcc@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_SGP_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/setup-gccsdk-params@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_ROINSTALL_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/porting-scripts/ro-install@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_AMP_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/recipe/patches/automake-for-binutils@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_UNIXLIB_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/recipe/files/gcc/libunixlib@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_LD_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/riscos/soloader/dynamic/ld.so-1.9.9@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_ASASM_URI := svn://svn.riscos.info/gccsdk/trunk/tools/asasm@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_ELF2AIF_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/riscos/elf2aif@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_LN_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/riscos/ln@$(UPSTREAM_GCCSDK_VERSION) +UPSTREAM_GCCSDK_MKRESFS_URI := svn://svn.riscos.info/gccsdk/trunk/gcc4/riscos/mkresfs@$(UPSTREAM_GCCSDK_VERSION) + +# OSLib 7.00 +UPSTREAM_OSLIB_VERSION := 700 +UPSTREAM_OSLIB_TARBALL := oslib$(UPSTREAM_OSLIB_VERSION).tar.gz +UPSTREAM_OSLIB_URI := https://svn.code.sf.net/p/ro-oslib/code/tags/oslib-$(UPSTREAM_OSLIB_VERSION)/!OSLib + +# Known tested version of trunk for CCRes +UPSTREAM_CCRES_VERSION := 96 +UPSTREAM_CCRES_TARBALL := ccres$(UPSTREAM_CCRES_VERSION).tar.gz +UPSTREAM_CCRES_URI := svn://svn.riscos.info/ccres/trunk@$(UPSTREAM_CCRES_VERSION) + +# Makerun +UPSTREAM_MAKERUN_VERSION := fe55b6bf +UPSTREAM_MAKERUN_TARBALL := makerun$(UPSTREAM_MAKERUN_VERSION).tar.gz +UPSTREAM_MAKERUN_URI := git://git.netsurf-browser.org/makerun.git + +# Squeeze +UPSTREAM_SQUEEZE_VERSION := d54d441 +UPSTREAM_SQUEEZE_TARBALL := squeeze$(UPSTREAM_SQUEEZE_VERSION).tar.gz +UPSTREAM_SQUEEZE_URI := git://git.netsurf-browser.org/squeeze.git + +# Infozip +UPSTREAM_INFOZIP_VERSION := 30 +UPSTREAM_INFOZIP_TARBALL := zip$(UPSTREAM_INFOZIP_VERSION).tar.gz +UPSTREAM_INFOZIP_URI := https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/$(UPSTREAM_INFOZIP_TARBALL) + +Q ?= @ +TOP := $(CURDIR) +RECIPES := $(TOP)/recipes +SOURCESDIR := $(TOP)/sources +BUILDDIR := $(TOP)/builddir +BUILDSTEPS := $(BUILDDIR)/build-steps + +TARGET_NAME := arm-riscos-gnueabi + +PREFIX ?= /opt/netsurf/$(TARGET_NAME) + +# tools +FETCHSRC:=$(CURDIR)/fetchsrc + +.PHONY: all clean distclean +all: $(BUILDSTEPS)/toolchain.d + +clean: + rm -fr $(BUILDDIR) + +distclean: clean + rm -fr $(SOURCESDIR) + +### +# Rules to build the full toolchain +### + +$(BUILDSTEPS)/toolchain.d: $(BUILDSTEPS)/ccres.d $(BUILDSTEPS)/makerun.d $(BUILDSTEPS)/squeeze.d $(BUILDSTEPS)/infozip.d + touch $@ + +### +# Rules to build and install Infozip +### + +$(BUILDSTEPS)/infozip.d: $(BUILDSTEPS)/gcc.d $(SOURCESDIR)/$(UPSTREAM_INFOZIP_TARBALL) + tar -C $(BUILDDIR) -xaf $(SOURCESDIR)/$(UPSTREAM_INFOZIP_TARBALL) + for p in `ls $(RECIPES)/patches/infozip/*.p` ; do patch -d $(BUILDDIR)/zip$(UPSTREAM_INFOZIP_VERSION) -p0 <$$p ; done + cd $(BUILDDIR)/zip$(UPSTREAM_INFOZIP_VERSION) && make -f unix/Makefile generic LOCAL_ZIP=-DFORRISCOS + cp $(BUILDDIR)/zip$(UPSTREAM_INFOZIP_VERSION)/zip $(PREFIX)/cross/bin/zip + @# Yuck. Build host tooling should not be installed into the target environment + mkdir -p $(PREFIX)/env/bin + ln -fs $(PREFIX)/cross/bin/zip $(PREFIX)/env/bin/zip + touch $@ + +### +# Rules to build and install Makerun +### + +$(BUILDSTEPS)/makerun.d: $(BUILDSTEPS)/gcc.d $(SOURCESDIR)/$(UPSTREAM_MAKERUN_TARBALL) + tar -C $(BUILDDIR) -xaf $(SOURCESDIR)/$(UPSTREAM_MAKERUN_TARBALL) + cd $(BUILDDIR)/makerun && GCCSDK_INSTALL_CROSSBIN=$(PREFIX)/cross/bin make install + touch $@ + +### +# Rules to build and install Squeeze +### + +$(BUILDSTEPS)/squeeze.d: $(BUILDSTEPS)/gcc.d $(SOURCESDIR)/$(UPSTREAM_SQUEEZE_TARBALL) + tar -C $(BUILDDIR) -xaf $(SOURCESDIR)/$(UPSTREAM_SQUEEZE_TARBALL) + cd $(BUILDDIR)/squeeze && GCCSDK_INSTALL_CROSSBIN=$(PREFIX)/cross/bin make install + touch $@ + +### +# Rules to build and install CCRes +### + +$(BUILDSTEPS)/ccres.d: $(BUILDSTEPS)/oslib.d $(SOURCESDIR)/$(UPSTREAM_CCRES_TARBALL) + tar -C $(BUILDDIR) -xaf $(SOURCESDIR)/$(UPSTREAM_CCRES_TARBALL) + cd $(BUILDDIR)/ccres && GCCSDK_INSTALL_ENV=$(PREFIX)/env GCCSDK_INSTALL_CROSSBIN=$(PREFIX)/cross/bin make + cd $(BUILDDIR)/ccres && GCCSDK_INSTALL_ENV=$(PREFIX)/env GCCSDK_INSTALL_CROSSBIN=$(PREFIX)/cross/bin make install + touch $@ + +### +# Rules to build and install OSLib +### + +$(BUILDSTEPS)/oslib.d: $(BUILDSTEPS)/gcc.d $(SOURCESDIR)/$(UPSTREAM_OSLIB_TARBALL) + tar -C $(BUILDDIR) -xaf $(SOURCESDIR)/$(UPSTREAM_OSLIB_TARBALL) + for p in `ls $(RECIPES)/patches/oslib/*.p` ; do patch -d $(BUILDDIR)/oslib -p0 <$$p ; done + cd $(BUILDDIR)/oslib && GCCSDK_INSTALL_ENV=$(PREFIX)/env GCCSDK_INSTALL_CROSSBIN=$(PREFIX)/cross/bin make install-elfeabi + touch $@ + +### +# Rules to build and install GCCSDK +### + +$(BUILDSTEPS)/gcc.d: $(BUILDSTEPS)/gccsdk-srcdir.d + cd $(BUILDDIR)/gccsdk && make + @# Install ro-install + mkdir -p $(PREFIX)/env + sed -e s:GCCSDK_ENV:$(PREFIX)/env:g < $(BUILDDIR)/gccsdk/ro-install > $(PREFIX)/env/ro-install + chmod 755 $(PREFIX)/env/ro-install + @# Install empty libraries needed to fool configure scripts + for l in c pthread gcc_s ; do $(PREFIX)/cross/bin/$(TARGET_NAME)-ar mv $(PREFIX)/cross/$(TARGET_NAME)/lib/lib$$l.a ; done + @# Newer GCCSDK adds these trampoline binaries that for us + @# serve no purpose and get in the way. + $(RM) $(PREFIX)/cross/bin/$(TARGET_NAME)-gcc-ar $(PREFIX)/cross/bin/$(TARGET_NAME)-gcc-nm $(PREFIX)/cross/bin/$(TARGET_NAME)-gcc-ranlib + touch $@ + +$(BUILDSTEPS)/gccsdk-srcdir.d: $(BUILDSTEPS)/buildsteps.d $(SOURCESDIR)/$(UPSTREAM_GCCSDK_TARBALL) + tar -C $(BUILDDIR) -xaf $(SOURCESDIR)/$(UPSTREAM_GCCSDK_TARBALL) + cp -p $(RECIPES)/files/gccsdk/gccsdk-params $(BUILDDIR)/gccsdk/gccsdk-params + sed -i 's#{PREFIX}#$(PREFIX)#' $(BUILDDIR)/gccsdk/gccsdk-params + sed -i \ + -e "s#GCCSDK_SUPPORTED_GCC_RELEASE=[0-9.]\+#GCCSDK_SUPPORTED_GCC_RELEASE=$$(grep '^GCC_VERSION=[0-9.]\+' $(BUILDDIR)/gccsdk/gcc/setvars | sed -e 's/^GCC_VERSION=//')#" \ + -e "s#GCCSDK_SUPPORTED_BINUTILS_RELEASE=[0-9.]\+#GCCSDK_SUPPORTED_BINUTILS_RELEASE=$$(grep '^BINUTILS_VERSION=[0-9.]\+' $(BUILDDIR)/gccsdk/gcc/setvars | sed -e 's/^BINUTILS_VERSION=//')#" \ + $(BUILDDIR)/gccsdk/setup-gccsdk-params + cp -p $(RECIPES)/files/gccsdk/Makefile $(BUILDDIR)/gccsdk/Makefile + $(Q)for p in $$(ls $(RECIPES)/files/gccsdk/*.p 2>/dev/null) ; do echo " COPY: $$p -> $(BUILDDIR)/gccsdk/gcc/" ; cp -p $$p $(BUILDDIR)/gccsdk/gcc/ ; done + $(Q)for p in $$(ls $(RECIPES)/files/gccsdk/*.pp 2>/dev/null) ; do echo " COPY: $$p -> $(BUILDDIR)/gccsdk/gcc/" ; cp -p $$p $(BUILDDIR)/gccsdk/gcc/ ; done + $(Q)for p in $$(ls $(RECIPES)/patches/gccsdk/*.p 2>/dev/null) ; do echo "PATCH: $$p" ; patch -d $(BUILDDIR)/gccsdk -p0 <$$p ; done + touch $@ + +### +# Rules to fetch upstream sources +### + +$(SOURCESDIR)/$(UPSTREAM_GCCSDK_TARBALL): + svn export $(UPSTREAM_GCCSDK_URI) $(SOURCESDIR)/gccsdk/gcc + svn export $(UPSTREAM_GCCSDK_SGP_URI) $(SOURCESDIR)/gccsdk/ + svn export $(UPSTREAM_GCCSDK_ROINSTALL_URI) $(SOURCESDIR)/gccsdk/ + svn export $(UPSTREAM_GCCSDK_AMP_URI) $(SOURCESDIR)/gccsdk/automake + svn export $(UPSTREAM_GCCSDK_UNIXLIB_URI) $(SOURCESDIR)/gccsdk/libunixlib + svn export $(UPSTREAM_GCCSDK_LD_URI) $(SOURCESDIR)/gccsdk/ld + svn export $(UPSTREAM_GCCSDK_ASASM_URI) $(SOURCESDIR)/gccsdk/asasm + svn export $(UPSTREAM_GCCSDK_ELF2AIF_URI) $(SOURCESDIR)/gccsdk/elf2aif + svn export $(UPSTREAM_GCCSDK_LN_URI) $(SOURCESDIR)/gccsdk/ln + svn export $(UPSTREAM_GCCSDK_MKRESFS_URI) $(SOURCESDIR)/gccsdk/mkresfs + tar -C $(SOURCESDIR) -caf $@ gccsdk + +$(SOURCESDIR)/$(UPSTREAM_OSLIB_TARBALL): + svn co $(UPSTREAM_OSLIB_URI) $(SOURCESDIR)/oslib + tar -C $(SOURCESDIR) -caf $@ oslib + +$(SOURCESDIR)/$(UPSTREAM_CCRES_TARBALL): + svn co $(UPSTREAM_CCRES_URI) $(SOURCESDIR)/ccres + tar -C $(SOURCESDIR) -caf $@ ccres + +$(SOURCESDIR)/$(UPSTREAM_MAKERUN_TARBALL): + $(RM) -rf $(SOURCESDIR)/makerun + git clone $(UPSTREAM_MAKERUN_URI) $(SOURCESDIR)/makerun + tar -C $(SOURCESDIR) -caf $@ makerun + +$(SOURCESDIR)/$(UPSTREAM_SQUEEZE_TARBALL): + $(RM) -rf $(SOURCESDIR)/squeeze + git clone $(UPSTREAM_SQUEEZE_URI) $(SOURCESDIR)/squeeze + tar -C $(SOURCESDIR) -caf $@ squeeze + +$(SOURCESDIR)/$(UPSTREAM_INFOZIP_TARBALL): + $(FETCHSRC) arm-unknown-riscos $(subst $(SOURCESDIR)/,,$@) $(UPSTREAM_INFOZIP_URI) $@ + +### +# Rule to create buildsteps dir +### + +$(BUILDSTEPS)/buildsteps.d: $(SOURCESDIR) + mkdir -p $(BUILDSTEPS) + touch $@ + +$(SOURCESDIR): + mkdir -p $@ + diff --git a/arm-riscos-gnueabi/fetchsrc b/arm-riscos-gnueabi/fetchsrc new file mode 100755 index 0000000..92ae5bf --- /dev/null +++ b/arm-riscos-gnueabi/fetchsrc @@ -0,0 +1,16 @@ +#!/bin/bash + +# script to fetch toolchain source tar using ci.netsurf-browser.org as a cache + +# Usage fetchsrc <target> <source> <upstream> <output> + +NSSRV="https://ci.netsurf-browser.org/toolchain/" + +wget -q -O ${4} ${NSSRV}/${1}/${2} +if [ $? -ne 0 ];then + wget -q -O ${4} ${3} + if [ $? -ne 0 ];then + rm ${4} + exit 1 + fi +fi diff --git a/arm-riscos-gnueabi/recipes/files/gccsdk/Makefile b/arm-riscos-gnueabi/recipes/files/gccsdk/Makefile new file mode 100644 index 0000000..01b4cbd --- /dev/null +++ b/arm-riscos-gnueabi/recipes/files/gccsdk/Makefile @@ -0,0 +1,447 @@ +# To build GCCSDK cross-compiler. +# Written by John Tytgat / BASS +# Copyright (c) 2009-2021 GCCSDK Developers +# +# Build requirements: +# - apt-get install flex bison libgmp3-dev libmpfr-dev texinfo build-essential +# - binutils 2.30 and gcc 10.2 needs automake 1.11.1 and autoconf 2.64 and +# a recent libtool version. +# Note the required automake/autoconf/libtool sources will be fetched +# & built automatically. +# - gcc 10.2 needs at least GMP 6.1.0, ISL 0.18, MPFR 3.1.4 and MPC 1.0.3 (MPFR needs GMP, MPC needs GMP & MPFR) +# For MPFR/GMP/ISL/MPC version numbers, a good set can be found mentioned at gcc/contrib/download_prerequisites. + +# TARGET can have following values: arm-riscos-gnueabi +TARGET=arm-riscos-gnueabi +GCC_LANGUAGES="c,c++" +# Enable shared library support in the cross compiler ? +CROSS_ENABLE_SHARED=yes + +# Release ID for GCCSDK RISC OS release (eg 4.7.4 release 6) +GCCSDK_GCC_RISCOS_RELEASE=1 + +# Versions of binutils/autotools needed to build our tools +AUTOCONF_FOR_BINUTILS_VERSION=2.64 +AUTOMAKE_FOR_BINUTILS_VERSION=1.11.1 +LIBTOOL_FOR_BINUTILS_VERSION=2.4.2 +BINUTILS_VERSION=$(GCCSDK_SUPPORTED_BINUTILS_RELEASE) +AUTOCONF_FOR_GCC_VERSION=2.69 +AUTOMAKE_FOR_GCC_VERSION=1.15.1 +LIBTOOL_FOR_GCC_VERSION=2.4.2 + +# Versions of upstream components we need +# XXX: fetch these ourselves, rather than using download_prerequisites +GCC_VERSION=$(GCCSDK_SUPPORTED_GCC_RELEASE) +GMP_VERSION=6.1.0 +ISL_VERSION=0.18 +MPFR_VERSION=3.1.4 +MPC_VERSION=1.1.0 + +# Whether to enable link-time optimisation +GCC_USE_LTO=no + +# If $(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS) equals +# $(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS) we can reuse the installed +# buildtools for binutils for building gcc. +AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS := $(AUTOCONF_FOR_BINUTILS_VERSION)-$(AUTOMAKE_FOR_BINUTILS_VERSION)-$(LIBTOOL_FOR_BINUTILS_VERSION) +AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS := $(AUTOCONF_FOR_GCC_VERSION)-$(AUTOMAKE_FOR_GCC_VERSION)-$(LIBTOOL_FOR_GCC_VERSION) + +# Notes: +# 1) Configure options are explained at http://gcc.gnu.org/install/configure.html +# but note that this explanation is for the latest gcc version released and +# not necessary the gcc version we're building here. +# Specifying --disable-multilib will significantly reduce build times but then +# you only end up with UnixLib/softfloat support. +# Note: --enable-multilib is the default. Don't specify it unless you want to get hit +# by PR43328/PR45174. +GCC_CONFIG_ARGS := \ + --enable-threads=posix \ + --enable-sjlj-exceptions=no \ + --enable-c99 \ + --enable-cmath \ + --disable-c-mbchar \ + --disable-wchar_t \ + --disable-libstdcxx-pch \ + --disable-tls \ + --enable-__cxa_atexit \ + --disable-libssp \ + --disable-libgomp \ + --disable-libitm \ + --with-abi=aapcs-linux \ + --with-arch=armv4 \ + --with-float=soft +BINUTILS_CONFIG_ARGS := +GCC_CONFIG_ARGS += --with-pkgversion='GCCSDK GCC $(GCC_VERSION) Release $(GCCSDK_GCC_RISCOS_RELEASE)' \ + --with-bugurl=http://gccsdk.riscos.info/ +BINUTILS_CONFIG_ARGS += --with-pkgversion='GCCSDK GCC $(GCC_VERSION) Release $(GCCSDK_GCC_RISCOS_RELEASE)' \ + --with-bugurl=http://gccsdk.riscos.info/ +BINUTILS_CONFIG_ARGS += --disable-werror --with-gcc --enable-interwork --disable-nls #--enable-maintainer-mode +# --disable-werror is added because --enable-maintainer-mode turns all warnings into errors and +# the gcc build is not 100% warning free. +# However, this does not help for libstdc++ builds when newlib is used, cfr http://gcc.gnu.org/PR47058. +GCC_CONFIG_ARGS += --enable-maintainer-mode --disable-werror +GCC_CONFIG_ARGS += --enable-interwork --disable-nls --disable-libquadmath + +# When debugging/testing/validating the compiler add "--enable-checking=all", +# otherwise add "--enable-checking=release" or even "--enable-checking=no" +GCC_CONFIG_ARGS += --enable-checking=release +# Configure args shared between different targets: +# For debugging: +# FIXME: add to GCC_BUILD_FLAGS for optimized ARM libraries: CFLAGS_FOR_TARGET="-O3 -march=armv5" CXXFLAGS_FOR_TARGET="-O3 -march=armv5" +# Or perhaps better, at GCC configure time something like --with-arch=armv6 --with-tune=cortex-a8 --with-float=softfp --with-fpu=vfp ? +##GCC_BUILD_FLAGS := CFLAGS="-O0 -g" LIBCXXFLAGS="-O0 -g" +##BINUTILS_BUILD_FLAGS = CFLAGS="-O0 -g" + +ROOT := $(CURDIR) +PREFIX_CROSS := $(GCCSDK_CROSS_PREFIX) +PREFIX_RONATIVE := $(GCCSDK_RISCOS_PREFIX)/\!GCC +BUILDDIR := $(GCCSDK_BUILDDIR) +BUILDSTEPSDIR := buildstepsdir +# PREFIX_BUILDTOOL_BINUTILS will contain the built autoconf/automake/libtool versions used during building binutils. +PREFIX_BUILDTOOL_BINUTILS := $(BUILDDIR)/installed-buildtools-for-binutils +# PREFIX_BUILDTOOL_GCC will contain the built autoconf/automake/libtool versions used during building gcc. +# When the autoconf/automake/libtool versions needed to build gcc are the same as the autoconf/automake/libtool versions +# needed to build binutils, PREFIX_BUILDTOOL_GCC will be a symlink to PREFIX_BUILDTOOL_BINUTILS +# (compare $(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS) with $(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)). +PREFIX_BUILDTOOL_GCC := $(BUILDDIR)/installed-buildtools-for-gcc +PREFIX_CROSSGCC_LIBS := $(BUILDDIR)/installed-libs-for-cross-gcc +SRCDIR := $(GCCSDK_SRCDIR) +SRCORIGDIR := $(GCCSDK_SRCDIR).orig + +ifeq ($(CROSS_ENABLE_SHARED),yes) +CROSS_GCC_CONFIG_ARGS += target_configargs=--enable-shared=libunixlib,libgcc,libstdc++,libbacktrace +else +CROSS_GCC_CONFIG_ARGS += target_configargs=--disable-shared +endif +ifeq ($(GCC_USE_LTO),yes) +CROSS_GCC_CONFIG_ARGS += --enable-lto +else +CROSS_GCC_CONFIG_ARGS += --disable-lto +endif + +# Configure arguments Binutils & GCC: +CROSS_CONFIG_ARGS := --target=$(TARGET) --prefix=$(PREFIX_CROSS) + +# To respawn Makefile with setup-gccsdk-param environment loaded. +GCCSDK_INTERNAL_GETENV=getenv +ifeq ($(MAKECMDGOALS),) +MAKECMDGOALS=all +endif + +.NOTPARALLEL: +.PHONY: all all-done cross clean clean-done clean-cross clean-cross-done distclean distclean-done getenv +VPATH = $(BUILDSTEPSDIR) + +# Default target is to build the cross-compiler (including the RISC OS tools): +all: $(GCCSDK_INTERNAL_GETENV) +all-done: cross-done + +# Builds the cross compiler: +cross: $(GCCSDK_INTERNAL_GETENV) +cross-done: cross-gcc-built cross-riscostools-built + touch $(BUILDSTEPSDIR)/$@ + +clean: $(GCCSDK_INTERNAL_GETENV) +clean-done: + -rm -rf $(BUILDDIR) $(BUILDSTEPSDIR) $(SRCDIR) $(GCCSDK_CROSS_PREFIX) + +# Return to a state for doing a full fresh cross build (using the current binutils/gcc sources). +clean-cross: $(GCCSDK_INTERNAL_GETENV) +clean-cross-done: + -rm -rf $(BUILDSTEPSDIR)/cross-* $(BUILDDIR)/cross* $(GCCSDK_CROSS_PREFIX) + +distclean: $(GCCSDK_INTERNAL_GETENV) +distclean-done: clean-done + -rm -rf release-area $(SRCORIGDIR) + +# Respawn Makefile again after having loaded all our GCCSDK environment variables. +ifeq ($(GCCSDK_INTERNAL_GETENV),getenv) +getenv: + test -d $(BUILDSTEPSDIR) || mkdir $(BUILDSTEPSDIR) + @bash -c ". ./setup-gccsdk-params && $(MAKE) $(patsubst %,%-done,$(MAKECMDGOALS)) GCCSDK_INTERNAL_GETENV=" +endif + +# -- Configure & building: + +# Configure & build autoconf-for-binutils tool: +buildtool-autoconf-for-binutils-built: src-autoconf-for-binutils-copied + -rm -rf $(BUILDDIR)/buildtool-autoconf-for-binutils + mkdir -p $(BUILDDIR)/buildtool-autoconf-for-binutils + cd $(BUILDDIR)/buildtool-autoconf-for-binutils && $(SRCDIR)/autoconf-for-binutils/configure --prefix=$(PREFIX_BUILDTOOL_BINUTILS) && $(MAKE) && $(MAKE) install + touch $(BUILDSTEPSDIR)/$@ + +ifneq ($(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS),$(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)) +# Configure & build autoconf-for-gcc tool: +buildtool-autoconf-for-gcc-built: src-autoconf-for-gcc-copied + -rm -rf $(BUILDDIR)/buildtool-autoconf-for-gcc + mkdir -p $(BUILDDIR)/buildtool-autoconf-for-gcc + cd $(BUILDDIR)/buildtool-autoconf-for-gcc && $(SRCDIR)/autoconf-for-gcc/configure --prefix=$(PREFIX_BUILDTOOL_GCC) && $(MAKE) && $(MAKE) install +else +# autoconf-for-gcc, automake-for-gcc and libtool-for-gcc are the same as autoconf-for-binutils, automake-for-binutils and libtool-for-binutils so we can use PREFIX_BUILDTOOL_GCC as PREFIX_BUILDTOOL_BINUTILS +buildtool-autoconf-for-gcc-built: buildtool-autoconf-for-binutils-built + ln -f -s $(PREFIX_BUILDTOOL_BINUTILS) $(PREFIX_BUILDTOOL_GCC) +endif + touch $(BUILDSTEPSDIR)/$@ + +# Configure & build automake-for-binutils tool: +buildtool-automake-for-binutils-built: src-automake-for-binutils-copied buildtool-autoconf-for-binutils-built + -rm -rf $(BUILDDIR)/buildtool-automake-for-binutils + mkdir -p $(BUILDDIR)/buildtool-automake-for-binutils + cd $(BUILDDIR)/buildtool-automake-for-binutils && PATH="$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" && $(SRCDIR)/automake-for-binutils/configure --prefix=$(PREFIX_BUILDTOOL_BINUTILS) && $(MAKE) && $(MAKE) install + touch $(BUILDSTEPSDIR)/$@ + +ifneq ($(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS),$(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)) +# Configure & build automake-for-gcc tool: +buildtool-automake-for-gcc-built: src-automake-for-gcc-copied buildtool-autoconf-for-gcc-built + -rm -rf $(BUILDDIR)/buildtool-automake-for-gcc + mkdir -p $(BUILDDIR)/buildtool-automake-for-gcc + cd $(BUILDDIR)/buildtool-automake-for-gcc && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" && $(SRCDIR)/automake-for-gcc/configure --prefix=$(PREFIX_BUILDTOOL_GCC) && $(MAKE) && $(MAKE) install +else +# autoconf-for-gcc, automake-for-gcc and libtool-for-gcc are the same as autoconf-for-binutils, automake-for-binutils and libtool-for-binutils so we can use PREFIX_BUILDTOOL_GCC as PREFIX_BUILDTOOL_BINUTILS +buildtool-automake-for-gcc-built: buildtool-automake-for-binutils-built +endif + touch $(BUILDSTEPSDIR)/$@ + +# Configure & build libtool-for-binutils tool: +buildtool-libtool-for-binutils-built: src-libtool-for-binutils-copied buildtool-autoconf-for-binutils-built buildtool-automake-for-binutils-built + -rm -rf $(BUILDDIR)/buildtool-libtool-for-binutils + mkdir -p $(BUILDDIR)/buildtool-libtool-for-binutils + cd $(BUILDDIR)/buildtool-libtool-for-binutils && PATH="$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" && $(SRCDIR)/libtool-for-binutils/configure --prefix=$(PREFIX_BUILDTOOL_BINUTILS) && $(MAKE) && $(MAKE) install + touch $(BUILDSTEPSDIR)/$@ + +ifneq ($(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS),$(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)) +# Configure & build libtool-for-gcc tool: +buildtool-libtool-for-gcc-built: src-libtool-for-gcc-copied buildtool-autoconf-for-gcc-built buildtool-automake-for-gcc-built + -rm -rf $(BUILDDIR)/buildtool-libtool-for-gcc + mkdir -p $(BUILDDIR)/buildtool-libtool-for-gcc + cd $(BUILDDIR)/buildtool-libtool-for-gcc && PATH="$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" && $(SRCDIR)/libtool-for-gcc/configure --prefix=$(PREFIX_BUILDTOOL_GCC) && $(MAKE) && $(MAKE) install +else +# autoconf-for-gcc, automake-for-gcc and libtool-for-gcc are the same as autoconf-for-binutils, automake-for-binutils and libtool-for-binutils so we can use PREFIX_BUILDTOOL_GCC as PREFIX_BUILDTOOL_BINUTILS +buildtool-libtool-for-gcc-built: buildtool-libtool-for-binutils-built +endif + touch $(BUILDSTEPSDIR)/$@ + +# Configure binutils cross: +cross-binutils-configured: src-binutils-copied + -rm -rf $(BUILDDIR)/cross-binutils + mkdir -p $(BUILDDIR)/cross-binutils + cd $(BUILDDIR)/cross-binutils && PATH="$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" && $(SRCDIR)/binutils/configure $(CROSS_CONFIG_ARGS) $(BINUTILS_CONFIG_ARGS) + touch $(BUILDSTEPSDIR)/$@ + +# Build binutils cross: +cross-binutils-built: cross-binutils-configured + cd $(BUILDDIR)/cross-binutils && PATH="$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" && $(SRCDIR)/binutils/configure $(CROSS_CONFIG_ARGS) $(BINUTILS_CONFIG_ARGS) && $(MAKE) $(BINUTILS_BUILD_FLAGS) && $(MAKE) install + touch $(BUILDSTEPSDIR)/$@ + +# Configure gcc cross: +cross-gcc-configured: src-gcc-copied cross-binutils-built + -rm -rf $(BUILDDIR)/cross-gcc + mkdir -p $(BUILDDIR)/cross-gcc + mkdir -p $(PREFIX_CROSS)/$(TARGET)/lib + for l in c pthread gcc_s; do $(PREFIX_CROSS)/bin/$(TARGET)-ar mv $(PREFIX_CROSS)/$(TARGET)/lib/lib$${l}.a; done + cd $(BUILDDIR)/cross-gcc && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PREFIX_CROSS)/bin:$(PATH)" && $(SRCDIR)/gcc/configure $(CROSS_CONFIG_ARGS) $(CROSS_GCC_CONFIG_ARGS) $(GCC_CONFIG_ARGS) --enable-languages=$(GCC_LANGUAGES) + touch $(BUILDSTEPSDIR)/$@ + +# Build gcc cross: +cross-gcc-built: cross-gcc-configured + cd $(BUILDDIR)/cross-gcc && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PREFIX_CROSS)/bin:$(PATH)" && $(MAKE) $(GCC_BUILD_FLAGS) && $(MAKE) install + touch $(BUILDSTEPSDIR)/$@ + +# Build the RISC OS related tools (elf2aif, asasm, etc) cross: +cross-riscostools-built: cross-gcc-built + @# LD + -rm -rf $(BUILDDIR)/cross-ld + mkdir -p $(BUILDDIR)/cross-ld + cd $(ROOT)/ld && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" autoreconf -f --install + cd $(BUILDDIR)/cross-ld && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" CC=$(GCCSDK_INSTALL_CROSSBIN)/$(TARGET)-gcc $(ROOT)/ld/configure --prefix=$(PREFIX_CROSS)/$(TARGET) --host=$(TARGET) --target=$(TARGET) + cd $(BUILDDIR)/cross-ld && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" make install + @# asasm + -rm -rf $(BUILDDIR)/cross-asasm + mkdir -p $(BUILDDIR)/cross-asasm + cd $(ROOT)/asasm && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" ACLOCAL='aclocal -I $(ROOT)/asasm/m4' autoreconf -f --install + cd $(BUILDDIR)/cross-asasm && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" $(ROOT)/asasm/configure --prefix=$(PREFIX_CROSS) --target=$(TARGET) --disable-building-tools + cd $(BUILDDIR)/cross-asasm && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" make install-minimum + @# elf2aif + -rm -rf $(BUILDDIR)/cross-elf2aif + mkdir -p $(BUILDDIR)/cross-elf2aif + cd $(ROOT)/elf2aif && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" autoreconf -f --install + cd $(BUILDDIR)/cross-elf2aif && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" $(ROOT)/elf2aif/configure --prefix=$(PREFIX_CROSS) --target=$(TARGET) + cd $(BUILDDIR)/cross-elf2aif && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" make install + @# ln + -rm -rf $(BUILDDIR)/cross-ln + mkdir -p $(BUILDDIR)/cross-ln + cd $(ROOT)/ln && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" autoreconf -f --install + cd $(BUILDDIR)/cross-ln && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" $(ROOT)/ln/configure --prefix=$(PREFIX_CROSS) --target=$(TARGET) + cd $(BUILDDIR)/cross-ln && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" make install + @# mkresfs + -rm -rf $(BUILDDIR)/cross-mkresfs + mkdir -p $(BUILDDIR)/cross-mkresfs + cd $(ROOT)/mkresfs && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" autoreconf -f --install + cd $(BUILDDIR)/cross-mkresfs && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" $(ROOT)/mkresfs/configure --prefix=$(PREFIX_CROSS) --target=$(TARGET) + cd $(BUILDDIR)/cross-mkresfs && PATH="$(PREFIX_CROSS)/bin:$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" make install + touch $(BUILDSTEPSDIR)/$@ + +# -- Source unpacking. + +# Unpack & copy autoconf-for-binutils source: +src-autoconf-for-binutils-copied: $(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_BINUTILS_VERSION).tar.xz + -rm -rf $(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_BINUTILS_VERSION) $(SRCDIR)/autoconf-for-binutils + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/autoconf-for-binutils + cp -T -p -r $(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_BINUTILS_VERSION) $(SRCDIR)/autoconf-for-binutils + touch $(BUILDSTEPSDIR)/$@ + +ifneq ($(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS),$(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)) +# Unpack & copy autoconf-for-gcc source: +src-autoconf-for-gcc-copied: $(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_GCC_VERSION).tar.xz + -rm -rf $(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_GCC_VERSION) $(SRCDIR)/autoconf-for-gcc + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/autoconf-for-gcc + cp -T -p -r $(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_GCC_VERSION) $(SRCDIR)/autoconf-for-gcc + touch $(BUILDSTEPSDIR)/$@ +endif + +# Unpack & copy automake-for-binutils source: +src-automake-for-binutils-copied: $(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_BINUTILS_VERSION).tar.bz2 + -rm -rf $(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_BINUTILS_VERSION) $(SRCDIR)/automake-for-binutils + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/automake-for-binutils + cp -T -p -r $(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_BINUTILS_VERSION) $(SRCDIR)/automake-for-binutils + for p in $$(ls $(ROOT)/automake/*.p); do patch -d $(SRCDIR)/automake-for-binutils -p0 -l < $$p; done + touch $(BUILDSTEPSDIR)/$@ + +ifneq ($(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS),$(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)) +# Unpack & copy automake-for-gcc source: +src-automake-for-gcc-copied: $(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_GCC_VERSION).tar.xz + -rm -rf $(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_GCC_VERSION) $(SRCDIR)/automake-for-gcc + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/automake-for-gcc + cp -T -p -r $(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_GCC_VERSION) $(SRCDIR)/automake-for-gcc + touch $(BUILDSTEPSDIR)/$@ +endif + +# Unpack & copy libtool-for-binutils source: +src-libtool-for-binutils-copied: $(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_BINUTILS_VERSION).tar.gz + -rm -rf $(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_BINUTILS_VERSION) $(SRCDIR)/libtool-for-binutils + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/libtool-for-binutils + cp -T -p -r $(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_BINUTILS_VERSION) $(SRCDIR)/libtool-for-binutils + touch $(BUILDSTEPSDIR)/$@ + +ifneq ($(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_BINUTILS_VERSIONS),$(AUTOCONF_AUTOMAKE_LIBTOOL_FOR_GCC_VERSIONS)) +# Unpack & copy libtool-for-gcc source: +src-libtool-for-gcc-copied: $(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_GCC_VERSION).tar.gz + -rm -rf $(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_GCC_VERSION) $(SRCDIR)/libtool-for-gcc + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/libtool-for-gcc + cp -T -p -r $(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_GCC_VERSION) $(SRCDIR)/libtool-for-gcc + touch $(BUILDSTEPSDIR)/$@ +endif + +# Unpack & copy (and optionally patch) binutils source: +# As we're patching and (re)configuring, we need built & installed versions of +# autoconf, automake and libtool. +src-binutils-copied: $(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2 buildtool-autoconf-for-binutils-built buildtool-automake-for-binutils-built buildtool-libtool-for-binutils-built + -rm -rf $(SRCORIGDIR)/binutils-$(BINUTILS_VERSION) $(SRCDIR)/binutils + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/binutils + cp -T -p -r $(SRCORIGDIR)/binutils-$(BINUTILS_VERSION) $(SRCDIR)/binutils + cp $(ROOT)/gcc/ld.emulparams.armelf_riscos_eabi.sh $(SRCDIR)/binutils/ld/emulparams/armelf_riscos_eabi.sh + cp $(ROOT)/gcc/gas.config.te-riscos.h $(SRCDIR)/binutils/gas/config/te-riscos.h + for p in $$(ls $(ROOT)/gcc/*.pp); do patch -d $(SRCDIR)/binutils -p0 -l < $$p ; done + cd $(SRCDIR)/binutils/ld && PATH="$(PREFIX_BUILDTOOL_BINUTILS)/bin:$(PATH)" autoreconf + touch $(BUILDSTEPSDIR)/$@ + +# Unpack & copy or checkout the gcc source: +# As we're patching and (re)configuring, we need built & installed versions of +# autoconf, automake and libtool. +src-gcc-copied: buildtool-autoconf-for-gcc-built buildtool-automake-for-gcc-built buildtool-libtool-for-gcc-built +src-gcc-copied: $(SRCORIGDIR)/gcc-$(GCC_VERSION).tar.xz + -rm -rf $(SRCORIGDIR)/gcc-$(GCC_VERSION) $(SRCDIR)/gcc + cd $(SRCORIGDIR) && tar xf $< + -mkdir -p $(SRCDIR)/gcc + cp -T -p -r $(SRCORIGDIR)/gcc-$(GCC_VERSION) $(SRCDIR)/gcc + mkdir -p $(SRCDIR)/gcc/libstdc++-v3/config/os/riscos + cp -T -p $(ROOT)/gcc//gcc.config.arm.riscos-elf.h $(SRCDIR)/gcc/gcc/config/arm/riscos-elf.h + cp -T -p $(ROOT)/gcc/gcc.config.arm.riscos-gnueabihf.h $(SRCDIR)/gcc/gcc/config/arm/riscos-gnueabihf.h + cp -T -p $(ROOT)/gcc/gcc.config.arm.riscos-gcc.c $(SRCDIR)/gcc/gcc/config/arm/riscos-gcc.c + cp -T -p $(ROOT)/gcc/gcc.config.arm.riscos.c $(SRCDIR)/gcc/gcc/config/arm/riscos.c + cp -T -p $(ROOT)/gcc/gcc.config.arm.riscos.md $(SRCDIR)/gcc/gcc/config/arm/riscos.md + cp -T -p $(ROOT)/gcc/gcc.config.arm.riscos.opt $(SRCDIR)/gcc/gcc/config/arm/riscos.opt + cp -T -p $(ROOT)/gcc/gcc.config.arm.t-arm-riscos-elf $(SRCDIR)/gcc/gcc/config/arm/t-arm-riscos-elf + cp -T -p $(ROOT)/gcc/gcc.config.arm.t-riscos-gnueabihf $(SRCDIR)/gcc/gcc/config/arm/t-riscos-gnueabihf + cp -T -p $(ROOT)/gcc/gcc.config.arm.xm-riscos.h $(SRCDIR)/gcc/gcc/config/arm/xm-riscos.h + cp -T -p $(ROOT)/gcc/libgcc.config.arm.t-arm-riscos-elf $(SRCDIR)/gcc/libgcc/config/arm/t-arm-riscos-elf + cp -T -p $(ROOT)/gcc/libgcc.config.arm.t-riscos-gnueabihf $(SRCDIR)/gcc/libgcc/config/arm/t-riscos-gnueabihf + cp -T -p $(ROOT)/gcc/libstdc++-v3.config.os.riscos.ctype_base.h $(SRCDIR)/gcc/libstdc++-v3/config/os/riscos/ctype_base.h + cp -T -p $(ROOT)/gcc/libstdc++-v3.config.os.riscos.ctype_configure_char.cc $(SRCDIR)/gcc/libstdc++-v3/config/os/riscos/ctype_configure_char.cc + cp -T -p $(ROOT)/gcc/libstdc++-v3.config.os.riscos.ctype_inline.h $(SRCDIR)/gcc/libstdc++-v3/config/os/riscos/ctype_inline.h + cp -T -p $(ROOT)/gcc/libstdc++-v3.config.os.riscos.error_constants.h $(SRCDIR)/gcc/libstdc++-v3/config/os/riscos/error_constants.h + cp -T -p $(ROOT)/gcc/libstdc++-v3.config.os.riscos.os_defines.h $(SRCDIR)/gcc/libstdc++-v3/config/os/riscos/os_defines.h + for p in $$(ls $(ROOT)/gcc/*.p); do patch -d $(SRCDIR)/gcc -p0 -l < $$p ; done + cp -T -p -r $(ROOT)/libunixlib $(SRCDIR)/gcc/libunixlib + cd $(SRCDIR)/gcc && $(SRCDIR)/gcc/contrib/download_prerequisites + cd $(SRCDIR)/gcc && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" autogen Makefile.def + cd $(SRCDIR)/gcc && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" autoconf + cd $(SRCDIR)/gcc/libcpp && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" ACLOCAL="aclocal -I .. -I ../config" autoreconf -v + cd $(SRCDIR)/gcc/libiberty && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" ACLOCAL="aclocal -I .. -I ../config" autoreconf -v + cd $(SRCDIR)/gcc/libstdc++-v3 && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" ACLOCAL="aclocal -I .. -I ../config" autoreconf -v + cd $(SRCDIR)/gcc && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" $(SRCDIR)/gcc/libunixlib/gen-auto.pl + cd $(SRCDIR)/gcc/libunixlib && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" ACLOCAL="aclocal -I .. -I ../config" autoreconf -v + touch $(BUILDSTEPSDIR)/$@ + +# -- Source downloading. + +# Download autoconf source to be used to build binutils: +$(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_BINUTILS_VERSION).tar.xz: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/autoconf/autoconf-$(AUTOCONF_FOR_BINUTILS_VERSION).tar.xz + touch $@ + +# Download automake source to be used to build binutils/autoconf-for-binutils: +$(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_BINUTILS_VERSION).tar.bz2: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/automake/automake-$(AUTOMAKE_FOR_BINUTILS_VERSION).tar.bz2 + touch $@ + +# Download libtool source to be used to build binutils/autoconf-for-binutils: +$(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_BINUTILS_VERSION).tar.gz: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/libtool/libtool-$(LIBTOOL_FOR_BINUTILS_VERSION).tar.gz + touch $@ + +ifneq ($(AUTOCONF_FOR_BINUTILS_VERSION),$(AUTOCONF_FOR_GCC_VERSION)) +# Download autoconf source to be used to build gcc: +$(SRCORIGDIR)/autoconf-$(AUTOCONF_FOR_GCC_VERSION).tar.xz: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/autoconf/autoconf-$(AUTOCONF_FOR_GCC_VERSION).tar.xz + touch $@ +endif + +ifneq ($(AUTOMAKE_FOR_BINUTILS_VERSION),$(AUTOMAKE_FOR_GCC_VERSION)) +# Download automake source to be used to build gcc: +$(SRCORIGDIR)/automake-$(AUTOMAKE_FOR_GCC_VERSION).tar.xz: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/automake/automake-$(AUTOMAKE_FOR_GCC_VERSION).tar.xz + touch $@ +endif + +ifneq ($(LIBTOOL_FOR_BINUTILS_VERSION),$(LIBTOOL_FOR_GCC_VERSION)) +# Download libtool source to be used to build gcc: +$(SRCORIGDIR)/libtool-$(LIBTOOL_FOR_GCC_VERSION).tar.gz: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/libtool/libtool-$(LIBTOOL_FOR_GCC_VERSION).tar.gz + touch $@ +endif + +# Download binutils source: +$(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2 + touch $@ + +# Download gcc source: +$(SRCORIGDIR)/gcc-$(GCC_VERSION).tar.xz: + -mkdir -p $(SRCORIGDIR) + cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.xz + touch $@ diff --git a/arm-riscos-gnueabi/recipes/files/gccsdk/config.sub.p b/arm-riscos-gnueabi/recipes/files/gccsdk/config.sub.p new file mode 100644 index 0000000..181b56f --- /dev/null +++ b/arm-riscos-gnueabi/recipes/files/gccsdk/config.sub.p @@ -0,0 +1,11 @@ +--- config.sub.orig 2022-06-01 07:47:44.364644855 +0100 ++++ config.sub 2022-06-01 07:48:02.892796689 +0100 +@@ -135,7 +135,7 @@ + | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ +- | storm-chaos* | os2-emx* | rtmk-nova*) ++ | storm-chaos* | os2-emx* | rtmk-nova* | riscos-gnu*) + basic_machine=$field1 + os=$maybe_os + ;; diff --git a/arm-riscos-gnueabi/recipes/files/gccsdk/gccsdk-params b/arm-riscos-gnueabi/recipes/files/gccsdk/gccsdk-params new file mode 100644 index 0000000..4f48c3c --- /dev/null +++ b/arm-riscos-gnueabi/recipes/files/gccsdk/gccsdk-params @@ -0,0 +1,8 @@ +# -- Following section is user configurable: +# This is where the cross compiler will be installed. It needs to end in 'bin'. +export GCCSDK_INSTALL_CROSSBIN={PREFIX}/cross/bin +# This is where the porting tools and any libraries you build will be installed. +export GCCSDK_INSTALL_ENV={PREFIX}/env + +# -- Do not change following section: + diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/01-relax-abi-matching.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/01-relax-abi-matching.p new file mode 100644 index 0000000..b1dd8cd --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/01-relax-abi-matching.p @@ -0,0 +1,100 @@ +Index: gcc/bfd.config.bfd.pp +=================================================================== +--- gcc/bfd.config.bfd.pp (revision 7698) ++++ gcc/bfd.config.bfd.pp (working copy) +@@ -4,7 +4,7 @@ + targ_defvec=arm_elf32_le_vec + targ_selvecs=arm_elf32_be_vec + ;; +-+ arm-riscos-gnueabihf) +++ arm-riscos-gnueabi*) + + targ_defvec=arm_elf32_le_vec + + targ_selvecs=arm_elf32_be_vec + + targ_cflags=-D__RISCOS_TARGET__ +Index: gcc/configure.ac.p +=================================================================== +--- gcc/configure.ac.p (revision 7698) ++++ gcc/configure.ac.p (working copy) +@@ -13,7 +13,7 @@ + esac + + +case "${target}" in +-+ arm*-*-riscos | *riscos-gnueabihf) +++ arm*-*-riscos | *riscos-gnueabi*) + + ;; + + *) + + noconfigdirs="$noconfigdirs target-libunixlib" +Index: gcc/gas.configure.tgt.pp +=================================================================== +--- gcc/gas.configure.tgt.pp (revision 7698) ++++ gcc/gas.configure.tgt.pp (working copy) +@@ -4,7 +4,7 @@ + arm-*-coff) fmt=coff ;; + arm-*-phoenix*) fmt=elf ;; + arm-*-elf) fmt=elf ;; +-+ arm-riscos-gnueabihf) fmt=elf em=riscos ;; +++ arm-riscos-gnueabi*) fmt=elf em=riscos ;; + arm-*-eabi* | arm-*-rtems*) fmt=elf em=armeabi ;; + arm-*-symbianelf*) fmt=elf em=symbian ;; + arm-*-kaos*) fmt=elf ;; +Index: gcc/gcc.config.gcc.p +=================================================================== +--- gcc/gcc.config.gcc.p (revision 7698) ++++ gcc/gcc.config.gcc.p (working copy) +@@ -13,7 +13,7 @@ + esac + tm_file="${tm_file} arm/aout.h arm/arm.h" + ;; +-+arm*-riscos-gnueabihf) +++arm*-riscos-gnueabi*) + + gas=yes + + gnu_ld=yes + + tm_file="dbxelf.h elfos.h glibc-stdint.h arm/elf.h arm/aout.h arm/arm.h arm/riscos-gnueabihf.h" +Index: gcc/ld.configure.tgt.pp +=================================================================== +--- gcc/ld.configure.tgt.pp (revision 7698) ++++ gcc/ld.configure.tgt.pp (working copy) +@@ -4,7 +4,7 @@ + arm-*-phoenix*) targ_emul=armelf ;; + armeb-*-elf | armeb-*-eabi*) + targ_emul=armelfb ;; +-+arm-riscos-gnueabihf) targ_emul=armelf_riscos_eabi ;; +++arm-riscos-gnueabi*) targ_emul=armelf_riscos_eabi ;; + arm-*-elf | arm*-*-eabi* | arm-*-rtems*) + targ_emul=armelf ;; + arm*-*-symbianelf*) targ_emul=armsymbian;; +Index: gcc/libgcc.config.host.p +=================================================================== +--- gcc/libgcc.config.host.p (revision 7698) ++++ gcc/libgcc.config.host.p (working copy) +@@ -4,7 +4,7 @@ + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia" + extra_parts="crtbegin.o crtend.o" + ;; +-+arm*-riscos-gnueabihf) +++arm*-riscos-gnueabi*) + + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" + + extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crti.o crtn.o" + + if test x$enable_vtable_verify = xyes; then +@@ -18,7 +18,7 @@ + ;; + esac + ;; +-+arm*-riscos-gnueabihf) +++arm*-riscos-gnueabi*) + + tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm" + + tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc t-slibgcc-nolc-override" + + tm_file="$tm_file arm/bpabi-lib.h" +Index: gcc/libstdc++-v3.configure.host.p +=================================================================== +--- gcc/libstdc++-v3.configure.host.p (revision 7698) ++++ gcc/libstdc++-v3.configure.host.p (working copy) +@@ -4,7 +4,7 @@ + linux-musl*) + os_include_dir="os/generic" + ;; +-+ gnueabihf) +++ gnueabi*) + + os_include_dir="os/riscos" + + ;; + gnu* | linux* | kfreebsd*-gnu | uclinux*) diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/elf2aif-eabi-support.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/elf2aif-eabi-support.p new file mode 100644 index 0000000..afac755 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/elf2aif-eabi-support.p @@ -0,0 +1,394 @@ +Index: elf2aif/src/elf2aif.c +=================================================================== +--- elf2aif/src/elf2aif.c (revision 7698) ++++ elf2aif/src/elf2aif.c (working copy) +@@ -54,7 +54,7 @@ + typedef struct + { + uint8_t decompress[4]; /* BL to decompression code for compressed images */ +- uint8_t selfreloc[4]; /* BL to self-relocation code */ ++ uint8_t selfreloc[4]; /* BL to self-relocation code (*) */ + uint8_t zeroinit[4]; /* BL to zero init code */ + uint8_t entrypoint[4]; /* BL to image entry point (*) */ + uint8_t exitinst[4]; /* Exit instruction */ +@@ -72,47 +72,50 @@ + } aifheader_t; + + static int opt_verbose = 0; ++static int opt_eabi = 0; + + static Elf32_External_Ehdr elf_ehdr; + static phdr_list_t *elf_phdrlistP; + static const char *elf_filename; ++static uint32_t got_addr = 0; + +-static const unsigned int aifcode[] = { +- 0xE1A00000, /* NOP (BL decompress) */ +- 0xE1A00000, /* NOP (BL self-relocate) */ +- 0xEB00000C, /* BL zero-init */ +- 0xEB000000, /* BL entrypoint (*) */ +- 0xEF000011, /* SWI OS_Exit */ +- 0x00000000, /* Image R/O size (*) */ +- 0x00000000, /* Image R/W size (*) */ +- 0x00000000, /* Image debug size */ +- 0x00000000, /* Image zero-init size (*) */ +- 0x00000000, /* Image debug type */ +- 0x00000000, /* Image base (*) */ +- 0x00000000, /* Workspace size */ +- 0x00000020, /* 32-bit addressing */ +- 0x00000000, /* Data base */ +- 0x00000000, /* Reserved */ +- 0x00000000, /* Reserved */ +- 0xE1A00000, /* MOV R0, R0 */ +- 0xE04EC00F, /* SUB R12, R14, PC */ +- 0xE08FC00C, /* ADD R12, PC, R12 */ +- 0xE99C0017, /* LDMIB R12, {R0-R2, R4} */ +- 0xE24CC010, /* SUB R12, R12, #0x10 */ +- 0xE08CC000, /* ADD R12, R12, R0 */ +- 0xE08CC001, /* ADD R12, R12, R1 */ +- 0xE3A00000, /* MOV R0, #0 */ +- 0xE3A01000, /* MOV R1, #0 */ +- 0xE3A02000, /* MOV R2, #0 */ +- 0xE3A03000, /* MOV R3, #0 */ +- 0xE3540000, /* CMP R4, #0 */ ++static const uint32_t aifcode[] = { ++ 0xE1A00000, /* NOP (BL decompress) */ ++ 0xE1A00000, /* NOP (BL self-relocate) (*) */ ++ 0xEB00000C, /* BL zero-init */ ++ 0xEB000000, /* BL entrypoint (*) */ ++ 0xEF000011, /* SWI OS_Exit */ ++ 0x00000000, /* Image R/O size (*) */ ++ 0x00000000, /* Image R/W size (*) */ ++ 0x00000000, /* Image debug size */ ++ 0x00000000, /* Image zero-init size (*) */ ++ 0x00000000, /* Image debug type */ ++ 0x00000000, /* Image base (*) */ ++ 0x00000000, /* Workspace size */ ++ 0x00000020, /* 32-bit addressing */ ++ 0x00000000, /* Data base */ ++ 0x00000000, /* Reserved */ ++ 0x00000000, /* Reserved */ ++ 0xE1A00000, /* MOV R0, R0 */ ++ 0xE04EC00F, /* SUB R12, R14, PC */ ++ 0xE08FC00C, /* ADD R12, PC, R12 */ ++ 0xE99C0017, /* LDMIB R12, {R0-R2, R4} */ ++ 0xE24CC010, /* SUB R12, R12, #16 */ ++ 0xE08CC000, /* ADD R12, R12, R0 */ ++ 0xE08CC001, /* ADD R12, R12, R1 */ ++ 0xE3A00000, /* MOV R0, #0 */ ++ 0xE3A01000, /* MOV R1, #0 */ ++ 0xE3A02000, /* MOV R2, #0 */ ++ 0xE3A03000, /* MOV R3, #0 */ ++ 0xE3540000, /* CMP R4, #0 */ + /* zeroloop: */ +- 0xD1A0F00E, /* MOVLE PC, R14 */ +- 0xE8AC000F, /* STMIA R12!, {R0-R3} */ +- 0xE2544010, /* SUBS R4, R4, #16 */ +- 0xEAFFFFFB /* B zeroloop */ ++ 0xD1A0F00E, /* MOVLE PC, R14 */ ++ 0xE8AC000F, /* STMIA R12!, {R0-R3} */ ++ 0xE2544010, /* SUBS R4, R4, #16 */ ++ 0xEAFFFFFB /* B zeroloop */ + }; + ++ + /* Read a little-endian 'short' value. */ + static uint16_t + RdShort (const uint8_t sh[2]) +@@ -143,6 +146,7 @@ + fprintf (stderr, "Usage: elf2aif [options] <ELF file> [<AIF file>]\n" + "Convert static ARM ELF binary to AIF (Acorn Image Format) binary.\n" + "Options:\n" ++ " -e, --eabi source binary uses EABI\n" + " -v, --verbose prints informational messages during processing\n" + " --help display this help and exit\n" + " --version output version information and exit\n"); +@@ -201,7 +205,8 @@ + return EXIT_FAILURE; + } + +- if (elf_ehdr.e_ident[EI_OSABI] != ELFOSABI_ARM) ++ if ((!opt_eabi && elf_ehdr.e_ident[EI_OSABI] != ELFOSABI_ARM) || ++ (opt_eabi && elf_ehdr.e_ident[EI_OSABI] != ELFOSABI_NONE)) + { + fprintf (stderr, "ELF file '%s' is not for ARM\n", elf_filename); + return EXIT_FAILURE; +@@ -344,6 +349,97 @@ + } + + static int ++e2a_readshdr (FILE * elfhandle) ++{ ++ Elf32_External_Shdr shstentry; ++ uint32_t shoffset, shentrysize, shentrycount, shstrndx; ++ uint32_t shstoffset, shstsize; ++ char *shst; ++ ++ if ((shoffset = RdLong (elf_ehdr.e_shoff)) == 0 ++ || (shentrycount = RdShort (elf_ehdr.e_shnum)) == 0) ++ { ++ fprintf (stderr, "ELF file '%s' does not have section headers\n", ++ elf_filename); ++ return EXIT_FAILURE; ++ } ++ ++ if ((shentrysize = RdShort (elf_ehdr.e_shentsize)) < sizeof (Elf32_External_Shdr)) ++ { ++ fprintf (stderr, "Size section header entry is too small\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if ((shstrndx = RdShort (elf_ehdr.e_shstrndx)) >= shentrycount) { ++ fprintf (stderr, "String table index out of bounds\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (fseek (elfhandle, shoffset + (shstrndx * shentrysize), SEEK_SET) != 0 ++ || fread (&shstentry, sizeof (Elf32_External_Shdr), 1, elfhandle) != 1) ++ { ++ fprintf (stderr, "Failed to read section header string table header\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if ((shstoffset = RdLong (shstentry.sh_offset)) == 0) ++ { ++ fprintf (stderr, "Section header string table data missing\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if ((shstsize = RdLong (shstentry.sh_size)) == 0) ++ { ++ fprintf (stderr, "Invalid section header string table size\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if ((shst = malloc (shstsize)) == NULL) ++ { ++ fprintf (stderr, "Out of memory\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (fseek (elfhandle, shstoffset, SEEK_SET) != 0 ++ || fread (shst, 1, shstsize, elfhandle) != shstsize) ++ { ++ fprintf (stderr, "Failed to read section header string table\n"); ++ return EXIT_FAILURE; ++ } ++ ++ while (shentrycount) ++ { ++ Elf32_External_Shdr shentry; ++ uint32_t shnameoff; ++ ++ if (fseek (elfhandle, shoffset, SEEK_SET) != 0 ++ || fread (&shentry, sizeof (Elf32_External_Shdr), 1, elfhandle) != 1) ++ { ++ fprintf (stderr, "Failed to read section header entry\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if ((shnameoff = RdLong (shentry.sh_name)) >= shstsize) ++ { ++ fprintf (stderr, "Section name out of bounds\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (strcmp ((shst + shnameoff), ".got") == 0) ++ { ++ got_addr = RdLong (shentry.sh_addr); ++ } ++ ++ shoffset += shentrysize; ++ --shentrycount; ++ } ++ ++ free (shst); ++ ++ return EXIT_SUCCESS; ++} ++ ++static int + e2a_copy (FILE * elfhandle, FILE * aifhandle) + { + const phdr_list_t *phdrP; +@@ -488,21 +584,156 @@ + } + + memcpy (&aifhdr, aifcode, sizeof (aifcode)); +- WrLong (aifhdr.entrypoint, +- RdLong (aifhdr.entrypoint) + +- ((exec_addr - load_addr - +- (offsetof (aifheader_t, entrypoint) + 8)) >> 2)); ++ if (opt_eabi) ++ { ++ /* BL to relocation code */ ++ WrLong (aifhdr.selfreloc, ++ /* Default is a NOP, so reading it is useless */ ++ 0xEB000000 + ++ ((aifend - (offsetof (aifheader_t, selfreloc) + 8)) >> 2)); ++ ++ /* BL to EABI startcode */ ++ WrLong (aifhdr.entrypoint, ++ RdLong (aifhdr.entrypoint) + ++ ((sizeof(aifcode) - (offsetof (aifheader_t, entrypoint) + 8)) >> 2)); ++ } ++ else ++ { ++ /* BL to program entrypoint */ ++ WrLong (aifhdr.entrypoint, ++ RdLong (aifhdr.entrypoint) + ++ ((exec_addr - load_addr - ++ (offsetof (aifheader_t, entrypoint) + 8)) >> 2)); ++ } + WrLong (aifhdr.rosize, rosize); + WrLong (aifhdr.rwsize, rwsize); + WrLong (aifhdr.zisize, zisize); + WrLong (aifhdr.imagebase, load_addr); +- if (fwrite (&aifhdr, sizeof (aifhdr), 1, aifhandle) != 1 +- || fseek (aifhandle, aifend, SEEK_SET) != 0) ++ if (fwrite (&aifhdr, sizeof (aifhdr), 1, aifhandle) != 1) + { + fprintf (stderr, "Failed to write aif header\n"); + return EXIT_FAILURE; + } + ++ /* In the EABI case we need to inject the code to install ++ * the ARMEABISupport abort handler */ ++ if (opt_eabi) ++ { ++ assert (128 == sizeof (aifcode)); ++ uint32_t entrycode[] = { ++ /* Space for GOTT_BASE injection (see below) */ ++ 0xE1A00000, /* MOV R0, R0 */ ++ 0xE1A00000, /* MOV R0, R0 */ ++ /* Install the abort handler */ ++ 0xE3A00002, /* MOV R0, #2 */ ++ 0xEF059D01, /* SWI ARMEABISupport_AbortOp */ ++ /* Proceed to the real program start */ ++ 0xEA000000, /* B <program_start> (*) */ ++ /* Offset of the GOT relative to the load address (or 0 if none) */ ++ 0x00000000, /* DCD <got_offset> (*) */ ++ }; ++ ++ const uint32_t reloccode[] = { ++ /* RelocCode: */ ++ 0xE1A00000, /* MOV R0, R0 */ ++ /* Dynamically compute the program load address */ ++ 0xE04EC00F, /* SUB R12, LR, PC */ ++ 0xE08FC00C, /* ADD R12, PC, R12 */ ++ 0xE24CC00C, /* SUB R12, R12, #12 */ ++ /* Prevent reentry by replacing the branch to the relocation code. */ ++ 0xE51F0018, /* LDR R0, =RelocCode */ ++ 0xE58C0004, /* STR R0, [R12, #4] */ ++ /* Relocate the GOT offset (above) to its absolute address */ ++ 0xE59C0094, /* LDR R0, [R12, #&94] */ ++ 0xE3300000, /* TEQ R0, #0 */ ++ 0x1080000C, /* ADDNE R0, R0, R12 */ ++ 0x158C0094, /* STRNE R0, [R12, #&94] */ ++ /* Fill in GOTT_BASE at load + 0x38, unless running under DDT */ ++ 0xE59C0038, /* LDR R0, [R12, #&38] */ ++ 0xE3300000, /* TEQ R0, #0 */ ++ 0x1A000002, /* BNE ddt_hack */ ++ 0xE28C0094, /* ADD R0, R12, #&94 */ ++ 0xE58C0038, /* STR R0, [R12, #&38] */ ++ 0xE1A0F00E, /* MOV PC, LR */ ++ /* Hack for DDT (which uses the reserved field at &8038 to ++ * temporarily store the address of the zero-initialisation code ++ * during program start, which is reinstated after DDT's ++ * replacement is called). In this case, modify the entrycode ++ * (above) to inject it for us. ++ * ++ * This does prevent the RO area being marked non-writeable if ++ * the modified entrycode gets executed, however (in the non-DDT ++ * case, the entrycode does not write to the AIF header, so ++ * there is no reason the RO area can't be non-writeable then). ++ * By definition the RO area must be writeable for relocations to ++ * work, so it is perfectly safe to assume that it is when this ++ * code runs. ++ */ ++ /* ddt_hack: */ ++ 0xE59F001C, /* LDR R0, =ddt_hack_data */ ++ 0xE59F101C, /* LDR R1, =ddt_hack_data+4 */ ++ 0xE58C0080, /* STR R0, [R12, #&80] */ ++ 0xE58C1084, /* STR R1, [R12, #&84] */ ++ /* Invalidate instruction cache */ ++ 0xE3A00001, /* MOV R0, #1 */ ++ 0xE28C1080, /* ADD R1, R12, #&80 */ ++ 0xE28C2088, /* ADD R2, R12, #&88 */ ++ 0xEF02006E, /* SWI XOSSynchroniseCodeAreas */ ++ 0xE1A0F00E, /* MOV PC, LR */ ++ /* Instructions to inject into entrycode. Uses PC-relative ++ * addressing, so must be kept in sync with changes to entrycode ++ * or the location of entrycode within memory. */ ++ /* ddt_hack_data: */ ++ /* Compute address of GOT field after entrycode */ ++ 0xE28F000C, /* ADR R0, got_address */ ++ /* Store computed address in GOTT_BASE (load + 0x38) */ ++ 0xE50F0054, /* STR R0, [pc, #-&54] */ ++ /* Relocation sentinel: just in case anything expects one */ ++ 0xFFFFFFFF, /* DCD -1 */ ++ }; ++ ++ /* Ensure there is sufficient space for the EABI entry code */ ++ if (opt_eabi && exec_addr - load_addr < sizeof (aifcode) + sizeof (entrycode)) ++ { ++ fprintf (stderr, "First program segment is not what we hoped to be " ++ "(not enough place before _start symbol for EABI entrycode)\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (opt_verbose) ++ printf ("Writing EABI entry code at offset 0x%x\n", sizeof (aifcode)); ++ ++ entrycode[4] |= (exec_addr - load_addr - (sizeof (aifcode) + 4*4 + 8)) >> 2; ++ if (got_addr) ++ { ++ if (opt_verbose) ++ printf ("Found GOT at 0x%x\n", got_addr); ++ entrycode[5] = (got_addr - load_addr); ++ } ++ if (fseek (aifhandle, sizeof (aifcode), SEEK_SET) != 0 ++ || fwrite (&entrycode, sizeof (entrycode), 1, aifhandle) != 1) ++ { ++ fprintf (stderr, "Failed to write EABI entrycode\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (opt_verbose) ++ printf ("Writing relocation code at offset 0x%x\n", aifend); ++ ++ if (fseek (aifhandle, aifend, SEEK_SET) != 0 ++ || fwrite (&reloccode, sizeof (reloccode), 1, aifhandle) != 1) ++ { ++ fprintf (stderr, "Failed to write relocation code\n"); ++ return EXIT_FAILURE; ++ } ++ } ++ ++ if (fseek (aifhandle, aifend, SEEK_SET) != 0) ++ { ++ fprintf (stderr, "Failed to seek to end of file\n"); ++ return EXIT_FAILURE; ++ } ++ + return EXIT_SUCCESS; + } + +@@ -557,6 +788,7 @@ + elf_filename = elffilename; + + if (e2a_readehdr (elfhandle) == EXIT_SUCCESS ++ && e2a_readshdr (elfhandle) == EXIT_SUCCESS + && e2a_readphdr (elfhandle) == EXIT_SUCCESS + && e2a_copy (elfhandle, aifhandle) == EXIT_SUCCESS) + status = EXIT_SUCCESS; +@@ -683,6 +915,9 @@ + fprintf (stderr, "Warning: extra options/arguments ignored\n"); + return EXIT_SUCCESS; + } ++ else if (!strcmp (&argv[i][1], "-eabi") ++ || !strcmp (&argv[i][1], "e")) ++ opt_eabi = 1; + else if (!strcmp (&argv[i][1], "-verbose") + || !strcmp (&argv[i][1], "v")) + ++opt_verbose; diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-add-mhalfword-access.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-add-mhalfword-access.p new file mode 100644 index 0000000..43061b9 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-add-mhalfword-access.p @@ -0,0 +1,153 @@ +Index: gcc/gcc.config.arm.arm.h.p +=================================================================== +--- gcc/gcc.config.arm.arm.h.p (nonexistent) ++++ gcc/gcc.config.arm.arm.h.p (working copy) +@@ -0,0 +1,33 @@ ++--- gcc/config/arm/arm.h.orig 2020-07-23 07:35:17.344384552 +0100 +++++ gcc/config/arm/arm.h 2022-05-28 22:48:25.064918314 +0100 ++@@ -1338,7 +1338,9 @@ ++ : (TARGET_IWMMXT && (CLASS) == IWMMXT_REGS) \ ++ ? coproc_secondary_reload_class (MODE, X, TRUE) \ ++ : TARGET_32BIT \ ++- ? (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \ +++ ? (((MODE) == HImode && \ +++ (!arm_arch4 || !halfword_access) && \ +++ true_regnum (X) == -1) \ ++ ? GENERAL_REGS : NO_REGS) \ ++ : THUMB_SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)) ++ ++@@ -1353,7 +1355,7 @@ ++ (((CLASS) == IWMMXT_REGS || (CLASS) == IWMMXT_GR_REGS) \ ++ && CONSTANT_P (X)) \ ++ ? GENERAL_REGS : \ ++- (((MODE) == HImode && ! arm_arch4 \ +++ (((MODE) == HImode && (!arm_arch4 || !halfword_access) \ ++ && (MEM_P (X) \ ++ || ((REG_P (X) || GET_CODE (X) == SUBREG) \ ++ && true_regnum (X) == -1))) \ ++@@ -2016,7 +2018,9 @@ ++ done, UNKNOWN if none. */ ++ #define LOAD_EXTEND_OP(MODE) \ ++ (TARGET_THUMB ? ZERO_EXTEND : \ ++- ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \ +++ (((arm_arch4 && (halfword_access || (MODE) != HImode)) || \ +++ (MODE) == QImode) \ +++ ? ZERO_EXTEND \ ++ : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : UNKNOWN))) ++ ++ /* Nonzero if access to memory by bytes is slow and undesirable. */ +Index: gcc/gcc.config.arm.arm.md.p +=================================================================== +--- gcc/gcc.config.arm.arm.md.p (revision 7698) ++++ gcc/gcc.config.arm.arm.md.p (working copy) +@@ -8,6 +8,42 @@ + (IP_REGNUM 12) ; Scratch register + (SP_REGNUM 13) ; Stack pointer + (LR_REGNUM 14) ; Return address register ++@@ -5546,7 +5547,7 @@ ++ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand")))] ++ "TARGET_EITHER" ++ { ++- if (TARGET_ARM && !arm_arch4 && MEM_P (operands[1])) +++ if (TARGET_ARM && (!arm_arch4 || !halfword_access) && MEM_P (operands[1])) ++ { ++ emit_insn (gen_movhi_bytes (operands[0], operands[1])); ++ DONE; ++@@ -5574,7 +5575,7 @@ ++ (define_insn "*arm_zero_extendhisi2" ++ [(set (match_operand:SI 0 "s_register_operand" "=r,r") ++ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] ++- "TARGET_ARM && arm_arch4 && !arm_arch6" +++ "TARGET_ARM && arm_arch4 && halfword_access && !arm_arch6" ++ "@ ++ # ++ ldrh%?\\t%0, %1" ++@@ -5735,7 +5736,7 @@ ++ emit_insn (gen_thumb1_extendhisi2 (operands[0], operands[1])); ++ DONE; ++ } ++- if (MEM_P (operands[1]) && TARGET_ARM && !arm_arch4) +++ if (MEM_P (operands[1]) && TARGET_ARM && (!arm_arch4 || !halfword_access)) ++ { ++ emit_insn (gen_extendhisi2_mem (operands[0], operands[1])); ++ DONE; ++@@ -5813,7 +5814,7 @@ ++ (define_insn "*arm_extendhisi2" ++ [(set (match_operand:SI 0 "s_register_operand" "=r,r") ++ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] ++- "TARGET_ARM && arm_arch4 && !arm_arch6" +++ "TARGET_ARM && arm_arch4 && halfword_access && !arm_arch6" ++ "@ ++ # ++ ldrsh%?\\t%0, %1" + @@ -6693,7 +6694,7 @@ + (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r") + (unspec:SI [(match_operand:SI 2 "" "X")] +@@ -17,3 +53,49 @@ + "ldr%?\\t%0, [%1,%2]" + [(set_attr "type" "load_4")] + ) ++@@ -6845,7 +6846,7 @@ ++ (define_expand "storehi_single_op" ++ [(set (match_operand:HI 0 "memory_operand") ++ (match_operand:HI 1 "general_operand"))] ++- "TARGET_32BIT && arm_arch4" +++ "TARGET_32BIT && arm_arch4 && halfword_access" ++ " ++ if (!s_register_operand (operands[1], HImode)) ++ operands[1] = copy_to_mode_reg (HImode, operands[1]); ++@@ -6865,7 +6865,7 @@ ++ { ++ if (MEM_P (operands[0])) ++ { ++- if (arm_arch4) +++ if (arm_arch4 && halfword_access) ++ { ++ emit_insn (gen_storehi_single_op (operands[0], operands[1])); ++ DONE; ++@@ -6905,15 +6905,15 @@ ++ emit_insn (gen_movsi (reg, GEN_INT (val))); ++ operands[1] = gen_lowpart (HImode, reg); ++ } ++- else if (arm_arch4 && optimize && can_create_pseudo_p () ++- && MEM_P (operands[1])) +++ else if (arm_arch4 && halfword_access && optimize +++ && can_create_pseudo_p () && MEM_P (operands[1])) ++ { ++ rtx reg = gen_reg_rtx (SImode); ++ ++ emit_insn (gen_zero_extendhisi2 (reg, operands[1])); ++ operands[1] = gen_lowpart (HImode, reg); ++ } ++- else if (!arm_arch4) +++ else if (!arm_arch4 || !halfword_access) ++ { ++ if (MEM_P (operands[1])) ++ { ++@@ -7099,7 +7100,7 @@ ++ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m,r") ++ (match_operand:HI 1 "general_operand" "rIk,K,n,r,mi"))] ++ "TARGET_ARM ++- && arm_arch4 && !TARGET_HARD_FLOAT +++ && arm_arch4 && halfword_access && !TARGET_HARD_FLOAT ++ && (register_operand (operands[0], HImode) ++ || register_operand (operands[1], HImode))" ++ "@ +Index: gcc/gcc.config.arm.arm.opt.p +=================================================================== +--- gcc/gcc.config.arm.arm.opt.p (nonexistent) ++++ gcc/gcc.config.arm.arm.opt.p (working copy) +@@ -0,0 +1,13 @@ ++--- gcc/config/arm/arm.opt.orig 2020-07-23 07:35:17.344384552 +0100 +++++ gcc/config/arm/arm.opt 2022-05-28 22:39:28.543576700 +0100 ++@@ -271,6 +271,10 @@ ++ Avoid overlapping destination and address registers on LDRD instructions ++ that may trigger Cortex-M3 errata. ++ +++mhalfword-access +++Target Report Var(halfword_access) Init(1) +++Enable halfword memory accesses. +++ ++ munaligned-access ++ Target Report Var(unaligned_access) Init(2) Save ++ Enable unaligned word and halfword accesses to packed data. diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-default-no-halfword-access.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-default-no-halfword-access.p new file mode 100644 index 0000000..400341f --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-default-no-halfword-access.p @@ -0,0 +1,13 @@ +Index: gcc/gcc.config.arm.arm.opt.p +=================================================================== +--- gcc/gcc.config.arm.arm.opt.p (nonexistent) ++++ gcc/gcc.config.arm.arm.opt.p (working copy) +@@ -5,7 +5,7 @@ + that may trigger Cortex-M3 errata. + + +mhalfword-access +-+Target Report Var(halfword_access) Init(1) +++Target Report Var(halfword_access) Init(0) + +Enable halfword memory accesses. + + + munaligned-access diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p new file mode 100644 index 0000000..5f93dbe --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p @@ -0,0 +1,56 @@ +Index: gcc/libgcc.config.arm.t-riscos-gnueabihf +=================================================================== +--- gcc/libgcc.config.arm.t-riscos-gnueabihf (revision 7698) ++++ gcc/libgcc.config.arm.t-riscos-gnueabihf (working copy) +@@ -1,36 +1,2 @@ +-# Copyright (C) 2011-2012 Free Software Foundation, Inc. +-# Contributed by John Tytgat (John.Tytgat@aaug.net). +-# +-# This file is part of GCC. +-# +-# GCC is free software; you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 3, or (at your option) +-# any later version. +-# +-# GCC is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with GCC; see the file COPYING3. If not see +-# <http://www.gnu.org/licenses/>. +- +-# vvv Part of config/arm/t-bpabi +-LIB2ADD_ST += $(srcdir)/config/arm/fp16.c +- +-LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \ +- $(srcdir)/config/arm/libunwind.S \ +- $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c +-# ^^^ +- +-ifeq (,$(findstring mlibscl,$(CFLAGS))$(findstring mmodule,$(CFLAGS))) +-# For shared libgcc building: +-EXTRA_PARTS += crtbeginS.o crtendS.o +-gcc_s_compile += -fPIC +-SHLIB_LDFLAGS=-fPIC +-include $(srcdir)/config/t-slibgcc +-include $(srcdir)/config/t-slibgcc-nolc-override +-endif +- ++# Use a version of div0 which raises SIGFPE, and a special __clear_cache. ++LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx _clear_cache +Index: gcc/libgcc.config.host.p +=================================================================== +--- gcc/libgcc.config.host.p (revision 7698) ++++ gcc/libgcc.config.host.p (working copy) +@@ -20,7 +20,7 @@ + ;; + +arm*-riscos-gnueabi*) + + tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm" +-+ tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc t-slibgcc-nolc-override" +++ tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-riscos-gnueabihf t-slibgcc-libgcc t-slibgcc-nolc-override" + + tm_file="$tm_file arm/bpabi-lib.h" + + unwind_header=config/arm/unwind-arm.h + + tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/ld-armv4.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/ld-armv4.p new file mode 100644 index 0000000..ae85eb0 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/ld-armv4.p @@ -0,0 +1,13 @@ +Index: ld/d-link/Makefile.am +=================================================================== +--- ld/d-link/Makefile.am (revision 7698) ++++ ld/d-link/Makefile.am (working copy) +@@ -68,7 +68,7 @@ + + ld_riscos_eabihf_so_CPPFLAGS = -I$(top_srcdir)/d-link -I$(top_srcdir)/d-link/riscos \ + -DNO_UNDERSCORE -DVERBOSE_DLINKER -D__TARGET_SOLOADER__ +-ld_riscos_eabihf_so_CFLAGS = -fPIC -O4 -Wall -std=gnu99 -march=armv7-a+fp+neon ++ld_riscos_eabihf_so_CFLAGS = -fPIC -O4 -Wall -std=gnu99 -march=armv4 + ld_riscos_eabihf_so_LDFLAGS = --shared -Wl,--no-undefined -nostdlib -nostartfiles -Wl,-e -Wl,_dl_start \ + -Wl,-soname -Wl,ld-riscos/so/2 + diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/libtool.m4.p.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/libtool.m4.p.p new file mode 100644 index 0000000..8061b92 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/libtool.m4.p.p @@ -0,0 +1,119 @@ +Index: gcc/libtool.m4.p +=================================================================== +--- gcc/libtool.m4.p (revision 7698) ++++ gcc/libtool.m4.p (working copy) +@@ -5,7 +5,7 @@ + ]) + ;; + + +-+ *riscos | *linux-gnueabihf) +++ *riscos*) + + lt_cv_dlopen="dlopen" + + lt_cv_dlopen_libs="-ldl" + + lt_cv_dlopen_self=yes +@@ -17,7 +17,7 @@ + shlibpath_var=LD_LIBRARY_PATH + ;; + +-+*riscos | linux-gnueabihf) +++*riscos*) + + version_type=linux + + library_names_spec='${libname}$versuffix.so ${libname}.so$major $libname.so' + + soname_spec='${libname}.so$major' +@@ -32,7 +32,7 @@ + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; +-+ *linux-gnueabihf) +++ riscos-gnu*) + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' +@@ -48,7 +48,7 @@ + esac + else + case $host_os in +-+ linux-gnueabihf) +++ riscos-gnu*) + + # RISC OS + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' +@@ -61,7 +61,7 @@ + ;; + vxworks*) + ;; +-+ *linux-gnueabihf) +++ riscos-gnu*) + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' +@@ -78,13 +78,13 @@ + fi + ;; + +-+ *linux-gnueabihf) +++ riscos-gnu*) + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + + ;; + + +-+ *riscos | linux-gnueabihf) +++ *riscos*) + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' +@@ -97,7 +97,7 @@ + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in +-+ linux-gnueabihf) +++ riscos-gnu*) + + # RISC OS + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' +@@ -110,7 +110,7 @@ + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + +-+ *linux-gnueabihf) +++ riscos-gnu*) + + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' +@@ -129,7 +129,7 @@ + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in +-+ linux-gnueabihf) +++ riscos-gnu*) + + # RISC OS + + _LT_TAGVAR(ld_shlibs, $1)=yes + + ;; +@@ -140,7 +140,7 @@ + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + +-+ *riscos | *linux-gnueabihf) +++ *riscos*) + + _LT_TAGVAR(ld_shlibs, $1)=yes + + ;; + + +@@ -151,7 +151,7 @@ + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in +-+ linux-gnueabihf) +++ riscos-gnu*) + + # RISC OS + + _LT_TAGVAR(ld_shlibs, $1)=yes + + ;; +@@ -162,7 +162,7 @@ + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + +-+ *riscos | *linux-gnueabihf) +++ *riscos*) + + _LT_TAGVAR(ld_shlibs, $1)=yes + + ;; + + diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/posix-extended-locale.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/posix-extended-locale.p new file mode 100644 index 0000000..e422786 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/posix-extended-locale.p @@ -0,0 +1,1920 @@ +Index: libunixlib/Makefile.am +=================================================================== +--- libunixlib/Makefile.am (revision 7698) ++++ libunixlib/Makefile.am (working copy) +@@ -583,11 +583,11 @@ + else + locale_src = \ + locale/localeconv.c \ ++ locale/newlocale.c \ + locale/nl_langinfo.c \ + locale/setlocale.c \ + locale/strcoll.c \ +- locale/strxfrm.c \ +- locale/territory.c ++ locale/strxfrm.c + endif + locale_src += \ + locale/iconv.c +@@ -1312,6 +1312,7 @@ + bits/in.h \ + bits/libc-lock.h \ + bits/locale.h \ ++ bits/locale_t.h \ + bits/mathcalls.h \ + bits/mathdef.h \ + bits/mathinline.h \ +Index: libunixlib/ctype/ctypetable.c +=================================================================== +--- libunixlib/ctype/ctypetable.c (revision 7698) ++++ libunixlib/ctype/ctypetable.c (working copy) +@@ -10,36 +10,35 @@ + #include <internal/os.h> + #include <internal/unix.h> + +-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must +- support EOF. */ +-static unsigned char ctype[257]; +-const unsigned char * const __ctype = &ctype[1]; ++/* Global containing current locale settings. */ ++struct _locale __locale_global; ++/* Offset 1 as the first entry is reserved for EOF. */ ++const unsigned char * const __ctype = &__locale_global.ctype[1]; ++const short * const __ctype_upper = &__locale_global.ctype_upper[1]; ++const short * const __ctype_lower = &__locale_global.ctype_lower[1]; + +-static short ctype_upper[257]; +-const short * const __ctype_upper = &ctype_upper[1]; +- +-static short ctype_lower[257]; +-const short * const __ctype_lower = &ctype_lower[1]; +- + void +-__build_ctype_tables (int territory) ++__build_ctype_tables (locale_t locobj, int territory) + { + PTHREAD_UNSAFE + + if (territory == -2) + { +- /* Initialise the array. This is only done by __unixinit(). */ ++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */ + territory = -1; +- for (int x = 0; x <= LC_ALL; x++) +- __locale_territory[x] = -1; ++ for (int x = 0; x < LC_ALL; x++) ++ locobj->locale_territory[x] = -1; ++ __localeconv_lconv_init(&locobj->lc); ++ locobj->lc_needs_refresh = 1; + } + + /* Initialise ctype_upper/ctype_lower tables. */ + for (int x = 0; x < 257; x++) + { +- /* In the C/POSIX locate, tolower(top bit set char) ++ /* In the C/POSIX locale, tolower(top bit set char) + should return the character unchanged. */ +- ctype_lower[x] = ctype_upper[x] = x - 1; ++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1; ++ locobj->ctype[x] = 0; + } + + int regs[10]; +@@ -61,7 +60,7 @@ + for (int offset = 1; bits; bits = bits >> 1, offset += 1) + { + if (bits & 1) +- ctype[pos + offset] |= 1 << code; ++ locobj->ctype[pos + offset] |= 1 << code; + } + pos += 32; + } +@@ -80,7 +79,7 @@ + int y = (territory == -1) ? 128 : 256; + for (int x = 1; x <= y; x++) + { +- ctype_lower[x] = (short)*p++; +- ctype_upper[x] = (short)*q++; ++ locobj->ctype_lower[x] = (short)*p++; ++ locobj->ctype_upper[x] = (short)*q++; + } + } +Index: libunixlib/ctype/isalnum.c +=================================================================== +--- libunixlib/ctype/isalnum.c (revision 7698) ++++ libunixlib/ctype/isalnum.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isalnum) (int c) +@@ -10,3 +11,8 @@ + return isalnum (c); + } + ++int ++isalnum_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit)); ++} +Index: libunixlib/ctype/isalpha.c +=================================================================== +--- libunixlib/ctype/isalpha.c (revision 7698) ++++ libunixlib/ctype/isalpha.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isalpha) (int c) +@@ -10,3 +11,8 @@ + return isalpha (c); + } + ++int ++isalpha_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_alpha); ++} +Index: libunixlib/ctype/isascii.c +=================================================================== +--- libunixlib/ctype/isascii.c (revision 7698) ++++ libunixlib/ctype/isascii.c (working copy) +@@ -10,3 +10,9 @@ + return isascii (c); + } + ++int ++isascii_l (int c, locale_t locobj) ++{ ++ (void) locobj; ++ return isascii (c); ++} +Index: libunixlib/ctype/isblank.c +=================================================================== +--- libunixlib/ctype/isblank.c (revision 7698) ++++ libunixlib/ctype/isblank.c (working copy) +@@ -9,3 +9,10 @@ + { + return isblank (c); + } ++ ++int ++isblank_l (int c, locale_t locobj) ++{ ++ (void) locobj; ++ return isblank (c); ++} +Index: libunixlib/ctype/iscntrl.c +=================================================================== +--- libunixlib/ctype/iscntrl.c (revision 7698) ++++ libunixlib/ctype/iscntrl.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (iscntrl) (int c) +@@ -10,3 +11,8 @@ + return iscntrl (c); + } + ++int ++iscntrl_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl); ++} +Index: libunixlib/ctype/isdigit.c +=================================================================== +--- libunixlib/ctype/isdigit.c (revision 7698) ++++ libunixlib/ctype/isdigit.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isdigit) (int c) +@@ -10,3 +11,8 @@ + return isdigit (c); + } + ++int ++isdigit_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_digit); ++} +Index: libunixlib/ctype/isgraph.c +=================================================================== +--- libunixlib/ctype/isgraph.c (revision 7698) ++++ libunixlib/ctype/isgraph.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isgraph) (int c) +@@ -10,3 +11,8 @@ + return isgraph (c); + } + ++int ++isgraph_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl)); ++} +Index: libunixlib/ctype/islower.c +=================================================================== +--- libunixlib/ctype/islower.c (revision 7698) ++++ libunixlib/ctype/islower.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (islower) (int c) +@@ -10,3 +11,8 @@ + return islower (c); + } + ++int ++islower_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_lower); ++} +Index: libunixlib/ctype/isprint.c +=================================================================== +--- libunixlib/ctype/isprint.c (revision 7698) ++++ libunixlib/ctype/isprint.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isprint) (int c) +@@ -10,3 +11,10 @@ + return isprint (c); + } + ++int ++isprint_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc | ++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl); ++} +Index: libunixlib/ctype/ispunct.c +=================================================================== +--- libunixlib/ctype/ispunct.c (revision 7698) ++++ libunixlib/ctype/ispunct.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (ispunct) (int c) +@@ -10,3 +11,8 @@ + return ispunct (c); + } + ++int ++ispunct_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_punc); ++} +Index: libunixlib/ctype/isspace.c +=================================================================== +--- libunixlib/ctype/isspace.c (revision 7698) ++++ libunixlib/ctype/isspace.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isspace) (int c) +@@ -10,3 +11,8 @@ + return isspace (c); + } + ++int ++isspace_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_white); ++} +Index: libunixlib/ctype/isupper.c +=================================================================== +--- libunixlib/ctype/isupper.c (revision 7698) ++++ libunixlib/ctype/isupper.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isupper) (int c) +@@ -10,3 +11,8 @@ + return isupper (c); + } + ++int ++isupper_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_upper); ++} +Index: libunixlib/ctype/isxdigit.c +=================================================================== +--- libunixlib/ctype/isxdigit.c (revision 7698) ++++ libunixlib/ctype/isxdigit.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isxdigit) (int c) +@@ -10,3 +11,8 @@ + return isxdigit (c); + } + ++int ++isxdigit_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit); ++} +Index: libunixlib/ctype/toascii.c +=================================================================== +--- libunixlib/ctype/toascii.c (revision 7698) ++++ libunixlib/ctype/toascii.c (working copy) +@@ -10,3 +10,9 @@ + return toascii (c); + } + ++int ++toascii_l (int c, locale_t locobj) ++{ ++ (void) locobj; ++ return toascii (c); ++} +Index: libunixlib/ctype/tolower.c +=================================================================== +--- libunixlib/ctype/tolower.c (revision 7698) ++++ libunixlib/ctype/tolower.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (tolower) (int c) +@@ -10,3 +11,8 @@ + return tolower (c); + } + ++int ++tolower_l (int c, locale_t locobj) ++{ ++ return (&locobj->ctype_lower[1])[c]; ++} +Index: libunixlib/ctype/toupper.c +=================================================================== +--- libunixlib/ctype/toupper.c (revision 7698) ++++ libunixlib/ctype/toupper.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (toupper) (int c) +@@ -10,3 +11,8 @@ + return toupper (c); + } + ++int ++toupper_l (int c, locale_t locobj) ++{ ++ return (&locobj->ctype_upper[1])[c]; ++} +Index: libunixlib/incl-local/locale.h +=================================================================== +--- libunixlib/incl-local/locale.h (revision 7698) ++++ libunixlib/incl-local/locale.h (working copy) +@@ -13,15 +13,36 @@ + + #ifndef __TARGET_SCL__ + +-/* Territory number for each locale. C locale is -1. */ +-extern int __locale_territory[LC_ALL + 1]; ++struct _locale { ++ /* Map from locale category to territory number. C locale is -1. */ ++ int locale_territory[LC_ALL]; + +-/* Set to 1 is setlocale has been called since the last call to +- localeconv. localeconv uses this flag to cache the lconv structure. */ +-extern int __setlocale_called; ++ /* Character type LUTs: EOF + one entry per character ++ * ++ * EOF is defined as -1, so character entries start at offset 1. ++ */ ++ short ctype_upper[257]; ++ short ctype_lower[257]; ++ unsigned char ctype[257]; + +-extern void __build_ctype_tables (int __territory) __THROW; ++ /* Set to 1 if the locale information has changed since the last time ++ * the lconv structure was updated. */ ++ int lc_needs_refresh; ++ /* Numeric formatting information for locale */ ++ struct lconv lc; ++}; + ++extern struct _locale __locale_global; ++ ++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW; ++ ++extern char *__setlocale_l (locale_t locobj, int __category, ++ const char *__locale) __THROW; ++ ++void __localeconv_lconv_init (struct lconv *lc); ++void __localeconv_lconv_fini (struct lconv *lc); ++void __localeconv_l (locale_t locobj); ++ + #endif + + __END_DECLS +Index: libunixlib/include/bits/locale_t.h +=================================================================== +--- libunixlib/include/bits/locale_t.h (nonexistent) ++++ libunixlib/include/bits/locale_t.h (working copy) +@@ -0,0 +1,10 @@ ++/* ++ * Copyright (c) 2022 UnixLib Developers ++ */ ++ ++#ifndef _BITS_LOCALE_T_H_ ++#define _BITS_LOCALE_T_H_ ++ ++typedef struct _locale *locale_t; ++ ++#endif +Index: libunixlib/include/ctype.h +=================================================================== +--- libunixlib/include/ctype.h (revision 7698) ++++ libunixlib/include/ctype.h (working copy) +@@ -51,6 +51,48 @@ + extern int isblank (int __c) __THROW; + + #ifndef __TARGET_SCL__ ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> ++ ++/* c is alphabetic or numeric. */ ++extern int isalnum_l (int __c, locale_t locobj) __THROW; ++ ++/* c is alphabetic. */ ++extern int isalpha_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a control character. */ ++extern int iscntrl_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a decimal digit. */ ++extern int isdigit_l (int __c, locale_t locobj) __THROW; ++ ++/* c is any printable character other than a space. */ ++extern int isgraph_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a lower-case letter. */ ++extern int islower_l (int __c, locale_t locobj) __THROW; ++ ++/* c is an upper-case letter. */ ++extern int isupper_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a printable character. */ ++extern int isprint_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a printable character other than a space or a ++ alphanumeric character. */ ++extern int ispunct_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a white space character e.g. space, newline, tab, linefeed, ++ return, vertical tab. */ ++extern int isspace_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a hex digit. */ ++extern int isxdigit_l (int __c, locale_t locobj) __THROW; ++ ++/* c is tab or space. */ ++extern int isblank_l (int __c, locale_t locobj) __THROW; ++# endif ++ + /* Characteristics. */ + extern const unsigned char * const __ctype; + /* Lower case table. */ +@@ -108,6 +150,10 @@ + extern int toupper (int __c) __THROW; + #ifndef __TARGET_SCL__ + # define toupper(c) ((int) __ctype_upper[(int) (c)]) ++ ++# ifdef __USE_XOPEN2K8 ++extern int toupper_l (int __c, locale_t locobj) __THROW; ++# endif + #endif + + /* Convert c to lower case. */ +@@ -114,6 +160,10 @@ + extern int tolower (int __c) __THROW; + #ifndef __TARGET_SCL__ + # define tolower(c) ((int) __ctype_lower[(int) (c)]) ++ ++# ifdef __USE_XOPEN2K8 ++extern int tolower_l (int __c, locale_t locobj) __THROW; ++# endif + #endif + + #ifndef __TARGET_SCL__ +@@ -135,6 +185,11 @@ + /* Is c an ASCII character. */ + extern int isascii (int __c) __THROW; + # define isascii(c) ((unsigned)(c) <= 0x7f) ++ ++# ifdef __USE_XOPEN2K8 ++extern int toascii_l (int __c, locale_t locobj) __THROW; ++extern int isascii_l (int __c, locale_t locobj) __THROW; ++# endif + # endif + #endif + +Index: libunixlib/include/langinfo.h +=================================================================== +--- libunixlib/include/langinfo.h (revision 7698) ++++ libunixlib/include/langinfo.h (working copy) +@@ -580,18 +580,12 @@ + extern char *nl_langinfo (nl_item __item) __THROW; + + +-#if 0 +-#ifdef __USE_GNU +-/* This interface is for the extended locale model. See <locale.h> for +- more information. */ ++#ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> + +-/* Get locale datatype definition. */ +-# include <xlocale.h> +- + /* Just like nl_langinfo but get the information from the locale object L. */ +-extern char *nl_langinfo_l (nl_item __item, __locale_t l); ++extern char *nl_langinfo_l (nl_item __item, locale_t __l); + #endif +-#endif + + __END_DECLS + +Index: libunixlib/include/locale.h +=================================================================== +--- libunixlib/include/locale.h (revision 7698) ++++ libunixlib/include/locale.h (working copy) +@@ -33,16 +33,16 @@ + /* Entire locale. */ + # define LC_ALL 6 + +-#define LC_COLLATE_MASK (1L << 1) +-#define LC_CTYPE_MASK (1L << 2) +-#define LC_MESSAGES_MASK (1L << 3) +-#define LC_MONETARY_MASK (1L << 4) +-#define LC_NUMERIC_MASK (1L << 5) +-#define LC_TIME_MASK (1L << 6) +-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) ++# ifdef __USE_XOPEN2K8 ++# define LC_COLLATE_MASK (1L << 0) ++# define LC_CTYPE_MASK (1L << 1) ++# define LC_MESSAGES_MASK (1L << 2) ++# define LC_MONETARY_MASK (1L << 3) ++# define LC_NUMERIC_MASK (1L << 4) ++# define LC_TIME_MASK (1L << 5) ++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) ++# endif + +-typedef struct _locale *locale_t; +- + #else + /* String collation (functions 'strcoll' and 'strxfrm'). */ + # define LC_COLLATE 1 +@@ -121,6 +121,9 @@ + extern struct lconv *localeconv (void) __THROW; + + #ifndef __TARGET_SCL__ ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> ++ + extern locale_t uselocale(locale_t newloc); + + extern void freelocale(locale_t locobj); +@@ -127,7 +130,11 @@ + + extern locale_t newlocale(int category_mask, const char *locale, + locale_t base); +-# define LC_GLOBAL_LOCALE ((locale_t) -1L) ++ ++extern locale_t duplocale(locale_t locobj); ++ ++# define LC_GLOBAL_LOCALE ((locale_t) -1L) ++# endif + #endif + + __END_NAMESPACE_STD +Index: libunixlib/include/string.h +=================================================================== +--- libunixlib/include/string.h (revision 7698) ++++ libunixlib/include/string.h (working copy) +@@ -93,6 +93,16 @@ + const char *__restrict __src, size_t __n) + __THROW __nonnull ((2)); + ++#ifdef __USE_XOPEN2K8 ++#include <bits/locale_t.h> ++ ++extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 3)); ++ ++extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, ++ locale_t __l) __THROW __nonnull ((2, 4)); ++#endif ++ + /* Find the first occurrence of c in s. */ + extern char *strchr (const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +@@ -281,6 +291,17 @@ + /* Compare no more than N chars of S1 and S2, ignoring case. */ + extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)) __wur; ++ ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> ++ ++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 3)); ++ ++extern int strncasecmp_l (const char *__s1, const char *__s2, ++ size_t __n, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 4)); ++# endif + #endif /* Use BSD. */ + + #if defined __USE_XOPEN2K || defined __USE_MISC +@@ -289,6 +310,11 @@ + __THROW __nonnull ((2)); + #endif + ++#ifdef __USE_XOPEN2K8 ++/* Translate error number to string according to the locale L. */ ++extern char *strerror_l (int __errnum, locale_t __l) __THROW; ++#endif ++ + #ifndef __TARGET_SCL__ + # ifndef basename + /* Return the file name within directory of FILENAME. We don't +Index: libunixlib/include/strings.h +=================================================================== +--- libunixlib/include/strings.h (revision 7698) ++++ libunixlib/include/strings.h (working copy) +@@ -37,7 +37,17 @@ + /* Compare n chars of S1 and S2, ignoring case. */ + extern int strncasecmp (const char *__s1, const char *__s2, size_t __n); + ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> + ++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 3)); ++ ++extern int strncasecmp_l (const char *__s1, const char *__s2, ++ size_t __n, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 4)); ++# endif ++ + /* Return the position of the first bit set in I, or 0 if none are set. + The least-significant bit is position 1, the most-significant 32. */ + extern int ffs (int __i); +Index: libunixlib/include/wchar.h +=================================================================== +--- libunixlib/include/wchar.h (revision 7698) ++++ libunixlib/include/wchar.h (working copy) +@@ -1,7 +1,7 @@ + /* + * File taken from glibc 2.11. + * Following changes were made: +- * - Disabled non-standard reentrant locale prototypes. ++ * - None + */ + + /* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc. +@@ -172,7 +172,6 @@ + __END_NAMESPACE_STD + #endif + +-#if 0 + #ifdef __USE_XOPEN2K8 + /* Compare S1 and S2, ignoring case. */ + extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; +@@ -183,15 +182,14 @@ + + /* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +-# include <xlocale.h> ++# include <bits/locale_t.h> + + extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, +- __locale_t __loc) __THROW; ++ locale_t __loc) __THROW; + + extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, +- size_t __n, __locale_t __loc) __THROW; ++ size_t __n, locale_t __loc) __THROW; + #endif +-#endif + + __BEGIN_NAMESPACE_STD + /* Compare S1 and S2, both interpreted as appropriate to the +@@ -205,7 +203,6 @@ + __END_NAMESPACE_STD + + #ifdef __USE_XOPEN2K8 +-#if 0 + /* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ + +@@ -212,14 +209,13 @@ + /* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the given locale. */ + extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, +- __locale_t __loc) __THROW; ++ locale_t __loc) __THROW; + + /* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ + extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, +- size_t __n, __locale_t __loc) __THROW; +-#endif ++ size_t __n, locale_t __loc) __THROW; + + #ifndef __TARGET_SCL__ + /* Duplicate S, returning an identical malloc'd string. */ +Index: libunixlib/include/wctype.h +=================================================================== +--- libunixlib/include/wctype.h (revision 7698) ++++ libunixlib/include/wctype.h (working copy) +@@ -3,7 +3,6 @@ + * Following changes were made: + * - Replaced "#include <bits/types.h>" into "#include <unixlib/types.h>" + * - Add wint_t typedef when it hasn't been defined in stddef.h. +- * - Disabled non-standard reentrant locale prototypes. + */ + + /* Copyright (C) 1996-2002,2005,2007,2008,2009 Free Software Foundation, Inc. +@@ -191,7 +190,6 @@ + /* Determine whether the wide-character WC has the property described by + DESC. */ + extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; +-#define iswctype_l(c, d, l) iswctype(c, d) + + __END_NAMESPACE_C99 + +@@ -241,73 +239,71 @@ + extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; + __END_NAMESPACE_C99 + +-#if 0 + # ifdef __USE_XOPEN2K8 +-/* Declare the interface to extended locale model. */ +-# include <xlocale.h> ++# include <bits/locale_t.h> + + /* Test for any wide character for which `iswalpha' or `iswdigit' is + true. */ +-extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character for which `iswupper' or 'iswlower' is + true, or any wide character that is one of a locale-specific set of + wide-characters for which none of `iswcntrl', `iswdigit', + `iswpunct', or `iswspace' is true. */ +-extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any control wide character. */ +-extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a decimal-digit + character. */ +-extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character for which `iswprint' is true and + `iswspace' is false. */ +-extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a lowercase letter + or is one of a locale-specific set of wide characters for which + none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +-extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any printing wide character. */ +-extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any printing wide character that is one of a + locale-specific et of wide characters for which neither `iswspace' + nor `iswalnum' is true. */ +-extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a locale-specific + set of wide characters for which none of `iswalnum', `iswgraph', or + `iswpunct' is true. */ +-extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to an uppercase letter + or is one of a locale-specific set of wide character for which none + of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +-extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a hexadecimal-digit + character equivalent to that performed be the functions described + in the previous subclause. */ +-extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a standard blank + wide character or a locale-specific set of wide characters for + which `iswalnum' is false. */ +-extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW; + + /* Construct value that describes a class of wide characters identified + by the string argument PROPERTY. */ +-extern wctype_t wctype_l (__const char *__property, __locale_t __locale) ++extern wctype_t wctype_l (__const char *__property, locale_t __locale) + __THROW; + + /* Determine whether the wide-character WC has the property described by + DESC. */ +-extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) ++extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale) + __THROW; + + +@@ -316,22 +312,21 @@ + */ + + /* Converts an uppercase letter to the corresponding lowercase letter. */ +-extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW; ++extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW; + + /* Converts an lowercase letter to the corresponding uppercase letter. */ +-extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW; ++extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW; + + /* Construct value that describes a mapping between wide characters + identified by the string argument PROPERTY. */ +-extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale) ++extern wctrans_t wctrans_l (__const char *__property, locale_t __locale) + __THROW; + + /* Map the wide character WC using the mapping described by DESC. */ + extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, +- __locale_t __locale) __THROW; ++ locale_t __locale) __THROW; + + # endif /* Use POSIX 2008. */ +-#endif + + __END_DECLS + +Index: libunixlib/locale/localeconv.c +=================================================================== +--- libunixlib/locale/localeconv.c (revision 7698) ++++ libunixlib/locale/localeconv.c (working copy) +@@ -14,8 +14,6 @@ + + /* #define DEBUG */ + +-int __setlocale_called = 1; +- + static int + read_symbol (int reason_code, int territory) + { +@@ -71,26 +69,44 @@ + *grouping = new_grouping; + } + +-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL, +- NULL, NULL, NULL, NULL, NULL, +- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, +- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX }; ++void ++__localeconv_lconv_init (struct lconv *lc) ++{ ++ memset(lc, 0, sizeof(*lc)); ++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes = ++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space = ++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX; ++} + +-/* Defined by POSIX as not threadsafe */ +-struct lconv * +-localeconv (void) ++void ++__localeconv_lconv_fini (struct lconv *lc) + { ++ free(lc->decimal_point); ++ free(lc->thousands_sep); ++ free(lc->grouping); ++ free(lc->int_curr_symbol); ++ free(lc->currency_symbol); ++ free(lc->mon_decimal_point); ++ free(lc->mon_thousands_sep); ++ free(lc->mon_grouping); ++ free(lc->positive_sign); ++ free(lc->negative_sign); ++} ++ ++void ++__localeconv_l (locale_t locobj) ++{ + int numeric, monetary; + + /* If setlocale has not been called since the last call to + localeconv, then the lconv structure will be the same. */ +- if (!__setlocale_called) +- return &lc; ++ if (!locobj->lc_needs_refresh) ++ return; + +- __setlocale_called = 0; ++ locobj->lc_needs_refresh = 0; + +- numeric = __locale_territory[LC_NUMERIC]; +- monetary = __locale_territory[LC_MONETARY]; ++ numeric = locobj->locale_territory[LC_NUMERIC]; ++ monetary = locobj->locale_territory[LC_MONETARY]; + + /* See the PRMs regarding SWI Territory_ReadSymbols for the + meanings of the following numbers. */ +@@ -97,71 +113,80 @@ + if (numeric == -1) + { + /* We're using the 'C' locale. */ +- free (lc.decimal_point); +- lc.decimal_point = strdup ("."); +- free (lc.thousands_sep); +- lc.thousands_sep = strdup (""); +- free (lc.grouping); +- lc.grouping = strdup (""); ++ free (locobj->lc.decimal_point); ++ locobj->lc.decimal_point = strdup ("."); ++ free (locobj->lc.thousands_sep); ++ locobj->lc.thousands_sep = strdup (""); ++ free (locobj->lc.grouping); ++ locobj->lc.grouping = strdup (""); + } + else + { +- free (lc.decimal_point); +- lc.decimal_point = strdup ((char *) read_symbol (0, numeric)); +- free (lc.thousands_sep); +- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric)); +- read_byte_list (2, &lc.grouping, numeric); ++ free (locobj->lc.decimal_point); ++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric)); ++ free (locobj->lc.thousands_sep); ++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric)); ++ read_byte_list (2, &locobj->lc.grouping, numeric); + } + if (monetary == -1) + { + /* We using the 'C' locale. Empty strings and CHAR_MAX means + that these fields are unspecified. */ +- free (lc.mon_decimal_point); +- lc.mon_decimal_point = strdup (""); +- free (lc.mon_thousands_sep); +- lc.mon_thousands_sep = strdup (""); +- free (lc.mon_grouping); +- lc.mon_grouping = strdup (""); +- lc.int_frac_digits = CHAR_MAX; +- lc.frac_digits = CHAR_MAX; +- free (lc.currency_symbol); +- lc.currency_symbol = strdup (""); +- free (lc.int_curr_symbol); +- lc.int_curr_symbol = strdup (""); +- lc.p_cs_precedes = CHAR_MAX; +- lc.n_cs_precedes = CHAR_MAX; +- lc.p_sep_by_space = CHAR_MAX; +- lc.n_sep_by_space = CHAR_MAX; +- free (lc.positive_sign); +- lc.positive_sign = strdup (""); +- free (lc.negative_sign); +- lc.negative_sign = strdup (""); +- lc.p_sign_posn = CHAR_MAX; +- lc.n_sign_posn = CHAR_MAX; ++ free (locobj->lc.mon_decimal_point); ++ locobj->lc.mon_decimal_point = strdup (""); ++ free (locobj->lc.mon_thousands_sep); ++ locobj->lc.mon_thousands_sep = strdup (""); ++ free (locobj->lc.mon_grouping); ++ locobj->lc.mon_grouping = strdup (""); ++ locobj->lc.int_frac_digits = CHAR_MAX; ++ locobj->lc.frac_digits = CHAR_MAX; ++ free (locobj->lc.currency_symbol); ++ locobj->lc.currency_symbol = strdup (""); ++ free (locobj->lc.int_curr_symbol); ++ locobj->lc.int_curr_symbol = strdup (""); ++ locobj->lc.p_cs_precedes = CHAR_MAX; ++ locobj->lc.n_cs_precedes = CHAR_MAX; ++ locobj->lc.p_sep_by_space = CHAR_MAX; ++ locobj->lc.n_sep_by_space = CHAR_MAX; ++ free (locobj->lc.positive_sign); ++ locobj->lc.positive_sign = strdup (""); ++ free (locobj->lc.negative_sign); ++ locobj->lc.negative_sign = strdup (""); ++ locobj->lc.p_sign_posn = CHAR_MAX; ++ locobj->lc.n_sign_posn = CHAR_MAX; + } + else + { +- free (lc.int_curr_symbol); +- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary)); +- free (lc.currency_symbol); +- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary)); +- free (lc.mon_decimal_point); +- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary)); +- free (lc.mon_thousands_sep); +- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary)); +- read_byte_list (7, &lc.mon_grouping, monetary); +- free (lc.positive_sign); +- lc.positive_sign = strdup ((char *)read_symbol (8, monetary)); +- free (lc.negative_sign); +- lc.negative_sign = strdup ((char *)read_symbol (9, monetary)); +- lc.int_frac_digits = (char)read_symbol (10, monetary); +- lc.frac_digits = (char)read_symbol (11, monetary); +- lc.p_cs_precedes = (char)read_symbol (12, monetary); +- lc.p_sep_by_space = (char)read_symbol (13, monetary); +- lc.n_cs_precedes = (char)read_symbol (14, monetary); +- lc.n_sep_by_space = (char)read_symbol (15, monetary); +- lc.p_sign_posn = (char)read_symbol (16, monetary); +- lc.n_sign_posn = (char)read_symbol (17, monetary); ++ free (locobj->lc.int_curr_symbol); ++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary)); ++ free (locobj->lc.currency_symbol); ++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary)); ++ free (locobj->lc.mon_decimal_point); ++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary)); ++ free (locobj->lc.mon_thousands_sep); ++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary)); ++ read_byte_list (7, &locobj->lc.mon_grouping, monetary); ++ free (locobj->lc.positive_sign); ++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary)); ++ free (locobj->lc.negative_sign); ++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary)); ++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary); ++ locobj->lc.frac_digits = (char)read_symbol (11, monetary); ++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary); ++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary); ++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary); ++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary); ++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary); ++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary); + } +- return &lc; ++ return; + } ++ ++/* Defined by POSIX as not threadsafe */ ++struct lconv * ++localeconv (void) ++{ ++ __localeconv_l (&__locale_global); ++ ++ return &__locale_global.lc; ++} +Index: libunixlib/locale/newlocale.c +=================================================================== +--- libunixlib/locale/newlocale.c (revision 7698) ++++ libunixlib/locale/newlocale.c (working copy) +@@ -1,17 +1,17 @@ + /* Copyright (c) 2019 UnixLib Developers + */ + ++#include <ctype.h> ++#include <errno.h> ++#include <locale.h> + #include <stdlib.h> +-#include <locale.h> + #include <stdio.h> +-#include <errno.h> ++#include <string.h> + +-struct _locale { +- struct lconv lc; +-}; ++#include <internal/unix.h> + + /* This is supposed to be per-thread. */ +-static locale_t current_locale; ++static locale_t current_locale = LC_GLOBAL_LOCALE; + + locale_t uselocale(locale_t newloc) + { +@@ -27,20 +27,94 @@ + + void freelocale(locale_t locobj) + { +- if (locobj) ++ if (locobj) { ++ __localeconv_lconv_fini(&locobj->lc); + free(locobj); ++ } + } + + locale_t newlocale(int category_mask, const char *locale, + locale_t base) + { +- locale_t loc = (locale_t)malloc(sizeof(*loc)); +- if (!loc) { ++ struct _locale tmp; ++ ++ PTHREAD_UNSAFE ++ ++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) { ++ __set_errno (EINVAL); ++ return 0; ++ } ++ ++ /* The locale provided will be verified by __setlocale_l() */ ++ ++ /* Prepare the temporary locale we will modify */ ++ if (base != 0 && base != LC_GLOBAL_LOCALE) { ++ memcpy(&tmp, base, sizeof(tmp)); ++ } else { ++ if (base == LC_GLOBAL_LOCALE) { ++ /* Undefined: be helpful to client */ ++ memcpy(&tmp, &__locale_global, sizeof(tmp)); ++ } else { ++ /* Initialise to C locale */ ++ __build_ctype_tables(&tmp, -2); ++ } ++ } ++ ++ /* Now, apply the requested locale to each of the categories in the mask */ ++ if (category_mask == LC_ALL_MASK) { ++ /* Special-case LC_ALL to handle the encoded locale string */ ++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) { ++ return 0; ++ } ++ } else { ++ int category = 0, mask = category_mask; ++ while (mask != 0) { ++ if (mask & 1) { ++ if (__setlocale_l(&tmp, category, locale) == NULL) { ++ return 0; ++ } ++ } ++ category++; ++ mask >>= 1; ++ } ++ } ++ ++ /* Allocate the result, if necessary */ ++ if (base == 0 || base == LC_GLOBAL_LOCALE) { ++ base = (locale_t)malloc(sizeof(*base)); ++ if (!base) { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ } ++ /* Fill it in */ ++ memcpy(base, &tmp, sizeof(tmp)); ++ ++ /* Mark the lconv data stale */ ++ base->lc_needs_refresh = 1; ++ ++ return base; ++} ++ ++locale_t duplocale(locale_t locobj) ++{ ++ locale_t loc; ++ ++ loc = (locale_t) malloc(sizeof(*loc)); ++ if (loc == NULL) { + __set_errno (ENOMEM); + return 0; + } + +- loc->lc = *localeconv(); ++ if (locobj == LC_GLOBAL_LOCALE) { ++ memcpy(loc, &__locale_global, sizeof(*loc)); ++ } else { ++ memcpy(loc, locobj, sizeof(*loc)); ++ } + ++ /* Invalidate lconv in the copy */ ++ __localeconv_lconv_init(&loc->lc); ++ loc->lc_needs_refresh = 1; ++ + return loc; + } +Index: libunixlib/locale/nl_langinfo.c +=================================================================== +--- libunixlib/locale/nl_langinfo.c (revision 7698) ++++ libunixlib/locale/nl_langinfo.c (working copy) +@@ -24,3 +24,10 @@ + + return (char *)value; + } ++ ++char * ++nl_langinfo_l (nl_item item, locale_t l) ++{ ++ (void) l; ++ return nl_langinfo(item); ++} +Index: libunixlib/locale/setlocale.c +=================================================================== +--- libunixlib/locale/setlocale.c (revision 7698) ++++ libunixlib/locale/setlocale.c (working copy) +@@ -195,7 +195,7 @@ + } + + static void +-do_lc_all (char *buffer, int size) ++do_lc_all (locale_t locobj, char *buffer, int size) + { + char temp[64]; + int category, same = 1; +@@ -204,13 +204,13 @@ + setlocale to set all locales. If all locales are + the same, then we can produce a very short string. */ + for (category = 1; category < LC_ALL; ++category) +- if (__locale_territory[0] != __locale_territory[category]) ++ if (locobj->locale_territory[0] != locobj->locale_territory[category]) + same = 0; + + if (same) + { + /* All locales are set to the same territory. */ +- territory_name (__locale_territory[0], buffer, size); ++ territory_name (locobj->locale_territory[0], buffer, size); + } + else + { +@@ -218,7 +218,7 @@ + LC_CATEGORY=country;LC_CATEGORY=country; ... */ + for (category = 0; category < LC_ALL; ++category) + { +- territory_name (__locale_territory[category], temp, sizeof (temp)); ++ territory_name (locobj->locale_territory[category], temp, sizeof (temp)); + buffer = stpcpy (buffer, locale_names[category]); + *buffer++ = '='; + buffer = stpcpy (buffer, temp); +@@ -230,15 +230,13 @@ + } + + char * +-setlocale (int category, const char *locale) ++__setlocale_l (locale_t locobj, int category, const char *locale) + { + int new_territory, changed; + static char old_locale[256]; + +- PTHREAD_UNSAFE +- + /* This tells localeconv to re-read data for the lconv structure. */ +- __setlocale_called = 1; ++ locobj->lc_needs_refresh = 1; + + if (locale == NULL) + { +@@ -247,11 +245,11 @@ + { + /* The locale string is specially encoded for LC_ALL so we + could restore all locales at any time. */ +- do_lc_all (old_locale, sizeof (old_locale)); ++ do_lc_all (locobj, old_locale, sizeof (old_locale)); + return old_locale; + } + +- territory_name (__locale_territory[category], old_locale, sizeof (old_locale)); ++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale)); + return old_locale; + } + +@@ -270,7 +268,7 @@ + /* Encode the locale string, as we will be returning this + later. Remember, setlocale returns the locale settings + that are about to be changed. */ +- do_lc_all (old_locale, sizeof (old_locale)); ++ do_lc_all (locobj, old_locale, sizeof (old_locale)); + + /* Check for an encoded (composite) name. Simply looking for + a semi-colon will verify this. */ +@@ -332,11 +330,11 @@ + + /* We now know all locales exist, so set them. */ + for (category = 0; category < LC_ALL; ++category) +- __locale_territory[category] = territory_number (newnames[category]); ++ locobj->locale_territory[category] = territory_number (newnames[category]); + + /* Re-build the character type tables according to the new + locale settings. */ +- __build_ctype_tables (__locale_territory[LC_CTYPE]); ++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]); + return old_locale; + } + } +@@ -359,9 +357,9 @@ + /* Change the locale for all categories. old_locale was created + when we previously checked for a composite string. */ + for (category = 0; category < LC_ALL; ++category) +- if (__locale_territory[category] != new_territory) ++ if (locobj->locale_territory[category] != new_territory) + { +- __locale_territory[category] = new_territory; ++ locobj->locale_territory[category] = new_territory; + changed = 1; + } + } +@@ -368,12 +366,12 @@ + else + { + /* Change the locale for just one category. */ +- territory_name (__locale_territory[category], ++ territory_name (locobj->locale_territory[category], + old_locale, sizeof (old_locale)); + +- if (__locale_territory[category] != new_territory) ++ if (locobj->locale_territory[category] != new_territory) + { +- __locale_territory[category] = new_territory; ++ locobj->locale_territory[category] = new_territory; + changed = 1; + } + } +@@ -384,7 +382,16 @@ + is changing. The GNU Java compiler is known to repeatedly call + setlocale. */ + if (changed && (category == LC_ALL || category == LC_CTYPE)) +- __build_ctype_tables (new_territory); ++ __build_ctype_tables (locobj, new_territory); + + return old_locale; + } ++ ++char * ++setlocale (int category, const char *locale) ++{ ++ ++ PTHREAD_UNSAFE ++ ++ return __setlocale_l(&__locale_global, category, locale); ++} +Index: libunixlib/locale/strcoll.c +=================================================================== +--- libunixlib/locale/strcoll.c (revision 7698) ++++ libunixlib/locale/strcoll.c (working copy) +@@ -11,9 +11,15 @@ + int + strcoll (const char *s1, const char *s2) + { ++ return strcoll_l (s1, s2, &__locale_global); ++} ++ ++int ++strcoll_l (const char *s1, const char *s2, locale_t l) ++{ + int regs[10]; + +- regs[0] = __locale_territory[LC_COLLATE]; ++ regs[0] = l->locale_territory[LC_COLLATE]; + regs[1] = (int)s1; + regs[2] = (int)s2; + regs[3] = 0; +@@ -21,3 +27,4 @@ + __os_swi (Territory_Collate, regs); + return regs[0]; + } ++ +Index: libunixlib/locale/strxfrm.c +=================================================================== +--- libunixlib/locale/strxfrm.c (revision 7698) ++++ libunixlib/locale/strxfrm.c (working copy) +@@ -11,9 +11,15 @@ + size_t + strxfrm (char *to, const char *from, size_t size) + { ++ return strxfrm_l (to, from, size, &__locale_global); ++} ++ ++size_t ++strxfrm_l (char *to, const char *from, size_t size, locale_t l) ++{ + int regs[10]; + +- regs[0] = __locale_territory[LC_COLLATE]; ++ regs[0] = l->locale_territory[LC_COLLATE]; + regs[1] = (int)to; + regs[2] = (int)from; + regs[3] = size; +Index: libunixlib/locale/territory.c +=================================================================== +--- libunixlib/locale/territory.c (revision 7698) ++++ libunixlib/locale/territory.c (nonexistent) +@@ -1,10 +0,0 @@ +-/* __locale_territory +- * Copyright (c) 2000-2006 UnixLib Developers +- */ +- +-#include <locale.h> +- +-/* Global used for all calls to the Territory module. These variable +- contain the territory number as set by setlocale. A value of +- -1 means use the C locale. */ +-int __locale_territory[LC_ALL + 1]; +Index: libunixlib/string/stricmp.c +=================================================================== +--- libunixlib/string/stricmp.c (revision 7698) ++++ libunixlib/string/stricmp.c (working copy) +@@ -4,6 +4,7 @@ + #include <string.h> + #include <strings.h> + #include <ctype.h> ++#include <locale.h> + + int + stricmp (const char *s1, const char *s2) +@@ -26,3 +27,24 @@ + return result; + } + strong_alias (stricmp, strcasecmp) ++ ++int ++strcasecmp_l (const char *s1, const char *s2, locale_t locobj) ++{ ++ const unsigned char *p1 = (const unsigned char *) s1; ++ const unsigned char *p2 = (const unsigned char *) s2; ++ int result = 0; ++ ++ if (p1 == p2) ++ return result; ++ ++ while (! result) ++ { ++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj); ++ if (*p1++ == '\0') ++ break; ++ p2 ++; ++ } ++ ++ return result; ++} +Index: libunixlib/string/strnicmp.c +=================================================================== +--- libunixlib/string/strnicmp.c (revision 7698) ++++ libunixlib/string/strnicmp.c (working copy) +@@ -5,6 +5,7 @@ + #include <string.h> + #include <strings.h> + #include <ctype.h> ++#include <locale.h> + + int + strnicmp (const char *s1, const char *s2, size_t n) +@@ -26,3 +27,22 @@ + } + strong_alias (strnicmp, strncasecmp) + ++int ++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj) ++{ ++ int i, j; ++ ++ if (!n) ++ return 0; ++ ++ do ++ { ++ i = *s1++, j = *s2++; ++ i = tolower_l (i, locobj); ++ j = tolower_l (j, locobj); ++ } ++ while (i && i == j && --n); ++ ++ return i - j; ++} ++ +Index: libunixlib/sys/errlist.c +=================================================================== +--- libunixlib/sys/errlist.c (revision 7698) ++++ libunixlib/sys/errlist.c (working copy) +@@ -211,3 +211,10 @@ + + return 0; + } ++ ++char * ++strerror_l (int errnum, locale_t l) ++{ ++ (void) l; ++ return strerror (errnum); ++} +Index: libunixlib/time/broken.c +=================================================================== +--- libunixlib/time/broken.c (revision 7698) ++++ libunixlib/time/broken.c (working copy) +@@ -49,7 +49,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, ordinals); + } +Index: libunixlib/time/gmtime_r.c +=================================================================== +--- libunixlib/time/gmtime_r.c (revision 7698) ++++ libunixlib/time/gmtime_r.c (working copy) +@@ -46,7 +46,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, ordinals)) != NULL) + { +Index: libunixlib/time/localtime_r.c +=================================================================== +--- libunixlib/time/localtime_r.c (revision 7698) ++++ libunixlib/time/localtime_r.c (working copy) +@@ -28,7 +28,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, ordinals)) != NULL) + { +Index: libunixlib/time/mktime.c +=================================================================== +--- libunixlib/time/mktime.c (revision 7698) ++++ libunixlib/time/mktime.c (working copy) +@@ -23,7 +23,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, + ordinals)) != NULL) +Index: libunixlib/time/stdtime.c +=================================================================== +--- libunixlib/time/stdtime.c (revision 7698) ++++ libunixlib/time/stdtime.c (working copy) +@@ -48,7 +48,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, + result, +Index: libunixlib/time/strftime.c +=================================================================== +--- libunixlib/time/strftime.c (revision 7698) ++++ libunixlib/time/strftime.c (working copy) +@@ -353,7 +353,7 @@ + int regs[10]; + char buffer[64]; + +- regs[0] = __locale_territory[LC_TIME]; ++ regs[0] = __locale_global.locale_territory[LC_TIME]; + regs[1] = (int)timep; + regs[2] = (int)buffer; + regs[3] = sizeof (buffer) - 1; +@@ -368,7 +368,7 @@ + int regs[10]; + char buffer[64]; + +- regs[0] = __locale_territory[LC_TIME]; ++ regs[0] = __locale_global.locale_territory[LC_TIME]; + regs[1] = (int)timep; + regs[2] = (int)buffer; + regs[3] = sizeof (buffer) - 1; +Index: libunixlib/time/tzset.c +=================================================================== +--- libunixlib/time/tzset.c (revision 7698) ++++ libunixlib/time/tzset.c (working copy) +@@ -36,7 +36,7 @@ + /* Get timezone information for current territory. */ + _kernel_swi_regs regs; + #ifndef __TARGET_SCL__ +- regs.r[0] = __locale_territory[LC_TIME]; ++ regs.r[0] = __locale_global.locale_territory[LC_TIME]; + #else + regs.r[0] = -1; /* Current territory. */ + #endif +Index: libunixlib/unix/unix.c +=================================================================== +--- libunixlib/unix/unix.c (revision 7698) ++++ libunixlib/unix/unix.c (working copy) +@@ -191,7 +191,7 @@ + __pthread_prog_init (); + __unixlib_signal_initialise (__u); + /* Initialise ctype tables to the C locale. */ +- __build_ctype_tables (-2); ++ __build_ctype_tables (&__locale_global, -2); + /* Define and initialise the Unix I/O. */ + initialise_unix_io (); + __stdioinit (); +Index: libunixlib/vscript +=================================================================== +--- libunixlib/vscript (revision 7698) ++++ libunixlib/vscript (working copy) +@@ -58,6 +58,9 @@ + __init_des_r; + __init_des; + __invalidate; ++ __locale_global; ++ __localeconv_lconv_init; ++ __localeconv_lconv_fini; + malloc_trim; + malloc_trim_unlocked; + malloc_unlocked; +@@ -80,6 +83,7 @@ + __res_vinit; + __runtime_features; + __setup_signalhandler_stack; ++ __setlocale_l; + __sdirinit; + __sfixinit; + __sfixfind; +Index: libunixlib/wchar/wctype.c +=================================================================== +--- libunixlib/wchar/wctype.c (revision 7698) ++++ libunixlib/wchar/wctype.c (working copy) +@@ -4,6 +4,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + #include <wctype.h> + + int +@@ -71,3 +72,69 @@ + { + return isxdigit (wc); + } ++ ++int ++iswalnum_l (wint_t wc, locale_t locale) ++{ ++ return isalnum_l (wc, locale); ++} ++ ++int ++iswalpha_l (wint_t wc, locale_t locale) ++{ ++ return isalpha_l (wc, locale); ++} ++ ++int ++iswcntrl_l (wint_t wc, locale_t locale) ++{ ++ return iscntrl_l (wc, locale); ++} ++ ++int ++iswdigit_l (wint_t wc, locale_t locale) ++{ ++ return isdigit_l (wc, locale); ++} ++ ++int ++iswgraph_l (wint_t wc, locale_t locale) ++{ ++ return isgraph_l (wc, locale); ++} ++ ++int ++iswprint_l (wint_t wc, locale_t locale) ++{ ++ return isprint_l (wc, locale); ++} ++ ++int ++iswpunct_l (wint_t wc, locale_t locale) ++{ ++ return ispunct_l (wc, locale); ++} ++ ++int ++iswspace_l (wint_t wc, locale_t locale) ++{ ++ return isspace_l (wc, locale); ++} ++ ++int ++iswxdigit_l (wint_t wc, locale_t locale) ++{ ++ return isxdigit_l (wc, locale); ++} ++ ++wint_t ++towlower_l (wint_t wc, locale_t locale) ++{ ++ return tolower_l (wc, locale); ++} ++ ++wint_t ++towupper_l (wint_t wc, locale_t locale) ++{ ++ return toupper_l (wc, locale); ++} +Index: libunixlib/wchar/wmissing.c +=================================================================== +--- libunixlib/wchar/wmissing.c (revision 7698) ++++ libunixlib/wchar/wmissing.c (working copy) +@@ -1,7 +1,7 @@ ++#include <locale.h> ++#include <stdio.h> + #include <stdlib.h> + #include <wctype.h> +-#include <wctype.h> +-#include <stdio.h> + + int iswupper (wint_t __wc) + { +@@ -9,13 +9,26 @@ + abort(); + } + +-unsigned long int wcstoul (__const wchar_t *__restrict __nptr, +- wchar_t **__restrict __endptr, int __base) ++int ++iswupper_l (wint_t wc, locale_t locale) + { + printf("%s: Not implemented\n", __func__); + abort(); + } + ++int iswlower (wint_t __wc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int ++iswlower_l (wint_t wc, locale_t locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) + { + printf("%s: Not implemented\n", __func__); +@@ -22,12 +35,47 @@ + abort(); + } + +-int iswlower (wint_t __wc) ++int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, ++ locale_t loc) + { + printf("%s: Not implemented\n", __func__); + abort(); + } + ++int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, ++ size_t __n) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, ++ locale_t __loc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, ++ size_t __n, locale_t __loc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++unsigned long int wcstoul (__const wchar_t *__restrict __nptr, ++ wchar_t **__restrict __endptr, int __base) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + long long int wcstoll (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + { +@@ -63,6 +111,13 @@ + abort(); + } + ++size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, ++ size_t __n, locale_t __loc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + float wcstof (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) + { +@@ -83,6 +138,13 @@ + abort(); + } + ++int ++iswblank_l (wint_t __wc, locale_t __locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + int iswctype (wint_t __wc, wctype_t __desc) + { + printf("%s: Not implemented\n", __func__); +@@ -89,6 +151,12 @@ + abort(); + } + ++int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) +@@ -116,6 +184,12 @@ + abort(); + } + ++wctype_t wctype_l (__const char *__property, locale_t __locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + wint_t ungetwc(wint_t wc, FILE *stream) + { + printf("%s: Not implemented\n", __func__); diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/roinstall-objdump-name.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/roinstall-objdump-name.p new file mode 100644 index 0000000..73a9abe --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/roinstall-objdump-name.p @@ -0,0 +1,13 @@ +Index: ro-install +=================================================================== +--- ro-install (revision 7698) ++++ ro-install (working copy) +@@ -72,7 +72,7 @@ + + # Check that static libraries really do contain static objects + if grep -q "\.a\$" <<< $param || grep -q "\.a-static" <<< $param ; then +- if GCCSDK_BIN/arm-unknown-riscos-objdump -p $param | grep -q "position independent"; then ++ if GCCSDK_BIN/arm-riscos-gnueabi-objdump -p $param | grep -q "position independent"; then + echo "RISC OS Cross installer: static archive $param contains position independent code" 1>&2 + exit 1 + fi diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-armv4.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-armv4.p new file mode 100644 index 0000000..1343d13 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-armv4.p @@ -0,0 +1,80 @@ +Index: libunixlib/gcccompat/atomics.c +=================================================================== +--- libunixlib/gcccompat/atomics.c (revision 7698) ++++ libunixlib/gcccompat/atomics.c (working copy) +@@ -378,7 +378,7 @@ + ATOMIC_OP_FETCH(or,(*ptr) |= val,unsigned) + ATOMIC_OP_FETCH(nand,(*ptr) = ~((*ptr) & val),unsigned) + +-#ifdef __ARM_EABI__ ++#if defined(__ARM_EABI__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) + + static int __cmpxchg (int oldval, int newval, volatile int *ptr) + { +Index: libunixlib/pthread/_ints.s +=================================================================== +--- libunixlib/pthread/_ints.s (revision 7698) ++++ libunixlib/pthread/_ints.s (working copy) +@@ -14,6 +14,15 @@ + .protected __pthread_enable_ints + .global __pthread_protect_unsafe + ++#if defined(__ARM_ARCH) && (__ARM_ARCH__ < 6) ++ /* Modern gas objects to our runtime-conditional use of LDREX/STREX ++ * in here. If we're building for pre-armv6 architectures, tell gas ++ * that to allow armv6 instructions, but mark the resulting object ++ * as armv4 compatible. */ ++ .arch armv6 ++ .object_arch armv4 ++#endif ++ + @ Disable context switches by incrementing the semaphore + @ May be called from USR or SVC mode + NAME __pthread_disable_ints +@@ -23,7 +32,7 @@ + LDR a1, .L0 @ =__ul_global + PICEQ "LDR a1, [a2, a1]" + LDR ip, [a1, #GBL_PTH_CALLEVERY_RMA] +-#ifdef __ARM_EABI__ ++#if defined(__ARM_EABI__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) + ADD a1, ip, #PTHREAD_CALLEVERY_RMA_WORKSEMAPHORE + #else + LDR a4, [a1, #GBL_CPU_FLAGS] +@@ -93,7 +102,7 @@ + LDR a4, .L2 @ =__ul_global + PICEQ "LDR a4, [a1, a4]" + LDR ip, [a4, #GBL_PTH_CALLEVERY_RMA] +-#ifdef __ARM_EABI__ ++#if defined(__ARM_EABI__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 6) + ADD a1, ip, #PTHREAD_CALLEVERY_RMA_WORKSEMAPHORE + #else + LDR a2, [a4, #GBL_CPU_FLAGS] +Index: libunixlib/sys/_syslib.s +=================================================================== +--- libunixlib/sys/_syslib.s (revision 7698) ++++ libunixlib/sys/_syslib.s (working copy) +@@ -49,6 +49,15 @@ + .weak __dynamic_da_max_size + .weak __stack_size + ++#if defined(__ARM_ARCH) && (__ARM_ARCH__ < 6) ++ /* Modern gas objects to our runtime-conditional use of LDREX/STREX ++ * in here. If we're building for pre-armv6 architectures, tell gas ++ * that to allow armv6 instructions, but mark the resulting object ++ * as armv4 compatible. */ ++ .arch armv6 ++ .object_arch armv4 ++#endif ++ + @ RMEnsure the minimum version of the SharedUnixLibrary we need. + @ Now check System modules first as UnixLib package is deprecated. + #if !defined(__SOFTFP__) && defined(__VFP_FP__) +@@ -1414,7 +1423,7 @@ + @ we go for a straight OS_Exit scenario. Anything better we + @ can do ? + ADD a3, a4, #GBL_PANIC_MODE +-#ifndef __ARM_EABI__ ++#if !defined(__ARM_EABI__) || !defined(__ARM_ARCH) || (__ARM_ARCH < 6) + LDR a2, [a4, #GBL_CPU_FLAGS] + TST a2, #__CPUCAP_HAVE_SWP + BEQ 0f diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-initial-sp.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-initial-sp.p new file mode 100644 index 0000000..f3309c2 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-initial-sp.p @@ -0,0 +1,31 @@ +Index: libunixlib/sys/_syslib.s +=================================================================== +--- libunixlib/sys/_syslib.s (revision 7698) ++++ libunixlib/sys/_syslib.s (working copy) +@@ -396,8 +396,9 @@ + SWI XOS_ReadVarVal @ Read value of progname$HeapMax + BVS t08 + TEQ v1, #1 @ Should be a number variable +- LDREQ v2, [sp], #4 ++ LDREQ v2, [sp] + MOVEQ v2, v2, LSL#20 @ Convert MB into bytes ++ ADD sp, sp, #4 + + @ v2 = size of DA area + t08: +@@ -512,7 +513,15 @@ + MOVCC a1, #ERR_NO_FPE + BCC __exit_with_error_num + #endif ++#else ++#ifdef __ARM_EABI__ ++ @ EABI with software FP. Burn the top of the stack to appease ++ @ ARMEABISupport (which does not consider the stack top address ++ @ as part of the stack). ++ SUB sp, sp, #4 ++ BIC sp, sp, #7 @ AAPCS wants 8 byte alignment + #endif ++#endif + + @ We need to create this now so that we have its address to give to + @ the callback handler, but we can initialise it later. diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-no-armv7-memcpy.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-no-armv7-memcpy.p new file mode 100644 index 0000000..c89d6ab --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-no-armv7-memcpy.p @@ -0,0 +1,34 @@ +Index: libunixlib/Makefile.am +=================================================================== +--- libunixlib/Makefile.am (revision 7698) ++++ libunixlib/Makefile.am (working copy) +@@ -1002,18 +1002,11 @@ + string/strtok.c \ + string/swab.c \ + string/_strcpy.s +-if ARM_EABI + string_src += \ +- string/_memcpymove-v7l.s \ +- string/_memset-v7l.s \ +- string/_strlen-v7l.s +-else +-string_src += \ + string/_memcpy.s \ + string/_memset.s \ + string/_strlen.s + endif +-endif + string_src += \ + string/memccpy.c \ + string/memchr.c \ +@@ -1029,10 +1022,8 @@ + string/strtok_r.c \ + string/_ffs.s \ + string/_ffsll.s +-if !ARM_EABI + string_src += \ + string/mempcpy.c +-endif + + if UNIXLIB_BUILDING_SCL + sys_src = diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-stdtime.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-stdtime.p new file mode 100644 index 0000000..3ad890a --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-stdtime.p @@ -0,0 +1,17 @@ +Index: libunixlib/time/stdtime.c +=================================================================== +--- libunixlib/time/stdtime.c (revision 7698) ++++ libunixlib/time/stdtime.c (working copy) +@@ -23,9 +23,11 @@ + register const char *str __asm ("r4") = __str; + register const _kernel_oserror *err __asm ("r0"); + register char *term __asm ("r1"); ++ register size_t left __asm ("r2"); ++ register const char *ostr __asm ("r3"); + __asm__ volatile ("SWI\t%[SWI_Territory_ConvertDateAndTime]\n\t" + "MOVVC\tr0, #0\n\t" +- : "=r" (err), "=r" (term) ++ : "=r" (err), "=r" (term), "=r" (left), "=r" (ostr) + : "r" (territory), "r" (ro_time), "r" (buf), "r" (size), "r" (str), + [SWI_Territory_ConvertDateAndTime] "i" (Territory_ConvertDateAndTime | (1<<17)) + : "r14", "cc", "memory"); diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p new file mode 100644 index 0000000..f9764ba --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p @@ -0,0 +1,22 @@ +Index: libunixlib/gcccompat/atomics.c +=================================================================== +--- libunixlib/gcccompat/atomics.c (revision 7698) ++++ libunixlib/gcccompat/atomics.c (working copy) +@@ -146,8 +146,6 @@ + ATOMIC_COMPARE_AND_EXCHANGE(4,uint32_t) + ATOMIC_COMPARE_AND_EXCHANGE(8,uint64_t) + +-#ifndef __ARM_EABI__ +- + /* These built-in functions perform the operation suggested by the name, + * and return the value that had previously been in *ptr. That is, + * +@@ -200,8 +198,6 @@ + SYNC_FETCH_AND_OP(xor,^,8,long long) + SYNC_FETCH_AND_OP(and,&,8,long long) + +-#endif +- + /* These built-in functions perform the operation suggested by the name, + * and return the new value. That is, + * diff --git a/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-unwind.p b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-unwind.p new file mode 100644 index 0000000..9ff54c9 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/gccsdk/unixlib-unwind.p @@ -0,0 +1,468 @@ +Index: libunixlib/Makefile.am +=================================================================== +--- libunixlib/Makefile.am (revision 7698) ++++ libunixlib/Makefile.am (working copy) +@@ -33,7 +33,7 @@ + # arguments can not be tested for NULL in UnixLib itself. + if ARM_EABI + AM_CFLAGS = -D__GNU_LIBRARY__ -DNO_LONG_DOUBLE -D_GNU_SOURCE=1 \ +- -D__UNIXLIB_NO_NONNULL -std=c99 $(LIBM_FLAGS) ++ -D__UNIXLIB_NO_NONNULL -std=c99 -mpoke-function-name -funwind-tables $(LIBM_FLAGS) + UNIXLIB_CHUNKED_STACK=0 + else + AM_CFLAGS = -D__GNU_LIBRARY__ -DNO_LONG_DOUBLE -D_GNU_SOURCE=1 \ +Index: libunixlib/signal/_signal.s +=================================================================== +--- libunixlib/signal/_signal.s (revision 7698) ++++ libunixlib/signal/_signal.s (working copy) +@@ -352,8 +352,8 @@ + CHGMODE a1, USR_Mode @ Back to USR mode now we have a stack + + #ifdef __ARM_EABI__ +- STMFD sp!, {v1, v3} +- ADD fp, sp, #4 ++ ANDS v2, sp, #7 @ Align stack ++ SUBEQ sp, sp, #4 + #else + ADR v4, __h_error + 4*3 @ Point at handler name for backtrace + STMFD sp!, {v1, v2, v3, v4} @ Setup an APCS-32 stack frame so we +@@ -758,10 +758,9 @@ + SWINE XOS_Byte @ This calls our escape handler + + #ifdef __ARM_EABI__ +- LDR a3, [sp, #14*4 + 4] @ saved USR lr +- LDR a1, [sp, #11*4 + 4] @ saved USR fp +- STMFD sp!, {a1, a3} @ create signal frame +- MOV fp, sp @ FIXME: check this with compiler output for similar function ++ MOV a1, sp @ a1 -> register save block ++ ANDS v2, sp, #7 ++ SUBNE sp, sp, #4 @ align stack to 8 bytes + #else + @ Create an APCS-32 compilant signal stack frame + ADR a4, __h_cback + 4*3 @ point at handler name for backtrace +@@ -796,11 +795,12 @@ + STR a1, [a3, #GBL_EXECUTING_SIGNALHANDLER] + + #ifdef __ARM_EABI__ +- ADD a1, sp, #8 @ Skip signal frame (fp, lr) ++ TEQ v2, #0 ++ ADDNE a1, sp, #4 @ Undo stack alignment + #else + ADD a1, sp, #16 @ Skip signal frame (fp, sp, lr, name ptr) + #endif +- ADD sp, sp, #16+17*4 ++ ADD sp, sp, #17*4 + SWI XOS_EnterOS @ We need to be in SVC mode so reenbling IRQs + @ is atomic with returning to USR mode, + @ otherwise USR sp could be overwitten by +Index: libunixlib/signal/post.c +=================================================================== +--- libunixlib/signal/post.c (revision 7698) ++++ libunixlib/signal/post.c (working copy) +@@ -255,19 +255,230 @@ + fprintf (stderr, "\nTermination signal received: %s\n", sys_siglist[signo]); + } + ++static void ++__write_abort_block (const unsigned int *blk, int is32bit) ++{ ++ const unsigned int pcmask = is32bit ? 0xfffffffcu : 0x03fffffcu; ++ ++ fprintf (stderr, "\n Register dump at %08x:\n", (unsigned int) blk); ++ ++ if (!__valid_address (blk, blk + 17)) ++ fputs ("\n [bad register dump address]\n", stderr); ++ else ++ { ++ const char rnames[] = "a1a2a3a4v1v2v3v4v5v6slfpipsplrpc"; ++ for (int reg = 0; reg < 16; reg++) ++ { ++ if ((reg & 0x3) == 0) ++ fputs ("\n ", stderr); ++ ++ fprintf (stderr, " %c%c: %8x", ++ rnames[2*reg + 0], rnames[2*reg + 1], blk[reg + 1]); ++ } ++ ++ if (is32bit) ++ fprintf (stderr, "\n cpsr: %8x\n", blk[0]); ++ else ++ { ++ const char * const pmode[4] = { "USR", "FIQ", "IRQ", "SVC" }; ++ fprintf (stderr, "\n Mode %s, flags set: %c%c%c%c%c%c\n", ++ pmode[blk[15 + 1] & 3], ++ (blk[15 + 1] & (1<<31)) ? 'N' : 'n', ++ (blk[15 + 1] & (1<<30)) ? 'Z' : 'z', ++ (blk[15 + 1] & (1<<29)) ? 'C' : 'c', ++ (blk[15 + 1] & (1<<28)) ? 'V' : 'v', ++ (blk[15 + 1] & (1<<27)) ? 'I' : 'i', ++ (blk[15 + 1] & (1<<26)) ? 'F' : 'f'); ++ } ++ ++ unsigned int *pc = (unsigned int *) (blk[15 + 1] & pcmask); ++ ++ /* Try LR if PC invalid (e.g. with a prefetch abort). */ ++ if (pc < (unsigned int *)0x8000 || !__valid_address (pc - 5, pc + 4)) ++ pc = (unsigned int *) (blk[14 + 1] & pcmask); ++ ++ if (pc >= (unsigned int *)0x8000 && __valid_address (pc - 5, pc + 4)) ++ { ++ for (unsigned int *diss = pc - 5; diss < pc + 4; diss++) ++ { ++ const char *ins; ++ int length; ++ _swix (Debugger_Disassemble, _INR(0,1) | _OUTR(1,2), ++ *diss, diss, &ins, &length); ++ ++ const unsigned char c[4] = ++ { ++ (*diss >> 0) & 0xFF, ++ (*diss >> 8) & 0xFF, ++ (*diss >> 16) & 0xFF, ++ (*diss >> 24) ++ }; ++ fprintf (stderr, "\n %08x : %c%c%c%c : %08x : ", ++ (unsigned int) diss, ++ (c[0] >= ' ' && c[0] != 127) ? c[0] : '.', ++ (c[1] >= ' ' && c[1] != 127) ? c[1] : '.', ++ (c[2] >= ' ' && c[2] != 127) ? c[2] : '.', ++ (c[3] >= ' ' && c[3] != 127) ? c[3] : '.', ++ *diss); ++ fwrite (ins, length, 1, stderr); ++ } ++ } ++ else ++ fputs ("\n [Disassembly not available]", stderr); ++ } ++ ++ fputs ("\n\n", stderr); ++} ++ + /* Clang and GCC do not have compatible frame pointers. */ + #ifdef __clang__ + #define FP_OFFSET (0) + #define LR_OFFSET (1) +-#elif defined (__ARM_EABI__) +-#define FP_OFFSET (-1) +-#define LR_OFFSET (0) + #else + #define LR_OFFSET (-1) + #define FP_OFFSET (-3) + #endif + ++#ifdef __ARM_EABI__ ++/** ++ * AAPCS does not require the compiler to construct a backtrace structure ++ * in the stack (unlike APCS, which does). This results in FP rarely pointing ++ * at any form of valid stack frame (and, to complicate matters, at the time ++ * of writing, some frames end up with APCS-format frame records, anyway) ++ * which makes it nigh-on impossible to reliably unwind the stack without ++ * additional information). FP is thus often treated as an additional ++ * callee-saved register (i.e. v8) in AAPCS-conformant code. ++ * ++ * Additionally, where frame records are generated, AAPCS has them contain ++ * two entries: previous-FP and LR on entry. There is therefore (unlike APCS) ++ * no way of finding the function entry point from the frame record at all, ++ * even if it did exist. ++ * ++ * So, we cannot trust that FP ever points at a valid stack frame record and ++ * we cannot find function entry points to extract poked function names from. ++ * We can, however, make stack unwinding work if we have some means of ++ * identifying the function in which an arbitrary instruction lies. ++ * ++ * -funwind-tables will result in clang/GCC generating such a data structure, ++ * (an array between __exidx_start and __exidx_end) which will be consulted ++ * by _Unwind_Backtrace() when unwinding the stack. ++ */ ++ ++#include <unwind.h> ++ ++typedef struct { ++ const unsigned int *regs; ++ const unsigned int *last_fn; ++} ul_unwind_ctx; ++ ++static void __attribute__((naked)) ++__do_unwind (_Unwind_Trace_Fn fn, const void *pw) ++{ ++ __asm volatile( ++ "stmfd sp!, {fp, lr};" ++ "add fp, sp, #4;" ++ /* Registers at this point in time will be the initial state. ++ * The trace function must unwind the stack frame we just created ++ * because the personality function will be told there is nothing ++ * to do as we are declared naked. ++ */ ++ "bl _Unwind_Backtrace;" ++ "ldmfd sp!, {fp, pc};" ++ ); ++} ++ ++static _Unwind_Reason_Code ++__write_backtrace_cb (_Unwind_Context *ctx, void *pw) ++{ ++ ul_unwind_ctx *uctx = pw; ++ _Unwind_Control_Block *ucbp = NULL; ++ const unsigned int *fn; ++ ++ ucbp = (_Unwind_Control_Block *) _Unwind_GetGR(ctx, UNWIND_POINTER_REG); ++ fn = (const unsigned int *) ucbp->pr_cache.fnstart; ++ ++ uctx->last_fn = fn; ++ ++ if (fn == (const unsigned int *) __do_unwind) ++ { ++ /* First call */ ++ if (uctx->regs == NULL) ++ { ++ /* Running thread: unwind on behalf of __do_unwind */ ++ _Unwind_VRS_Pop (ctx, _UVRSC_CORE, (1<<11)|(1<<14), _UVRSD_UINT32); ++ } ++ else ++ { ++ /* Thread backtrace: replace entire VRS */ ++ int idx; ++ for (idx = 16; idx > 0; idx--) ++ _Unwind_SetGR (ctx, idx - 1, uctx->regs[idx - 1]); ++ } ++ ++ return _URC_NO_REASON; ++ } ++ ++ fprintf (stderr, " (%8x) fn: %8x pc: %8x sp: %8x ", ++ _Unwind_GetGR (ctx, 11), (unsigned int)fn, _Unwind_GetIP (ctx), ++ _Unwind_GetGR (ctx, 13)); ++ ++#if PIC ++ /* FIXME: extend this with source location when available. */ ++ const char *lib = NULL; ++ unsigned offset; ++ _swix(SOM_Location, ++ _IN(0) | _OUTR(0,1), _Unwind_GetIP (ctx), &lib, &offset); ++ if (lib) ++ fprintf(stderr, " : %8X : %s\n", offset, lib); ++ else ++#endif ++ { ++ int cplusplus_name; ++ const char *name = extract_name (fn, &cplusplus_name); ++ fprintf (stderr, (cplusplus_name) ? " %s\n" : " %s()\n", name); ++ } ++ ++ return _URC_NO_REASON; ++} ++ + static void ++__write_backtrace_thread (const unsigned int *regs) ++{ ++ ul_unwind_ctx ctx; ++ ++ /* First pass: dump trace for stack as provided */ ++ ctx.regs = regs; ++ ctx.last_fn = NULL; ++ __do_unwind (__write_backtrace_cb, &ctx); ++ ++ /* If we got here via an environment handler, there may be a saved abort ++ * block to look at. We only want to look if the first pass terminated with ++ * __unixlib_raise_signal (being the entry point to all this unwind logic ++ * from the environment handlers) -- if the first pass terminated somewhere ++ * else, then it is likely that we have been invoked directly via raise(), ++ * and so the presence or otherwise of an abort block is irrelevant. ++ * ++ * If an abort block is available, it will be pointed at by the ++ * (misnamed for EABI) __ul_callbackfp; if not __ul_callbackfp will be NULL. ++ * Additionally, we only want to consider the abort block if we're dumping ++ * the running thread, so check for regs being NULL to identify that. ++ */ ++ if (__ul_callbackfp != NULL && regs == NULL ++ && ctx.last_fn == (unsigned int *) __unixlib_raise_signal) ++ { ++ /* Abort block: cpsr, r0-r15. */ ++ __write_abort_block (__ul_callbackfp, /* is32bit= */ 1); ++ ++ /* Dump remaining trace from block (skipping over saved CPSR) */ ++ ctx.regs = __ul_callbackfp + 1; ++ ctx.last_fn = NULL; ++ __do_unwind (__write_backtrace_cb, &ctx); ++ } ++ ++ fputc ('\n', stderr); ++} ++#else ++static void + __write_backtrace_thread (const unsigned int *fp) + { + /* Running as USR26 or USR32 ? */ +@@ -306,22 +517,6 @@ + break; + } + +-#ifdef __ARM_EABI__ +- const unsigned int * const lr = (unsigned int *)fp[LR_OFFSET]; +- fprintf (stderr, " (%8x) lr: %8x", +- (unsigned int)fp, (unsigned int)lr); +-#if PIC +- /* FIXME: extend this with source location when available. */ +- const char *lib = NULL; +- unsigned offset; +- _swix(SOM_Location, +- _IN(0) | _OUTR(0,1), lr, &lib, &offset); +- if (lib) +- fprintf(stderr, " : %8X : %s\n", offset, lib); +- else +-#endif +- fputc('\n', stderr); +-#else + /* Retrieve PC counter. + PC counter has been saved using STMxx ..., { ..., PC } so it can be + 8 or 12 bytes away from the STMxx instruction depending on the ARM +@@ -347,96 +542,24 @@ + int cplusplus_name; + const char *name = extract_name (pc, &cplusplus_name); + fprintf (stderr, (cplusplus_name) ? " %s\n" : " %s()\n", name); +-#endif ++ + oldfp = fp; + fp = (const unsigned int *)fp[FP_OFFSET]; +-#ifndef __ARM_EABI__ + if (__ul_callbackfp != NULL && fp == __ul_callbackfp) + { + /* At &oldfp[1] = cpsr, a1-a4, v1-v6, sl, fp, ip, sp, lr, pc */ +- fprintf (stderr, "\n Register dump at %08x:\n", +- (unsigned int) &oldfp[1]); +- +- if (!__valid_address (oldfp + 1, oldfp + 18)) +- fputs ("\n [bad register dump address]\n", stderr); +- else +- { +- const char rnames[] = "a1a2a3a4v1v2v3v4v5v6slfpipsplrpc"; +- for (int reg = 0; reg < 16; reg++) +- { +- if ((reg & 0x3) == 0) +- fputs ("\n ", stderr); +- +- fprintf (stderr, " %c%c: %8x", +- rnames[2*reg + 0], rnames[2*reg + 1], oldfp[reg + 2]); +- } +- +- if (is32bit) +- fprintf (stderr, "\n cpsr: %8x\n", oldfp[1]); +- else +- { +- const char * const pmode[4] = { "USR", "FIQ", "IRQ", "SVC" }; +- fprintf (stderr, "\n Mode %s, flags set: %c%c%c%c%c%c\n", +- pmode[oldfp[15 + 2] & 3], +- (oldfp[15 + 2] & (1<<31)) ? 'N' : 'n', +- (oldfp[15 + 2] & (1<<30)) ? 'Z' : 'z', +- (oldfp[15 + 2] & (1<<29)) ? 'C' : 'c', +- (oldfp[15 + 2] & (1<<28)) ? 'V' : 'v', +- (oldfp[15 + 2] & (1<<27)) ? 'I' : 'i', +- (oldfp[15 + 2] & (1<<26)) ? 'F' : 'f'); +- } +- +- pc = (unsigned int *) (oldfp[17] & pcmask); +- +- /* Try LR if PC invalid (e.g. with a prefetch abort). */ +- if (pc < (unsigned int *)0x8000 || !__valid_address (pc - 5, pc + 4)) +- pc = (unsigned int *) (oldfp[16] & pcmask); +- +- if (pc >= (unsigned int *)0x8000 && __valid_address (pc - 5, pc + 4)) +- { +- for (unsigned int *diss = pc - 5; diss < pc + 4; diss++) +- { +- const char *ins; +- int length; +- _swix (Debugger_Disassemble, _INR(0,1) | _OUTR(1,2), +- *diss, diss, &ins, &length); +- +- const unsigned char c[4] = +- { +- (*diss >> 0) & 0xFF, +- (*diss >> 8) & 0xFF, +- (*diss >> 16) & 0xFF, +- (*diss >> 24) +- }; +- fprintf (stderr, "\n %08x : %c%c%c%c : %08x : ", +- (unsigned int) diss, +- (c[0] >= ' ' && c[0] != 127) ? c[0] : '.', +- (c[1] >= ' ' && c[1] != 127) ? c[1] : '.', +- (c[2] >= ' ' && c[2] != 127) ? c[2] : '.', +- (c[3] >= ' ' && c[3] != 127) ? c[3] : '.', +- *diss); +- fwrite (ins, length, 1, stderr); +- } +- } +- else +- fputs ("\n [Disassembly not available]", stderr); +- } +- +- fputs ("\n\n", stderr); ++ __write_abort_block (&oldfp[1], is32bit); + } +-#endif + } + + fputc ('\n', stderr); + } ++#endif + +- + void + __write_backtrace (int signo) + { +-#ifdef __ARM_EABI__ +- register const unsigned int *fp = __builtin_frame_address(0); +-#else ++#ifndef __ARM_EABI__ + register const unsigned int *fp __asm ("fp"); + #endif + +@@ -485,7 +608,11 @@ + /* Dump first the details of the current thread. */ + fprintf (stderr, "Stack backtrace:\n\nRunning thread %p (%s)\n", + __pthread_running_thread, __pthread_running_thread->name); ++#ifdef __ARM_EABI__ ++ __write_backtrace_thread (NULL); ++#else + __write_backtrace_thread (fp); ++#endif + + /* And then the other suspended threads if any. */ + for (pthread_t th = __pthread_thread_list; th != NULL; th = th->next) +@@ -494,7 +621,10 @@ + continue; + + fprintf (stderr, "\nThread %p (%s)\n", th, th->name); +-#ifdef __clang__ ++#ifdef __ARM_EABI__ ++ __write_backtrace_thread (&th->saved_context->r[0]); ++#else ++# ifdef __clang__ + const unsigned int fakestackframe[] = + { + (unsigned int)th->saved_context->r[11], +@@ -501,22 +631,16 @@ + (unsigned int)th->saved_context->r[14] + }; + __write_backtrace_thread (&fakestackframe[0]); +-#elif defined (__ARM_EABI__) ++# else + const unsigned int fakestackframe[] = + { + (unsigned int)th->saved_context->r[11], +- (unsigned int)th->saved_context->r[14] +- }; +- __write_backtrace_thread (&fakestackframe[1]); +-#else +- const unsigned int fakestackframe[] = +- { +- (unsigned int)th->saved_context->r[11], + (unsigned int)th->saved_context->r[13], + (unsigned int)th->saved_context->r[14], + (unsigned int)th->saved_context->r[15] + }; + __write_backtrace_thread (&fakestackframe[3]); ++# endif + #endif + } + } diff --git a/arm-riscos-gnueabi/recipes/patches/infozip/globals.p b/arm-riscos-gnueabi/recipes/patches/infozip/globals.p new file mode 100644 index 0000000..c10adfa --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/infozip/globals.p @@ -0,0 +1,13 @@ +--- globals.c.orig 2005-03-20 12:32:02.000000000 -0800 ++++ globals.c 2008-01-12 22:45:07.000000000 -0800 +@@ -30,6 +30,10 @@ + int pathput = 1; /* 1=store path with name */ + #ifdef RISCOS + int scanimage = 1; /* 1=scan through image files */ ++#else ++#ifdef FORRISCOS ++int decomma = 0; ++#endif + #endif + int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ + int dosify = 0; /* 1=make new entries look like MSDOS */ diff --git a/arm-riscos-gnueabi/recipes/patches/infozip/zip.p b/arm-riscos-gnueabi/recipes/patches/infozip/zip.p new file mode 100644 index 0000000..aee2b24 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/infozip/zip.p @@ -0,0 +1,58 @@ +--- zip.c.orig 2009-05-07 11:54:09.000000000 +0100 ++++ zip.c 2009-05-07 11:53:08.000000000 +0100 +@@ -668,6 +668,9 @@ + ," -h2 show more help -I don't scan thru Image files" + #else + ," -h2 show more help" ++#ifdef FORRISCOS ++," -, strip ,xxx from filename and convert to RISCOS filetype encoding" ++#endif + #endif + #endif /* ?MACOS */ + #ifdef VMS +@@ -1144,6 +1147,9 @@ + #if CRYPT && defined(PASSWD_FROM_STDIN) + "PASSWD_FROM_STDIN", + #endif /* CRYPT & PASSWD_FROM_STDIN */ ++#ifdef FORRISCOS ++ "FORRISCOS", ++#endif + NULL + }; + +@@ -2109,6 +2115,9 @@ + #ifdef RISCOS + {"/", "exts-to-swap", o_REQUIRED_VALUE, o_NOT_NEGATABLE, '/', "override Zip$Exts"}, + #endif ++#ifdef FORRISCOS ++ {",", "strip-type", o_NO_VALUE, o_NOT_NEGATABLE, ',', "strip ,xxx extension"}, ++#endif + /* the end of the list */ + {NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE, 0, NULL} /* end has option_ID = 0 */ + }; +@@ -2847,6 +2856,12 @@ + case 'I': /* Don't scan through Image files */ + scanimage = 0; + break; ++#else ++#ifdef FORRISCOS ++ case ',': /* Convert ,xxx to RISC OS extended filetype info */ ++ decomma = 1; ++ break; ++#endif + #endif + #ifdef MACOS + case o_jj: /* store absolute path including volname */ +--- zip.h.org 2008-01-12 22:56:51.000000000 -0800 ++++ zip.h 2008-01-12 23:00:05.000000000 -0800 +@@ -323,6 +323,10 @@ + + #ifdef RISCOS + extern int scanimage; /* Scan through image files */ ++#else ++#ifdef FORRISCOS ++extern int decomma; /* Convert ,xxx filename to RISC OS filetype info */ ++#endif + #endif + + #define BEST -1 /* Use best method (deflation or store) */ diff --git a/arm-riscos-gnueabi/recipes/patches/infozip/zipup.p b/arm-riscos-gnueabi/recipes/patches/infozip/zipup.p new file mode 100644 index 0000000..f4d43d0 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/infozip/zipup.p @@ -0,0 +1,162 @@ +--- zipup.c.orig 2008-01-12 22:29:14.000000000 -0800 ++++ zipup.c 2008-01-12 22:36:00.000000000 -0800 +@@ -139,6 +139,9 @@ + #else + local int filetypes OF((char *, char *)); + #endif ++#ifdef FORRISCOS ++ local int set_extra_field_forriscos OF((struct zlist far *z, iztimes *z_utim)); ++#endif + local unsigned file_read OF((char *buf, unsigned size)); + #ifdef USE_ZLIB + local int zl_deflate_init OF((int pack_level)); +@@ -379,7 +382,133 @@ + } + #endif /* ?RISCOS */ + ++#ifdef FORRISCOS ++ ++int set_extra_field_forriscos(z, z_utim) ++ struct zlist far *z; ++ iztimes *z_utim; ++{ ++#ifdef USE_EF_UT_TIME ++ char *eb_ptr; ++#endif /* USE_EF_UT_TIME */ ++ char *cptr; ++ char *extra_block; ++ unsigned int addr; ++ unsigned int ftype = 0xfff; /* Untyped files default to 'text' */ ++ unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */ ++ unsigned timhi; /* 2 high bytes of acorn file-time */ ++ ++#define EB_SPARK_LEN 20 ++#define EB_SPARK_SIZE (EB_HEADSIZE+EB_SPARK_LEN) ++#ifdef USE_EF_UT_TIME ++# ifdef IZ_CHECK_TZ ++# define EB_UTTIME_SIZE (zp_tz_is_valid ? EB_HEADSIZE+EB_UT_LEN(1) : 0) ++# else ++# define EB_UTTIME_SIZE (EB_HEADSIZE+EB_UT_LEN(1)) ++# endif ++#else ++# define EB_UTTIME_SIZE 0 ++#endif ++#define EF_SPARK_TOTALSIZE (EB_SPARK_SIZE + EB_UTTIME_SIZE) ++ ++ cptr=strrchr(z->iname, (int) ','); ++ if (cptr) ++ if ((cptr - z->iname) != (int)(strlen(z->iname)-4)) ++ cptr = NULL; /* There was a comma, but it wasn't a ,xxx at the end! */ ++ ++ if (cptr) ++ { ++ *cptr='\0'; /* Chop the filename at the comma */ ++ ++ ftype = strtol(cptr+1, NULL, 16); /* read the ,xxx as hex filetype */ ++ } ++ else ++ { ++ /* When there is no given filetype, but there is a full stop in the name, ++ then it is better to let the unzip utility in RISC OS do a MimeMap lookup ++ instead, and therefore do nothing here */ ++ if (strchr(z->iname, '.')) ++ return ZE_OK; ++ } ++ ++ z->extra=(char *)malloc(EF_SPARK_TOTALSIZE); ++ if (z->extra==NULL) { ++ fprintf(stderr," set_extra_field_forriscos: not enough memory\n"); ++ return ZE_MEM; ++ } ++ z->cextra = z->extra; ++ z->cext = z->ext = EF_SPARK_TOTALSIZE; ++ ++ timlo = ((unsigned)z_utim->mtime & 0x00ffffffU) * 100 + 0x00996a00U; ++ timhi = ((unsigned)z_utim->mtime >> 24); ++ timhi = timhi * 100 + 0x0000336eU + (timlo >> 24); ++ ++ extra_block=z->extra; ++ /* ID */ ++ extra_block[0]='A'; ++ extra_block[1]='C'; ++ ++ /* size */ ++ extra_block[2]=(char)(EB_SPARK_LEN); ++ extra_block[3]=(char)(EB_SPARK_LEN)>>8; ++ ++ /* ID_2 */ ++ extra_block[4]='A'; ++ extra_block[5]='R'; ++ extra_block[6]='C'; ++ extra_block[7]='0'; ++ ++ /* Load address */ ++ addr=0xfff00000 | (ftype << 8); /* This file is typed, and has filetype 'ftype' */ ++ addr|= ((timhi >> 8) & 0xffU); ++ extra_block[8]=(char)(addr); ++ extra_block[9]=(char)(addr>>8); ++ extra_block[10]=(char)(addr>>16); ++ extra_block[11]=(char)(addr>>24); ++ ++ /* Exec address */ ++ addr=(timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24); ++ extra_block[12]=(char)(addr); ++ extra_block[13]=(char)(addr>>8); ++ extra_block[14]=(char)(addr>>16); ++ extra_block[15]=(char)(addr>>24); ++ ++ /* Attributes */ ++ extra_block[16]=0x13; /* Private read/write, no public access, unlocked */ ++ extra_block[17]=0; ++ extra_block[18]=0; ++ extra_block[19]=0; ++ ++ /* Zero */ ++ extra_block[20]=0; ++ extra_block[21]=0; ++ extra_block[22]=0; ++ extra_block[23]=0; ++ ++#ifdef USE_EF_UT_TIME ++# ifdef IZ_CHECK_TZ ++ if (zp_tz_is_valid) { ++# endif ++ eb_ptr = z->extra + EB_SPARK_SIZE; ++ ++ eb_ptr[0] = 'U'; ++ eb_ptr[1] = 'T'; ++ eb_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */ ++ eb_ptr[3] = 0; ++ eb_ptr[4] = EB_UT_FL_MTIME; ++ eb_ptr[5] = (char)(z_utim->mtime); ++ eb_ptr[6] = (char)(z_utim->mtime >> 8); ++ eb_ptr[7] = (char)(z_utim->mtime >> 16); ++ eb_ptr[8] = (char)(z_utim->mtime >> 24); ++# ifdef IZ_CHECK_TZ ++ } ++# endif ++#endif /* USE_EF_UT_TIME */ ++ ++ return ZE_OK; ++} + ++#endif /* FORRISCOS */ + + /* Note: a zip "entry" includes a local header (which includes the file + name), an encryption header if encrypting, the compressed data +@@ -552,6 +681,15 @@ + #if !(defined(VMS) && defined(VMS_PK_EXTRA)) + if (extra_fields) { + /* create extra field and change z->att and z->atx if desired */ ++#ifdef FORRISCOS ++ if (decomma) ++ { ++ /* If we're making a zip for RISC OS, we don't bother with any other */ ++ /* OS-Specific info (although we could - but there's no point!) */ ++ set_extra_field_forriscos(z, &f_utim); ++ } ++ else ++#endif + set_extra_field(z, &f_utim); + # ifdef QLZIP + if(qlflag) diff --git a/arm-riscos-gnueabi/recipes/patches/oslib/buildsystem-elfeabi.p b/arm-riscos-gnueabi/recipes/patches/oslib/buildsystem-elfeabi.p new file mode 100644 index 0000000..83bd862 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/oslib/buildsystem-elfeabi.p @@ -0,0 +1,144 @@ +Index: Source/Makefile +=================================================================== +--- Source/Makefile (revision 477) ++++ Source/Makefile (working copy) +@@ -3,8 +3,8 @@ + # already be built upfront. + # Written by OSLib Development Team. + +-# Build type: CROSSGCC_AOF, CROSSGCC_ELF (default), [NORCROFT_AOF: not +-# supported yet] ++# Build type: CROSSGCC_AOF, CROSSGCC_ELF (default), CROSSGCC_ELFEABI, ++# [NORCROFT_AOF: not supported yet] + export BUILDTYPE ?= CROSSGCC_ELF + # Possible values: "SOFTFPU" (e.g. for UnixLib usage), "HARDFPU" (e.g. for + # SharedCLibrary usage) and "MODULE" (latter also meaning HARDFPU but the +@@ -12,9 +12,10 @@ + export ELFOBJECTTYPE ?= SOFTFPU + + ifeq ($(BUILDTYPE),CROSSGCC_ELF) ++else ifeq ($(BUILDTYPE),CROSSGCC_ELFEABI) + else ifeq ($(BUILDTYPE),CROSSGCC_AOF) + else +-$(error Unknown BUILDTYPE value, possible values are CROSSGCC_AOF and CROSSGCC_ELF) ++$(error Unknown BUILDTYPE value, possible values are CROSSGCC_AOF, CROSSGCC_ELF, and CROSSGCC_ELFEABI) + endif + include Makefile.setup.$(BUILDTYPE) + +Index: Source/Makefile.inc +=================================================================== +--- Source/Makefile.inc (revision 477) ++++ Source/Makefile.inc (working copy) +@@ -65,6 +65,9 @@ + ifeq ($(BUILDTYPE),CROSSGCC_ELF) + .ELFHdr.Hdr: + if [ -s "$<" ]; then $(CP) $< $@; fi ++else ifeq ($(BUILDTYPE),CROSSGCC_ELFEABI) ++.ELFHdr.Hdr: ++ if [ -s "$<" ]; then $(CP) $< $@; fi + else + .AOFHdr.Hdr: + if [ -s "$<" ]; then $(CP) $< $@; fi +@@ -98,6 +101,9 @@ + ifeq ($(BUILDTYPE),CROSSGCC_ELF) + .gas.o: + $(AS) -o $@ $< ++else ifeq ($(BUILDTYPE),CROSSGCC_ELFEABI) ++.gas.o: ++ $(AS) -o $@ $< + else + .asm.o: + $(AS) -o $@ $< +Index: Source/Makefile.setup.CROSSGCC_ELFEABI +=================================================================== +--- Source/Makefile.setup.CROSSGCC_ELFEABI (nonexistent) ++++ Source/Makefile.setup.CROSSGCC_ELFEABI (working copy) +@@ -0,0 +1,62 @@ ++# Settings for ELF building ++ ++ifndef GCCSDK_INSTALL_CROSSBIN ++$(error Environment variable GCCSDK_INSTALL_CROSSBIN is not defined) ++endif ++ifndef GCCSDK_INSTALL_ENV ++$(error Environment variable GCCSDK_INSTALL_ENV is not defined) ++endif ++ ++ifeq ($(ELFOBJECTTYPE),SOFTFPU) ++CCFLAGS = -mfloat-abi=soft ++DEFMODFLAGS = -float-abi soft ++else ifeq ($(ELFOBJECTTYPE),HARDFPU) ++CCFLAGS = -mlibscl ++DEFMODFLAGS = -float-abi hard ++else ifeq ($(ELFOBJECTTYPE),MODULE) ++CCFLAGS = -mmodule ++DEFMODFLAGS = -float-abi hard ++else ++$(error Unknown ELFOBJECTTYPE value, possible values are SOFTFPU, HARDFPU and MODULE) ++endif ++ ++export SOURCEDIR := $(abspath .) ++export BINDIR := $(SOURCEDIR)/../Bin ++export BUILDDIR := $(SOURCEDIR)/../Build ++export RELEASEDIR := $(SOURCEDIR)/../Release ++export RELEASEBINDIR := $(SOURCEDIR)/../Release/$(BUILDTYPE)/$(ELFOBJECTTYPE) ++export EXAMPLESDIR := $(SOURCEDIR)/../examples ++export DOCSDIR := $(SOURCEDIR)/../docs ++ ++export TOPHEADERDIR := $(BUILDDIR)/Header ++export HEADERDIR := $(TOPHEADERDIR)/oslib ++export CSTRONGDIR := $(BUILDDIR)/CStrong ++export VAPIDIR := $(BUILDDIR)/\!Vala/vapi ++export VAPIHDIR := $(BUILDDIR)/vapih ++export OBJDIR := $(BUILDDIR)/Objs ++export OBJEXCEPTDIR := $(BUILDDIR)/Objs/Exceptions ++export OSLIBSUPPORTDIR := $(BUILDDIR)/OSLibSupport ++ ++export BYTEWIDE := $(SOURCEDIR)/ByteWide ++export DEFMOD := $(BINDIR)/defmod -asmtype gccelfeabi $(DEFMODFLAGS) ++export REDUCEAOF := @echo Not needed for ELF build: reduceaof ++export BINDHELP := $(BINDIR)/bindhelp ++ ++export PATH := $(GCCSDK_INSTALL_CROSSBIN):$(PATH) ++ ++export CC := arm-riscos-gnueabi-gcc $(CCFLAGS) ++export CXX := arm-riscos-gnueabi-g++ $(CCFLAGS) ++export AS := arm-riscos-gnueabi-gcc -c -xassembler-with-cpp $(CCFLAGS) -I.. -I$(SOURCEDIR)/Types ++export LIBFILE := arm-riscos-gnueabi-ar rs ++export MKDIR := mkdir -p ++export RM := rm -rf ++export CP := cp -r ++export INSTALL := $(GCCSDK_INSTALL_ENV)/ro-install ++ ++export ASMEXT := .gas ++export EXEEXT := ,e1f ++export LIBSUFFIX := a ++ ++export OSLIBLIB := $(BUILDDIR)/libOSLib32.$(LIBSUFFIX) ++export OSLIBSUPPORTLIB := $(OSLIBSUPPORTDIR)/libOSLibSupport32.$(LIBSUFFIX) ++export OSLIBCSTRONG := $(BUILDDIR)/OSLib,3d6 +Index: Makefile +=================================================================== +--- Makefile (revision 477) ++++ Makefile (working copy) +@@ -29,6 +29,10 @@ + install-elf: oslib-elf + $(MAKE) -C Source install BUILDTYPE=CROSSGCC_ELF + ++# Installs the ELF headers & library in GCCSDK environment. ++install-elfeabi: oslib-elfeabi ++ $(MAKE) -C Source install BUILDTYPE=CROSSGCC_ELFEABI ++ + # Installs the AOF headers & library in GCCSDK environment. + install-aof: oslib-aof + $(MAKE) -C Source install BUILDTYPE=CROSSGCC_AOF +@@ -49,6 +53,10 @@ + $(MAKE) -C Source oslib BUILDTYPE=CROSSGCC_ELF + $(MAKE) -C Source oslibsupport BUILDTYPE=CROSSGCC_ELF + ++oslib-elfeabi: tools ++ $(MAKE) -C Source oslib BUILDTYPE=CROSSGCC_ELFEABI ++ $(MAKE) -C Source oslibsupport BUILDTYPE=CROSSGCC_ELFEABI ++ + vapis: tools + $(MAKE) -C Source vapis BUILDTYPE=CROSSGCC_ELF + diff --git a/arm-riscos-gnueabi/recipes/patches/oslib/defmod-elfeabi.p b/arm-riscos-gnueabi/recipes/patches/oslib/defmod-elfeabi.p new file mode 100644 index 0000000..eadeb6d --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/oslib/defmod-elfeabi.p @@ -0,0 +1,84 @@ +Index: Tools/DefMod2/assembler.c +=================================================================== +--- Tools/DefMod2/assembler.c (revision 477) ++++ Tools/DefMod2/assembler.c (working copy) +@@ -1242,6 +1242,21 @@ + goto finish; + break; + } ++ case AsmType_eGCCELFEABI: ++ { ++ const char *floatABI = (FloatABI == FloatABI_eSoft) ? "soft" : "hard"; ++ if (!apcs32) ++ { ++ fprintf(stderr, "EABI does not support APCS-26."); ++ goto finish; ++ } ++ if ((rc = sprintf (cmd, ++ "arm-riscos-gnueabi-gcc -c -xassembler -mfloat-abi=%s -o %s %s", ++ floatABI, ++ name2, name1)) < 0) ++ goto finish; ++ break; ++ } + default: + fprintf (stderr, "Unknown assembler type\n"); + goto finish; +Index: Tools/DefMod2/assembler.h +=================================================================== +--- Tools/DefMod2/assembler.h (revision 477) ++++ Tools/DefMod2/assembler.h (working copy) +@@ -22,8 +22,9 @@ + AsmType_eGCCAOF, /* Assembler used in GCCSDK 3.4 (AOF) release, called + 'as' (predecessor of AsAsm). */ + AsmType_eARMASM, /* ARM's assembler. */ +- AsmType_eGCCELF /* Assembler used in GCCSDK 4 (ELF) release, called ++ AsmType_eGCCELF, /* Assembler used in GCCSDK 4 (ELF) release, called + 'gas' (GNU binutils assembler). */ ++ AsmType_eGCCELFEABI /* Assembler used in EABI-capable GCCSDK */ + } AsmType_e; + + typedef enum +@@ -37,7 +38,7 @@ + extern AsmType_e AsmType; + extern FloatABI_e FloatABI; + +-#define GASSyntax (AsmType == AsmType_eGCCELF) ++#define GASSyntax (AsmType == AsmType_eGCCELF || AsmType == AsmType_eGCCELFEABI) + + /*if |separate|, output is to the directory |output|; otherwise, to the file |file|.*/ + extern os_error *assembler_output (FILE *file, const char *title, const char *author, lookup_t types, lookup_t swis, osbool separate, osbool apcs32, char *output); +Index: Tools/DefMod2/defmod.y +=================================================================== +--- Tools/DefMod2/defmod.y (revision 477) ++++ Tools/DefMod2/defmod.y (working copy) +@@ -1179,7 +1179,7 @@ + "[-o <output-dir> | > <output-file>] " + "[-byte_wide <byte-wide-file>] " + "[-26bit | -32bit] " +- "[-asmtype [objasm | asasmaof | asasmelf | gccaof | armasm | gccelf]] " ++ "[-asmtype [objasm | asasmaof | asasmelf | gccaof | armasm | gccelf | gccelfeabi]] " + "[-float-abi [soft | hard]] " + "< <module-interface-file>\r" + "Purpose: generate output from a module interface file\r" +@@ -1203,6 +1203,7 @@ + "\tgccaof\t\t" "...use GCC AOF toolkit (GCCSDK 3.4 only)\r" + "\tarmasm\t\t" "...use ARM ASM\r" + "\tgccelf\t\t" "...use GCC ELF toolkit (GCCSDK 4 only)\r" ++ "\tgccelfeabi\t\t" "...use GCC EABI ELF toolkit (GCCSDK 8+ only)\r" + "-float-abi\t\t" "marks object files which float-abi is in use\r" + "\tsoft\t\t" "...soft-float, no FP instructions used\r" + "\thard\t\t" "...hard-float, FP instructions can be used\r" +@@ -1345,9 +1346,11 @@ + AsmType = AsmType_eARMASM; + else if (strcmp (argv[i], "gccelf") == 0) + AsmType = AsmType_eGCCELF; ++ else if (strcmp (argv[i], "gccelfeabi") == 0) ++ AsmType = AsmType_eGCCELFEABI; + else + { +- fprintf (stderr, "Unknown option value %s for -asmtype (only \"objasm\", \"asasmaof\", \"asasmelf\", \"armarm\", \"gccaof\" and \"gccelf\" are known)\n", argv[i]); ++ fprintf (stderr, "Unknown option value %s for -asmtype (only \"objasm\", \"asasmaof\", \"asasmelf\", \"armarm\", \"gccaof\", \"gccelf\" and \"gccelfeabi\" are known)\n", argv[i]); + Parse_Error = TRUE; + goto finish; + } diff --git a/arm-riscos-gnueabi/recipes/patches/oslib/vapi.p b/arm-riscos-gnueabi/recipes/patches/oslib/vapi.p new file mode 100644 index 0000000..a3daf40 --- /dev/null +++ b/arm-riscos-gnueabi/recipes/patches/oslib/vapi.p @@ -0,0 +1,10 @@ +--- Tools/DefMod2/vapi.c.orig 2017-09-19 11:57:15.559547484 +0100 ++++ Tools/DefMod2/vapi.c 2017-09-19 11:57:31.067750029 +0100 +@@ -23,6 +23,7 @@ + #include <stdio.h> + #include <string.h> + #include <ctype.h> ++#include <stdbool.h> + + #include "oslib/os.h" + diff --git a/arm-unknown-riscos/Makefile b/arm-unknown-riscos/Makefile index 64516de..60b08a7 100644 --- a/arm-unknown-riscos/Makefile +++ b/arm-unknown-riscos/Makefile @@ -1,5 +1,5 @@ # Use a tested trunk version of GCCSDK -UPSTREAM_GCCSDK_VERSION := release_4_7_4_v2 +UPSTREAM_GCCSDK_VERSION := release_4_7_4_v6 UPSTREAM_GCCSDK_TARBALL := gcc4$(UPSTREAM_GCCSDK_VERSION).tar.gz UPSTREAM_GCCSDK_URI := svn://svn.riscos.info/gccsdk/tags/$(UPSTREAM_GCCSDK_VERSION) @@ -14,7 +14,7 @@ UPSTREAM_CCRES_TARBALL := ccres$(UPSTREAM_CCRES_VERSION).tar.gz UPSTREAM_CCRES_URI := svn://svn.riscos.info/ccres/trunk@$(UPSTREAM_CCRES_VERSION) # Makerun -UPSTREAM_MAKERUN_VERSION := abdbd16 +UPSTREAM_MAKERUN_VERSION := fe55b6bf UPSTREAM_MAKERUN_TARBALL := makerun$(UPSTREAM_MAKERUN_VERSION).tar.gz UPSTREAM_MAKERUN_URI := git://git.netsurf-browser.org/makerun.git @@ -26,7 +26,7 @@ UPSTREAM_SQUEEZE_URI := git://git.netsurf-browser.org/squeeze.git # Infozip UPSTREAM_INFOZIP_VERSION := 30 UPSTREAM_INFOZIP_TARBALL := zip$(UPSTREAM_INFOZIP_VERSION).tar.gz -UPSTREAM_INFOZIP_URI := http://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/$(UPSTREAM_INFOZIP_TARBALL) +UPSTREAM_INFOZIP_URI := https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/$(UPSTREAM_INFOZIP_TARBALL) TOP := $(CURDIR) RECIPES := $(TOP)/recipes diff --git a/arm-unknown-riscos/fetchsrc b/arm-unknown-riscos/fetchsrc index e71d85f..92ae5bf 100755 --- a/arm-unknown-riscos/fetchsrc +++ b/arm-unknown-riscos/fetchsrc @@ -4,7 +4,7 @@ # Usage fetchsrc <target> <source> <upstream> <output> -NSSRV="http://ci.netsurf-browser.org/toolchain/" +NSSRV="https://ci.netsurf-browser.org/toolchain/" wget -q -O ${4} ${NSSRV}/${1}/${2} if [ $? -ne 0 ];then diff --git a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p index 54720f5..3f2f110 100644 --- a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p +++ b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p @@ -4,9 +4,9 @@ # Download binutils source: $(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2: -mkdir -p $(SRCORIGDIR) -- cd $(SRCORIGDIR) && wget -c http://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2 +- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2 - touch $@ -+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BINUTILS_VERSION).tar.bz2 ++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BINUTILS_VERSION).tar.bz2 ifeq "$(GCC_USE_SCM)" "yes" # Checkout gcc source: diff --git a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p index 194ef7f..6f91911 100644 --- a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p +++ b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p @@ -6,7 +6,7 @@ -mkdir -p $(SRCORIGDIR) - cd $(SRCORIGDIR) && wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-$(CLOOG_VERSION).tar.gz - touch $@ -+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(CLOOG_VERSION).tar.gz ++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(CLOOG_VERSION).tar.gz # Download newlib source: $(SRCORIGDIR)/newlib-$(NEWLIB_VERSION).tar.gz: diff --git a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p index 0bfd4ec..4f99d57 100644 --- a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p +++ b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p @@ -4,8 +4,8 @@ # Download mpc source: $(SRCORIGDIR)/mpc-$(MPC_VERSION).tar.gz: -mkdir -p $(SRCORIGDIR) -- cd $(SRCORIGDIR) && wget -c http://www.multiprecision.org/mpc/download/mpc-$(MPC_VERSION).tar.gz -+ cd $(SRCORIGDIR) && wget -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VERSION).tar.gz +- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/mpc/mpc-$(MPC_VERSION).tar.gz ++ cd $(SRCORIGDIR) && wget -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VERSION).tar.gz touch $@ # Download mpfr source: diff --git a/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p b/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p new file mode 100644 index 0000000..5e12120 --- /dev/null +++ b/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p @@ -0,0 +1,11 @@ +--- gcc4/Makefile (old) ++++ gcc4/Makefile (new) +@@ -36,7 +36,7 @@ + AUTOMAKE_FOR_GCC_VERSION=1.11.1 + LIBTOOL_FOR_GCC_VERSION=2.4.2 + GCC_VERSION=$(GCCSDK_SUPPORTED_GCC_RELEASE) +-GCC_USE_SCM=yes ++GCC_USE_SCM=no + GCC_SCM_PATH=branches/gcc-4_7-branch + NEWLIB_VERSION=1.19.0 + NEWLIB_USE_SCM=no diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p new file mode 100644 index 0000000..f5726b8 --- /dev/null +++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p @@ -0,0 +1,1920 @@ +Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy) +@@ -583,11 +583,11 @@ + else + locale_src = \ + locale/localeconv.c \ ++ locale/newlocale.c \ + locale/nl_langinfo.c \ + locale/setlocale.c \ + locale/strcoll.c \ +- locale/strxfrm.c \ +- locale/territory.c ++ locale/strxfrm.c + endif + locale_src += \ + locale/iconv.c +@@ -1312,6 +1312,7 @@ + bits/in.h \ + bits/libc-lock.h \ + bits/locale.h \ ++ bits/locale_t.h \ + bits/mathcalls.h \ + bits/mathdef.h \ + bits/mathinline.h \ +Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy) +@@ -10,36 +10,35 @@ + #include <internal/os.h> + #include <internal/unix.h> + +-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must +- support EOF. */ +-static unsigned char ctype[257]; +-const unsigned char * const __ctype = &ctype[1]; ++/* Global containing current locale settings. */ ++struct _locale __locale_global; ++/* Offset 1 as the first entry is reserved for EOF. */ ++const unsigned char * const __ctype = &__locale_global.ctype[1]; ++const short * const __ctype_upper = &__locale_global.ctype_upper[1]; ++const short * const __ctype_lower = &__locale_global.ctype_lower[1]; + +-static short ctype_upper[257]; +-const short * const __ctype_upper = &ctype_upper[1]; +- +-static short ctype_lower[257]; +-const short * const __ctype_lower = &ctype_lower[1]; +- + void +-__build_ctype_tables (int territory) ++__build_ctype_tables (locale_t locobj, int territory) + { + PTHREAD_UNSAFE + + if (territory == -2) + { +- /* Initialise the array. This is only done by __unixinit(). */ ++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */ + territory = -1; +- for (int x = 0; x <= LC_ALL; x++) +- __locale_territory[x] = -1; ++ for (int x = 0; x < LC_ALL; x++) ++ locobj->locale_territory[x] = -1; ++ __localeconv_lconv_init(&locobj->lc); ++ locobj->lc_needs_refresh = 1; + } + + /* Initialise ctype_upper/ctype_lower tables. */ + for (int x = 0; x < 257; x++) + { +- /* In the C/POSIX locate, tolower(top bit set char) ++ /* In the C/POSIX locale, tolower(top bit set char) + should return the character unchanged. */ +- ctype_lower[x] = ctype_upper[x] = x - 1; ++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1; ++ locobj->ctype[x] = 0; + } + + int regs[10]; +@@ -61,7 +60,7 @@ + for (int offset = 1; bits; bits = bits >> 1, offset += 1) + { + if (bits & 1) +- ctype[pos + offset] |= 1 << code; ++ locobj->ctype[pos + offset] |= 1 << code; + } + pos += 32; + } +@@ -80,7 +79,7 @@ + int y = (territory == -1) ? 128 : 256; + for (int x = 1; x <= y; x++) + { +- ctype_lower[x] = (short)*p++; +- ctype_upper[x] = (short)*q++; ++ locobj->ctype_lower[x] = (short)*p++; ++ locobj->ctype_upper[x] = (short)*q++; + } + } +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isalnum) (int c) +@@ -10,3 +11,8 @@ + return isalnum (c); + } + ++int ++isalnum_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit)); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isalpha) (int c) +@@ -10,3 +11,8 @@ + return isalpha (c); + } + ++int ++isalpha_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_alpha); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (working copy) +@@ -10,3 +10,9 @@ + return isascii (c); + } + ++int ++isascii_l (int c, locale_t locobj) ++{ ++ (void) locobj; ++ return isascii (c); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (working copy) +@@ -9,3 +9,10 @@ + { + return isblank (c); + } ++ ++int ++isblank_l (int c, locale_t locobj) ++{ ++ (void) locobj; ++ return isblank (c); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (iscntrl) (int c) +@@ -10,3 +11,8 @@ + return iscntrl (c); + } + ++int ++iscntrl_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isdigit) (int c) +@@ -10,3 +11,8 @@ + return isdigit (c); + } + ++int ++isdigit_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_digit); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isgraph) (int c) +@@ -10,3 +11,8 @@ + return isgraph (c); + } + ++int ++isgraph_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl)); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/islower.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (islower) (int c) +@@ -10,3 +11,8 @@ + return islower (c); + } + ++int ++islower_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_lower); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isprint) (int c) +@@ -10,3 +11,10 @@ + return isprint (c); + } + ++int ++isprint_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc | ++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (ispunct) (int c) +@@ -10,3 +11,8 @@ + return ispunct (c); + } + ++int ++ispunct_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_punc); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isspace) (int c) +@@ -10,3 +11,8 @@ + return isspace (c); + } + ++int ++isspace_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_white); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isupper) (int c) +@@ -10,3 +11,8 @@ + return isupper (c); + } + ++int ++isupper_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_upper); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (isxdigit) (int c) +@@ -10,3 +11,8 @@ + return isxdigit (c); + } + ++int ++isxdigit_l (int c, locale_t locobj) ++{ ++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (working copy) +@@ -10,3 +10,9 @@ + return toascii (c); + } + ++int ++toascii_l (int c, locale_t locobj) ++{ ++ (void) locobj; ++ return toascii (c); ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (tolower) (int c) +@@ -10,3 +11,8 @@ + return tolower (c); + } + ++int ++tolower_l (int c, locale_t locobj) ++{ ++ return (&locobj->ctype_lower[1])[c]; ++} +Index: gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (working copy) +@@ -3,6 +3,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + + int + (toupper) (int c) +@@ -10,3 +11,8 @@ + return toupper (c); + } + ++int ++toupper_l (int c, locale_t locobj) ++{ ++ return (&locobj->ctype_upper[1])[c]; ++} +Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (working copy) +@@ -13,15 +13,36 @@ + + #ifndef __TARGET_SCL__ + +-/* Territory number for each locale. C locale is -1. */ +-extern int __locale_territory[LC_ALL + 1]; ++struct _locale { ++ /* Map from locale category to territory number. C locale is -1. */ ++ int locale_territory[LC_ALL]; + +-/* Set to 1 is setlocale has been called since the last call to +- localeconv. localeconv uses this flag to cache the lconv structure. */ +-extern int __setlocale_called; ++ /* Character type LUTs: EOF + one entry per character ++ * ++ * EOF is defined as -1, so character entries start at offset 1. ++ */ ++ short ctype_upper[257]; ++ short ctype_lower[257]; ++ unsigned char ctype[257]; + +-extern void __build_ctype_tables (int __territory) __THROW; ++ /* Set to 1 if the locale information has changed since the last time ++ * the lconv structure was updated. */ ++ int lc_needs_refresh; ++ /* Numeric formatting information for locale */ ++ struct lconv lc; ++}; + ++extern struct _locale __locale_global; ++ ++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW; ++ ++extern char *__setlocale_l (locale_t locobj, int __category, ++ const char *__locale) __THROW; ++ ++void __localeconv_lconv_init (struct lconv *lc); ++void __localeconv_lconv_fini (struct lconv *lc); ++void __localeconv_l (locale_t locobj); ++ + #endif + + __END_DECLS +Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent) ++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy) +@@ -0,0 +1,10 @@ ++/* ++ * Copyright (c) 2022 UnixLib Developers ++ */ ++ ++#ifndef _BITS_LOCALE_T_H_ ++#define _BITS_LOCALE_T_H_ ++ ++typedef struct _locale *locale_t; ++ ++#endif +Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/ctype.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/ctype.h (working copy) +@@ -51,6 +51,48 @@ + extern int isblank (int __c) __THROW; + + #ifndef __TARGET_SCL__ ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> ++ ++/* c is alphabetic or numeric. */ ++extern int isalnum_l (int __c, locale_t locobj) __THROW; ++ ++/* c is alphabetic. */ ++extern int isalpha_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a control character. */ ++extern int iscntrl_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a decimal digit. */ ++extern int isdigit_l (int __c, locale_t locobj) __THROW; ++ ++/* c is any printable character other than a space. */ ++extern int isgraph_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a lower-case letter. */ ++extern int islower_l (int __c, locale_t locobj) __THROW; ++ ++/* c is an upper-case letter. */ ++extern int isupper_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a printable character. */ ++extern int isprint_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a printable character other than a space or a ++ alphanumeric character. */ ++extern int ispunct_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a white space character e.g. space, newline, tab, linefeed, ++ return, vertical tab. */ ++extern int isspace_l (int __c, locale_t locobj) __THROW; ++ ++/* c is a hex digit. */ ++extern int isxdigit_l (int __c, locale_t locobj) __THROW; ++ ++/* c is tab or space. */ ++extern int isblank_l (int __c, locale_t locobj) __THROW; ++# endif ++ + /* Characteristics. */ + extern const unsigned char * const __ctype; + /* Lower case table. */ +@@ -108,6 +150,10 @@ + extern int toupper (int __c) __THROW; + #ifndef __TARGET_SCL__ + # define toupper(c) ((int) __ctype_upper[(int) (c)]) ++ ++# ifdef __USE_XOPEN2K8 ++extern int toupper_l (int __c, locale_t locobj) __THROW; ++# endif + #endif + + /* Convert c to lower case. */ +@@ -114,6 +160,10 @@ + extern int tolower (int __c) __THROW; + #ifndef __TARGET_SCL__ + # define tolower(c) ((int) __ctype_lower[(int) (c)]) ++ ++# ifdef __USE_XOPEN2K8 ++extern int tolower_l (int __c, locale_t locobj) __THROW; ++# endif + #endif + + #ifndef __TARGET_SCL__ +@@ -135,6 +185,11 @@ + /* Is c an ASCII character. */ + extern int isascii (int __c) __THROW; + # define isascii(c) ((unsigned)(c) <= 0x7f) ++ ++# ifdef __USE_XOPEN2K8 ++extern int toascii_l (int __c, locale_t locobj) __THROW; ++extern int isascii_l (int __c, locale_t locobj) __THROW; ++# endif + # endif + #endif + +Index: gcc4/recipe/files/gcc/libunixlib/include/langinfo.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/langinfo.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/langinfo.h (working copy) +@@ -580,18 +580,12 @@ + extern char *nl_langinfo (nl_item __item) __THROW; + + +-#if 0 +-#ifdef __USE_GNU +-/* This interface is for the extended locale model. See <locale.h> for +- more information. */ ++#ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> + +-/* Get locale datatype definition. */ +-# include <xlocale.h> +- + /* Just like nl_langinfo but get the information from the locale object L. */ +-extern char *nl_langinfo_l (nl_item __item, __locale_t l); ++extern char *nl_langinfo_l (nl_item __item, locale_t __l); + #endif +-#endif + + __END_DECLS + +Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/locale.h (working copy) +@@ -33,16 +33,16 @@ + /* Entire locale. */ + # define LC_ALL 6 + +-#define LC_COLLATE_MASK (1L << 1) +-#define LC_CTYPE_MASK (1L << 2) +-#define LC_MESSAGES_MASK (1L << 3) +-#define LC_MONETARY_MASK (1L << 4) +-#define LC_NUMERIC_MASK (1L << 5) +-#define LC_TIME_MASK (1L << 6) +-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) ++# ifdef __USE_XOPEN2K8 ++# define LC_COLLATE_MASK (1L << 0) ++# define LC_CTYPE_MASK (1L << 1) ++# define LC_MESSAGES_MASK (1L << 2) ++# define LC_MONETARY_MASK (1L << 3) ++# define LC_NUMERIC_MASK (1L << 4) ++# define LC_TIME_MASK (1L << 5) ++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) ++# endif + +-typedef struct _locale *locale_t; +- + #else + /* String collation (functions 'strcoll' and 'strxfrm'). */ + # define LC_COLLATE 1 +@@ -121,6 +121,9 @@ + extern struct lconv *localeconv (void) __THROW; + + #ifndef __TARGET_SCL__ ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> ++ + extern locale_t uselocale(locale_t newloc); + + extern void freelocale(locale_t locobj); +@@ -127,7 +130,11 @@ + + extern locale_t newlocale(int category_mask, const char *locale, + locale_t base); +-# define LC_GLOBAL_LOCALE ((locale_t) -1L) ++ ++extern locale_t duplocale(locale_t locobj); ++ ++# define LC_GLOBAL_LOCALE ((locale_t) -1L) ++# endif + #endif + + __END_NAMESPACE_STD +Index: gcc4/recipe/files/gcc/libunixlib/include/string.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy) +@@ -93,6 +93,16 @@ + const char *__restrict __src, size_t __n) + __THROW __nonnull ((2)); + ++#ifdef __USE_XOPEN2K8 ++#include <bits/locale_t.h> ++ ++extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 3)); ++ ++extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, ++ locale_t __l) __THROW __nonnull ((2, 4)); ++#endif ++ + /* Find the first occurrence of c in s. */ + extern char *strchr (const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +@@ -281,6 +291,17 @@ + /* Compare no more than N chars of S1 and S2, ignoring case. */ + extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)) __wur; ++ ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> ++ ++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 3)); ++ ++extern int strncasecmp_l (const char *__s1, const char *__s2, ++ size_t __n, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 4)); ++# endif + #endif /* Use BSD. */ + + #if defined __USE_XOPEN2K || defined __USE_MISC +@@ -289,6 +310,11 @@ + __THROW __nonnull ((2)); + #endif + ++#ifdef __USE_XOPEN2K8 ++/* Translate error number to string according to the locale L. */ ++extern char *strerror_l (int __errnum, locale_t __l) __THROW; ++#endif ++ + #ifndef __TARGET_SCL__ + # ifndef basename + /* Return the file name within directory of FILENAME. We don't +Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/strings.h (working copy) +@@ -37,7 +37,17 @@ + /* Compare n chars of S1 and S2, ignoring case. */ + extern int strncasecmp (const char *__s1, const char *__s2, size_t __n); + ++# ifdef __USE_XOPEN2K8 ++# include <bits/locale_t.h> + ++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 3)); ++ ++extern int strncasecmp_l (const char *__s1, const char *__s2, ++ size_t __n, locale_t __loc) ++ __THROW __attribute_pure__ __nonnull ((1, 2, 4)); ++# endif ++ + /* Return the position of the first bit set in I, or 0 if none are set. + The least-significant bit is position 1, the most-significant 32. */ + extern int ffs (int __i); +Index: gcc4/recipe/files/gcc/libunixlib/include/wchar.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/wchar.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/wchar.h (working copy) +@@ -1,7 +1,7 @@ + /* + * File taken from glibc 2.11. + * Following changes were made: +- * - Disabled non-standard reentrant locale prototypes. ++ * - None + */ + + /* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc. +@@ -172,7 +172,6 @@ + __END_NAMESPACE_STD + #endif + +-#if 0 + #ifdef __USE_XOPEN2K8 + /* Compare S1 and S2, ignoring case. */ + extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; +@@ -183,15 +182,14 @@ + + /* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +-# include <xlocale.h> ++# include <bits/locale_t.h> + + extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, +- __locale_t __loc) __THROW; ++ locale_t __loc) __THROW; + + extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, +- size_t __n, __locale_t __loc) __THROW; ++ size_t __n, locale_t __loc) __THROW; + #endif +-#endif + + __BEGIN_NAMESPACE_STD + /* Compare S1 and S2, both interpreted as appropriate to the +@@ -205,7 +203,6 @@ + __END_NAMESPACE_STD + + #ifdef __USE_XOPEN2K8 +-#if 0 + /* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ + +@@ -212,14 +209,13 @@ + /* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the given locale. */ + extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, +- __locale_t __loc) __THROW; ++ locale_t __loc) __THROW; + + /* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ + extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, +- size_t __n, __locale_t __loc) __THROW; +-#endif ++ size_t __n, locale_t __loc) __THROW; + + #ifndef __TARGET_SCL__ + /* Duplicate S, returning an identical malloc'd string. */ +Index: gcc4/recipe/files/gcc/libunixlib/include/wctype.h +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/include/wctype.h (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/include/wctype.h (working copy) +@@ -3,7 +3,6 @@ + * Following changes were made: + * - Replaced "#include <bits/types.h>" into "#include <unixlib/types.h>" + * - Add wint_t typedef when it hasn't been defined in stddef.h. +- * - Disabled non-standard reentrant locale prototypes. + */ + + /* Copyright (C) 1996-2002,2005,2007,2008,2009 Free Software Foundation, Inc. +@@ -191,7 +190,6 @@ + /* Determine whether the wide-character WC has the property described by + DESC. */ + extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; +-#define iswctype_l(c, d, l) iswctype(c, d) + + __END_NAMESPACE_C99 + +@@ -241,73 +239,71 @@ + extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; + __END_NAMESPACE_C99 + +-#if 0 + # ifdef __USE_XOPEN2K8 +-/* Declare the interface to extended locale model. */ +-# include <xlocale.h> ++# include <bits/locale_t.h> + + /* Test for any wide character for which `iswalpha' or `iswdigit' is + true. */ +-extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character for which `iswupper' or 'iswlower' is + true, or any wide character that is one of a locale-specific set of + wide-characters for which none of `iswcntrl', `iswdigit', + `iswpunct', or `iswspace' is true. */ +-extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any control wide character. */ +-extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a decimal-digit + character. */ +-extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character for which `iswprint' is true and + `iswspace' is false. */ +-extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a lowercase letter + or is one of a locale-specific set of wide characters for which + none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +-extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any printing wide character. */ +-extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any printing wide character that is one of a + locale-specific et of wide characters for which neither `iswspace' + nor `iswalnum' is true. */ +-extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a locale-specific + set of wide characters for which none of `iswalnum', `iswgraph', or + `iswpunct' is true. */ +-extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to an uppercase letter + or is one of a locale-specific set of wide character for which none + of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +-extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a hexadecimal-digit + character equivalent to that performed be the functions described + in the previous subclause. */ +-extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW; + + /* Test for any wide character that corresponds to a standard blank + wide character or a locale-specific set of wide characters for + which `iswalnum' is false. */ +-extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; ++extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW; + + /* Construct value that describes a class of wide characters identified + by the string argument PROPERTY. */ +-extern wctype_t wctype_l (__const char *__property, __locale_t __locale) ++extern wctype_t wctype_l (__const char *__property, locale_t __locale) + __THROW; + + /* Determine whether the wide-character WC has the property described by + DESC. */ +-extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) ++extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale) + __THROW; + + +@@ -316,22 +312,21 @@ + */ + + /* Converts an uppercase letter to the corresponding lowercase letter. */ +-extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW; ++extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW; + + /* Converts an lowercase letter to the corresponding uppercase letter. */ +-extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW; ++extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW; + + /* Construct value that describes a mapping between wide characters + identified by the string argument PROPERTY. */ +-extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale) ++extern wctrans_t wctrans_l (__const char *__property, locale_t __locale) + __THROW; + + /* Map the wide character WC using the mapping described by DESC. */ + extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, +- __locale_t __locale) __THROW; ++ locale_t __locale) __THROW; + + # endif /* Use POSIX 2008. */ +-#endif + + __END_DECLS + +Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (working copy) +@@ -14,8 +14,6 @@ + + /* #define DEBUG */ + +-int __setlocale_called = 1; +- + static int + read_symbol (int reason_code, int territory) + { +@@ -71,26 +69,44 @@ + *grouping = new_grouping; + } + +-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL, +- NULL, NULL, NULL, NULL, NULL, +- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, +- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX }; ++void ++__localeconv_lconv_init (struct lconv *lc) ++{ ++ memset(lc, 0, sizeof(*lc)); ++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes = ++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space = ++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX; ++} + +-/* Defined by POSIX as not threadsafe */ +-struct lconv * +-localeconv (void) ++void ++__localeconv_lconv_fini (struct lconv *lc) + { ++ free(lc->decimal_point); ++ free(lc->thousands_sep); ++ free(lc->grouping); ++ free(lc->int_curr_symbol); ++ free(lc->currency_symbol); ++ free(lc->mon_decimal_point); ++ free(lc->mon_thousands_sep); ++ free(lc->mon_grouping); ++ free(lc->positive_sign); ++ free(lc->negative_sign); ++} ++ ++void ++__localeconv_l (locale_t locobj) ++{ + int numeric, monetary; + + /* If setlocale has not been called since the last call to + localeconv, then the lconv structure will be the same. */ +- if (!__setlocale_called) +- return &lc; ++ if (!locobj->lc_needs_refresh) ++ return; + +- __setlocale_called = 0; ++ locobj->lc_needs_refresh = 0; + +- numeric = __locale_territory[LC_NUMERIC]; +- monetary = __locale_territory[LC_MONETARY]; ++ numeric = locobj->locale_territory[LC_NUMERIC]; ++ monetary = locobj->locale_territory[LC_MONETARY]; + + /* See the PRMs regarding SWI Territory_ReadSymbols for the + meanings of the following numbers. */ +@@ -97,71 +113,80 @@ + if (numeric == -1) + { + /* We're using the 'C' locale. */ +- free (lc.decimal_point); +- lc.decimal_point = strdup ("."); +- free (lc.thousands_sep); +- lc.thousands_sep = strdup (""); +- free (lc.grouping); +- lc.grouping = strdup (""); ++ free (locobj->lc.decimal_point); ++ locobj->lc.decimal_point = strdup ("."); ++ free (locobj->lc.thousands_sep); ++ locobj->lc.thousands_sep = strdup (""); ++ free (locobj->lc.grouping); ++ locobj->lc.grouping = strdup (""); + } + else + { +- free (lc.decimal_point); +- lc.decimal_point = strdup ((char *) read_symbol (0, numeric)); +- free (lc.thousands_sep); +- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric)); +- read_byte_list (2, &lc.grouping, numeric); ++ free (locobj->lc.decimal_point); ++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric)); ++ free (locobj->lc.thousands_sep); ++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric)); ++ read_byte_list (2, &locobj->lc.grouping, numeric); + } + if (monetary == -1) + { + /* We using the 'C' locale. Empty strings and CHAR_MAX means + that these fields are unspecified. */ +- free (lc.mon_decimal_point); +- lc.mon_decimal_point = strdup (""); +- free (lc.mon_thousands_sep); +- lc.mon_thousands_sep = strdup (""); +- free (lc.mon_grouping); +- lc.mon_grouping = strdup (""); +- lc.int_frac_digits = CHAR_MAX; +- lc.frac_digits = CHAR_MAX; +- free (lc.currency_symbol); +- lc.currency_symbol = strdup (""); +- free (lc.int_curr_symbol); +- lc.int_curr_symbol = strdup (""); +- lc.p_cs_precedes = CHAR_MAX; +- lc.n_cs_precedes = CHAR_MAX; +- lc.p_sep_by_space = CHAR_MAX; +- lc.n_sep_by_space = CHAR_MAX; +- free (lc.positive_sign); +- lc.positive_sign = strdup (""); +- free (lc.negative_sign); +- lc.negative_sign = strdup (""); +- lc.p_sign_posn = CHAR_MAX; +- lc.n_sign_posn = CHAR_MAX; ++ free (locobj->lc.mon_decimal_point); ++ locobj->lc.mon_decimal_point = strdup (""); ++ free (locobj->lc.mon_thousands_sep); ++ locobj->lc.mon_thousands_sep = strdup (""); ++ free (locobj->lc.mon_grouping); ++ locobj->lc.mon_grouping = strdup (""); ++ locobj->lc.int_frac_digits = CHAR_MAX; ++ locobj->lc.frac_digits = CHAR_MAX; ++ free (locobj->lc.currency_symbol); ++ locobj->lc.currency_symbol = strdup (""); ++ free (locobj->lc.int_curr_symbol); ++ locobj->lc.int_curr_symbol = strdup (""); ++ locobj->lc.p_cs_precedes = CHAR_MAX; ++ locobj->lc.n_cs_precedes = CHAR_MAX; ++ locobj->lc.p_sep_by_space = CHAR_MAX; ++ locobj->lc.n_sep_by_space = CHAR_MAX; ++ free (locobj->lc.positive_sign); ++ locobj->lc.positive_sign = strdup (""); ++ free (locobj->lc.negative_sign); ++ locobj->lc.negative_sign = strdup (""); ++ locobj->lc.p_sign_posn = CHAR_MAX; ++ locobj->lc.n_sign_posn = CHAR_MAX; + } + else + { +- free (lc.int_curr_symbol); +- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary)); +- free (lc.currency_symbol); +- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary)); +- free (lc.mon_decimal_point); +- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary)); +- free (lc.mon_thousands_sep); +- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary)); +- read_byte_list (7, &lc.mon_grouping, monetary); +- free (lc.positive_sign); +- lc.positive_sign = strdup ((char *)read_symbol (8, monetary)); +- free (lc.negative_sign); +- lc.negative_sign = strdup ((char *)read_symbol (9, monetary)); +- lc.int_frac_digits = (char)read_symbol (10, monetary); +- lc.frac_digits = (char)read_symbol (11, monetary); +- lc.p_cs_precedes = (char)read_symbol (12, monetary); +- lc.p_sep_by_space = (char)read_symbol (13, monetary); +- lc.n_cs_precedes = (char)read_symbol (14, monetary); +- lc.n_sep_by_space = (char)read_symbol (15, monetary); +- lc.p_sign_posn = (char)read_symbol (16, monetary); +- lc.n_sign_posn = (char)read_symbol (17, monetary); ++ free (locobj->lc.int_curr_symbol); ++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary)); ++ free (locobj->lc.currency_symbol); ++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary)); ++ free (locobj->lc.mon_decimal_point); ++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary)); ++ free (locobj->lc.mon_thousands_sep); ++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary)); ++ read_byte_list (7, &locobj->lc.mon_grouping, monetary); ++ free (locobj->lc.positive_sign); ++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary)); ++ free (locobj->lc.negative_sign); ++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary)); ++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary); ++ locobj->lc.frac_digits = (char)read_symbol (11, monetary); ++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary); ++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary); ++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary); ++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary); ++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary); ++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary); + } +- return &lc; ++ return; + } ++ ++/* Defined by POSIX as not threadsafe */ ++struct lconv * ++localeconv (void) ++{ ++ __localeconv_l (&__locale_global); ++ ++ return &__locale_global.lc; ++} +Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy) +@@ -1,17 +1,17 @@ + /* Copyright (c) 2019 UnixLib Developers + */ + ++#include <ctype.h> ++#include <errno.h> ++#include <locale.h> + #include <stdlib.h> +-#include <locale.h> + #include <stdio.h> +-#include <errno.h> ++#include <string.h> + +-struct _locale { +- struct lconv lc; +-}; ++#include <internal/unix.h> + + /* This is supposed to be per-thread. */ +-static locale_t current_locale; ++static locale_t current_locale = LC_GLOBAL_LOCALE; + + locale_t uselocale(locale_t newloc) + { +@@ -27,20 +27,94 @@ + + void freelocale(locale_t locobj) + { +- if (locobj) ++ if (locobj) { ++ __localeconv_lconv_fini(&locobj->lc); + free(locobj); ++ } + } + + locale_t newlocale(int category_mask, const char *locale, + locale_t base) + { +- locale_t loc = (locale_t)malloc(sizeof(*loc)); +- if (!loc) { ++ struct _locale tmp; ++ ++ PTHREAD_UNSAFE ++ ++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) { ++ __set_errno (EINVAL); ++ return 0; ++ } ++ ++ /* The locale provided will be verified by __setlocale_l() */ ++ ++ /* Prepare the temporary locale we will modify */ ++ if (base != 0 && base != LC_GLOBAL_LOCALE) { ++ memcpy(&tmp, base, sizeof(tmp)); ++ } else { ++ if (base == LC_GLOBAL_LOCALE) { ++ /* Undefined: be helpful to client */ ++ memcpy(&tmp, &__locale_global, sizeof(tmp)); ++ } else { ++ /* Initialise to C locale */ ++ __build_ctype_tables(&tmp, -2); ++ } ++ } ++ ++ /* Now, apply the requested locale to each of the categories in the mask */ ++ if (category_mask == LC_ALL_MASK) { ++ /* Special-case LC_ALL to handle the encoded locale string */ ++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) { ++ return 0; ++ } ++ } else { ++ int category = 0, mask = category_mask; ++ while (mask != 0) { ++ if (mask & 1) { ++ if (__setlocale_l(&tmp, category, locale) == NULL) { ++ return 0; ++ } ++ } ++ category++; ++ mask >>= 1; ++ } ++ } ++ ++ /* Allocate the result, if necessary */ ++ if (base == 0 || base == LC_GLOBAL_LOCALE) { ++ base = (locale_t)malloc(sizeof(*base)); ++ if (!base) { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ } ++ /* Fill it in */ ++ memcpy(base, &tmp, sizeof(tmp)); ++ ++ /* Mark the lconv data stale */ ++ base->lc_needs_refresh = 1; ++ ++ return base; ++} ++ ++locale_t duplocale(locale_t locobj) ++{ ++ locale_t loc; ++ ++ loc = (locale_t) malloc(sizeof(*loc)); ++ if (loc == NULL) { + __set_errno (ENOMEM); + return 0; + } + +- loc->lc = *localeconv(); ++ if (locobj == LC_GLOBAL_LOCALE) { ++ memcpy(loc, &__locale_global, sizeof(*loc)); ++ } else { ++ memcpy(loc, locobj, sizeof(*loc)); ++ } + ++ /* Invalidate lconv in the copy */ ++ __localeconv_lconv_init(&loc->lc); ++ loc->lc_needs_refresh = 1; ++ + return loc; + } +Index: gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c (working copy) +@@ -24,3 +24,10 @@ + + return (char *)value; + } ++ ++char * ++nl_langinfo_l (nl_item item, locale_t l) ++{ ++ (void) l; ++ return nl_langinfo(item); ++} +Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (working copy) +@@ -195,7 +195,7 @@ + } + + static void +-do_lc_all (char *buffer, int size) ++do_lc_all (locale_t locobj, char *buffer, int size) + { + char temp[64]; + int category, same = 1; +@@ -204,13 +204,13 @@ + setlocale to set all locales. If all locales are + the same, then we can produce a very short string. */ + for (category = 1; category < LC_ALL; ++category) +- if (__locale_territory[0] != __locale_territory[category]) ++ if (locobj->locale_territory[0] != locobj->locale_territory[category]) + same = 0; + + if (same) + { + /* All locales are set to the same territory. */ +- territory_name (__locale_territory[0], buffer, size); ++ territory_name (locobj->locale_territory[0], buffer, size); + } + else + { +@@ -218,7 +218,7 @@ + LC_CATEGORY=country;LC_CATEGORY=country; ... */ + for (category = 0; category < LC_ALL; ++category) + { +- territory_name (__locale_territory[category], temp, sizeof (temp)); ++ territory_name (locobj->locale_territory[category], temp, sizeof (temp)); + buffer = stpcpy (buffer, locale_names[category]); + *buffer++ = '='; + buffer = stpcpy (buffer, temp); +@@ -230,15 +230,13 @@ + } + + char * +-setlocale (int category, const char *locale) ++__setlocale_l (locale_t locobj, int category, const char *locale) + { + int new_territory, changed; + static char old_locale[256]; + +- PTHREAD_UNSAFE +- + /* This tells localeconv to re-read data for the lconv structure. */ +- __setlocale_called = 1; ++ locobj->lc_needs_refresh = 1; + + if (locale == NULL) + { +@@ -247,11 +245,11 @@ + { + /* The locale string is specially encoded for LC_ALL so we + could restore all locales at any time. */ +- do_lc_all (old_locale, sizeof (old_locale)); ++ do_lc_all (locobj, old_locale, sizeof (old_locale)); + return old_locale; + } + +- territory_name (__locale_territory[category], old_locale, sizeof (old_locale)); ++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale)); + return old_locale; + } + +@@ -270,7 +268,7 @@ + /* Encode the locale string, as we will be returning this + later. Remember, setlocale returns the locale settings + that are about to be changed. */ +- do_lc_all (old_locale, sizeof (old_locale)); ++ do_lc_all (locobj, old_locale, sizeof (old_locale)); + + /* Check for an encoded (composite) name. Simply looking for + a semi-colon will verify this. */ +@@ -332,11 +330,11 @@ + + /* We now know all locales exist, so set them. */ + for (category = 0; category < LC_ALL; ++category) +- __locale_territory[category] = territory_number (newnames[category]); ++ locobj->locale_territory[category] = territory_number (newnames[category]); + + /* Re-build the character type tables according to the new + locale settings. */ +- __build_ctype_tables (__locale_territory[LC_CTYPE]); ++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]); + return old_locale; + } + } +@@ -359,9 +357,9 @@ + /* Change the locale for all categories. old_locale was created + when we previously checked for a composite string. */ + for (category = 0; category < LC_ALL; ++category) +- if (__locale_territory[category] != new_territory) ++ if (locobj->locale_territory[category] != new_territory) + { +- __locale_territory[category] = new_territory; ++ locobj->locale_territory[category] = new_territory; + changed = 1; + } + } +@@ -368,12 +366,12 @@ + else + { + /* Change the locale for just one category. */ +- territory_name (__locale_territory[category], ++ territory_name (locobj->locale_territory[category], + old_locale, sizeof (old_locale)); + +- if (__locale_territory[category] != new_territory) ++ if (locobj->locale_territory[category] != new_territory) + { +- __locale_territory[category] = new_territory; ++ locobj->locale_territory[category] = new_territory; + changed = 1; + } + } +@@ -384,7 +382,16 @@ + is changing. The GNU Java compiler is known to repeatedly call + setlocale. */ + if (changed && (category == LC_ALL || category == LC_CTYPE)) +- __build_ctype_tables (new_territory); ++ __build_ctype_tables (locobj, new_territory); + + return old_locale; + } ++ ++char * ++setlocale (int category, const char *locale) ++{ ++ ++ PTHREAD_UNSAFE ++ ++ return __setlocale_l(&__locale_global, category, locale); ++} +Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy) +@@ -11,9 +11,15 @@ + int + strcoll (const char *s1, const char *s2) + { ++ return strcoll_l (s1, s2, &__locale_global); ++} ++ ++int ++strcoll_l (const char *s1, const char *s2, locale_t l) ++{ + int regs[10]; + +- regs[0] = __locale_territory[LC_COLLATE]; ++ regs[0] = l->locale_territory[LC_COLLATE]; + regs[1] = (int)s1; + regs[2] = (int)s2; + regs[3] = 0; +@@ -21,3 +27,4 @@ + __os_swi (Territory_Collate, regs); + return regs[0]; + } ++ +Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy) +@@ -11,9 +11,15 @@ + size_t + strxfrm (char *to, const char *from, size_t size) + { ++ return strxfrm_l (to, from, size, &__locale_global); ++} ++ ++size_t ++strxfrm_l (char *to, const char *from, size_t size, locale_t l) ++{ + int regs[10]; + +- regs[0] = __locale_territory[LC_COLLATE]; ++ regs[0] = l->locale_territory[LC_COLLATE]; + regs[1] = (int)to; + regs[2] = (int)from; + regs[3] = size; +Index: gcc4/recipe/files/gcc/libunixlib/locale/territory.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/locale/territory.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/locale/territory.c (nonexistent) +@@ -1,10 +0,0 @@ +-/* __locale_territory +- * Copyright (c) 2000-2006 UnixLib Developers +- */ +- +-#include <locale.h> +- +-/* Global used for all calls to the Territory module. These variable +- contain the territory number as set by setlocale. A value of +- -1 means use the C locale. */ +-int __locale_territory[LC_ALL + 1]; +Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (working copy) +@@ -4,6 +4,7 @@ + #include <string.h> + #include <strings.h> + #include <ctype.h> ++#include <locale.h> + + int + stricmp (const char *s1, const char *s2) +@@ -26,3 +27,24 @@ + return result; + } + strong_alias (stricmp, strcasecmp) ++ ++int ++strcasecmp_l (const char *s1, const char *s2, locale_t locobj) ++{ ++ const unsigned char *p1 = (const unsigned char *) s1; ++ const unsigned char *p2 = (const unsigned char *) s2; ++ int result = 0; ++ ++ if (p1 == p2) ++ return result; ++ ++ while (! result) ++ { ++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj); ++ if (*p1++ == '\0') ++ break; ++ p2 ++; ++ } ++ ++ return result; ++} +Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (working copy) +@@ -5,6 +5,7 @@ + #include <string.h> + #include <strings.h> + #include <ctype.h> ++#include <locale.h> + + int + strnicmp (const char *s1, const char *s2, size_t n) +@@ -26,3 +27,22 @@ + } + strong_alias (strnicmp, strncasecmp) + ++int ++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj) ++{ ++ int i, j; ++ ++ if (!n) ++ return 0; ++ ++ do ++ { ++ i = *s1++, j = *s2++; ++ i = tolower_l (i, locobj); ++ j = tolower_l (j, locobj); ++ } ++ while (i && i == j && --n); ++ ++ return i - j; ++} ++ +Index: gcc4/recipe/files/gcc/libunixlib/sys/errlist.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/sys/errlist.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/sys/errlist.c (working copy) +@@ -211,3 +211,10 @@ + + return 0; + } ++ ++char * ++strerror_l (int errnum, locale_t l) ++{ ++ (void) l; ++ return strerror (errnum); ++} +Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/broken.c (working copy) +@@ -49,7 +49,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, ordinals); + } +Index: gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (working copy) +@@ -46,7 +46,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, ordinals)) != NULL) + { +Index: gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (working copy) +@@ -28,7 +28,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, ordinals)) != NULL) + { +Index: gcc4/recipe/files/gcc/libunixlib/time/mktime.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/mktime.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/mktime.c (working copy) +@@ -23,7 +23,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, + ordinals)) != NULL) +Index: gcc4/recipe/files/gcc/libunixlib/time/stdtime.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (working copy) +@@ -48,7 +48,7 @@ + #ifdef __TARGET_SCL__ + -1, + #else +- __locale_territory[LC_TIME], ++ __locale_global.locale_territory[LC_TIME], + #endif + riscos_time, + result, +Index: gcc4/recipe/files/gcc/libunixlib/time/strftime.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/strftime.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/strftime.c (working copy) +@@ -353,7 +353,7 @@ + int regs[10]; + char buffer[64]; + +- regs[0] = __locale_territory[LC_TIME]; ++ regs[0] = __locale_global.locale_territory[LC_TIME]; + regs[1] = (int)timep; + regs[2] = (int)buffer; + regs[3] = sizeof (buffer) - 1; +@@ -368,7 +368,7 @@ + int regs[10]; + char buffer[64]; + +- regs[0] = __locale_territory[LC_TIME]; ++ regs[0] = __locale_global.locale_territory[LC_TIME]; + regs[1] = (int)timep; + regs[2] = (int)buffer; + regs[3] = sizeof (buffer) - 1; +Index: gcc4/recipe/files/gcc/libunixlib/time/tzset.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/time/tzset.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/time/tzset.c (working copy) +@@ -36,7 +36,7 @@ + /* Get timezone information for current territory. */ + _kernel_swi_regs regs; + #ifndef __TARGET_SCL__ +- regs.r[0] = __locale_territory[LC_TIME]; ++ regs.r[0] = __locale_global.locale_territory[LC_TIME]; + #else + regs.r[0] = -1; /* Current territory. */ + #endif +Index: gcc4/recipe/files/gcc/libunixlib/unix/unix.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/unix/unix.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/unix/unix.c (working copy) +@@ -191,7 +191,7 @@ + __pthread_prog_init (); + __unixlib_signal_initialise (__u); + /* Initialise ctype tables to the C locale. */ +- __build_ctype_tables (-2); ++ __build_ctype_tables (&__locale_global, -2); + /* Define and initialise the Unix I/O. */ + initialise_unix_io (); + __stdioinit (); +Index: gcc4/recipe/files/gcc/libunixlib/vscript +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/vscript (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/vscript (working copy) +@@ -58,6 +58,9 @@ + __init_des_r; + __init_des; + __invalidate; ++ __locale_global; ++ __localeconv_lconv_init; ++ __localeconv_lconv_fini; + malloc_trim; + malloc_trim_unlocked; + malloc_unlocked; +@@ -80,6 +83,7 @@ + __res_vinit; + __runtime_features; + __setup_signalhandler_stack; ++ __setlocale_l; + __sdirinit; + __sfixinit; + __sfixfind; +Index: gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c (working copy) +@@ -4,6 +4,7 @@ + */ + + #include <ctype.h> ++#include <locale.h> + #include <wctype.h> + + int +@@ -71,3 +72,69 @@ + { + return isxdigit (wc); + } ++ ++int ++iswalnum_l (wint_t wc, locale_t locale) ++{ ++ return isalnum_l (wc, locale); ++} ++ ++int ++iswalpha_l (wint_t wc, locale_t locale) ++{ ++ return isalpha_l (wc, locale); ++} ++ ++int ++iswcntrl_l (wint_t wc, locale_t locale) ++{ ++ return iscntrl_l (wc, locale); ++} ++ ++int ++iswdigit_l (wint_t wc, locale_t locale) ++{ ++ return isdigit_l (wc, locale); ++} ++ ++int ++iswgraph_l (wint_t wc, locale_t locale) ++{ ++ return isgraph_l (wc, locale); ++} ++ ++int ++iswprint_l (wint_t wc, locale_t locale) ++{ ++ return isprint_l (wc, locale); ++} ++ ++int ++iswpunct_l (wint_t wc, locale_t locale) ++{ ++ return ispunct_l (wc, locale); ++} ++ ++int ++iswspace_l (wint_t wc, locale_t locale) ++{ ++ return isspace_l (wc, locale); ++} ++ ++int ++iswxdigit_l (wint_t wc, locale_t locale) ++{ ++ return isxdigit_l (wc, locale); ++} ++ ++wint_t ++towlower_l (wint_t wc, locale_t locale) ++{ ++ return tolower_l (wc, locale); ++} ++ ++wint_t ++towupper_l (wint_t wc, locale_t locale) ++{ ++ return toupper_l (wc, locale); ++} +Index: gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c +=================================================================== +--- gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c (revision 7698) ++++ gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c (working copy) +@@ -1,7 +1,7 @@ ++#include <locale.h> ++#include <stdio.h> + #include <stdlib.h> + #include <wctype.h> +-#include <wctype.h> +-#include <stdio.h> + + int iswupper (wint_t __wc) + { +@@ -9,13 +9,26 @@ + abort(); + } + +-unsigned long int wcstoul (__const wchar_t *__restrict __nptr, +- wchar_t **__restrict __endptr, int __base) ++int ++iswupper_l (wint_t wc, locale_t locale) + { + printf("%s: Not implemented\n", __func__); + abort(); + } + ++int iswlower (wint_t __wc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int ++iswlower_l (wint_t wc, locale_t locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) + { + printf("%s: Not implemented\n", __func__); +@@ -22,12 +35,47 @@ + abort(); + } + +-int iswlower (wint_t __wc) ++int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, ++ locale_t loc) + { + printf("%s: Not implemented\n", __func__); + abort(); + } + ++int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, ++ size_t __n) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, ++ locale_t __loc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, ++ size_t __n, locale_t __loc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ ++unsigned long int wcstoul (__const wchar_t *__restrict __nptr, ++ wchar_t **__restrict __endptr, int __base) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + long long int wcstoll (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + { +@@ -63,6 +111,13 @@ + abort(); + } + ++size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, ++ size_t __n, locale_t __loc) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + float wcstof (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) + { +@@ -83,6 +138,13 @@ + abort(); + } + ++int ++iswblank_l (wint_t __wc, locale_t __locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + int iswctype (wint_t __wc, wctype_t __desc) + { + printf("%s: Not implemented\n", __func__); +@@ -89,6 +151,12 @@ + abort(); + } + ++int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) +@@ -116,6 +184,12 @@ + abort(); + } + ++wctype_t wctype_l (__const char *__property, locale_t __locale) ++{ ++ printf("%s: Not implemented\n", __func__); ++ abort(); ++} ++ + wint_t ungetwc(wint_t wc, FILE *stream) + { + printf("%s: Not implemented\n", __func__); diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p index 7eb77c3..128e9eb 100644 --- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p +++ b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p @@ -19,9 +19,9 @@ -$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz: +$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz: -mkdir -p $(SRCORIGDIR) -- cd $(SRCORIGDIR) && wget -c http://www.cs.unipr.it/ppl/download/ftp/releases/$(PPL_VERSION)/ppl-$(PPL_VERSION).tar.gz +- cd $(SRCORIGDIR) && wget -c https://www.bugseng.com/external/ppl/download/ftp/releases/$(PPL_VERSION)/ppl-$(PPL_VERSION).tar.gz - touch $@ -+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VERSION).tar.xz ++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VERSION).tar.xz # Download CLooG source: $(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz: diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p deleted file mode 100644 index 7631c68..0000000 --- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p +++ /dev/null @@ -1,175 +0,0 @@ -Index: gcc4/Makefile -=================================================================== ---- gcc4/Makefile (revision 7156) -+++ gcc4/Makefile (working copy) -@@ -45,7 +45,7 @@ - MPFR_VERSION=3.0.1 - MPC_VERSION=0.8.2 - GCC_USE_PPL_CLOOG=yes --PPL_VERSION=0.11.2 -+PPL_VERSION=1.2 - CLOOG_VERSION=0.15.11 - GCC_USE_LTO=yes - -@@ -182,8 +182,8 @@ - RONATIVE_MPFR_CONFIG_ARGS := --disable-shared --with-gmp=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS) - - # Configure arguments PPL: --CROSS_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp-prefix=$(PREFIX_CROSSGCC_LIBS) --prefix=$(PREFIX_CROSSGCC_LIBS) --RONATIVE_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp-prefix=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS) -+CROSS_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp=$(PREFIX_CROSSGCC_LIBS) --prefix=$(PREFIX_CROSSGCC_LIBS) -+RONATIVE_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS) - - # Configure arguments CLooG: - CROSS_CLOOG_CONFIG_ARGS := --disable-shared --with-gmp=$(PREFIX_CROSSGCC_LIBS) --with-bits=gmp --with-ppl=$(PREFIX_CROSSGCC_LIBS) --with-host-libstdcxx='-lstdc++' --prefix=$(PREFIX_CROSSGCC_LIBS) -Index: gcc4/recipe/patches/cloog/configure.in.p -=================================================================== ---- gcc4/recipe/patches/cloog/configure.in.p (revision 7156) -+++ gcc4/recipe/patches/cloog/configure.in.p (working copy) -@@ -1,5 +1,5 @@ ----- configure.in.orig 2013-05-01 16:15:33.235945936 +0200 --+++ configure.in 2013-05-01 16:15:15.484169106 +0200 -+--- configure.in.orig 2017-04-23 11:55:00.956204411 +0100 -++++ configure.in 2017-04-23 11:50:39.385519538 +0100 - @@ -41,7 +41,7 @@ dnl ************************************ - AC_PREREQ(2.13) - AC_INIT(source/cloog.c) -@@ -9,7 +9,13 @@ - dnl Every other copy of the package version number gets its value from here. - AM_INIT_AUTOMAKE(cloog, 0.15) - AC_CONFIG_HEADER(include/cloog/cloog-config.h) --@@ -343,7 +343,7 @@ if test "x$with_ppl" != "x" -a "x$with_p -+@@ -338,12 +338,12 @@ if test "x$with_ppl" != "x" -a "x$with_p -+ -+ AC_MSG_CHECKING([for version 0.10 (or later revision) of PPL]) -+ AC_TRY_COMPILE([#include "ppl_c.h"],[ -+- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10 -++ #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 10 -+ choke me - #endif - ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ]) - -Index: gcc4/recipe/patches/gcc/configure.ac.p -=================================================================== ---- gcc4/recipe/patches/gcc/configure.ac.p (revision 7156) -+++ gcc4/recipe/patches/gcc/configure.ac.p (working copy) -@@ -1,6 +1,6 @@ - Index: configure.ac - =================================================================== ----- configure.ac (revision 197339) -+--- configure.ac (revision 247077) - +++ configure.ac (working copy) - @@ -152,6 +152,7 @@ - # Note that libiberty is not a target library. -@@ -34,6 +34,15 @@ - - if test "$enable_ppl_version_check" != no; then - saved_CFLAGS="$CFLAGS" -+@@ -1577,7 +1586,7 @@ -+ CFLAGS="$CFLAGS $pplinc $gmpinc" -+ AC_MSG_CHECKING([for version 0.11 (revision 0 or later) of PPL]) -+ AC_TRY_COMPILE([#include "ppl_c.h"],[ -+- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11 -++ #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11 -+ choke me -+ #endif -+ ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ]) - @@ -2895,6 +2904,10 @@ - ;; - esac -Index: gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p -=================================================================== ---- gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p (revision 7156) -+++ gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p (nonexistent) -@@ -1,19 +0,0 @@ ----- src/Congruence_System.defs.hh.orig 2015-03-01 19:57:52.887328139 +0100 --+++ src/Congruence_System.defs.hh 2015-03-01 19:57:12.315328259 +0100 --@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */ -- #include "Grid.types.hh" -- #include "Grid_Certificate.types.hh" -- #include <iosfwd> --+#include <cstddef> -- -- namespace Parma_Polyhedra_Library { -- --@@ -235,7 +236,7 @@ public: -- class const_iterator -- : public std::iterator<std::forward_iterator_tag, -- Congruence, --- ptrdiff_t, --+ std::ptrdiff_t, -- const Congruence*, -- const Congruence&> { -- public: -Index: gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p -=================================================================== ---- gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p (revision 7156) -+++ gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p (nonexistent) -@@ -1,19 +0,0 @@ ----- src/Constraint_System.defs.hh.orig 2015-03-01 19:58:03.831328106 +0100 --+++ src/Constraint_System.defs.hh 2015-03-01 19:57:12.315328259 +0100 --@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */ -- #include "Congruence_System.types.hh" -- #include <iterator> -- #include <iosfwd> --+#include <cstddef> -- -- namespace Parma_Polyhedra_Library { -- --@@ -204,7 +205,7 @@ public: -- class const_iterator -- : public std::iterator<std::forward_iterator_tag, -- Constraint, --- ptrdiff_t, --+ std::ptrdiff_t, -- const Constraint*, -- const Constraint&> { -- public: -Index: gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p -=================================================================== ---- gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p (revision 7156) -+++ gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p (nonexistent) -@@ -1,19 +0,0 @@ ----- src/Generator_System.defs.hh.orig 2015-03-01 19:58:13.511328077 +0100 --+++ src/Generator_System.defs.hh 2015-03-01 19:57:12.319328259 +0100 --@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */ -- #include "Polyhedron.types.hh" -- #include "Poly_Con_Relation.defs.hh" -- #include <iosfwd> --+#include <cstddef> -- -- namespace Parma_Polyhedra_Library { -- --@@ -250,7 +251,7 @@ public: -- class const_iterator -- : public std::iterator<std::forward_iterator_tag, -- Generator, --- ptrdiff_t, --+ std::ptrdiff_t, -- const Generator*, -- const Generator&> { -- public: -Index: gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p -=================================================================== ---- gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p (revision 7156) -+++ gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p (nonexistent) -@@ -1,19 +0,0 @@ ----- src/Grid_Generator_System.defs.hh.orig 2015-03-01 19:57:31.127328203 +0100 --+++ src/Grid_Generator_System.defs.hh 2015-03-01 19:57:12.315328259 +0100 --@@ -30,6 +30,7 @@ site: http://www.cs.unipr.it/ppl/ . */ -- #include "Variables_Set.types.hh" -- #include "Grid.types.hh" -- #include <iosfwd> --+#include <cstddef> -- -- namespace Parma_Polyhedra_Library { -- --@@ -267,7 +268,7 @@ public: -- class const_iterator -- : public std::iterator<std::forward_iterator_tag, -- Grid_Generator, --- ptrdiff_t, --+ std::ptrdiff_t, -- const Grid_Generator*, -- const Grid_Generator&>, -- private Generator_System::const_iterator { diff --git a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p deleted file mode 100644 index 045a0b8..0000000 --- a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p +++ /dev/null @@ -1,304 +0,0 @@ -Backport r7043 from upstream: partially replaces use of SWP with LDREX/STREX -on systems where SWP is no longer available. This fix is incomplete, -but sufficient for our purposes. - -Fri Mar 11 14:51:54 GMT 2016 Lee Noar <leenoar@sky.com> - - * sys/_cpucaps.s: New file. Provide functions to probe the - OS for details of the CPU (currently SWP, LDREX/STREX - availability). - * Makefile.am: Add above file. - * include/unixlib/local.h: Add declarations for user facing - functions provided above. - * incl-local/internal/asm_dec.s(__ul_global): Add entry to - record CPU flags. - * incl-local/internal/unix.h: Likewise. - * pthread/_ints.s(__pthread_disable_ints,__pthread_protect_unsafe): - Use CPU flags to determine whether to use the SWP instruction or - LRDEX/STREX. - * sys/_syslib.s(__main): Add call to __probe_cpu_caps. - (__unixlib_fatal): Use CPU flags to determine whether to use the - SWP instruction or LRDEX/STREX. - - -Index: gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7042) -+++ gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7043) -@@ -2,7 +2,7 @@ - @ disable_ints can be called multiple times, provided enable_ints is - @ subsequently called an equal number of times - @ Written by Martin Piper and Alex Waugh --@ Copyright (c) 2002-2008 UnixLib Developers -+@ Copyright (c) 2002-2016 UnixLib Developers - - #include "internal/asm_dec.s" - -@@ -20,15 +20,26 @@ - PICEQ "LDR a2, [a2, #0]" - PICEQ "LDR a2, [a2, #__GOTT_INDEX__]" @ a2 = GOT ptr - -- LDR a1, .L0 @=__ul_global -+ LDR a1, .L0 @ =__ul_global - PICEQ "LDR a1, [a2, a1]" -+ LDR a4, [a1, #GBL_CPU_FLAGS] - ADD a1, a1, #GBL_PTH_WORKSEMAPHORE -+ TST a4, #__CPUCAP_HAVE_SWP -+ @ From this point onwards we will not be interrupted by the callback -+ BEQ 0f -+ - MOV a3, #1 - SWP a2, a3, [a1] -- @ From this point onwards we will not be interrupted by the callback - ADD a2, a2, #1 - STR a2, [a1] - MOV pc, lr -+0: -+ LDREX a2, [a1] -+ ADD a2, a2, #1 -+ STREX a3, a2, [a1] -+ TEQ a3, #1 -+ BEQ 0b -+ MOV pc, lr - .L0: - WORD __ul_global - DECLARE_FUNCTION __pthread_disable_ints -@@ -78,18 +89,32 @@ - PICEQ "LDR a1, [a1, #0]" - PICEQ "LDR a1, [a1, #__GOTT_INDEX__]" @ a1 = GOT ptr - -- LDR a4, .L2 @=__ul_global -+ LDR a4, .L2 @ =__ul_global - PICEQ "LDR a4, [a1, a4]" -+ LDR a2, [a4, #GBL_CPU_FLAGS] - ADD a1, a4, #GBL_PTH_WORKSEMAPHORE -+ TST a2, #__CPUCAP_HAVE_SWP -+ @ From this point onwards we cannot be interrupted by the callback -+ BEQ 0f -+ - MOV a2, #1 - SWP a3, a2, [a1] -- @ From this point onwards we cannot be interrupted by the callback - CMP a3, #0 -- STRNE a3, [a1, #0] @ Restore original value -+ BEQ 1f -+ STR a3, [a1, #0] @ Restore original value - @ Return, as if ints are disabled on entry to the - @ calling function then they should not be reenabled - @ until the calling function has returned -+ MOV pc, lr -+0: -+ LDREX a3, [a1] -+ MOV ip, #1 -+ STREX a2, ip, [a1] -+ TEQ a2, #1 -+ BEQ 0b -+ TEQ a3, #0 - MOVNE pc, lr -+1: - - #if __UNIXLIB_PARANOID - LDR a3, [a4, #GBL_PTH_RETURN_ADDRESS] -Index: gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7042) -+++ gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7043) -@@ -133,6 +133,16 @@ - socket. Is -1 when socket handle is not valid. */ - extern int __get_ro_socket (int __sockfd); - -+/* Return 1 if the SWP instruction is available, otherwise 0. */ -+extern unsigned int __cpucap_have_swp (void); -+ -+/* Return 1 if the LDREX/STREX instructions are available, otherwise 0. */ -+extern unsigned int __cpucap_have_rex (void); -+ -+/* Return 1 if the LDREX/STREX instructions that operate on bytes, half-words -+ and double words are available, otherwise 0. */ -+extern unsigned int __cpucap_have_rexbhd (void); -+ - __END_DECLS - - #endif - * incl-local/internal/asm_dec.s(XSOM_DeregisterClient): Add -Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7042) -+++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7043) -@@ -1027,6 +1027,7 @@ - sys/sigsetjmp.c \ - sys/stackalloc.c \ - sys/vfork.c \ -+ sys/_cpucaps.s \ - sys/_getcpuarch.s \ - sys/_jmp.s \ - sys/_mman.s \ -Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7042) -+++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7043) -@@ -269,8 +269,10 @@ - .set GBL_FLS_LBSTM_ON_RD, 108 @ = __ul_global.fls_lbstm_on_rd - .set GBL_PTH_CALLEVERY_RMA, 112 @ = __ul_global.pthread_callevery_rma - -+.set GBL_CPU_FLAGS, 116 @ = __ul_global.cpu_flags -+ - #if !defined(__SOFTFP__) && defined(__VFP_FP__) --.set GBL_VFP_REGCOUNT, 116 @ = __ul_global.vfp_regcount -+.set GBL_VFP_REGCOUNT, 120 @ = __ul_global.vfp_regcount - #endif - - @ Entries in the __ul_memory table. Must be kept in sync with -@@ -322,3 +324,7 @@ - .set CRT1_LIB_FINI, 32 @ Ptr to function to finalise shared libraries - @ at program exit - can be NULL. - #endif -+ -+#define __CPUCAP_HAVE_SWP 0x1 -+#define __CPUCAP_HAVE_REX 0x2 -+#define __CPUCAP_HAVE_REXBHD 0x4 -Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7042) -+++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7043) -@@ -197,6 +197,8 @@ - the life of the program. This block is passed to the call_every handler in - r12. */ - -+ unsigned int cpu_flags; /* Flags indicating the capabilities of the CPU. */ -+ - #if !defined(__SOFTFP__) && defined(__VFP_FP__) - int vfp_regcount; /* Number of doubleword registers we should request for - VFP contexts */ -Index: gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 0) -+++ gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 7043) -@@ -0,0 +1,91 @@ -+@ Determine the capabilities of the CPU and allow callers to enquire -+@ what they are. -+@ Copyright (c) 2016 UnixLib Developers. -+@ Written by Lee Noar. -+ -+#include "internal/asm_dec.s" -+ -+ .text -+ -+@ Determine what the CPU capabilities are, and record them. -+@ Called early on during program initialisation in _syslib.s. -+ .global __probe_cpu_caps -+ NAME __probe_cpu_caps -+__probe_cpu_caps: -+ MOV r0, #0 -+ SWI XOS_PlatformFeatures -+ MOVVS r0, #0 -+ -+ MOV r2, #0 -+ @ The OS flag is set to 1 to indicate _no_ SWP instruction available (for -+ @ backwards compatibility). We reverse it here and set our flag to 1 to -+ @ indicate that SWP _is_ available. -+ TST r0, #1<<11 @ SWP{B} not available -+ ORREQ r2, r2, #__CPUCAP_HAVE_SWP -+ TST r0, #1<<12 @ LDREX/STREX available -+ ORRNE r2, r2, #__CPUCAP_HAVE_REX -+ TST r0, #1<<13 @ LDREX/STREX{B/H/D} available -+ ORRNE r2, r2, #__CPUCAP_HAVE_REXBHD -+ -+ PICEQ "LDR r0, =__GOTT_BASE__" -+ PICEQ "LDR r0, [r0, #0]" -+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr -+ LDR r1, .L0 @ =__ul_global -+ PICEQ "LDR r1, [r0, r1]" -+ STR r2, [r1, #GBL_CPU_FLAGS] -+ -+ MOV pc, lr -+.L0: -+ WORD __ul_global -+ DECLARE_FUNCTION __probe_cpu_caps -+ -+ .global __cpucap_have_swp -+ NAME __cpucap_have_swp -+__cpucap_have_swp: -+ PICEQ "LDR r0, =__GOTT_BASE__" -+ PICEQ "LDR r0, [r0, #0]" -+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr -+ LDR r1, .L0 @ =__ul_global -+ PICEQ "LDR r1, [r0, r1]" -+ LDR r0, [r1, #GBL_CPU_FLAGS] -+ TST r0, #__CPUCAP_HAVE_SWP -+ MOVEQ r0, #0 -+ MOVNE r0, #1 -+ -+ MOV pc, lr -+ DECLARE_FUNCTION __cpucap_have_swp -+ -+@ Return 1 if LDREX/STREX instructions are available on the CPU, otherwise 0. -+ .global __cpucap_have_rex -+ NAME __cpucap_have_rex -+__cpucap_have_rex: -+ PICEQ "LDR r0, =__GOTT_BASE__" -+ PICEQ "LDR r0, [r0, #0]" -+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr -+ LDR r1, .L0 @ =__ul_global -+ PICEQ "LDR r1, [r0, r1]" -+ LDR r0, [r1, #GBL_CPU_FLAGS] -+ TST r0, #__CPUCAP_HAVE_REX -+ MOVEQ r0, #0 -+ MOVNE r0, #1 -+ -+ MOV pc, lr -+ DECLARE_FUNCTION __cpucap_have_rex -+ -+@ Return 1 if LDREX/STREX instructions that work on non-32 bit data sizes -+@ are available on the CPU, otherwise 0. -+ .global __cpucap_have_rexbhd -+ NAME __cpucap_have_rexbhd -+__cpucap_have_rexbhd: -+ PICEQ "LDR r0, =__GOTT_BASE__" -+ PICEQ "LDR r0, [r0, #0]" -+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr -+ LDR r1, .L0 @ =__ul_global -+ PICEQ "LDR r1, [r0, r1]" -+ LDR r0, [r1, #GBL_CPU_FLAGS] -+ TST r0, #__CPUCAP_HAVE_REXBHD -+ MOVEQ r0, #0 -+ MOVNE r0, #1 -+ -+ MOV pc, lr -+ DECLARE_FUNCTION __cpucap_have_rexbhd -Index: gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s -=================================================================== ---- gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7042) -+++ gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7043) -@@ -255,6 +255,8 @@ - BCC __exit_with_error_num - unknown_cpu_arch: - -+ BL __probe_cpu_caps -+ - @ Use of DAs explicitly overridden if __dynamic_no_da is declared - MOV lr, #-1 - STR lr, [ip, #GBL_DYNAMIC_NUM] -@@ -1286,9 +1288,21 @@ - @ error handling. As last resort to avoid an infinite loop - @ we go for a straight OS_Exit scenario. Anything better we - @ can do ? -+ ADD a3, a4, #GBL_PANIC_MODE -+ LDR a2, [a4, #GBL_CPU_FLAGS] -+ TST a2, #__CPUCAP_HAVE_SWP -+ BEQ 0f -+ - MOV a2, #1 -- ADD a3, a4, #GBL_PANIC_MODE - SWP a2, a2, [a3] -+ B 1f -+0: -+ LDREX a2, [a3] -+ MOV ip, #1 -+ STREX lr, ip, [a3] -+ TEQ lr, #1 -+ BEQ 0b -+1: - TEQ a2, #0 - BEQ __unixlib_fatal_cont1 - diff --git a/i686-w64-mingw32/Makefile b/i686-w64-mingw32/Makefile index 484c476..5d35249 100644 --- a/i686-w64-mingw32/Makefile +++ b/i686-w64-mingw32/Makefile @@ -1,29 +1,28 @@ -#!/usr/bin/make +#!/bin/make # Build cross toolchain for i686 processor with a win32 (mingw) ABI -UPSTREAM_GCC_VERSION := 4.8.4 -UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.bz2 +UPSTREAM_GCC_VERSION := 12.2.0 +UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.xz UPSTREAM_GCC_URI := http://ftpmirror.gnu.org/gcc/gcc-$(UPSTREAM_GCC_VERSION)/$(UPSTREAM_GCC_TARBALL) -UPSTREAM_BINUTILS_VERSION := 2.25 +UPSTREAM_BINUTILS_VERSION := 2.39 UPSTREAM_BINUTILS_TARBALL := binutils-$(UPSTREAM_BINUTILS_VERSION).tar.bz2 UPSTREAM_BINUTILS_URI := http://ftpmirror.gnu.org/binutils/$(UPSTREAM_BINUTILS_TARBALL) -UPSTREAM_GMP_VERSION := 5.0.5 +UPSTREAM_GMP_VERSION := 6.2.1 UPSTREAM_GMP_TARBALL := gmp-$(UPSTREAM_GMP_VERSION).tar.bz2 -UPSTREAM_GMP_URI := https://gmplib.org/download/gmp-$(UPSTREAM_GMP_VERSION)/$(UPSTREAM_GMP_TARBALL) +UPSTREAM_GMP_URI := http://ftp.gnu.org/gnu/gmp/$(UPSTREAM_GMP_TARBALL) -# Would use 3.0.0, but that dislikes in-tree gmp sources -UPSTREAM_MPFR_VERSION := 2.4.2 -UPSTREAM_MPFR_TARBALL := mpfr-$(UPSTREAM_MPFR_VERSION).tar.bz2 +UPSTREAM_MPFR_VERSION := 4.2.0 +UPSTREAM_MPFR_TARBALL := mpfr-$(UPSTREAM_MPFR_VERSION).tar.xz UPSTREAM_MPFR_URI := http://www.mpfr.org/mpfr-$(UPSTREAM_MPFR_VERSION)/$(UPSTREAM_MPFR_TARBALL) -UPSTREAM_MPC_VERSION := 0.8.2 +UPSTREAM_MPC_VERSION := 1.3.0 UPSTREAM_MPC_TARBALL := mpc-$(UPSTREAM_MPC_VERSION).tar.gz UPSTREAM_MPC_URI := http://www.multiprecision.org/downloads/$(UPSTREAM_MPC_TARBALL) -UPSTREAM_MINGW_VERSION := 3.3.0 +UPSTREAM_MINGW_VERSION := 10.0.0 UPSTREAM_MINGW_TARBALL := mingw-w64-v$(UPSTREAM_MINGW_VERSION).tar.bz2 UPSTREAM_MINGW_URI := "http://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/$(UPSTREAM_MINGW_TARBALL)?r=http%3A%2F%2Fmingw-w64.sourceforge.net%2Fdownload.php&ts=1426088797&use_mirror=cznic" @@ -62,7 +61,7 @@ $(BUILDSTEPS)/gcc-core.d: $(BUILDSTEPS)/srcdir-step3.d $(BUILDSTEPS)/binutils.d --prefix=$(PREFIX) --target=$(TARGET_NAME) \ --enable-languages=c,c++ --with-system-zlib --disable-multilib \ --enable-shared --enable-fully-dynamic-string - cd $(BUILDDIR)/gcc && PATH="$(PREFIX)/bin:$(PATH)" make all-gcc + cd $(BUILDDIR)/gcc && PATH="$(PREFIX)/bin:$(PATH)" make all-gcc -j 8 cd $(BUILDDIR)/gcc && PATH="$(PREFIX)/bin:$(PATH)" make install-gcc touch $@ @@ -104,7 +103,6 @@ $(BUILDSTEPS)/mingw-srcdir.d: $(SOURCESDIR)/$(UPSTREAM_MINGW_TARBALL) ### $(BUILDSTEPS)/srcdir-step3.d: $(BUILDSTEPS)/srcdir-step2.d - for p in `ls $(RECIPES)/patches/gcc4/*.p` ; do patch -d $(GCC_SRCDIR) -p0 <$$p ; done touch $@ $(BUILDSTEPS)/srcdir-step2.d: $(BUILDSTEPS)/srcdir-step1.d $(SOURCESDIR)/$(UPSTREAM_GMP_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPFR_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPC_TARBALL) @@ -144,28 +142,22 @@ $(BUILDSTEPS)/binutils-srcdir.d: $(SOURCESDIR)/$(UPSTREAM_BINUTILS_TARBALL) ### $(SOURCESDIR)/$(UPSTREAM_GCC_TARBALL): - wget -q -O $@ $(UPSTREAM_GCC_URI) - touch $@ + wget -q -O $@ $(UPSTREAM_GCC_URI) $(SOURCESDIR)/$(UPSTREAM_GMP_TARBALL): wget -q -O $@ $(UPSTREAM_GMP_URI) - touch $@ $(SOURCESDIR)/$(UPSTREAM_MPFR_TARBALL): wget -q -O $@ $(UPSTREAM_MPFR_URI) - touch $@ $(SOURCESDIR)/$(UPSTREAM_MPC_TARBALL): wget -q -O $@ $(UPSTREAM_MPC_URI) - touch $@ $(SOURCESDIR)/$(UPSTREAM_BINUTILS_TARBALL): wget -q -O $@ $(UPSTREAM_BINUTILS_URI) - touch $@ $(SOURCESDIR)/$(UPSTREAM_MINGW_TARBALL): wget -q -O $@ $(UPSTREAM_MINGW_URI) - touch $@ ### # Rule to create buildsteps dir @@ -176,7 +168,7 @@ $(BUILDSTEPS)/buildsteps.d: $(SOURCESDIR) $(SRCDIR) touch $@ $(SOURCESDIR): - mkdir -p $@ + mkdir -p $(SOURCESDIR) $(SRCDIR): - mkdir -p $@ + mkdir -p $(SRCDIR) diff --git a/m5475-atari-mint/Makefile b/m5475-atari-mint/Makefile index a59c304..6ed3b4c 100644 --- a/m5475-atari-mint/Makefile +++ b/m5475-atari-mint/Makefile @@ -5,7 +5,7 @@ UPSTREAM_GCC_VERSION := 4.6.4 UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.bz2 UPSTREAM_GCC_URI := http://ftp.gnu.org/gnu/gcc/gcc-$(UPSTREAM_GCC_VERSION)/$(UPSTREAM_GCC_TARBALL) -UPSTREAM_GCC_PATCH := gcc-4.6.4-mint-20130415.patch.bz2 +UPSTREAM_GCC_PATCH := gcc-4.6.4-mint-20200504.patch.bz2 UPSTREAM_GCC_PATCH_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_GCC_PATCH) UPSTREAM_BINUTILS_VERSION := 2.30 @@ -27,21 +27,21 @@ UPSTREAM_MPC_VERSION := 0.8.2 UPSTREAM_MPC_TARBALL := mpc-$(UPSTREAM_MPC_VERSION).tar.gz UPSTREAM_MPC_URI := http://www.multiprecision.org/mpc/download/$(UPSTREAM_MPC_TARBALL) -UPSTREAM_MINTBIN_VERSION := CVS-20110527 +UPSTREAM_MINTBIN_VERSION := Git-20201129 UPSTREAM_MINTBIN_TARBALL := mintbin-$(UPSTREAM_MINTBIN_VERSION).tar.gz UPSTREAM_MINTBIN_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_MINTBIN_TARBALL) -UPSTREAM_MINTLIB_VERSION := Git-20170304 +UPSTREAM_MINTLIB_VERSION := Git-20220821 UPSTREAM_MINTLIB_TARBALL := mintlib-$(UPSTREAM_MINTLIB_VERSION).tar.gz UPSTREAM_MINTLIB_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_MINTLIB_TARBALL) UPSTREAM_PML_VERSION := 2.03 UPSTREAM_PML_TARBALL := pml-$(UPSTREAM_PML_VERSION).tar.bz2 UPSTREAM_PML_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_PML_TARBALL) -UPSTREAM_PML_PATCH := pml-2.03-mint-20110207.patch.bz2 +UPSTREAM_PML_PATCH := pml-2.03-mint-20191013.patch.bz2 UPSTREAM_PML_PATCH_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_PML_PATCH) -UPSTREAM_GEMLIB_VERSION := CVS-20130415 +UPSTREAM_GEMLIB_VERSION := Git-20230112 UPSTREAM_GEMLIB_TARBALL := gemlib-$(UPSTREAM_GEMLIB_VERSION).tar.bz2 UPSTREAM_GEMLIB_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_GEMLIB_TARBALL) @@ -86,8 +86,8 @@ $(BUILDSTEPS)/gemlib.d: $(BUILDSTEPS)/stage2.d $(SOURCESDIR)/$(UPSTREAM_GEMLIB_T tar xjf $(SOURCESDIR)/$(UPSTREAM_GEMLIB_TARBALL) mv gemlib-$(UPSTREAM_GEMLIB_VERSION) $(BUILDDIR)/gemlib for p in `ls $(RECIPES)/patches/gemlib/*.p` ; do patch -d $(BUILDDIR)/gemlib -p0 <$$p ; done - cd $(BUILDDIR)/gemlib/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make - cd $(BUILDDIR)/gemlib/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make install + cd $(BUILDDIR)/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make + cd $(BUILDDIR)/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make install touch $@ ### @@ -191,9 +191,6 @@ $(BUILDSTEPS)/mintbin.d: $(BUILDSTEPS)/mintbin-srcdir.d cd $(BUILDDIR)/mintbin && $(MINTBIN_SRCDIR)/configure --prefix=$(PREFIX) --target=$(TARGET_NAME) --disable-nls cd $(BUILDDIR)/mintbin && make cd $(BUILDDIR)/mintbin && make install - #mv $(PREFIX)/{$(TARGET_NAME)/bin/$(TARGET_NAME)-* $(PREFIX)/bin/ - #HACK: mintbin install traget looks broken - mv $(PREFIX)/*-atari-mint/bin/$(TARGET_NAME)-* $(PREFIX)/bin/ touch $@ $(BUILDSTEPS)/mintbin-srcdir.d: $(SOURCESDIR)/$(UPSTREAM_MINTBIN_TARBALL) diff --git a/m5475-atari-mint/fetchsrc b/m5475-atari-mint/fetchsrc index bbe8f6b..9396a4e 100755 --- a/m5475-atari-mint/fetchsrc +++ b/m5475-atari-mint/fetchsrc @@ -4,7 +4,7 @@ # Usage fetchsrc <target> <source> <upstream> <output> -NSSRV="http://ci.netsurf-browser.org/toolchain/" +NSSRV="https://ci.netsurf-browser.org/toolchain/" wget -q -O ${4} ${NSSRV}/${1}/${2} if [ $? -ne 0 ];then diff --git a/m5475-atari-mint/recipes/patches/gemlib/CONFIGVARS.p b/m5475-atari-mint/recipes/patches/gemlib/CONFIGVARS.p index 5692a21..f65dc89 100644 --- a/m5475-atari-mint/recipes/patches/gemlib/CONFIGVARS.p +++ b/m5475-atari-mint/recipes/patches/gemlib/CONFIGVARS.p @@ -1,29 +1,28 @@ ---- CONFIGVARS.orig 2012-10-11 17:55:52.000000000 +0100 -+++ CONFIGVARS 2012-10-11 17:56:37.000000000 +0100 -@@ -1,8 +1,8 @@ - # - # +--- CONFIGVARS 2011-05-13 23:38:45.000000000 +0100 ++++ CONFIGVARS 2011-05-13 23:40:11.000000000 +0100 +@@ -3,6 +3,7 @@ # cross compiling --#CROSS = yes --CROSS = no + #CROSS = yes + #CROSS = no +CROSS = yes -+#CROSS = no - # - # build alternate libraries for processor variants -@@ -15,13 +15,13 @@ # + # cross compiling +@@ -33,7 +34,7 @@ + CROSS := yes + else ifeq ($(CROSS),yes) - --CROSSPREFIX=m68k-atari-mint- -+CROSSPREFIX=m5475-atari-mint- - - NATIVECC = gcc +- CROSS_TOOL=m68k-atari-mint ++ CROSS_TOOL=m5475-atari-mint + CROSSPREFIX=$(CROSS_TOOL)- + else + CROSSPREFIX= +@@ -46,7 +47,7 @@ NATIVECFLAGS = -O CRLF = echo crlf -s --PREFIX=/usr/m68k-atari-mint +-PREFIX=$(shell $(CROSSPREFIX)gcc -print-sysroot)/usr +PREFIX=/opt/netsurf/m5475-atari-mint/cross/m5475-atari-mint - - else - + ifeq ($(PREFIX),) + PREFIX=/usr/$(CROSS_TOOL) + endif diff --git a/m5475-atari-mint/recipes/patches/mintlib/configvars.p b/m5475-atari-mint/recipes/patches/mintlib/configvars.p index f72d6f4..803272a 100644 --- a/m5475-atari-mint/recipes/patches/mintlib/configvars.p +++ b/m5475-atari-mint/recipes/patches/mintlib/configvars.p @@ -1,6 +1,6 @@ --- ./configvars.orig 2012-05-03 19:26:10.000000000 +0200 -+++ ./configvars 2012-11-05 23:03:52.000000000 +0100 -@@ -12,14 +12,14 @@ ++++ ./configvars 2012-11-05 22:34:07.000000000 +0100 +@@ -12,7 +12,7 @@ # get installed. You have to take car yourself that the libraries # and include files and so on will get installed in the right place # The easiest way to do this is to change "prefix", see below. @@ -9,29 +9,30 @@ # Silent build or verbose AM_DEFAULT_VERBOSITY = 1 - - # Define this to "m68k-atari-mint-" if you cross compile. +@@ -35,7 +35,7 @@ + CROSS := yes + else ifeq ($(CROSS),yes) -- toolprefix=m68k-atari-mint- -+ toolprefix=m5475-atari-mint- +- CROSS_TOOL=m68k-atari-mint ++ CROSS_TOOL=m5475-atari-mint + toolprefix=$(CROSS_TOOL)- else toolprefix= - endif -@@ -47,7 +47,7 @@ +@@ -64,7 +64,7 @@ + # This variable is used for various others. Change its value if # need be. When cross-compiling you will usually want to set this # to "/usr/m68k-atari-mint". - ifeq ($(CROSS),yes) -- prefix=/usr/m68k-atari-mint -+ prefix=/opt/netsurf/m5475-atari-mint/cross/m5475-atari-mint - else - prefix=/usr - endif -@@ -124,7 +124,7 @@ - CFLAGS=-O2 -fomit-frame-pointer +-prefix=/usr ++prefix=/opt/netsurf/m5475-atari-mint/cross/m5475-atari-mint + + # This is where include files get installed. + includedir=${prefix}/include +@@ -141,7 +141,7 @@ + LDFLAGS= # Additional defines. -DEFS= +DEFS=-DREGEX_MALLOC # Define this to the warning level you want. - WARN=-Wall + WARN=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wold-style-declaration -Wold-style-definition diff --git a/m5475-atari-mint/recipes/patches/mintlib/posix_regex.p b/m5475-atari-mint/recipes/patches/mintlib/posix_regex.p new file mode 100644 index 0000000..6a42a40 --- /dev/null +++ b/m5475-atari-mint/recipes/patches/mintlib/posix_regex.p @@ -0,0 +1,11 @@ +--- ./posix/regex.c.orig 2012-05-03 19:26:10.000000000 +0200 ++++ ./posix/regex.c 2012-11-05 22:34:07.000000000 +0100 +@@ -1364,6 +1364,7 @@ + \ + DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ + DEBUG_PUSH (failure_id); \ ++ (void) destination; \ + } while (0) + + /* This is the number of items that are pushed and popped on the stack + diff --git a/m68k-atari-mint/Makefile b/m68k-atari-mint/Makefile index 053a6ad..f05fb8e 100644 --- a/m68k-atari-mint/Makefile +++ b/m68k-atari-mint/Makefile @@ -5,7 +5,7 @@ UPSTREAM_GCC_VERSION := 4.6.4 UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.bz2 UPSTREAM_GCC_URI := http://ftp.gnu.org/gnu/gcc/gcc-$(UPSTREAM_GCC_VERSION)/$(UPSTREAM_GCC_TARBALL) -UPSTREAM_GCC_PATCH := gcc-4.6.4-mint-20130415.patch.bz2 +UPSTREAM_GCC_PATCH := gcc-4.6.4-mint-20200504.patch.bz2 UPSTREAM_GCC_PATCH_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_GCC_PATCH) UPSTREAM_BINUTILS_VERSION := 2.30 @@ -27,21 +27,21 @@ UPSTREAM_MPC_VERSION := 0.8.2 UPSTREAM_MPC_TARBALL := mpc-$(UPSTREAM_MPC_VERSION).tar.gz UPSTREAM_MPC_URI := http://www.multiprecision.org/mpc/download/$(UPSTREAM_MPC_TARBALL) -UPSTREAM_MINTBIN_VERSION := CVS-20110527 +UPSTREAM_MINTBIN_VERSION := Git-20201129 UPSTREAM_MINTBIN_TARBALL := mintbin-$(UPSTREAM_MINTBIN_VERSION).tar.gz UPSTREAM_MINTBIN_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_MINTBIN_TARBALL) -UPSTREAM_MINTLIB_VERSION := Git-20170304 +UPSTREAM_MINTLIB_VERSION := Git-20220821 UPSTREAM_MINTLIB_TARBALL := mintlib-$(UPSTREAM_MINTLIB_VERSION).tar.gz UPSTREAM_MINTLIB_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_MINTLIB_TARBALL) UPSTREAM_PML_VERSION := 2.03 UPSTREAM_PML_TARBALL := pml-$(UPSTREAM_PML_VERSION).tar.bz2 UPSTREAM_PML_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_PML_TARBALL) -UPSTREAM_PML_PATCH := pml-2.03-mint-20110207.patch.bz2 +UPSTREAM_PML_PATCH := pml-2.03-mint-20191013.patch.bz2 UPSTREAM_PML_PATCH_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_PML_PATCH) -UPSTREAM_GEMLIB_VERSION := CVS-20130415 +UPSTREAM_GEMLIB_VERSION := Git-20230112 UPSTREAM_GEMLIB_TARBALL := gemlib-$(UPSTREAM_GEMLIB_VERSION).tar.bz2 UPSTREAM_GEMLIB_URI := http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/$(UPSTREAM_GEMLIB_TARBALL) @@ -86,8 +86,8 @@ $(BUILDSTEPS)/gemlib.d: $(BUILDSTEPS)/stage2.d $(SOURCESDIR)/$(UPSTREAM_GEMLIB_T tar xjf $(SOURCESDIR)/$(UPSTREAM_GEMLIB_TARBALL) mv gemlib-$(UPSTREAM_GEMLIB_VERSION) $(BUILDDIR)/gemlib for p in `ls $(RECIPES)/patches/gemlib/*.p` ; do patch -d $(BUILDDIR)/gemlib -p0 <$$p ; done - cd $(BUILDDIR)/gemlib/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make - cd $(BUILDDIR)/gemlib/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make install + cd $(BUILDDIR)/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make + cd $(BUILDDIR)/gemlib && PATH="$(PREFIX)/bin:$(PATH)" make install touch $@ ### @@ -190,7 +190,6 @@ $(BUILDSTEPS)/mintbin.d: $(BUILDSTEPS)/mintbin-srcdir.d cd $(BUILDDIR)/mintbin && $(MINTBIN_SRCDIR)/configure --prefix=$(PREFIX) --target=$(TARGET_NAME) --disable-nls cd $(BUILDDIR)/mintbin && make cd $(BUILDDIR)/mintbin && make install - mv $(PREFIX)/$(TARGET_NAME)/bin/$(TARGET_NAME)-* $(PREFIX)/bin/ touch $@ $(BUILDSTEPS)/mintbin-srcdir.d: $(SOURCESDIR)/$(UPSTREAM_MINTBIN_TARBALL) diff --git a/m68k-atari-mint/fetchsrc b/m68k-atari-mint/fetchsrc index e71d85f..92ae5bf 100755 --- a/m68k-atari-mint/fetchsrc +++ b/m68k-atari-mint/fetchsrc @@ -4,7 +4,7 @@ # Usage fetchsrc <target> <source> <upstream> <output> -NSSRV="http://ci.netsurf-browser.org/toolchain/" +NSSRV="https://ci.netsurf-browser.org/toolchain/" wget -q -O ${4} ${NSSRV}/${1}/${2} if [ $? -ne 0 ];then diff --git a/m68k-atari-mint/recipes/patches/gemlib/CONFIGVARS.p b/m68k-atari-mint/recipes/patches/gemlib/CONFIGVARS.p index 6f774db..c865542 100644 --- a/m68k-atari-mint/recipes/patches/gemlib/CONFIGVARS.p +++ b/m68k-atari-mint/recipes/patches/gemlib/CONFIGVARS.p @@ -1,20 +1,19 @@ --- CONFIGVARS 2011-05-13 23:38:45.000000000 +0100 +++ CONFIGVARS 2011-05-13 23:40:11.000000000 +0100 -@@ -2,7 +2,7 @@ - # +@@ -3,6 +3,7 @@ # cross compiling #CROSS = yes --CROSS = no + #CROSS = no +CROSS = yes - # - # build alternate libraries for processor variants -@@ -21,7 +21,7 @@ + # + # cross compiling +@@ -46,7 +47,7 @@ NATIVECFLAGS = -O CRLF = echo crlf -s --PREFIX=/usr/m68k-atari-mint +-PREFIX=$(shell $(CROSSPREFIX)gcc -print-sysroot)/usr +PREFIX=/opt/netsurf/m68k-atari-mint/cross/m68k-atari-mint - - else - + ifeq ($(PREFIX),) + PREFIX=/usr/$(CROSS_TOOL) + endif diff --git a/m68k-atari-mint/recipes/patches/mintlib/configvars.p b/m68k-atari-mint/recipes/patches/mintlib/configvars.p index 1df9fae..a3acd90 100644 --- a/m68k-atari-mint/recipes/patches/mintlib/configvars.p +++ b/m68k-atari-mint/recipes/patches/mintlib/configvars.p @@ -9,21 +9,21 @@ # Silent build or verbose AM_DEFAULT_VERBOSITY = 1 -@@ -47,7 +47,7 @@ +@@ -64,7 +64,7 @@ + # This variable is used for various others. Change its value if # need be. When cross-compiling you will usually want to set this # to "/usr/m68k-atari-mint". - ifeq ($(CROSS),yes) -- prefix=/usr/m68k-atari-mint -+ prefix=/opt/netsurf/m68k-atari-mint/cross/m68k-atari-mint - else - prefix=/usr - endif -@@ -124,7 +124,7 @@ - CFLAGS=-O2 -fomit-frame-pointer +-prefix=/usr ++prefix=/opt/netsurf/m68k-atari-mint/cross/m68k-atari-mint + + # This is where include files get installed. + includedir=${prefix}/include +@@ -141,7 +141,7 @@ + LDFLAGS= # Additional defines. -DEFS= +DEFS=-DREGEX_MALLOC # Define this to the warning level you want. - WARN=-Wall + WARN=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wold-style-declaration -Wold-style-definition diff --git a/m68k-atari-mint/recipes/patches/mintlib/posix_regex.p b/m68k-atari-mint/recipes/patches/mintlib/posix_regex.p new file mode 100644 index 0000000..6a42a40 --- /dev/null +++ b/m68k-atari-mint/recipes/patches/mintlib/posix_regex.p @@ -0,0 +1,11 @@ +--- ./posix/regex.c.orig 2012-05-03 19:26:10.000000000 +0200 ++++ ./posix/regex.c 2012-11-05 22:34:07.000000000 +0100 +@@ -1364,6 +1364,7 @@ + \ + DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ + DEBUG_PUSH (failure_id); \ ++ (void) destination; \ + } while (0) + + /* This is the number of items that are pushed and popped on the stack + diff --git a/m68k-unknown-amigaos/Makefile b/m68k-unknown-amigaos/Makefile index 5c66cdd..d3b3d52 100644 --- a/m68k-unknown-amigaos/Makefile +++ b/m68k-unknown-amigaos/Makefile @@ -36,8 +36,8 @@ UPSTREAM_OPENURL_VERSION := 7.16 UPSTREAM_OPENURL_TARBALL := openurl-$(UPSTREAM_OPENURL_VERSION) UPSTREAM_OPENURL_URI := https://github.com/jens-maus/libopenurl/archive/$(UPSTREAM_OPENURL_VERSION).tar.gz -UPSTREAM_AMISSL_VERSION := 4.4 -UPSTREAM_AMISSL_TARBALL := AmiSSL-$(UPSTREAM_AMISSL_VERSION).lha +UPSTREAM_AMISSL_VERSION := 5.13 +UPSTREAM_AMISSL_TARBALL := AmiSSL-$(UPSTREAM_AMISSL_VERSION)-SDK.lha UPSTREAM_AMISSL_URI := https://github.com/jens-maus/amissl/releases/download/$(UPSTREAM_AMISSL_VERSION)/$(UPSTREAM_AMISSL_TARBALL) UPSTREAM_GUIGFX_TARBALL := guigfxlib.lha diff --git a/ppc-amigaos/Makefile b/ppc-amigaos/Makefile index b6f8eef..47260b1 100644 --- a/ppc-amigaos/Makefile +++ b/ppc-amigaos/Makefile @@ -18,8 +18,12 @@ UPSTREAM_MPC_VERSION := 1.0.2 UPSTREAM_MPC_TARBALL := mpc-$(UPSTREAM_MPC_VERSION).tar.gz UPSTREAM_MPC_URI := http://ftp.gnu.org/gnu/mpc/$(UPSTREAM_MPC_TARBALL) -UPSTREAM_NDK_TARBALL := SDK_53.29.lha -UPSTREAM_NDK_URI := "http://hyperion-entertainment.biz/index.php/downloads?view=download&format=raw&file=82" +UPSTREAM_LHASA_VERSION := 887d68ebca0cbad392af3709203745d202a2020b +UPSTREAM_LHASA_TARBALL := lhasa-$(UPSTREAM_LHASA_VERSION).zip +UPSTREAM_LHASA_URI := https://github.com/fragglet/lhasa/archive/$(UPSTREAM_LHASA_VERSION).zip + +UPSTREAM_NDK_TARBALL := SDK_54.16.lha +UPSTREAM_NDK_URI := "http://hyperion-entertainment.biz/index.php/downloads?view=download&format=raw&file=127" UPSTREAM_NDK_UPDATE_TARBALL := SDK_addon_final_edition_update2.zip UPSTREAM_NDK_UPDATE_URI := http://kas1e.mikendezign.com/aos4/SDK_addon_final_edition_update2.zip @@ -92,14 +96,15 @@ $(BUILDSTEPS)/stage2.d: $(BUILDSTEPS)/srcdir-step3.d $(BUILDSTEPS)/binutils.d $( # Rules to install the NDK ### -$(BUILDSTEPS)/ndk.d: $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL) $(SOURCESDIR)/$(UPSTREAM_NDK_UPDATE_TARBALL) $(SOURCESDIR)/$(UPSTREAM_OPENURL_TARBALL) $(SOURCESDIR)/$(UPSTREAM_ONCHIPMEM_TARBALL) $(SOURCESDIR)/$(UPSTREAM_GUIGFX_TARBALL) $(SOURCESDIR)/$(UPSTREAM_RENDER_TARBALL) $(SOURCESDIR)/$(UPSTREAM_CODESETS_TARBALL) +$(BUILDSTEPS)/ndk.d: $(BUILDSTEPS)/lhasa.d $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL) $(SOURCESDIR)/$(UPSTREAM_NDK_UPDATE_TARBALL) $(SOURCESDIR)/$(UPSTREAM_OPENURL_TARBALL) $(SOURCESDIR)/$(UPSTREAM_ONCHIPMEM_TARBALL) $(SOURCESDIR)/$(UPSTREAM_GUIGFX_TARBALL) $(SOURCESDIR)/$(UPSTREAM_RENDER_TARBALL) $(SOURCESDIR)/$(UPSTREAM_CODESETS_TARBALL) mkdir -p $(BUILDDIR)/ndk/tmp/ - lha xw=$(BUILDDIR)/ndk $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL) - lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/base.lha - lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/newlib-53.30.lha - lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/clib2-1.206.lha - lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/pthreads-53.11.lha - lha xw=$(BUILDDIR)/ndk/tmp $(SOURCESDIR)/$(UPSTREAM_ONCHIPMEM_TARBALL) + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL) + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/base.lha + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/execsg_sdk-54.31.lha + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/newlib-53.80.lha + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/clib2.lha + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk/tmp $(BUILDDIR)/ndk/SDK_Install/pthreads-53.12.lha + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/ndk/tmp $(SOURCESDIR)/$(UPSTREAM_ONCHIPMEM_TARBALL) mkdir -p $(PREFIX)/$(TARGET_NAME)/SDK unzip -o $(SOURCESDIR)/$(UPSTREAM_NDK_UPDATE_TARBALL) -d $(BUILDDIR)/ndk/tmp cp -r $(BUILDDIR)/ndk/tmp/Include $(PREFIX)/$(TARGET_NAME)/SDK/include @@ -116,17 +121,35 @@ $(BUILDSTEPS)/ndk.d: $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL) $(SOURCESDIR)/$(UPSTR cd $(BUILDDIR)/openurl && tar xaf $(SOURCESDIR)/$(UPSTREAM_OPENURL_TARBALL) cp -r $(BUILDDIR)/openurl/libopenurl-$(UPSTREAM_OPENURL_VERSION)/include/* $(PREFIX)/$(TARGET_NAME)/SDK/include/include_h/ mkdir -p $(BUILDDIR)/guigfxlib - lha xw=$(BUILDDIR)/guigfxlib $(SOURCESDIR)/$(UPSTREAM_GUIGFX_TARBALL) + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/guigfxlib $(SOURCESDIR)/$(UPSTREAM_GUIGFX_TARBALL) cp -r $(BUILDDIR)/guigfxlib/include_os4/* $(PREFIX)/$(TARGET_NAME)/SDK/include/include_h/ mkdir -p $(BUILDDIR)/renderlib - lha xw=$(BUILDDIR)/renderlib $(SOURCESDIR)/$(UPSTREAM_RENDER_TARBALL) + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/renderlib $(SOURCESDIR)/$(UPSTREAM_RENDER_TARBALL) cp -r $(BUILDDIR)/renderlib/renderlib/include_os4/* $(PREFIX)/$(TARGET_NAME)/SDK/include/include_h/ mkdir -p $(BUILDDIR)/codesets - lha xw=$(BUILDDIR)/codesets $(SOURCESDIR)/$(UPSTREAM_CODESETS_TARBALL) + $(BUILDDIR)/prefix/bin/lha xw=$(BUILDDIR)/codesets $(SOURCESDIR)/$(UPSTREAM_CODESETS_TARBALL) cp -r $(BUILDDIR)/codesets/codesets/Developer/include/* $(PREFIX)/$(TARGET_NAME)/SDK/include/include_h/ touch $@ ### +# Rules to build and install lhasa +### + +$(BUILDSTEPS)/lhasa.d: $(BUILDSTEPS)/lhasa-srcdir.d + mkdir -p $(BUILDDIR)/lhasa + mkdir -p $(BUILDDIR)/prefix + cd $(BUILDDIR)/lhasa && $(SRCDIR)/lhasa/configure --prefix=$(BUILDDIR)/prefix + cd $(BUILDDIR)/lhasa && make + cd $(BUILDDIR)/lhasa && make install + touch $@ + +$(BUILDSTEPS)/lhasa-srcdir.d: $(SOURCESDIR)/$(UPSTREAM_LHASA_TARBALL) + unzip $(SOURCESDIR)/$(UPSTREAM_LHASA_TARBALL) + mv lhasa-$(UPSTREAM_LHASA_VERSION) $(SRCDIR)/lhasa + cd $(SRCDIR)/lhasa && autoreconf -i + touch $@ + +### # Rules to create the GCC source tree ### @@ -192,6 +215,9 @@ $(SOURCESDIR)/$(UPSTREAM_MPC_TARBALL): $(SOURCESDIR)/$(UPSTREAM_BINUTILS_TARBALL): wget -q -O $@ $(UPSTREAM_BINUTILS_URI) +$(SOURCESDIR)/$(UPSTREAM_LHASA_TARBALL): + wget -q -O $@ $(UPSTREAM_LHASA_URI) + $(SOURCESDIR)/$(UPSTREAM_NDK_TARBALL): wget -q -O $@ $(UPSTREAM_NDK_URI) diff --git a/sdk/Makefile b/sdk/Makefile index d8c4bc7..340be7d 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -7,11 +7,13 @@ # GCCSDK_INSTALL_CROSSBIN -- /path/to/toolchain/bin # # supported targets are: +# arm-riscos-gnueabi # arm-unknown-riscos # m68k-atari-mint # m5475-atari-mint # ppc-amigaos # i686-w64-mingw32 +# x86_64-w64-mingw32 # m68k-unknown-amigaos ifeq ($(GCCSDK_INSTALL_ENV),) @@ -24,37 +26,63 @@ endif # Upstream package versions # https://zlib.net/ -VERSION_ZLIB := 1.2.11 +VERSION_ZLIB := 1.2.13 +CKSUM_ZLIB := b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30 # https://www.gnu.org/software/libiconv/ -VERSION_LIBICONV := 1.16 +VERSION_LIBICONV := 1.17 +CKSUM_LIBICONV := 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313 # https://laurikari.net/tre/ VERSION_LIBTRE := 0.8.0 +CKSUM_LIBTRE := 8dc642c2cde02b2dac6802cdbe2cda201daf79c4ebcbb3ea133915edf1636658 # https://www.openssl.org/ -VERSION_OPENSSL := 1.1.0l +VERSION_OPENSSL := 3.0.12 +CKSUM_OPENSSL := f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 # http://www.libpng.org/pub/png/libpng.html -VERSION_LIBPNG := 1.6.37 +VERSION_LIBPNG := 1.6.40 +CKSUM_LIBPNG := 8f720b363aa08683c9bf2a563236f45313af2c55d542b5481ae17dd8d183bb42 # http://libjpeg.sourceforge.net/ VERSION_LIBJPEG := 8d +CKSUM_LIBJPEG := 00029b1473f0f0ea72fbca3230e8cb25797fbb27e58ae2e46bb8bf5a806fe0b3 # https://libjpeg-turbo.org/ -# libjpeg turbo have dropped autotools support VERSION_LIBJPEG_TURBO := 2.0.2 -VERSION_LIBJPEG_TURBO := 1.5.3 +VERSION_LIBJPEG_TURBO := 3.0.1 +CKSUM_LIBJPEG_TURBO := 22429507714ae147b3acacd299e82099fce5d9f456882fc28e252e4579ba2a75 # https://developers.google.com/speed/webp/ -VERSION_LIBWEBP := 1.0.3 -# https://c-ares.haxx.se/ -VERSION_LIBCARES := 1.15.0 -# https://curl.haxx.se/ -VERSION_LIBCURL := 7.68.0 +VERSION_LIBWEBP := 1.3.2 +CKSUM_LIBWEBP := 2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 +# https://c-ares.org/ +VERSION_LIBCARES := 1.23.0 +CKSUM_LIBCARES := cb614ecf78b477d35963ebffcf486fc9d55cc3d3216f00700e71b7d4868f79f5 +# https://curl.se/ +VERSION_LIBCURL := 8.5.0 +CKSUM_LIBCURL := ce4b6a6655431147624aaf582632a36fe1ade262d5fab385c60f78942dd8d87b +# VERSION_LIBGNURX := 2.5.1 +CKSUM_LIBGNURX := 7147b7f806ec3d007843b38e19f42a5b7c65894a57ffc297a76b0dcd5f675d76 # http://mission-base.com/peter/source/ +# 1.7.0: https://github.com/peterGraf/pbl/releases VERSION_LIBPBL := 1_04 +CKSUM_LIBPBL := 20f0ab1af09a22a8f3cb3ce3832247a6b51d8db57211f6bb0794af9485229a67 +# Git-20170304 VERSION_LIBCF := CVS-20130415 +CKSUM_LIBCF := 5d25c4faa2f5b7fc106bb47d093646f79d0fa72a34aaf8122110a2e4cf9eb6cc # https://github.com/libexpat/libexpat -VERSION_LIBEXPAT := 2.2.9 -VERSION_LDG := 2.32 +VERSION_LIBEXPAT := 2.5.0 +CKSUM_LIBEXPAT := 6f0e6e01f7b30025fa05c85fdad1e5d0ec7fd35d9f61b22f34998de11969ff67 +# +VERSION_LDG := SVN-20150827 +CKSUM_LDG := ca7959d31b46cb1e755005eddcc0daf6a91f7faad7d869d82e94d98d20650d94 +# VERSION_WINDOM := 2.0.1 +CKSUM_WINDOM := 2539c15c22f7b8ca48c015f0c3d33f3bd1666cc8aa56eef6f38de2cc98a3479e +# https://github.com/berkus/hermes-pixel-format/archive/refs/tags/v1.3.3.tar.gz VERSION_HERMES := 1.3.3 +CKSUM_HERMES := e86374606105d2a251d4406e5f9fca8d09e2fd971ebb0dfd342e40953676c46e # https://www.freetype.org/ -VERSION_FREETYPE := 2.10.1 +VERSION_FREETYPE := 2.13.2 +CKSUM_FREETYPE := 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 +# +VERSION_ROADSHOW := 7_64_0-amissl +CKSUM_ROADSHOW := 5af092c2319f184d49f5eda72d160231b3f3551f9884f8136c531521059a4ad2 # Path path__ := $(GCCSDK_INSTALL_CROSSBIN):$(PATH) @@ -64,6 +92,7 @@ cc__ := $(word 1,$(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)) cxx__ := $(word 1,$(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)) ar__ := $(word 1,$(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*ar)) ranlib__ := $(word 1,$(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*ranlib)) +windres__ := $(word 1,$(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*windres)) # Flags cflags__ := -I$(GCCSDK_INSTALL_ENV)/include @@ -74,11 +103,31 @@ pkg_config_libdir__ := $(GCCSDK_INSTALL_ENV)/lib/pkgconfig # Target TARGET := $(shell $(cc__) -dumpmachine) +ifeq ($(findstring -riscos,$(TARGET)),-riscos) + cflags__ := $(cflags__) -mpoke-function-name + ifeq ($(findstring -gnueabi,$(TARGET)),-gnueabi) + cflags__ := $(cflags__) -funwind-tables + endif +endif + # Environment # Newer autotools objects to -I appearing in CFLAGS cleanenv := PATH="$(path__)" CC="$(cc__)" CXX="$(cxx__)" AR="$(ar__)" RANLIB="$(ranlib__)" CPPFLAGS="$(cppflags__)" LDFLAGS="$(ldflags__)" PKG_CONFIG_LIBDIR="$(pkg_config_libdir__)" env := $(cleanenv) CFLAGS="$(cflags__)" +# Cross-compiling CMake invocation. +NS_SDK_CMAKE_CMD=cmake \ + -DCMAKE_INSTALL_PREFIX="$(GCCSDK_INSTALL_ENV)" \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_COLOR_MAKEFILE=OFF \ + -DBUILD_DOC=OFF \ + -DBUILD_DOCS=OFF \ + -DBUILD_EXAMPLE=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TEST=OFF \ + -DBUILD_TESTS=OFF \ + -DBUILD_TESTING=OFF \ + RECIPES := $(CURDIR)/recipes SOURCEDIR := $(CURDIR)/sources BUILDDIR := $(CURDIR)/builddir-$(TARGET) @@ -94,13 +143,24 @@ SDK_ITEMS := COMMON_SDK_ITEMS := zlib.d openssl.d libpng.d libcares.d libcurl.d libexpat.d -LIBCURL_DISABLES := $(patsubst %,--disable-%,ftp file dict ldap ldaps rtsp telnet gopher tftp pop3 imap smb smtp manual) +LIBCURL_SSL := openssl +LIBCURL_DISABLES := $(patsubst %,--disable-%,ftp file dict ldap ldaps mqtt rtsp telnet gopher tftp pop3 imap smb smtp manual) FREETYPE_ENV := LIBPNG_CFLAGS=$$($(GCCSDK_INSTALL_ENV)/bin/libpng-config --cflags) LIBPNG_LDFLAGS=$$($(GCCSDK_INSTALL_ENV)/bin/libpng-config --ldflags) # per target environments LIBJPEG_TURBO_BUILDDIR:=$(BUILDDIR)/libjpegturbo +# Openssl target has to alter for mingw +TARGET_OPENSSL:=$(TARGET) + # Target Specific setup +ifeq ($(TARGET),arm-riscos-gnueabi) + SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, $(COMMON_SDK_ITEMS) libjpeg-turbo.d libwebp.d) + EXTRAARGS_LIBCARES := --disable-shared + EXTRAARGS_LIBCURL := --enable-nonblocking --enable-ares --with-random="/dev/urandom" $(LIBCURL_DISABLES) + EXTRAARGS_OPENSSL := no-asm +endif + ifeq ($(TARGET),arm-unknown-riscos) SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, $(COMMON_SDK_ITEMS) libjpeg-turbo.d libwebp.d) EXTRAARGS_LIBCARES := --disable-shared @@ -135,19 +195,41 @@ ifeq ($(TARGET),i686-w64-mingw32) SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d libgnurx.d $(COMMON_SDK_ITEMS) libjpeg.d libwebp.d) EXTRAARGS_LIBCARES := --disable-shared EXTRAARGS_LIBCURL := --enable-nonblocking --enable-ares --disable-ldap --without-random - LIBCURL_ENV := CFLAGS="-DCARES_STATICLIB" LIBS="-lgdi32 -lcrypt32" + LIBCURL_ENV := CFLAGS="-DCARES_STATICLIB" LIBS="-lgdi32 -lcrypt32 -liphlpapi" + TARGET_OPENSSL := mingw + ENV_OPENSSL := WINDRES="$(windres__)" + EXTRAARGS_OPENSSL := no-asm enable-capieng +endif + +ifeq ($(TARGET),x86_64-w64-mingw32) + SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, libiconv.d libgnurx.d $(COMMON_SDK_ITEMS) libjpeg.d libwebp.d) + EXTRAARGS_LIBCARES := --disable-shared + EXTRAARGS_LIBCURL := --enable-nonblocking --enable-ares --disable-ldap --without-random + LIBCURL_ENV := CFLAGS="-DCARES_STATICLIB" LIBS="-lgdi32 -lcrypt32 -liphlpapi" + TARGET_OPENSSL := mingw64 EXTRAARGS_OPENSSL := no-asm enable-capieng endif ifeq ($(TARGET),m68k-unknown-amigaos) SDK_ITEMS := $(addprefix $(BUILDSTEPS)/, roadshow.d libiconv.d libtre.d libpbl.d $(COMMON_SDK_ITEMS) libjpeg.d) EXTRAARGS_LIBCARES := --disable-shared --without-random - EXTRAARGS_LIBCURL := --disable-ntlm-wb --without-random --disable-threaded-resolver --with-amissl --with-zlib --disable-rt --disable-ipv6 - LIBICONV_ENV := CFLAGS="-DPATH_MAX=1024" + LIBCARES_ENV := LIBS="-lm" + LIBCURL_SSL := amissl + EXTRAARGS_LIBCURL := --disable-ntlm-wb --without-random --disable-threaded-resolver --with-zlib --disable-rt --disable-ipv6 + LIBICONV_ENV := CFLAGS="-DPATH_MAX=1024 -DRLIMIT_NOFILE=6" LIBJPEG_ENV := LDFLAGS="-lm" LIBJPEG_TURBO_ENV := LDFLAGS="-lm" - LIBCURL_ENV := CFLAGS="-I$(GCCSDK_INSTALL_ENV)/netinclude -D__NO_NET_API" LIBS="-lm" - LIBEXPAT_ENV := LDFLAGS="-lm" + # XXX: build openssl against bsdsocket.library? + # ENV_OPENSSL := CFLAGS="-I$(GCCSDK_INSTALL_ENV)/netinclude" CPPFLAGS="-D__NO_NET_API" + ifeq ($(LIBCURL_SSL),openssl) + LIBCURL_ENV := LIBS="-lm -lnet" + else + LIBCURL_ENV := CFLAGS="-I$(GCCSDK_INSTALL_ENV)/netinclude -D__NO_NET_API -DHAVE_IOCTLSOCKET_CAMEL_FIONBIO" LIBS="-lm" + endif + # XXX: libgcc is meant to be implied, but for some reason that + # results in ld evaluating it after libm and thus failing to find symbols. + # Hack around it by forcing the link order here. + LIBEXPAT_ENV := LDFLAGS="-lgcc -lm" endif ifeq ($(SDK_ITEMS),) @@ -189,7 +271,7 @@ endif touch $@ $(SOURCEDIR)/zlib-$(VERSION_ZLIB).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://zlib.net/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://zlib.net/fossils/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_ZLIB) $@ # libiconv $(BUILDSTEPS)/libiconv.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libiconv-src.d @@ -207,7 +289,7 @@ $(BUILDSTEPS)/libiconv-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libiconv-$( touch $@ $(SOURCEDIR)/libiconv-$(VERSION_LIBICONV).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://ftp.gnu.org/pub/gnu/libiconv/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://ftp.gnu.org/pub/gnu/libiconv/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBICONV) $@ # libgnurx $(BUILDSTEPS)/libgnurx.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libgnurx-src.d @@ -227,7 +309,7 @@ $(BUILDSTEPS)/libgnurx-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libgnurx-$( touch $@ $(SOURCEDIR)/libgnurx-$(VERSION_LIBGNURX).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://downloads.sourceforge.net/project/mingw/Other/UserContributed/regex/mingw-regex-$(VERSION_LIBGNURX)/mingw-libgnurx-$(VERSION_LIBGNURX)-src.tar.gz" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://downloads.sourceforge.net/project/mingw/Other/UserContributed/regex/mingw-regex-$(VERSION_LIBGNURX)/mingw-libgnurx-$(VERSION_LIBGNURX)-src.tar.gz" $(CKSUM_LIBGNURX) $@ # atari cf library $(BUILDSTEPS)/libcf.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libcf-src.d @@ -245,7 +327,7 @@ $(BUILDSTEPS)/libcf-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libcf-$(VERSIO touch $@ $(SOURCEDIR)/libcf-$(VERSION_LIBCF).tar.bz2: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/cflib-$(VERSION_LIBCF).tar.bz2" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/cflib-$(VERSION_LIBCF).tar.bz2" $(CKSUM_LIBCF) $@ # atari windom library $(BUILDSTEPS)/windom.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/windom-src.d @@ -263,12 +345,12 @@ $(BUILDSTEPS)/windom-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/windom-$(VERS touch $@ $(SOURCEDIR)/windom-$(VERSION_WINDOM).zip: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://downloads.sourceforge.net/project/windom/windom/$(VERSION_WINDOM)/windom-$(VERSION_WINDOM)-1.zip" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://downloads.sourceforge.net/project/windom/windom/$(VERSION_WINDOM)/windom-$(VERSION_WINDOM)-1.zip" $(CKSUM_WINDOM) $@ # atari ldg library $(BUILDSTEPS)/ldg.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/ldg-src.d mkdir -p $(BUILDDIR)/ldg - cd $(BUILDDIR)/ldg && unzip $(SOURCEDIR)/ldg-$(VERSION_LDG).zip + cd $(BUILDDIR)/ldg && tar xjf $(SOURCEDIR)/ldg-$(VERSION_LDG).tar.bz2 $(env) make -C $(BUILDDIR)/ldg/ldg-$(VERSION_LDG)/src/devel -f gcc.mak CROSS=yes PREFIX=$(GCCSDK_INSTALL_ENV) CC=${TARGET}-gcc AR=${TARGET}-ar cp $(BUILDDIR)/ldg/ldg-$(VERSION_LDG)/lib/gcc/libldg.a $(GCCSDK_INSTALL_ENV)/lib/ cp $(BUILDDIR)/ldg/ldg-$(VERSION_LDG)/include/ldg.h $(GCCSDK_INSTALL_ENV)/include/ldg.h @@ -276,31 +358,31 @@ $(BUILDSTEPS)/ldg.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/ldg-src.d cp $(BUILDDIR)/ldg/ldg-$(VERSION_LDG)/include/ldg/mem.h $(GCCSDK_INSTALL_ENV)/include/ldg/ touch $@ -$(BUILDSTEPS)/ldg-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/ldg-$(VERSION_LDG).zip +$(BUILDSTEPS)/ldg-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/ldg-$(VERSION_LDG).tar.bz2 touch $@ -$(SOURCEDIR)/ldg-$(VERSION_LDG).zip: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://ldg.org.free.fr/distrib/ldg-$(VERSION_LDG).zip" $@ +$(SOURCEDIR)/ldg-$(VERSION_LDG).tar.bz2: + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/ldg-$(VERSION_LDG).tar.bz2" $(CKSUM_LDG) $@ # hermes bitmap lib $(BUILDSTEPS)/hermes.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/hermes-src.d - cd $(BUILDDIR)/hermes/Hermes-$(VERSION_HERMES) - for p in `ls $(RECIPES)/patches/hermes/*.p` ; do $(PATCH) -d $(BUILDDIR)/hermes/Hermes-$(VERSION_HERMES) -p0 <$$p ; done + cd $(BUILDDIR)/hermes/hermes-pixel-format-$(VERSION_HERMES) + for p in `ls $(RECIPES)/patches/hermes/*.p` ; do $(PATCH) -d $(BUILDDIR)/hermes/hermes-pixel-format-$(VERSION_HERMES) -p0 <$$p ; done ifneq ($(realpath $(RECIPES)/patches/hermes/$(TARGET)),) - for p in `ls $(RECIPES)/patches/hermes/$(TARGET)/*.p` ; do $(PATCH) -d $(BUILDDIR)/hermes/Hermes-$(VERSION_HERMES) -p0 <$$p ; done + for p in `ls $(RECIPES)/patches/hermes/$(TARGET)/*.p` ; do $(PATCH) -d $(BUILDDIR)/hermes/hermes-pixel-format-$(VERSION_HERMES) -p0 <$$p ; done endif - cd $(BUILDDIR)/hermes/Hermes-$(VERSION_HERMES) && $(env) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared --disable-x86asm - cd $(BUILDDIR)/hermes/Hermes-$(VERSION_HERMES) && $(env) make CFLAGS="-D__BIG_ENDIAN__" install + cd $(BUILDDIR)/hermes/hermes-pixel-format-$(VERSION_HERMES) && $(env) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared --disable-x86asm + cd $(BUILDDIR)/hermes/hermes-pixel-format-$(VERSION_HERMES) && $(env) make CFLAGS="-D__BIG_ENDIAN__" install touch $@ -$(BUILDSTEPS)/hermes-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.bz2 +$(BUILDSTEPS)/hermes-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.gz $(RM) -rf $(BUILDDIR)/hermes mkdir -p $(BUILDDIR)/hermes - cd $(BUILDDIR)/hermes && tar xaf $(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.bz2 + cd $(BUILDDIR)/hermes && tar xaf $(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.gz touch $@ -$(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.bz2: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://clanlib.org/download/legacy/Hermes-$(VERSION_HERMES).tar.bz2" $@ +$(SOURCEDIR)/hermes-$(VERSION_HERMES).tar.gz: + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://github.com/berkus/hermes-pixel-format/archive/refs/tags/v$(VERSION_HERMES).tar.gz" $(CKSUM_HERMES) $@ # freetype font lib $(BUILDSTEPS)/freetype.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/freetype-src.d @@ -319,21 +401,21 @@ endif touch $@ $(SOURCEDIR)/freetype-$(VERSION_FREETYPE).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://download.savannah.gnu.org/releases/freetype/freetype-$(VERSION_FREETYPE).tar.gz" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://download.savannah.gnu.org/releases/freetype/freetype-$(VERSION_FREETYPE).tar.gz" $(CKSUM_FREETYPE) $@ # amiga roadshow sdk $(BUILDSTEPS)/roadshow.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/roadshow-src.d mkdir -p $(BUILDDIR)/Roadshow-SDK - lha xw=$(BUILDDIR)/Roadshow-SDK $(SOURCEDIR)/Roadshow-SDK-NS.lha + lha xw=$(BUILDDIR)/Roadshow-SDK $(SOURCEDIR)/Roadshow-SDK-NS-$(VERSION_ROADSHOW).lha mkdir -p $(GCCSDK_INSTALL_ENV)/netinclude cp -r $(BUILDDIR)/Roadshow-SDK/SDK/netinclude/* $(GCCSDK_INSTALL_ENV)/netinclude/ touch $@ -$(BUILDSTEPS)/roadshow-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/Roadshow-SDK-NS.lha +$(BUILDSTEPS)/roadshow-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/Roadshow-SDK-NS-$(VERSION_ROADSHOW).lha touch $@ -$(SOURCEDIR)/Roadshow-SDK-NS.lha: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://github.com/chris-y/curl/releases/download/curl-7_64_0-amissl/Roadshow-SDK-NS.lha" $@ +$(SOURCEDIR)/Roadshow-SDK-NS-$(VERSION_ROADSHOW).lha: + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://github.com/chris-y/curl/releases/download/curl-$(VERSION_ROADSHOW)/Roadshow-SDK-NS.lha" $(CKSUM_ROADSHOW) $@ # regex $(BUILDSTEPS)/libtre.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libtre-src.d @@ -348,7 +430,7 @@ $(BUILDSTEPS)/libtre-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/tre-$(VERSION touch $@ $(SOURCEDIR)/tre-$(VERSION_LIBTRE).tar.bz2: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://laurikari.net/tre/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://laurikari.net/tre/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBTRE) $@ # libpbl $(BUILDSTEPS)/libpbl.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libpbl-src.d @@ -365,12 +447,12 @@ $(BUILDSTEPS)/libpbl-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/pbl_$(VERSION touch $@ $(SOURCEDIR)/pbl_$(VERSION_LIBPBL).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://www.mission-base.com/peter/source/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://www.mission-base.com/peter/source/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBPBL) $@ # OpenSSL $(BUILDSTEPS)/openssl.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/zlib.d $(BUILDSTEPS)/openssl-src.d -ifneq ($(TARGET),m68k-unknown-amigaos) - cd $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL) && $(env) ./Configure --prefix=$(GCCSDK_INSTALL_ENV) $(TARGET) no-shared no-threads $(EXTRAARGS_OPENSSL) +ifeq ($(LIBCURL_SSL),openssl) + cd $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL) && $(env) $(ENV_OPENSSL) ./Configure --prefix=$(GCCSDK_INSTALL_ENV) $(TARGET_OPENSSL) no-shared no-threads $(EXTRAARGS_OPENSSL) cd $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL) && $(env) make install endif touch $@ @@ -391,7 +473,7 @@ endif # get the openssl source tar $(SOURCEDIR)/openssl-$(VERSION_OPENSSL).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://www.openssl.org/source/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://www.openssl.org/source/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_OPENSSL) $@ # libPNG $(BUILDSTEPS)/libpng.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/zlib.d $(BUILDSTEPS)/libpng-src.d @@ -408,7 +490,7 @@ $(BUILDSTEPS)/libpng-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libpng-$(VERS touch $@ $(SOURCEDIR)/libpng-$(VERSION_LIBPNG).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://downloads.sourceforge.net/libpng/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://downloads.sourceforge.net/libpng/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBPNG) $@ # libjpeg @@ -427,8 +509,7 @@ $(BUILDSTEPS)/libjpeg-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/jpegsrc.v$(V touch $@ $(SOURCEDIR)/jpegsrc.v$(VERSION_LIBJPEG).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://ijg.org/files/$(subst $(SOURCEDIR)/,,$@)" $@ - + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://ijg.org/files/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBJPEG) $@ # libjpegturbo $(BUILDSTEPS)/libjpeg-turbo.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libjpeg-turbo-src.d @@ -438,15 +519,19 @@ $(BUILDSTEPS)/libjpeg-turbo.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libjpeg-tu ifneq ($(realpath $(RECIPES)/patches/libjpegturbo/$(TARGET)),) for p in `ls $(RECIPES)/patches/libjpegturbo/$(TARGET)/*.p` ; do $(PATCH) -d $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO) -p0 <$$p ; done endif - cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO) && $(env) $(LIBJPEG_TURBO_ENV) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared - cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO) && $(env) make install + mkdir -p $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO)/ns-sdk-build + cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO)/ns-sdk-build && $(env) $(LIBJPEG_TURBO_ENV) $(NS_SDK_CMAKE_CMD) \ + -DENABLE_STATIC=ON \ + -DENABLE_SHARED=OFF \ + .. + cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO)/ns-sdk-build && $(env) make install VERBOSE=1 touch $@ $(BUILDSTEPS)/libjpeg-turbo-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libjpeg-turbo-src-$(VERSION_LIBJPEG_TURBO).tar.gz touch $@ $(SOURCEDIR)/libjpeg-turbo-src-$(VERSION_LIBJPEG_TURBO).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://sourceforge.net/projects/libjpeg-turbo/files/$(VERSION_LIBJPEG_TURBO)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO).tar.gz/download" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/$(VERSION_LIBJPEG_TURBO)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO).tar.gz" $(CKSUM_LIBJPEG_TURBO) $@ # libwebp @@ -465,7 +550,7 @@ $(BUILDSTEPS)/libwebp-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libwebp-$(VE touch $@ $(SOURCEDIR)/libwebp-$(VERSION_LIBWEBP).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$(VERSION_LIBWEBP).tar.gz" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$(VERSION_LIBWEBP).tar.gz" $(CKSUM_LIBWEBP) $@ # libcares @@ -476,7 +561,7 @@ $(BUILDSTEPS)/libcares.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libcares-src.d ifneq ($(realpath $(RECIPES)/patches/libcares/$(TARGET)),) for p in `ls $(RECIPES)/patches/libcares/$(TARGET)/*.p` ; do $(PATCH) -d $(BUILDDIR)/libcares/c-ares-$(VERSION_LIBCARES) -p0 <$$p ; done endif - cd $(BUILDDIR)/libcares/c-ares-$(VERSION_LIBCARES) && $(cleanenv) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) $(EXTRAARGS_LIBCARES) + cd $(BUILDDIR)/libcares/c-ares-$(VERSION_LIBCARES) && $(cleanenv) $(LIBCARES_ENV) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) $(EXTRAARGS_LIBCARES) cd $(BUILDDIR)/libcares/c-ares-$(VERSION_LIBCARES) && $(cleanenv) make install touch $@ @@ -484,12 +569,12 @@ $(BUILDSTEPS)/libcares-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/c-ares-$(VE touch $@ $(SOURCEDIR)/c-ares-$(VERSION_LIBCARES).tar.gz: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://c-ares.haxx.se/download/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://c-ares.org/download/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBCARES) $@ # libcurl $(BUILDSTEPS)/libcurl.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/zlib.d $(BUILDSTEPS)/openssl.d $(BUILDSTEPS)/libcares.d $(BUILDSTEPS)/libcurl-src.d - cd $(BUILDDIR)/libcurl/curl-$(VERSION_LIBCURL) && $(env) CFLAGS="" $(LIBCURL_ENV) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared --without-libidn ${EXTRAARGS_LIBCURL} + cd $(BUILDDIR)/libcurl/curl-$(VERSION_LIBCURL) && $(env) CFLAGS="" $(LIBCURL_ENV) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared --with-$(LIBCURL_SSL) --without-libidn2 ${EXTRAARGS_LIBCURL} cd $(BUILDDIR)/libcurl/curl-$(VERSION_LIBCURL) && $(env) make install touch $@ @@ -503,20 +588,23 @@ endif touch $@ $(SOURCEDIR)/curl-$(VERSION_LIBCURL).tar.bz2: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://curl.haxx.se/download/$(subst $(SOURCEDIR)/,,$@)" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://curl.se/download/$(subst $(SOURCEDIR)/,,$@)" $(CKSUM_LIBCURL) $@ # libexpat $(BUILDSTEPS)/libexpat.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libexpat-src.d - mkdir -p $(BUILDDIR)/libexpat - cd $(BUILDDIR)/libexpat && tar xaf $(SOURCEDIR)/expat-$(VERSION_LIBEXPAT).tar.bz2 cd $(BUILDDIR)/libexpat/expat-$(VERSION_LIBEXPAT) && $(env) $(LIBEXPAT_ENV) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared cd $(BUILDDIR)/libexpat/expat-$(VERSION_LIBEXPAT) && $(env) $(LIBEXPAT_ENV) make install touch $@ $(BUILDSTEPS)/libexpat-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/expat-$(VERSION_LIBEXPAT).tar.bz2 + mkdir -p $(BUILDDIR)/libexpat + cd $(BUILDDIR)/libexpat && tar xaf $(SOURCEDIR)/expat-$(VERSION_LIBEXPAT).tar.bz2 +ifneq ($(realpath $(RECIPES)/patches/libexpat/$(TARGET)),) + for p in `ls $(RECIPES)/patches/libexpat/$(TARGET)/*.p` ; do $(PATCH) -d $(BUILDDIR)/libexpat/expat-$(VERSION_LIBEXPAT) -p0 <$$p ; done +endif touch $@ $(SOURCEDIR)/expat-$(VERSION_LIBEXPAT).tar.bz2: - $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://downloads.sourceforge.net/project/expat/expat/$(VERSION_LIBEXPAT)/expat-$(VERSION_LIBEXPAT).tar.bz2" $@ + $(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(VERSION_LIBEXPAT))/expat-$(VERSION_LIBEXPAT).tar.bz2" $(CKSUM_LIBEXPAT) $@ diff --git a/sdk/fetchsrc b/sdk/fetchsrc index 46b72b0..6a7b3b8 100755 --- a/sdk/fetchsrc +++ b/sdk/fetchsrc @@ -4,15 +4,18 @@ set -x # script to fetch toolchain source tar using ci.netsurf-browser.org as a cache -# Usage fetchsrc <target> <source> <upstream> <output> +# Usage fetchsrc <target> <source> <upstream> <sha256sum> <output> -NSSRV="http://ci.netsurf-browser.org/toolchain/" +NSSRV="https://ci.netsurf-browser.org/toolchain/" -wget -q -O ${4} ${NSSRV}/${1}/${2} +wget -q -O ${5} ${NSSRV}/${1}/${2} if [ $? -ne 0 ];then - wget -q -O ${4} ${3} + wget -q -O ${5} ${3} if [ $? -ne 0 ];then - rm ${4} + rm ${5} exit 1 fi fi + +echo "${4} *${5}" | sha256sum --strict -c - +exit $? diff --git a/sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/rand/rand_amiga.c b/sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/rand/rand_amiga.c deleted file mode 100644 index 3c18b7d..0000000 --- a/sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/rand/rand_amiga.c +++ /dev/null @@ -1,189 +0,0 @@ -#include <openssl/rand.h> -#include <openssl/sha.h> -#include "rand_lcl.h" - -#if defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) -#define __USE_INLINE__ 1 - -#include <proto/exec.h> -#include <proto/timer.h> -#include <devices/timer.h> - -/* Maximum number of attempts to get a delay of 1 microsecond that is not equal to 0 */ -#define MAX_ATTEMPTS 1000 - -#ifdef __amigaos4__ - -#ifdef CreateMsgPort -#undef CreateMsgPort -#endif -#define CreateMsgPort() AllocSysObject(ASOT_PORT,NULL) -#ifdef DeleteMsgPort -#undef DeleteMsgPort -#endif -#define DeleteMsgPort(msgPort) FreeSysObject(ASOT_PORT,msgPort) -#ifdef CreateIORequest -#undef CreateIORequest -#endif -#define CreateIORequest(ioReplyPort,size) AllocSysObjectTags(ASOT_IOREQUEST,ASOIOR_ReplyPort,ioReplyPort,ASOIOR_Size,size,TAG_DONE) -#ifdef DeleteIORequest -#undef DeleteIORequest -#endif -#define DeleteIORequest(ioReq) FreeSysObject(ASOT_IOREQUEST,ioReq) - -#else - -#define GetInterface(a, b, c, d) 1 -#define DropInterface(x) - -/* OS3 has a different but compatible TimeVal definition */ -struct TimeVal -{ - ULONG Seconds; - ULONG Microseconds; -}; - -/* ...and ditto for TimeRequest */ -struct TimeRequest -{ - struct IORequest Request; - struct TimeVal Time; -}; - -#endif /* !__amigaos4__ */ - -int RAND_poll(void) -{ - unsigned char temp_buffer[SHA_DIGEST_LENGTH], data_buffer[SHA_DIGEST_LENGTH]; - struct MsgPort *port = NULL; - double entropy_added = 0; - struct TimeRequest *time_request = NULL; -#ifdef __amigaos4__ - struct IOStdReq *entropy_request = NULL; - - if ((port = CreateMsgPort()) - && (entropy_request = (struct IOStdReq *)CreateIORequest(port, sizeof(*entropy_request)))) - { - if (OpenDevice(TIMERNAME, UNIT_ENTROPY, (struct IORequest *)entropy_request, 0) == 0) - { - while(entropy_added < ENTROPY_NEEDED) - { - entropy_request->io_Command = TR_READENTROPY; - entropy_request->io_Data = &temp_buffer[0]; - entropy_request->io_Length = sizeof(temp_buffer); - - if (DoIO((struct IORequest *)entropy_request) == 0) - { - SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); - RAND_add(&data_buffer[0], sizeof(data_buffer), sizeof(data_buffer)); - entropy_added += sizeof(data_buffer); - } - else - break; - } - - CloseDevice((struct IORequest *)entropy_request); - } - } - - DeleteIORequest((struct IORequest *)entropy_request); -#endif /* __amigaos4__ */ - - /* The following block will be used on "classic" machines. It does not generate - * a high degree of randomness, but it does the job since RAND_poll is - * called only once by OpenSSL to generate a 32 byte seed. - */ - if (entropy_added < ENTROPY_NEEDED - && (port || (port = CreateMsgPort())) - && (time_request = (struct TimeRequest *)CreateIORequest(port, sizeof(*time_request)))) - { - if (OpenDevice(TIMERNAME, UNIT_VBLANK, (struct IORequest *)time_request, 0) == 0) - { - #if defined(__amigaos4__) - struct TimerIFace *ITimer = NULL; - #endif - struct Device *TimerBase; - - if ((TimerBase = time_request->Request.io_Device) - #if defined(__amigaos4__) - && (ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL)) - #endif - ) - { - struct EClockVal curr_eclock; - ULONG prev_ev_lo = 0; - struct TimeVal tv; - int i, attempt; - BOOL aborted; - - ReadEClock(&curr_eclock); - aborted = FALSE; - - while(!aborted && entropy_added < ENTROPY_NEEDED) - { - for(i = 0; - !aborted && i < (int)sizeof(temp_buffer) - (int)sizeof(ULONG); - i++) - { - attempt = 0; - - /* Ask for a one microsecond delay and measure the time - * the delay actually took. - */ - do - { - time_request->Request.io_Command = TR_ADDREQUEST; - time_request->Time.Seconds = 0; - time_request->Time.Microseconds = 1; - - if (DoIO((struct IORequest *)time_request) == 0) - { - prev_ev_lo = curr_eclock.ev_lo; - ReadEClock(&curr_eclock); - - attempt++; - } - else - aborted = TRUE; - } while(!aborted && prev_ev_lo == 0 && attempt < MAX_ATTEMPTS); - - if (attempt >= MAX_ATTEMPTS) - aborted = TRUE; - - /* Since we are going for randomness, ev_hi is irrelevant */ - temp_buffer[i] = (unsigned char)(curr_eclock.ev_lo - prev_ev_lo); - } - - GetSysTime(&tv); - - if (sizeof(temp_buffer) > sizeof(ULONG)) - *(ULONG *)&temp_buffer[sizeof(temp_buffer) - sizeof(ULONG)] - = tv.Microseconds; - - /* Shuffle the bits around and specify that about - * one fourth of it adds to the entropy. - */ - if (!aborted) - { - SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); - RAND_add(&data_buffer[0], sizeof(data_buffer), (double)sizeof(data_buffer) / 4); - entropy_added += sizeof(data_buffer) / 4; - } - } - } - - #if defined(__amigaos4__) - DropInterface((struct Interface *)ITimer); - #endif - CloseDevice((struct IORequest *)time_request); - } - } - - DeleteIORequest((struct IORequest *)time_request); - - DeleteMsgPort(port); - - return(entropy_added >= ENTROPY_NEEDED); -} - -#endif /* OPENSSL_SYS_AMIGA */ diff --git a/sdk/recipes/files/openssl/m68k-unknown-amigaos/providers/implementations/rands/seeding/rand_amiga.c b/sdk/recipes/files/openssl/m68k-unknown-amigaos/providers/implementations/rands/seeding/rand_amiga.c new file mode 100644 index 0000000..205d527 --- /dev/null +++ b/sdk/recipes/files/openssl/m68k-unknown-amigaos/providers/implementations/rands/seeding/rand_amiga.c @@ -0,0 +1,282 @@ +#include "internal/cryptlib.h" +#include <openssl/rand.h> +#include <openssl/sha.h> +#include "crypto/rand_pool.h" +#include "crypto/rand.h" +#include "prov/seeding.h" + +#if defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) + +# ifndef OPENSSL_RAND_SEED_OS +# error "Unsupported seeding method configured; must be os" +# endif + +#define __USE_INLINE__ 1 + +#include <sys/types.h> +#include <time.h> +#include <unistd.h> + +#include <proto/exec.h> +#include <proto/timer.h> +#include <devices/timer.h> + +/* Maximum number of attempts to get a delay of 1 microsecond that is not equal to 0 */ +#define MAX_ATTEMPTS 1000 + +#ifdef __amigaos4__ + +#ifdef CreateMsgPort +#undef CreateMsgPort +#endif +#define CreateMsgPort() AllocSysObject(ASOT_PORT,NULL) +#ifdef DeleteMsgPort +#undef DeleteMsgPort +#endif +#define DeleteMsgPort(msgPort) FreeSysObject(ASOT_PORT,msgPort) +#ifdef CreateIORequest +#undef CreateIORequest +#endif +#define CreateIORequest(ioReplyPort,size) AllocSysObjectTags(ASOT_IOREQUEST,ASOIOR_ReplyPort,ioReplyPort,ASOIOR_Size,size,TAG_DONE) +#ifdef DeleteIORequest +#undef DeleteIORequest +#endif +#define DeleteIORequest(ioReq) FreeSysObject(ASOT_IOREQUEST,ioReq) + +#else + +#define GetInterface(a, b, c, d) 1 +#define DropInterface(x) + +/* OS3 has a different but compatible TimeVal definition */ +struct TimeVal +{ + ULONG Seconds; + ULONG Microseconds; +}; + +/* ... and ditto for TimeRequest */ +struct TimeRequest +{ + struct IORequest Request; + struct TimeVal Time; +}; + +#endif /* !__amigaos4__ */ + +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) +{ + unsigned char temp_buffer[SHA_DIGEST_LENGTH], data_buffer[SHA_DIGEST_LENGTH]; + struct MsgPort *port = NULL; + size_t bytes_needed; + size_t entropy_available = 0; + struct TimeRequest *time_request = NULL; +#ifdef __amigaos4__ + struct IOStdReq *entropy_request = NULL; + + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); + + if ((port = CreateMsgPort()) + && (entropy_request = (struct IOStdReq *)CreateIORequest(port, sizeof(*entropy_request)))) + { + if (OpenDevice(TIMERNAME, UNIT_ENTROPY, (struct IORequest *)entropy_request, 0) == 0) + { + while(bytes_needed > 0) + { + entropy_request->io_Command = TR_READENTROPY; + entropy_request->io_Data = &temp_buffer[0]; + entropy_request->io_Length = sizeof(temp_buffer); + + if (DoIO((struct IORequest *)entropy_request) == 0) + { + unsigned char *buffer; + size_t bytes = (bytes_needed < sizeof(data_buffer) ? bytes_needed : sizeof(data_buffer)); + + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); + SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); + memcpy(buffer, data_buffer, bytes); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); + bytes_needed -= bytes; + } + else + break; + } + + CloseDevice((struct IORequest *)entropy_request); + } + } + + DeleteIORequest((struct IORequest *)entropy_request); + + entropy_available = ossl_rand_pool_entropy_available(pool); + if (entropy_available > 0) + return entropy_available; +#endif /* __amigaos4__ */ + + /* The following block will be used on "classic" machines. It does not generate + * a high degree of randomness, but it does the job since RAND_poll is + * called only once by OpenSSL to generate a 32 byte seed. + */ + + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); + + if (bytes_needed > 0 + && (port || (port = CreateMsgPort())) + && (time_request = (struct TimeRequest *)CreateIORequest(port, sizeof(*time_request)))) + { + if (OpenDevice(TIMERNAME, UNIT_VBLANK, (struct IORequest *)time_request, 0) == 0) + { + #if defined(__amigaos4__) + struct TimerIFace *ITimer = NULL; + #endif + struct Device *TimerBase; + + if ((TimerBase = time_request->Request.io_Device) + #if defined(__amigaos4__) + && (ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL)) + #endif + ) + { + struct EClockVal curr_eclock; + ULONG prev_ev_lo = 0; + struct TimeVal tv; + int i, attempt; + BOOL aborted; + + ReadEClock(&curr_eclock); + aborted = FALSE; + + while(!aborted && bytes_needed > 0) + { + for(i = 0; + !aborted && i < (int)sizeof(temp_buffer) - (int)sizeof(ULONG); + i++) + { + attempt = 0; + + /* Ask for a one microsecond delay and measure the time + * the delay actually took. + */ + do + { + time_request->Request.io_Command = TR_ADDREQUEST; + time_request->Time.Seconds = 0; + time_request->Time.Microseconds = 1; + + if (DoIO((struct IORequest *)time_request) == 0) + { + prev_ev_lo = curr_eclock.ev_lo; + ReadEClock(&curr_eclock); + + attempt++; + } + else + aborted = TRUE; + } while(!aborted && prev_ev_lo == 0 && attempt < MAX_ATTEMPTS); + + if (attempt >= MAX_ATTEMPTS) + aborted = TRUE; + + /* Since we are going for randomness, ev_hi is irrelevant */ + temp_buffer[i] = (unsigned char)(curr_eclock.ev_lo - prev_ev_lo); + } + + GetSysTime(&tv); + + if (sizeof(temp_buffer) > sizeof(ULONG)) + *(ULONG *)&temp_buffer[sizeof(temp_buffer) - sizeof(ULONG)] + = tv.Microseconds; + + /* Shuffle the bits around and specify that about + * one fourth of it adds to the entropy. + */ + if (!aborted) + { + unsigned char *buffer; + size_t bytes = (bytes_needed < sizeof(data_buffer) ? bytes_needed : sizeof(data_buffer)); + + SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); + + ossl_rand_pool_add_end(pool, bytes, (sizeof(data_buffer) / 4) * 8); + bytes_needed -= bytes; + } + } + } + + #if defined(__amigaos4__) + DropInterface((struct Interface *)ITimer); + #endif + CloseDevice((struct IORequest *)time_request); + } + } + + DeleteIORequest((struct IORequest *)time_request); + + DeleteMsgPort(port); + + return ossl_rand_pool_entropy_available(pool); +} + +int ossl_pool_add_nonce_data(RAND_POOL *pool) +{ + struct { + pid_t pid; + CRYPTO_THREAD_ID tid; + uint64_t time; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); + + /* + * Add process id, thread id, and a high resolution timestamp to + * ensure that the nonce is unique with high probability for + * different process instances. + */ + data.pid = getpid(); + data.tid = CRYPTO_THREAD_get_current_id(); + /*XXX: can this be improved? */ + data.time = time(NULL); + + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); +} + +int ossl_rand_pool_add_additional_data(RAND_POOL *pool) +{ + struct { + int fork_id; + CRYPTO_THREAD_ID tid; + uint64_t time; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); + + /* + * Add some noise from the thread id and a high resolution timer. + * The fork_id adds some extra fork-safety. + * The thread id adds a little randomness if the drbg is accessed + * concurrently (which is the case for the <master> drbg). + */ + data.fork_id = openssl_get_fork_id(); + data.tid = CRYPTO_THREAD_get_current_id(); + /*XXX: can this be improved? */ + data.time = (uint64_t) time(NULL); + + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); +} + +int ossl_rand_pool_init(void) +{ + return 1; +} + +void ossl_rand_pool_cleanup(void) +{ +} + +void ossl_rand_pool_keep_random_devices_open(int keep) +{ +} + +#endif /* OPENSSL_SYS_AMIGA */ diff --git a/sdk/recipes/files/openssl/ppc-amigaos/crypto/rand/rand_amiga.c b/sdk/recipes/files/openssl/ppc-amigaos/crypto/rand/rand_amiga.c deleted file mode 100644 index cd3f236..0000000 --- a/sdk/recipes/files/openssl/ppc-amigaos/crypto/rand/rand_amiga.c +++ /dev/null @@ -1,182 +0,0 @@ -#include <openssl/rand.h> -#include <openssl/sha.h> -#include "rand_lcl.h" - -#if defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) -#define __USE_INLINE__ 1 - -#include <proto/exec.h> -#include <proto/timer.h> -#include <devices/timer.h> - -/* Maximum number of attempts to get a delay of 1 microsecond that is not equal to 0 */ -#define MAX_ATTEMPTS 1000 - -#ifdef __amigaos4__ - -#ifdef CreateMsgPort -#undef CreateMsgPort -#endif -#define CreateMsgPort() AllocSysObject(ASOT_PORT,NULL) -#ifdef DeleteMsgPort -#undef DeleteMsgPort -#endif -#define DeleteMsgPort(msgPort) FreeSysObject(ASOT_PORT,msgPort) -#ifdef CreateIORequest -#undef CreateIORequest -#endif -#define CreateIORequest(ioReplyPort,size) AllocSysObjectTags(ASOT_IOREQUEST,ASOIOR_ReplyPort,ioReplyPort,ASOIOR_Size,size,TAG_DONE) -#ifdef DeleteIORequest -#undef DeleteIORequest -#endif -#define DeleteIORequest(ioReq) FreeSysObject(ASOT_IOREQUEST,ioReq) - -#else - -#define GetInterface(a, b, c, d) 1 -#define DropInterface(x) - -/* OS3 has a different but compatible TimeVal definition */ -struct TimeVal -{ - uint32 Seconds; - uint32 Microseconds; -}; - -#endif /* !__amigaos4__ */ - -int RAND_poll(void) -{ - unsigned char temp_buffer[SHA_DIGEST_LENGTH], data_buffer[SHA_DIGEST_LENGTH]; - struct MsgPort *port = NULL; - double entropy_added = 0; - struct TimeRequest *time_request = NULL; -#ifdef __amigaos4__ - struct IOStdReq *entropy_request = NULL; - - if ((port = CreateMsgPort()) - && (entropy_request = (struct IOStdReq *)CreateIORequest(port, sizeof(*entropy_request)))) - { - if (OpenDevice(TIMERNAME, UNIT_ENTROPY, (struct IORequest *)entropy_request, 0) == 0) - { - while(entropy_added < ENTROPY_NEEDED) - { - entropy_request->io_Command = TR_READENTROPY; - entropy_request->io_Data = &temp_buffer[0]; - entropy_request->io_Length = sizeof(temp_buffer); - - if (DoIO((struct IORequest *)entropy_request) == 0) - { - SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); - RAND_add(&data_buffer[0], sizeof(data_buffer), sizeof(data_buffer)); - entropy_added += sizeof(data_buffer); - } - else - break; - } - - CloseDevice((struct IORequest *)entropy_request); - } - } - - DeleteIORequest((struct IORequest *)entropy_request); -#endif /* __amigaos4__ */ - - /* The following block will be used on "classic" machines. It does not generate - * a high degree of randomness, but it does the job since RAND_poll is - * called only once by OpenSSL to generate a 32 byte seed. - */ - if (entropy_added < ENTROPY_NEEDED - && (port || (port = CreateMsgPort())) - && (time_request = (struct TimeRequest *)CreateIORequest(port, sizeof(*time_request)))) - { - if (OpenDevice(TIMERNAME, UNIT_VBLANK, (struct IORequest *)time_request, 0) == 0) - { - #if defined(__amigaos4__) - struct TimerIFace *ITimer = NULL; - #endif - struct Device *TimerBase; - - if ((TimerBase = time_request->Request.io_Device) - #if defined(__amigaos4__) - && (ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL)) - #endif - ) - { - struct EClockVal curr_eclock; - ULONG prev_ev_lo = 0; - struct TimeVal tv; - int i, attempt; - BOOL aborted; - - ReadEClock(&curr_eclock); - aborted = FALSE; - - while(!aborted && entropy_added < ENTROPY_NEEDED) - { - for(i = 0; - !aborted && i < (int)sizeof(temp_buffer) - (int)sizeof(ULONG); - i++) - { - attempt = 0; - - /* Ask for a one microsecond delay and measure the time - * the delay actually took. - */ - do - { - time_request->Request.io_Command = TR_ADDREQUEST; - time_request->Time.Seconds = 0; - time_request->Time.Microseconds = 1; - - if (DoIO((struct IORequest *)time_request) == 0) - { - prev_ev_lo = curr_eclock.ev_lo; - ReadEClock(&curr_eclock); - - attempt++; - } - else - aborted = TRUE; - } while(!aborted && prev_ev_lo == 0 && attempt < MAX_ATTEMPTS); - - if (attempt >= MAX_ATTEMPTS) - aborted = TRUE; - - /* Since we are going for randomness, ev_hi is irrelevant */ - temp_buffer[i] = (unsigned char)(curr_eclock.ev_lo - prev_ev_lo); - } - - GetSysTime(&tv); - - if (sizeof(temp_buffer) > sizeof(ULONG)) - *(ULONG *)&temp_buffer[sizeof(temp_buffer) - sizeof(ULONG)] - = tv.Microseconds; - - /* Shuffle the bits around and specify that about - * one fourth of it adds to the entropy. - */ - if (!aborted) - { - SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); - RAND_add(&data_buffer[0], sizeof(data_buffer), (double)sizeof(data_buffer) / 4); - entropy_added += sizeof(data_buffer) / 4; - } - } - } - - #if defined(__amigaos4__) - DropInterface((struct Interface *)ITimer); - #endif - CloseDevice((struct IORequest *)time_request); - } - } - - DeleteIORequest((struct IORequest *)time_request); - - DeleteMsgPort(port); - - return(entropy_added >= ENTROPY_NEEDED); -} - -#endif /* OPENSSL_SYS_AMIGA */ diff --git a/sdk/recipes/files/openssl/ppc-amigaos/providers/implementations/rands/seeding/rand_amiga.c b/sdk/recipes/files/openssl/ppc-amigaos/providers/implementations/rands/seeding/rand_amiga.c new file mode 100644 index 0000000..ed315ed --- /dev/null +++ b/sdk/recipes/files/openssl/ppc-amigaos/providers/implementations/rands/seeding/rand_amiga.c @@ -0,0 +1,275 @@ +#include "internal/cryptlib.h" +#include <openssl/rand.h> +#include <openssl/sha.h> +#include "crypto/rand_pool.h" +#include "crypto/rand.h" +#include "prov/seeding.h" + +#if defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) + +# ifndef OPENSSL_RAND_SEED_OS +# error "Unsupported seeding method configured; must be os" +# endif + +#define __USE_INLINE__ 1 + +#include <sys/types.h> +#include <time.h> +#include <unistd.h> + +#include <proto/exec.h> +#include <proto/timer.h> +#include <devices/timer.h> + +/* Maximum number of attempts to get a delay of 1 microsecond that is not equal to 0 */ +#define MAX_ATTEMPTS 1000 + +#ifdef __amigaos4__ + +#ifdef CreateMsgPort +#undef CreateMsgPort +#endif +#define CreateMsgPort() AllocSysObject(ASOT_PORT,NULL) +#ifdef DeleteMsgPort +#undef DeleteMsgPort +#endif +#define DeleteMsgPort(msgPort) FreeSysObject(ASOT_PORT,msgPort) +#ifdef CreateIORequest +#undef CreateIORequest +#endif +#define CreateIORequest(ioReplyPort,size) AllocSysObjectTags(ASOT_IOREQUEST,ASOIOR_ReplyPort,ioReplyPort,ASOIOR_Size,size,TAG_DONE) +#ifdef DeleteIORequest +#undef DeleteIORequest +#endif +#define DeleteIORequest(ioReq) FreeSysObject(ASOT_IOREQUEST,ioReq) + +#else + +#define GetInterface(a, b, c, d) 1 +#define DropInterface(x) + +/* OS3 has a different but compatible TimeVal definition */ +struct TimeVal +{ + uint32 Seconds; + uint32 Microseconds; +}; + +#endif /* !__amigaos4__ */ + +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) +{ + unsigned char temp_buffer[SHA_DIGEST_LENGTH], data_buffer[SHA_DIGEST_LENGTH]; + struct MsgPort *port = NULL; + size_t bytes_needed; + size_t entropy_available = 0; + struct TimeRequest *time_request = NULL; +#ifdef __amigaos4__ + struct IOStdReq *entropy_request = NULL; + + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); + + if ((port = CreateMsgPort()) + && (entropy_request = (struct IOStdReq *)CreateIORequest(port, sizeof(*entropy_request)))) + { + if (OpenDevice(TIMERNAME, UNIT_ENTROPY, (struct IORequest *)entropy_request, 0) == 0) + { + while(bytes_needed > 0) + { + entropy_request->io_Command = TR_READENTROPY; + entropy_request->io_Data = &temp_buffer[0]; + entropy_request->io_Length = sizeof(temp_buffer); + + if (DoIO((struct IORequest *)entropy_request) == 0) + { + unsigned char *buffer; + size_t bytes = (bytes_needed < sizeof(data_buffer) ? bytes_needed : sizeof(data_buffer)); + + buffer = ossl_rand_pool_add_begin(pool, bytes_needed); + SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); + memcpy(buffer, data_buffer, bytes); + ossl_rand_pool_add_end(pool, bytes, 8 * bytes); + bytes_needed -= bytes; + } + else + break; + } + + CloseDevice((struct IORequest *)entropy_request); + } + } + + DeleteIORequest((struct IORequest *)entropy_request); + + entropy_available = ossl_rand_pool_entropy_available(pool); + if (entropy_available > 0) + return entropy_available; +#endif /* __amigaos4__ */ + + /* The following block will be used on "classic" machines. It does not generate + * a high degree of randomness, but it does the job since RAND_poll is + * called only once by OpenSSL to generate a 32 byte seed. + */ + + bytes_needed = ossl_rand_pool_bytes_needed(pool, 1); + + if (bytes_needed > 0 + && (port || (port = CreateMsgPort())) + && (time_request = (struct TimeRequest *)CreateIORequest(port, sizeof(*time_request)))) + { + if (OpenDevice(TIMERNAME, UNIT_VBLANK, (struct IORequest *)time_request, 0) == 0) + { + #if defined(__amigaos4__) + struct TimerIFace *ITimer = NULL; + #endif + struct Device *TimerBase; + + if ((TimerBase = time_request->Request.io_Device) + #if defined(__amigaos4__) + && (ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL)) + #endif + ) + { + struct EClockVal curr_eclock; + ULONG prev_ev_lo = 0; + struct TimeVal tv; + int i, attempt; + BOOL aborted; + + ReadEClock(&curr_eclock); + aborted = FALSE; + + while(!aborted && bytes_needed > 0) + { + for(i = 0; + !aborted && i < (int)sizeof(temp_buffer) - (int)sizeof(ULONG); + i++) + { + attempt = 0; + + /* Ask for a one microsecond delay and measure the time + * the delay actually took. + */ + do + { + time_request->Request.io_Command = TR_ADDREQUEST; + time_request->Time.Seconds = 0; + time_request->Time.Microseconds = 1; + + if (DoIO((struct IORequest *)time_request) == 0) + { + prev_ev_lo = curr_eclock.ev_lo; + ReadEClock(&curr_eclock); + + attempt++; + } + else + aborted = TRUE; + } while(!aborted && prev_ev_lo == 0 && attempt < MAX_ATTEMPTS); + + if (attempt >= MAX_ATTEMPTS) + aborted = TRUE; + + /* Since we are going for randomness, ev_hi is irrelevant */ + temp_buffer[i] = (unsigned char)(curr_eclock.ev_lo - prev_ev_lo); + } + + GetSysTime(&tv); + + if (sizeof(temp_buffer) > sizeof(ULONG)) + *(ULONG *)&temp_buffer[sizeof(temp_buffer) - sizeof(ULONG)] + = tv.Microseconds; + + /* Shuffle the bits around and specify that about + * one fourth of it adds to the entropy. + */ + if (!aborted) + { + unsigned char *buffer; + size_t bytes = (bytes_needed < sizeof(data_buffer) ? bytes_needed : sizeof(data_buffer)); + + SHA1(&temp_buffer[0], sizeof(temp_buffer), &data_buffer[0]); + + ossl_rand_pool_add_end(pool, bytes, (sizeof(data_buffer) / 4) * 8); + bytes_needed -= bytes; + } + } + } + + #if defined(__amigaos4__) + DropInterface((struct Interface *)ITimer); + #endif + CloseDevice((struct IORequest *)time_request); + } + } + + DeleteIORequest((struct IORequest *)time_request); + + DeleteMsgPort(port); + + return ossl_rand_pool_entropy_available(pool); +} + +int ossl_pool_add_nonce_data(RAND_POOL *pool) +{ + struct { + pid_t pid; + CRYPTO_THREAD_ID tid; + uint64_t time; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); + + /* + * Add process id, thread id, and a high resolution timestamp to + * ensure that the nonce is unique with high probability for + * different process instances. + */ + data.pid = getpid(); + data.tid = CRYPTO_THREAD_get_current_id(); + /*XXX: can this be improved? */ + data.time = time(NULL); + + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); +} + +int ossl_rand_pool_add_additional_data(RAND_POOL *pool) +{ + struct { + int fork_id; + CRYPTO_THREAD_ID tid; + uint64_t time; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); + + /* + * Add some noise from the thread id and a high resolution timer. + * The fork_id adds some extra fork-safety. + * The thread id adds a little randomness if the drbg is accessed + * concurrently (which is the case for the <master> drbg). + */ + data.fork_id = openssl_get_fork_id(); + data.tid = CRYPTO_THREAD_get_current_id(); + /*XXX: can this be improved? */ + data.time = (uint64_t) time(NULL); + + return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); +} + +int ossl_rand_pool_init(void) +{ + return 1; +} + +void ossl_rand_pool_cleanup(void) +{ +} + +void ossl_rand_pool_keep_random_devices_open(int keep) +{ +} + +#endif /* OPENSSL_SYS_AMIGA */ diff --git a/sdk/recipes/patches/libcares/m5475-atari-mint/config.sub.p b/sdk/recipes/patches/libcares/m5475-atari-mint/config.sub.p new file mode 100644 index 0000000..a681d0a --- /dev/null +++ b/sdk/recipes/patches/libcares/m5475-atari-mint/config.sub.p @@ -0,0 +1,11 @@ +--- config.sub.orig 2023-10-01 08:53:00.740777146 +0100 ++++ config.sub 2023-10-01 08:59:22.657161841 +0100 +@@ -1209,7 +1209,7 @@ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ +- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ ++ | m5200 | m5475 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ diff --git a/sdk/recipes/patches/libcares/m68k-atari-mint/configure.p b/sdk/recipes/patches/libcares/m68k-atari-mint/configure.p deleted file mode 100644 index 254a483..0000000 --- a/sdk/recipes/patches/libcares/m68k-atari-mint/configure.p +++ /dev/null @@ -1,11 +0,0 @@ ---- configure.orig 2011-03-08 23:18:37.000000000 +0000 -+++ configure 2011-03-08 23:18:59.000000000 +0000 -@@ -18503,8 +18503,6 @@ - stdbool.h \ - time.h \ - limits.h \ -- arpa/nameser.h \ -- arpa/nameser_compat.h \ - arpa/inet.h - do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` diff --git a/sdk/recipes/patches/libcares/m68k-unknown-amigaos/ipv6-support.p b/sdk/recipes/patches/libcares/m68k-unknown-amigaos/ipv6-support.p new file mode 100644 index 0000000..ce60c44 --- /dev/null +++ b/sdk/recipes/patches/libcares/m68k-unknown-amigaos/ipv6-support.p @@ -0,0 +1,71 @@ +--- src/lib/ares_ipv6.h.orig 2017-10-10 15:19:45.611896396 +0100 ++++ src/lib/ares_ipv6.h 2017-10-17 15:42:25.304921197 +0100 +@@ -32,6 +32,11 @@ + #endif + ++#ifndef INET6_ADDRSTRLEN ++#define INET6_ADDRSTRLEN 46 ++#endif ++ + #ifndef HAVE_STRUCT_SOCKADDR_IN6 ++#define s6_addr _S6_un._S6_u8 + struct sockaddr_in6 { + unsigned short sin6_family; + unsigned short sin6_port; +--- src/lib/ares__sortaddrinfo.c.orig 2017-10-10 15:19:45.611896396 +0100 ++++ src/lib/ares__sortaddrinfo.c 2017-10-17 15:42:25.304921197 +0100 +@@ -73,6 +73,40 @@ + #define ARES_IN_LOOPBACK(a) \ + ((((long unsigned int)(a)) & 0xff000000) == 0x7f000000) + ++#include <inttypes.h> ++#ifndef IN6_IS_ADDR_LINKLOCAL ++#define IN6_IS_ADDR_LINKLOCAL(a) \ ++ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ ++ == htonl (0xfe800000)) ++#endif ++#ifndef IN6_IS_ADDR_LOOPBACK ++#define IN6_IS_ADDR_LOOPBACK(a) \ ++ (((__const uint32_t *) (a))[0] == 0 \ ++ && ((__const uint32_t *) (a))[1] == 0 \ ++ && ((__const uint32_t *) (a))[2] == 0 \ ++ && ((__const uint32_t *) (a))[3] == htonl (1)) ++#endif ++#ifndef IN6_IS_ADDR_MULTICAST ++#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) ++#endif ++#ifndef IN6_IS_ADDR_SITELOCAL ++#define IN6_IS_ADDR_SITELOCAL(a) \ ++ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ ++ == htonl (0xfec00000)) ++#endif ++#ifndef IN6_IS_ADDR_V4COMPAT ++#define IN6_IS_ADDR_V4COMPAT(a) \ ++ ((((__const uint32_t *) (a))[0] == 0) \ ++ && (((__const uint32_t *) (a))[1] == 0) \ ++ && (((__const uint32_t *) (a))[2] == 0) \ ++ && (ntohl (((__const uint32_t *) (a))[3]) > 1)) ++#endif ++#ifndef IN6_IS_ADDR_V4MAPPED ++#define IN6_IS_ADDR_V4MAPPED(a) \ ++ ((((__const uint32_t *) (a))[0] == 0) \ ++ && (((__const uint32_t *) (a))[1] == 0) \ ++ && (((__const uint32_t *) (a))[2] == htonl (0xffff))) ++#endif + /* RFC 4193. */ + #define ARES_IN6_IS_ADDR_ULA(a) (((a)->s6_addr[0] & 0xfe) == 0xfc) + +@@ -205,8 +239,13 @@ + /* + * Find number of matching initial bits between the two addresses a1 and a2. + */ ++#ifndef HAVE_STRUCT_SOCKADDR_IN6 ++static size_t common_prefix_len(const struct ares_in6_addr *a1, ++ const struct ares_in6_addr *a2) ++#else + static size_t common_prefix_len(const struct in6_addr *a1, + const struct in6_addr *a2) ++#endif + { + const unsigned char *p1 = (const unsigned char *)a1; + const unsigned char *p2 = (const unsigned char *)a2; diff --git a/sdk/recipes/patches/libcares/ppc-amigaos/configure.p b/sdk/recipes/patches/libcares/ppc-amigaos/configure.p deleted file mode 100644 index 254a483..0000000 --- a/sdk/recipes/patches/libcares/ppc-amigaos/configure.p +++ /dev/null @@ -1,11 +0,0 @@ ---- configure.orig 2011-03-08 23:18:37.000000000 +0000 -+++ configure 2011-03-08 23:18:59.000000000 +0000 -@@ -18503,8 +18503,6 @@ - stdbool.h \ - time.h \ - limits.h \ -- arpa/nameser.h \ -- arpa/nameser_compat.h \ - arpa/inet.h - do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` diff --git a/sdk/recipes/patches/libcares/ppc-amigaos/ipv6-support.p b/sdk/recipes/patches/libcares/ppc-amigaos/ipv6-support.p new file mode 100644 index 0000000..f34fb45 --- /dev/null +++ b/sdk/recipes/patches/libcares/ppc-amigaos/ipv6-support.p @@ -0,0 +1,70 @@ +--- src/lib/ares_ipv6.h.orig 2017-10-10 15:19:45.611896396 +0100 ++++ src/lib/ares_ipv6.h 2017-10-17 15:42:25.304921197 +0100 +@@ -32,6 +32,11 @@ + #endif + ++#ifndef INET6_ADDRSTRLEN ++#define INET6_ADDRSTRLEN 46 ++#endif ++ + #ifndef HAVE_STRUCT_SOCKADDR_IN6 ++#define s6_addr _S6_un._S6_u8 + struct sockaddr_in6 { + unsigned short sin6_family; + unsigned short sin6_port; +--- src/lib/ares__sortaddrinfo.c.orig 2017-10-10 15:19:45.611896396 +0100 ++++ src/lib/ares__sortaddrinfo.c 2017-10-17 15:42:25.304921197 +0100 +@@ -73,6 +73,39 @@ + #define ARES_IN_LOOPBACK(a) \ + ((((long unsigned int)(a)) & 0xff000000) == 0x7f000000) + ++#ifndef IN6_IS_ADDR_LINKLOCAL ++#define IN6_IS_ADDR_LINKLOCAL(a) \ ++ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ ++ == htonl (0xfe800000)) ++#endif ++#ifndef IN6_IS_ADDR_LOOPBACK ++#define IN6_IS_ADDR_LOOPBACK(a) \ ++ (((__const uint32_t *) (a))[0] == 0 \ ++ && ((__const uint32_t *) (a))[1] == 0 \ ++ && ((__const uint32_t *) (a))[2] == 0 \ ++ && ((__const uint32_t *) (a))[3] == htonl (1)) ++#endif ++#ifndef IN6_IS_ADDR_MULTICAST ++#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) ++#endif ++#ifndef IN6_IS_ADDR_SITELOCAL ++#define IN6_IS_ADDR_SITELOCAL(a) \ ++ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ ++ == htonl (0xfec00000)) ++#endif ++#ifndef IN6_IS_ADDR_V4COMPAT ++#define IN6_IS_ADDR_V4COMPAT(a) \ ++ ((((__const uint32_t *) (a))[0] == 0) \ ++ && (((__const uint32_t *) (a))[1] == 0) \ ++ && (((__const uint32_t *) (a))[2] == 0) \ ++ && (ntohl (((__const uint32_t *) (a))[3]) > 1)) ++#endif ++#ifndef IN6_IS_ADDR_V4MAPPED ++#define IN6_IS_ADDR_V4MAPPED(a) \ ++ ((((__const uint32_t *) (a))[0] == 0) \ ++ && (((__const uint32_t *) (a))[1] == 0) \ ++ && (((__const uint32_t *) (a))[2] == htonl (0xffff))) ++#endif + /* RFC 4193. */ + #define ARES_IN6_IS_ADDR_ULA(a) (((a)->s6_addr[0] & 0xfe) == 0xfc) + +@@ -205,8 +238,13 @@ + /* + * Find number of matching initial bits between the two addresses a1 and a2. + */ ++#ifndef HAVE_STRUCT_SOCKADDR_IN6 ++static size_t common_prefix_len(const struct ares_in6_addr *a1, ++ const struct ares_in6_addr *a2) ++#else + static size_t common_prefix_len(const struct in6_addr *a1, + const struct in6_addr *a2) ++#endif + { + const unsigned char *p1 = (const unsigned char *)a1; + const unsigned char *p2 = (const unsigned char *)a2; diff --git a/sdk/recipes/patches/libcurl/m5475-atari-mint/config.sub.p b/sdk/recipes/patches/libcurl/m5475-atari-mint/config.sub.p new file mode 100644 index 0000000..a681d0a --- /dev/null +++ b/sdk/recipes/patches/libcurl/m5475-atari-mint/config.sub.p @@ -0,0 +1,11 @@ +--- config.sub.orig 2023-10-01 08:53:00.740777146 +0100 ++++ config.sub 2023-10-01 08:59:22.657161841 +0100 +@@ -1209,7 +1209,7 @@ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ +- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ ++ | m5200 | m5475 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ diff --git a/sdk/recipes/patches/libcurl/m68k-unknown-amigaos/lib.curl_setup.h.p b/sdk/recipes/patches/libcurl/m68k-unknown-amigaos/lib.curl_setup.h.p new file mode 100644 index 0000000..ba595ca --- /dev/null +++ b/sdk/recipes/patches/libcurl/m68k-unknown-amigaos/lib.curl_setup.h.p @@ -0,0 +1,10 @@ +--- lib/curl_setup.h.orig 2017-10-10 15:19:45.611896396 +0100 ++++ lib/curl_setup.h 2017-10-17 15:42:25.304921197 +0100 +@@ -314,7 +314,6 @@ + * In clib2 arpa/inet.h warns that some prototypes may clash + * with bsdsocket.library. This avoids the definition of those. + */ +-# define __NO_NET_API + #endif + + #include <stdio.h> diff --git a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.c.p b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.c.p index 5243fc5..384bcd5 100644 --- a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.c.p +++ b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.c.p @@ -1,20 +1,12 @@ ---- lib/amigaos.c 2019-03-25 08:42:50.000000000 +0000 -+++ lib/amigaos.c 2019-03-30 12:49:06.680985341 +0000 -@@ -24,7 +24,7 @@ +--- lib/amigaos.c.orig 2017-10-10 15:19:45.611896396 +0100 ++++ lib/amigaos.c 2017-10-17 15:42:25.304921197 +0100 +@@ -86,7 +86,9 @@ + ULONG enabled = 0; - #ifdef __AMIGA__ - # include "amigaos.h" --# if defined(HAVE_PROTO_BSDSOCKET_H) && !defined(USE_AMISSL) -+# if 0 - # include <amitcp/socketbasetags.h> - # endif - # ifdef __libnix__ -@@ -37,7 +37,7 @@ - #include "memdebug.h" - - #ifdef __AMIGA__ --#if defined(HAVE_PROTO_BSDSOCKET_H) && !defined(USE_AMISSL) -+#if 0 - struct Library *SocketBase = NULL; - extern int errno, h_errno; + SocketBaseTags(SBTM_SETVAL(SBTC_CAN_SHARE_LIBRARY_BASES), TRUE, ++#ifdef SBTC_HAVE_GETHOSTADDR_R_API + SBTM_GETREF(SBTC_HAVE_GETHOSTADDR_R_API), (ULONG)&enabled, ++#endif + TAG_DONE); + if(enabled) { diff --git a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.h.p b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.h.p deleted file mode 100644 index 2f62a1c..0000000 --- a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.amigaos.h.p +++ /dev/null @@ -1,11 +0,0 @@ ---- lib/amigaos.h 2019-03-25 08:42:50.000000000 +0000 -+++ lib/amigaos.h 2019-03-30 12:49:50.744493740 +0000 -@@ -23,7 +23,7 @@ - ***************************************************************************/ - #include "curl_setup.h" - --#if defined(__AMIGA__) && defined(HAVE_BSDSOCKET_H) && !defined(USE_AMISSL) -+#if 0 - - bool Curl_amiga_init(); - void Curl_amiga_cleanup(); diff --git a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.curl_setup.h.p b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.curl_setup.h.p deleted file mode 100644 index 0e52d73..0000000 --- a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.curl_setup.h.p +++ /dev/null @@ -1,12 +0,0 @@ ---- lib/curl_setup.h 2019-03-30 13:44:08.576270700 +0000 -+++ lib/curl_setup.h 2019-03-30 13:44:33.011975643 +0000 -@@ -314,7 +314,8 @@ - # include <exec/execbase.h> - # include <proto/exec.h> - # include <proto/dos.h> --# ifdef HAVE_PROTO_BSDSOCKET_H -+# define HAVE_SELECT 1 -+# if 0 - # include <proto/bsdsocket.h> /* ensure bsdsocket.library use */ - # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) - # endif diff --git a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p b/sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p deleted file mode 100644 index 39952b8..0000000 --- a/sdk/recipes/patches/libcurl/ppc-amigaos/lib.hostip4.c.p +++ /dev/null @@ -1,60 +0,0 @@ ---- lib/hostip4.c 2020-01-05 09:50:51.000000000 +0000 -+++ lib/hostip4.c 2020-05-07 16:02:59.313823259 +0100 -@@ -120,6 +120,10 @@ Curl_addrinfo *Curl_getaddrinfo(struct c - * implying that only threadsafe code and function calls may be used. - * - */ -+#ifdef __amigaos4__ -+#include <proto/exec.h> -+#include <proto/bsdsocket.h> -+#endif - Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, - int port) - { -@@ -130,6 +134,9 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const - struct hostent *h = NULL; - struct in_addr in; - struct hostent *buf = NULL; -+#ifdef __amigaos4__ -+ struct SocketIFace *ISocket = NULL; -+#endif - - #ifdef ENABLE_IPV6 - { -@@ -302,7 +309,20 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const - * gethostbyname() is the preferred one. - */ - else { -+#ifdef __amigaos4__ -+ struct Library *SocketBase = IExec->OpenLibrary("bsdsocket.library", 4); -+ if (SocketBase) -+ { -+ ISocket = (struct SocketIFace *)IExec->GetInterface(SocketBase, "main", 1, NULL); -+ } -+ -+ if (ISocket) -+ { -+ h = ISocket->gethostbyname((void*)hostname); -+ } -+#else - h = gethostbyname((void *)hostname); -+#endif - #endif /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */ - } - -@@ -312,7 +332,14 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const - if(buf) /* used a *_r() function */ - free(buf); - } -- -+#ifdef __amigaos4__ -+ if (ISocket) -+ { -+ struct Library *SocketBase = ISocket->Data.LibBase; -+ IExec->DropInterface((struct Interface *)ISocket); -+ IExec->CloseLibrary(SocketBase); -+ } -+#endif - return ai; - } - #endif /* defined(CURLRES_IPV4) && !defined(CURLRES_ARES) */ diff --git a/sdk/recipes/patches/libexpat/m5475-atari-mint/conftools.config.sub.p b/sdk/recipes/patches/libexpat/m5475-atari-mint/conftools.config.sub.p new file mode 100644 index 0000000..90e61b1 --- /dev/null +++ b/sdk/recipes/patches/libexpat/m5475-atari-mint/conftools.config.sub.p @@ -0,0 +1,11 @@ +--- conftools/config.sub.orig 2023-10-01 08:53:00.740777146 +0100 ++++ conftools/config.sub 2023-10-01 08:59:22.657161841 +0100 +@@ -1209,7 +1209,7 @@ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ +- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ ++ | m5200 | m5475 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ diff --git a/sdk/recipes/patches/libexpat/m68k-unknown-amigaos/xmlwf.xmltchar.h.p b/sdk/recipes/patches/libexpat/m68k-unknown-amigaos/xmlwf.xmltchar.h.p new file mode 100644 index 0000000..c9da0e8 --- /dev/null +++ b/sdk/recipes/patches/libexpat/m68k-unknown-amigaos/xmlwf.xmltchar.h.p @@ -0,0 +1,9 @@ +--- xmlwf/xmltchar.h.orig 2017-10-10 15:19:45.611896396 +0100 ++++ xmlwf/xmltchar.h 2017-10-17 15:42:25.304921197 +0100 +@@ -75,5 +75,5 @@ + # define tremove remove + # define tchar char + # define tcstof strtof +-# define tcstoull strtoull ++# define tcstoull strtoul + #endif /* not XML_UNICODE */ diff --git a/sdk/recipes/patches/libiconv/libcharset.lib.localcharset.c.p b/sdk/recipes/patches/libiconv/libcharset.lib.localcharset.c.p index b456c94..3296a6e 100644 --- a/sdk/recipes/patches/libiconv/libcharset.lib.localcharset.c.p +++ b/sdk/recipes/patches/libiconv/libcharset.lib.localcharset.c.p @@ -1,6 +1,6 @@ --- libcharset/lib/localcharset.c.old 2010-12-29 19:12:21.000000000 +0000 +++ libcharset/lib/localcharset.c 2010-12-29 19:12:49.000000000 +0000 -@@ -352,9 +352,6 @@ +@@ -824,9 +824,6 @@ If the canonical name cannot be determined, the result is a non-canonical name. */ diff --git a/sdk/recipes/patches/libiconv/m5475-atari-mint/build-aux.config.sub.p b/sdk/recipes/patches/libiconv/m5475-atari-mint/build-aux.config.sub.p new file mode 100644 index 0000000..9bacbb8 --- /dev/null +++ b/sdk/recipes/patches/libiconv/m5475-atari-mint/build-aux.config.sub.p @@ -0,0 +1,11 @@ +--- build-aux/config.sub.orig 2023-10-01 08:53:00.740777146 +0100 ++++ build-aux/config.sub 2023-10-01 08:59:22.657161841 +0100 +@@ -1209,7 +1209,7 @@ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ +- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ ++ | m5200 | m5475 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ diff --git a/sdk/recipes/patches/libiconv/m5475-atari-mint/libcharset.build-aux.config.sub.p b/sdk/recipes/patches/libiconv/m5475-atari-mint/libcharset.build-aux.config.sub.p new file mode 100644 index 0000000..d615e13 --- /dev/null +++ b/sdk/recipes/patches/libiconv/m5475-atari-mint/libcharset.build-aux.config.sub.p @@ -0,0 +1,11 @@ +--- libcharset/build-aux/config.sub.orig 2023-10-01 08:53:00.740777146 +0100 ++++ libcharset/build-aux/config.sub 2023-10-01 08:59:22.657161841 +0100 +@@ -1209,7 +1209,7 @@ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ +- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ ++ | m5200 | m5475 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ diff --git a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.getprogname.c.p b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.getprogname.c.p index 314a4b1..ac19b03 100644 --- a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.getprogname.c.p +++ b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.getprogname.c.p @@ -1,11 +1,11 @@ --- srclib/getprogname.c 2019-04-26 19:29:00.000000000 +0100 +++ srclib/getprogname.c 2020-03-06 19:32:44.157018596 +0000 -@@ -245,7 +245,7 @@ getprogname (void) +@@ -288,7 +288,7 @@ getprogname (void) } - return NULL; + return "?"; # else -# error "getprogname module not ported to this OS" -+ const char *p = ""; /* this is never used for anything important */ ++ return ""; /* this is never used for anything important */ # endif } diff --git a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.signal.in.h.p b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.signal.in.h.p index 8647b83..0102857 100644 --- a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.signal.in.h.p +++ b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.signal.in.h.p @@ -1,6 +1,6 @@ --- srclib/signal.in.h 2017-01-01 23:02:22.000000000 +0000 +++ srclib/signal.in.h 2017-03-26 22:56:18.360017409 +0100 -@@ -211,69 +211,6 @@ typedef int verify_NSIG_constraint[NSIG +@@ -223,69 +223,6 @@ typedef int verify_NSIG_constraint[NSIG # undef sigismember #endif diff --git a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.sigprocmask.c.p b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.sigprocmask.c.p index a811881..fbf554a 100644 --- a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.sigprocmask.c.p +++ b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.sigprocmask.c.p @@ -1,6 +1,6 @@ --- srclib/sigprocmask.c.orig 2011-08-07 14:42:06.000000000 +0100 +++ srclib/sigprocmask.c 2014-01-15 00:59:33.130968152 +0000 -@@ -83,77 +83,6 @@ +@@ -110,77 +110,6 @@ # define signal ext_signal #endif diff --git a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.time.in.h.p b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.time.in.h.p index 1ea2d0e..0d10bce 100644 --- a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.time.in.h.p +++ b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.time.in.h.p @@ -1,6 +1,6 @@ --- srclib/time.in.h 2019-01-06 08:51:41.000000000 +0000 +++ srclib/time.in.h 2020-03-06 19:46:37.429016156 +0000 -@@ -70,7 +70,7 @@ extern "C" { +@@ -76,7 +76,7 @@ extern "C" { # define timespec rpl_timespec struct timespec { diff --git a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.unistd.in.h.p b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.unistd.in.h.p index 2e1cf5e..a70f0b5 100644 --- a/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.unistd.in.h.p +++ b/sdk/recipes/patches/libiconv/m68k-unknown-amigaos/srclib.unistd.in.h.p @@ -1,6 +1,6 @@ --- srclib/unistd.in.h.orig 2017-03-27 23:12:52.149619622 +0100 +++ srclib/unistd.in.h 2017-03-27 23:13:12.582243962 +0100 -@@ -1262,40 +1262,6 @@ +@@ -1873,44 +1873,6 @@ #endif @@ -9,24 +9,28 @@ - bytes of it into BUF. Return the number of bytes placed into BUF if - successful, otherwise -1 and errno set. - See the POSIX:2008 specification -- <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ +- <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ -# if @REPLACE_READLINK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define readlink rpl_readlink -# endif -_GL_FUNCDECL_RPL (readlink, ssize_t, -- (const char *file, char *buf, size_t bufsize) +- (const char *restrict file, +- char *restrict buf, size_t bufsize) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (readlink, ssize_t, -- (const char *file, char *buf, size_t bufsize)); +- (const char *restrict file, +- char *restrict buf, size_t bufsize)); -# else -# if !@HAVE_READLINK@ -_GL_FUNCDECL_SYS (readlink, ssize_t, -- (const char *file, char *buf, size_t bufsize) +- (const char *restrict file, +- char *restrict buf, size_t bufsize) - _GL_ARG_NONNULL ((1, 2))); -# endif -_GL_CXXALIAS_SYS (readlink, ssize_t, -- (const char *file, char *buf, size_t bufsize)); +- (const char *restrict file, +- char *restrict buf, size_t bufsize)); -# endif -_GL_CXXALIASWARN (readlink); -#elif defined GNULIB_POSIXCHECK diff --git a/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.getprogname.c.p b/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.getprogname.c.p index 314a4b1..ac19b03 100644 --- a/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.getprogname.c.p +++ b/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.getprogname.c.p @@ -1,11 +1,11 @@ --- srclib/getprogname.c 2019-04-26 19:29:00.000000000 +0100 +++ srclib/getprogname.c 2020-03-06 19:32:44.157018596 +0000 -@@ -245,7 +245,7 @@ getprogname (void) +@@ -288,7 +288,7 @@ getprogname (void) } - return NULL; + return "?"; # else -# error "getprogname module not ported to this OS" -+ const char *p = ""; /* this is never used for anything important */ ++ return ""; /* this is never used for anything important */ # endif } diff --git a/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.signal.in.h.p b/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.signal.in.h.p index 8647b83..0102857 100644 --- a/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.signal.in.h.p +++ b/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.signal.in.h.p @@ -1,6 +1,6 @@ --- srclib/signal.in.h 2017-01-01 23:02:22.000000000 +0000 +++ srclib/signal.in.h 2017-03-26 22:56:18.360017409 +0100 -@@ -211,69 +211,6 @@ typedef int verify_NSIG_constraint[NSIG +@@ -223,69 +223,6 @@ typedef int verify_NSIG_constraint[NSIG # undef sigismember #endif diff --git a/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.sigprocmask.c.p b/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.sigprocmask.c.p index a811881..fbf554a 100644 --- a/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.sigprocmask.c.p +++ b/sdk/recipes/patches/libiconv/ppc-amigaos/srclib.sigprocmask.c.p @@ -1,6 +1,6 @@ --- srclib/sigprocmask.c.orig 2011-08-07 14:42:06.000000000 +0100 +++ srclib/sigprocmask.c 2014-01-15 00:59:33.130968152 +0000 -@@ -83,77 +83,6 @@ +@@ -110,77 +110,6 @@ # define signal ext_signal #endif diff --git a/sdk/recipes/patches/libpng/m5475-atari-mint/config.sub.p b/sdk/recipes/patches/libpng/m5475-atari-mint/config.sub.p new file mode 100644 index 0000000..a681d0a --- /dev/null +++ b/sdk/recipes/patches/libpng/m5475-atari-mint/config.sub.p @@ -0,0 +1,11 @@ +--- config.sub.orig 2023-10-01 08:53:00.740777146 +0100 ++++ config.sub 2023-10-01 08:59:22.657161841 +0100 +@@ -1209,7 +1209,7 @@ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ +- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ ++ | m5200 | m5475 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ diff --git a/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p b/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p index 3012ad2..26bb873 100644 --- a/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p +++ b/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p @@ -1,16 +1,17 @@ --- /dev/null 2017-10-10 15:19:45.611896396 +0100 +++ Configurations/50-amigaos.conf 2017-10-17 15:42:25.304921197 +0100 -@@ -0,0 +1,31 @@ -+%targets = ( +@@ -0,0 +1,32 @@ ++my %targets = ( + + "ppc-amigaos" => { -+ inherit_from => [ "BASE_unix", asm("ppc32_asm") ], ++ inherit_from => [ "BASE_unix" ], + cc => "ppc-amigaos-gcc", + cflags => picker(default => "-DB_ENDIAN -DTERMIOS -DNO_SYS_UN_H -DNO_SYSLOG", + debug => "-O0 -g", + release => "-O3 -fomit-frame-pointer", -+ threads("-D_REENTRANT")), ++ threads("-D_REENTRANT")), + thread_scheme => "(unknown)", ++ asm_arch => "ppc32", + perlasm_scheme => "linux32", + sys_id => "AMIGAOS4", + bn_ops => "THIRTY_TWO_BIT BN_LLONG RC4_CHAR", @@ -23,7 +24,7 @@ + cflags => picker(default => "-DB_ENDIAN -DTERMIOS -DNO_SYS_UN_H -DNO_SYS_PARAM_H -DNO_SYSLOG -m68020 -std=gnu99", + debug => "-O0 -g", + release => "-O3 -fomit-frame-pointer", -+ threads("-D_REENTRANT")), ++ threads("-D_REENTRANT")), + thread_scheme => "(unknown)", + ex_libs => add("-lm -lnet"), + sys_id => "AMIGAOS3", diff --git a/sdk/recipes/patches/openssl/Configurations-50-atari.conf.p b/sdk/recipes/patches/openssl/Configurations-50-atari.conf.p index b5a55dd..d9c51be 100644 --- a/sdk/recipes/patches/openssl/Configurations-50-atari.conf.p +++ b/sdk/recipes/patches/openssl/Configurations-50-atari.conf.p @@ -1,7 +1,7 @@ --- /dev/null 2018-06-01 10:46:49.956110101 +0200 +++ Configurations/50-atari.conf 2018-06-03 03:10:55.000000000 +0200 @@ -0,0 +1,42 @@ -+%targets = ( ++my %targets = ( + "atari-common" => { + inherit_from => [ "BASE_unix" ], + template => 1, diff --git a/sdk/recipes/patches/openssl/Configurations-50-riscos.conf.p b/sdk/recipes/patches/openssl/Configurations-50-riscos.conf.p index 128d400..c3f2fe5 100644 --- a/sdk/recipes/patches/openssl/Configurations-50-riscos.conf.p +++ b/sdk/recipes/patches/openssl/Configurations-50-riscos.conf.p @@ -1,7 +1,7 @@ --- /dev/null 2017-10-10 15:19:45.611896396 +0100 +++ Configurations/50-riscos.conf 2017-10-17 15:42:25.304921197 +0100 -@@ -0,0 +1,14 @@ -+%targets = ( +@@ -0,0 +1,26 @@ ++my %targets = ( + + "arm-unknown-riscos" => { + inherit_from => [ "BASE_unix" ], @@ -14,4 +14,16 @@ + sys_id => "RISCOS", + bn_ops => "BN_LLONG", + }, ++ ++ "arm-riscos-gnueabi" => { ++ inherit_from => [ "BASE_unix" ], ++ cc => "arm-riscos-gnueabi-gcc", ++ cflags => picker(default => "-DL_ENDIAN -DTERMIOS -DNO_SYS_UN_H", ++ debug => "-O0 -g", ++ release => "-O3 ", ++ threads("-D_REENTRANT")), ++ thread_scheme => "(unknown)", ++ sys_id => "RISCOS", ++ bn_ops => "BN_LLONG", ++ }, +); diff --git a/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p b/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p index c492c01..fafa6cf 100644 --- a/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p +++ b/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p @@ -1,20 +1,21 @@ --- /dev/null 2017-10-10 15:19:45.611896396 +0100 +++ Configurations/50-windows.conf 2017-10-17 15:42:25.304921197 +0100 -@@ -0,0 +1,25 @@ -+%targets = ( +@@ -0,0 +1,26 @@ ++my %targets = ( + + "i686-w64-mingw32" => { -+ inherit_from => [ "BASE_unix", asm("x86_asm"), -+ sub { $disabled{shared} ? () : "x86_uplink" } ], ++ inherit_from => [ "BASE_unix", ++ sub { $disabled{shared} ? () : "x86_uplink" } ], + cc => "gcc", + cflags => combine(picker(default => "-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -m32 -Wall", -+ debug => "-g -O0", ++ debug => "-g -O0", + release => "-O3 -fomit-frame-pointer"), + threads("-D_MT")), + sys_id => "MINGW32", + ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"), + bn_ops => "BN_LLONG EXPORT_VAR_AS_FN", + thread_scheme => "winthreads", ++ asm_arch => "x86", + perlasm_scheme => "coff", + dso_scheme => "win32", + shared_target => "mingw-shared", diff --git a/sdk/recipes/patches/openssl/Configure.p b/sdk/recipes/patches/openssl/Configure.p index c26e08b..aff7878 100644 --- a/sdk/recipes/patches/openssl/Configure.p +++ b/sdk/recipes/patches/openssl/Configure.p @@ -1,10 +1,11 @@ --- Configure.orig 2017-10-17 14:53:18.369801491 +0100 +++ Configure 2017-10-17 15:11:04.312242542 +0100 -@@ -946,6 +946,7 @@ - $target{exe_extension}=".exe" if ($config{target} eq "DJGPP" - || $config{target} =~ /^(?:Cygwin|mingw)/); +@@ -1329,6 +1329,8 @@ + $target{cxxflags}//=$target{cflags} if $target{CXX}; + $target{exe_extension}=".exe" if ($config{target} eq "DJGPP"); $target{exe_extension}=".pm" if ($config{target} =~ /vos/); ++$target{exe_extension}=",e1f" if ($config{target} eq "arm-riscos-gnueabi"); +$target{exe_extension}=",e1f" if ($config{target} eq "arm-unknown-riscos"); - ($target{shared_extension_simple}=$target{shared_extension}) - =~ s|\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)||; + # Fill %config with values from %user, and in case those are undefined or + # empty, use values from %target (acting as a default). diff --git a/sdk/recipes/patches/openssl/apps.s_socket.c.p b/sdk/recipes/patches/openssl/apps.s_socket.c.p deleted file mode 100644 index f4c8e1c..0000000 --- a/sdk/recipes/patches/openssl/apps.s_socket.c.p +++ /dev/null @@ -1,18 +0,0 @@ ---- apps/s_socket.c.orig 2019-02-13 18:04:36.643334493 +0000 -+++ apps/s_socket.c 2019-02-13 18:04:46.271279170 +0000 -@@ -160,6 +160,7 @@ - sock_protocol = BIO_ADDRINFO_protocol(res); - sock_address = BIO_ADDRINFO_address(res); - next = BIO_ADDRINFO_next(res); -+#ifdef AF_INET6 - if (sock_family == AF_INET6) - sock_options |= BIO_SOCK_V6_ONLY; - if (next != NULL -@@ -174,6 +175,7 @@ - sock_options &= ~BIO_SOCK_V6_ONLY; - } - } -+#endif - - asock = BIO_socket(sock_family, sock_type, sock_protocol, 0); - if (asock == INVALID_SOCKET diff --git a/sdk/recipes/patches/openssl/apps.speed.c.p b/sdk/recipes/patches/openssl/apps.speed.c.p index 88ae1c3..132d473 100644 --- a/sdk/recipes/patches/openssl/apps.speed.c.p +++ b/sdk/recipes/patches/openssl/apps.speed.c.p @@ -1,7 +1,7 @@ ---- apps/speed.c.orig 2017-11-22 08:07:53.851790744 +0000 -+++ apps/speed.c 2017-11-22 08:15:49.608768064 +0000 -@@ -111,6 +111,12 @@ - #endif +--- apps/speed.c.orig 2017-11-21 22:49:00.185608040 +0000 ++++ apps/speed.c 2017-11-21 22:49:21.488219518 +0000 +@@ -62,6 +62,12 @@ + #include "./testdsa.h" #include <openssl/modes.h> + @@ -11,18 +11,24 @@ +#endif + #ifndef HAVE_FORK - # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) + # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_VXWORKS) # define HAVE_FORK 0 ---- apps/speed.c.orig 2017-11-22 08:33:02.137445746 +0000 -+++ apps/speed.c 2017-11-22 08:36:00.833790589 +0000 -@@ -345,8 +345,10 @@ - static double Time_F(int s) - { - double ret = app_tminterval(s, usertime); -+ #ifdef SIGALRM - if (s == STOP) - alarm(0); -+ #endif +@@ -186,6 +192,18 @@ + return ret; } ++#elif defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) ++static void alarm_aos(unsigned int secs) ++{ ++ (void) secs; ++} ++#define alarm alarm_aos ++ ++static double Time_F(int s) ++{ ++ double ret = app_tminterval(s, usertime); ++ return ret; ++} + #else + # error "SIGALRM not defined and the platform is not Windows" #endif diff --git a/sdk/recipes/patches/openssl/aps.opt.c.p b/sdk/recipes/patches/openssl/aps.opt.c.p deleted file mode 100644 index 531cf76..0000000 --- a/sdk/recipes/patches/openssl/aps.opt.c.p +++ /dev/null @@ -1,14 +0,0 @@ ---- apps/opt.c.orig 2017-11-22 08:42:07.605882648 +0000 -+++ apps/opt.c 2017-11-22 08:48:31.712843519 +0000 -@@ -353,6 +353,11 @@ - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ - defined(INTMAX_MAX) && defined(UINTMAX_MAX) - -+#if defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) -+# define strtoimax strtol -+# define strtoumax strtoul -+#endif -+ - /* Parse an intmax_t, put it into *result; return 0 on failure, else 1. */ - int opt_imax(const char *value, intmax_t *result) - { diff --git a/sdk/recipes/patches/openssl/crypto.arm_arch.h.p b/sdk/recipes/patches/openssl/crypto.arm_arch.h.p new file mode 100644 index 0000000..093e4de --- /dev/null +++ b/sdk/recipes/patches/openssl/crypto.arm_arch.h.p @@ -0,0 +1,11 @@ +--- crypto/arm_arch.h 2015-07-09 12:21:24.000000000 +0000 ++++ crypto/arm_arch.h 2015-11-13 13:47:02.386910047 +0000 +@@ -51,6 +51,8 @@ + # define __ARM_ARCH__ 5 + # elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) + # define __ARM_ARCH__ 4 ++# elif defined(__ARM_ARCH_3__) ++# define __ARM_ARCH__ 3 + # else + # error "unsupported ARM architecture" + # endif diff --git a/sdk/recipes/patches/openssl/bio_lcl.h.p b/sdk/recipes/patches/openssl/crypto.bio.bio_local.h.p index feae76f..e811d8b 100644 --- a/sdk/recipes/patches/openssl/bio_lcl.h.p +++ b/sdk/recipes/patches/openssl/crypto.bio.bio_local.h.p @@ -1,5 +1,5 @@ ---- crypto/bio/bio_lcl.h.orig 2017-10-17 16:19:36.908150231 +0100 -+++ crypto/bio/bio_lcl.h 2017-10-17 16:19:52.056631064 +0100 +--- crypto/bio/bio_local.h.orig 2017-10-17 16:19:36.908150231 +0100 ++++ crypto/bio/bio_local.h 2017-10-17 16:19:52.056631064 +0100 @@ -36,7 +36,7 @@ /* * Undefine AF_UNIX on systems that define it but don't support it. diff --git a/sdk/recipes/patches/openssl/crypto.mem_sec.c.p b/sdk/recipes/patches/openssl/crypto.mem_sec.c.p deleted file mode 100644 index 271d571..0000000 --- a/sdk/recipes/patches/openssl/crypto.mem_sec.c.p +++ /dev/null @@ -1,16 +0,0 @@ ---- crypto/mem_sec.c.orig 2019-02-13 14:25:17.725058588 +0000 -+++ crypto/mem_sec.c 2019-02-13 14:35:39.790029062 +0000 -@@ -25,7 +25,12 @@ - #include <string.h> - - /* e_os.h includes unistd.h, which defines _POSIX_VERSION */ --#if !defined(OPENSSL_NO_SECURE_MEMORY) && defined(OPENSSL_SYS_UNIX) \ -+#if !defined(OPENSSL_NO_SECURE_MEMORY) \ -+ && !defined(OPENSSL_SYS_RISCOS) \ -+ && !defined(OPENSSL_SYS_AMIGAOS3) \ -+ && !defined(OPENSSL_SYS_AMIGAOS4) \ -+ && !defined(OPENSSL_SYS_MINT) \ -+ && defined(OPENSSL_SYS_UNIX) \ - && ( (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \ - || defined(__sun) || defined(__hpux) || defined(__sgi) \ - || defined(__osf__) ) diff --git a/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p b/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p index a4513f2..366cd19 100644 --- a/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p +++ b/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p @@ -1,11 +1,12 @@ ---- crypto/rand/rand_unix.c.orig 2017-11-22 11:25:03.096636507 +0000 -+++ crypto/rand/rand_unix.c 2017-11-22 11:25:52.649406308 +0000 -@@ -15,7 +15,7 @@ - #include <openssl/rand.h> - #include "rand_lcl.h" +--- providers/implementations/rands/seeding/rand_unix.c.orig 2017-11-22 11:25:03.096636507 +0000 ++++ providers/implementations/rands/seeding/rand_unix.c 2017-11-22 11:25:52.649406308 +0000 +@@ -109,7 +109,8 @@ --#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)) -+#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI) || defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4)) + #if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) \ + || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VXWORKS) \ +- || defined(OPENSSL_SYS_UEFI)) ++ || defined(OPENSSL_SYS_UEFI) || defined(OPENSSL_SYS_AMIGAOS3) \ ++ || defined(OPENSSL_SYS_AMIGAOS4)) + + # if defined(OPENSSL_SYS_VOS) - # include <sys/types.h> - # include <sys/time.h> diff --git a/sdk/recipes/patches/openssl/e_os.h.p b/sdk/recipes/patches/openssl/e_os.h.p new file mode 100644 index 0000000..07ed97e --- /dev/null +++ b/sdk/recipes/patches/openssl/e_os.h.p @@ -0,0 +1,13 @@ +--- e_os.h.orig 2019-02-13 14:25:17.725058588 +0000 ++++ e_os.h 2019-02-13 14:35:39.790029062 +0000 +@@ -399,6 +399,10 @@ + # ifndef OPENSSL_NO_SECURE_MEMORY + /* unistd.h defines _POSIX_VERSION */ + # if (defined(OPENSSL_SYS_UNIX) \ ++ && !defined(OPENSSL_SYS_RISCOS) \ ++ && !defined(OPENSSL_SYS_AMIGAOS3) \ ++ && !defined(OPENSSL_SYS_AMIGAOS4) \ ++ && !defined(OPENSSL_SYS_MINT) \ + && ( (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \ + || defined(__sun) || defined(__hpux) || defined(__sgi) \ + || defined(__osf__) )) \ diff --git a/sdk/recipes/patches/openssl/m5475-atari-mint/apps.lib.s_socket.c.p b/sdk/recipes/patches/openssl/m5475-atari-mint/apps.lib.s_socket.c.p new file mode 100644 index 0000000..d659de7 --- /dev/null +++ b/sdk/recipes/patches/openssl/m5475-atari-mint/apps.lib.s_socket.c.p @@ -0,0 +1,12 @@ +--- apps/lib/s_socket.c.orig 2018-06-03 03:19:29.000000000 +0200 ++++ apps/lib/s_socket.c 2018-06-03 03:19:36.000000000 +0200 +@@ -179,7 +179,9 @@ + BIO_ADDRINFO_family(res) == AF_INET6 ? "IPv6 " : + #endif + BIO_ADDRINFO_family(res) == AF_INET ? "IPv4 " : ++#ifdef AF_UNIX + BIO_ADDRINFO_family(res) == AF_UNIX ? "unix " : "", ++#endif + bindhost != NULL ? bindhost : "", + bindport != NULL ? ":" : "", + bindport != NULL ? bindport : ""); diff --git a/sdk/recipes/patches/openssl/m5475-atari-mint/e_os.h.p b/sdk/recipes/patches/openssl/m5475-atari-mint/e_os.h.p deleted file mode 100644 index ede1edc..0000000 --- a/sdk/recipes/patches/openssl/m5475-atari-mint/e_os.h.p +++ /dev/null @@ -1,18 +0,0 @@ ---- e_os.h.orig 2018-06-03 03:19:29.000000000 +0200 -+++ e_os.h 2018-06-03 03:19:36.000000000 +0200 -@@ -462,6 +462,15 @@ - # define OPENSSL_USE_IPV6 0 - # endif - # endif -+/* -+ * We mean it -+ */ -+# if (OPENSSL_USE_IPV6 == 0) -+# undef AF_INET6 -+# warning undef AF_INET6 -+# undef AF_UNIX -+# warning undef AF_UNIX -+# endif - - # endif - diff --git a/sdk/recipes/patches/openssl/m5475-atari-mint/include.internal.sockets.h.p b/sdk/recipes/patches/openssl/m5475-atari-mint/include.internal.sockets.h.p new file mode 100644 index 0000000..5ad3a7b --- /dev/null +++ b/sdk/recipes/patches/openssl/m5475-atari-mint/include.internal.sockets.h.p @@ -0,0 +1,19 @@ +--- include/internal/sockets.h.orig 2018-06-03 03:19:29.000000000 +0200 ++++ include/internal/sockets.h 2018-06-03 03:19:36.000000000 +0200 +@@ -124,6 +124,16 @@ + # define OPENSSL_USE_IPV6 0 + # endif + # endif ++/* ++ * We mean it ++ */ ++# if (OPENSSL_USE_IPV6 == 0) ++# undef AF_INET6 ++# warning undef AF_INET6 ++# undef AF_UNIX ++# warning undef AF_UNIX ++# undef IPV6_V6ONLY ++# endif + + # define get_last_socket_error() errno + # define clear_socket_error() errno=0 diff --git a/sdk/recipes/patches/openssl/m68k-atari-mint/apps.lib.s_socket.c.p b/sdk/recipes/patches/openssl/m68k-atari-mint/apps.lib.s_socket.c.p new file mode 100644 index 0000000..d659de7 --- /dev/null +++ b/sdk/recipes/patches/openssl/m68k-atari-mint/apps.lib.s_socket.c.p @@ -0,0 +1,12 @@ +--- apps/lib/s_socket.c.orig 2018-06-03 03:19:29.000000000 +0200 ++++ apps/lib/s_socket.c 2018-06-03 03:19:36.000000000 +0200 +@@ -179,7 +179,9 @@ + BIO_ADDRINFO_family(res) == AF_INET6 ? "IPv6 " : + #endif + BIO_ADDRINFO_family(res) == AF_INET ? "IPv4 " : ++#ifdef AF_UNIX + BIO_ADDRINFO_family(res) == AF_UNIX ? "unix " : "", ++#endif + bindhost != NULL ? bindhost : "", + bindport != NULL ? ":" : "", + bindport != NULL ? bindport : ""); diff --git a/sdk/recipes/patches/openssl/m68k-atari-mint/e_os.h.p b/sdk/recipes/patches/openssl/m68k-atari-mint/e_os.h.p deleted file mode 100644 index ede1edc..0000000 --- a/sdk/recipes/patches/openssl/m68k-atari-mint/e_os.h.p +++ /dev/null @@ -1,18 +0,0 @@ ---- e_os.h.orig 2018-06-03 03:19:29.000000000 +0200 -+++ e_os.h 2018-06-03 03:19:36.000000000 +0200 -@@ -462,6 +462,15 @@ - # define OPENSSL_USE_IPV6 0 - # endif - # endif -+/* -+ * We mean it -+ */ -+# if (OPENSSL_USE_IPV6 == 0) -+# undef AF_INET6 -+# warning undef AF_INET6 -+# undef AF_UNIX -+# warning undef AF_UNIX -+# endif - - # endif - diff --git a/sdk/recipes/patches/openssl/m68k-atari-mint/include.internal.sockets.h.p b/sdk/recipes/patches/openssl/m68k-atari-mint/include.internal.sockets.h.p new file mode 100644 index 0000000..5ad3a7b --- /dev/null +++ b/sdk/recipes/patches/openssl/m68k-atari-mint/include.internal.sockets.h.p @@ -0,0 +1,19 @@ +--- include/internal/sockets.h.orig 2018-06-03 03:19:29.000000000 +0200 ++++ include/internal/sockets.h 2018-06-03 03:19:36.000000000 +0200 +@@ -124,6 +124,16 @@ + # define OPENSSL_USE_IPV6 0 + # endif + # endif ++/* ++ * We mean it ++ */ ++# if (OPENSSL_USE_IPV6 == 0) ++# undef AF_INET6 ++# warning undef AF_INET6 ++# undef AF_UNIX ++# warning undef AF_UNIX ++# undef IPV6_V6ONLY ++# endif + + # define get_last_socket_error() errno + # define clear_socket_error() errno=0 diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.apps.c.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.apps.c.p index 947eeca..1e677d2 100644 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.apps.c.p +++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.apps.c.p @@ -1,6 +1,6 @@ ---- apps.c 2014-10-15 13:53:39.000000000 +0100 -+++ apps/apps.c 2015-01-05 21:02:13.650018727 +0000 -@@ -2872,10 +2872,11 @@ double app_tminterval(int stop, int user +--- apps/lib/apps.c.orig 2014-10-15 13:53:39.000000000 +0100 ++++ apps/lib/apps.c 2015-01-05 21:02:13.650018727 +0000 +@@ -2797,10 +2797,11 @@ double app_tminterval(int stop, int user struct rusage rus; struct timeval now; static struct timeval tmstart; diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.include.http_server.h.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.include.http_server.h.p new file mode 100644 index 0000000..8d9684e --- /dev/null +++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/apps.include.http_server.h.p @@ -0,0 +1,11 @@ +--- apps/include/http_server.h.orig 2017-11-21 22:49:00.185608040 +0000 ++++ apps/include/http_server.h 2017-11-21 22:49:21.488219518 +0000 +@@ -27,7 +27,7 @@ + # endif + + # if !defined(NO_FORK) && !defined(OPENSSL_NO_SOCK) \ +- && !defined(OPENSSL_NO_POSIX_IO) ++ && !defined(OPENSSL_NO_POSIX_IO) && !defined(NO_SYSLOG) + # define HTTP_DAEMON + # include <sys/types.h> + # include <sys/wait.h> diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bio.b_sock2.c.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bio.b_sock2.c.p index 4f6fa4b..93db04c 100644 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bio.b_sock2.c.p +++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bio.b_sock2.c.p @@ -1,14 +1,14 @@ ---- crypto/bio/b_sock2.c.orig 2019-02-15 10:07:24.181612545 +0000 -+++ crypto/bio/b_sock2.c 2019-02-15 10:07:15.637654488 +0000 -@@ -94,6 +94,7 @@ +--- crypto/bio/bio_sock2.c.orig 2019-02-15 10:07:24.181612545 +0000 ++++ crypto/bio/bio_sock2.c 2019-02-15 10:07:15.637654488 +0000 +@@ -98,6 +98,7 @@ } } +#if defined(TCP_NODELAY) if (options & BIO_SOCK_NODELAY) { - if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0) { - SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error()); -@@ -101,6 +102,7 @@ + if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, + (const void *)&on, sizeof(on)) != 0) { +@@ -107,6 +108,7 @@ return 0; } } @@ -16,19 +16,19 @@ if (connect(sock, BIO_ADDR_sockaddr(addr), BIO_ADDR_sockaddr_size(addr)) == -1) { -@@ -193,6 +195,7 @@ +@@ -252,6 +254,7 @@ } } +#if defined(TCP_NODELAY) if (options & BIO_SOCK_NODELAY) { - if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0) { - SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error()); -@@ -200,6 +203,7 @@ + if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, + (const void *)&on, sizeof(on)) != 0) { +@@ -261,6 +264,7 @@ return 0; } } +#endif - # ifdef IPV6_V6ONLY - if (BIO_ADDR_family(addr) == AF_INET6) { + /* On OpenBSD it is always ipv6 only with ipv6 sockets thus read-only */ + # if defined(IPV6_V6ONLY) && !defined(__OpenBSD__) diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p index 0d5492f..3fa3a53 100644 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p +++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p @@ -1,6 +1,6 @@ --- crypto/bn/bn_div.c 2017-01-26 13:22:03.000000000 +0000 +++ crypto/bn/bn_div.c 2017-02-11 16:06:29.437010335 +0000 -@@ -175,6 +175,22 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, cons +@@ -194,6 +194,22 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, cons q; \ }) # define REMAINDER_IS_ALREADY_CALCULATED diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.include.internal.md32_common.h.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.include.internal.md32_common.h.p deleted file mode 100644 index 7447d54..0000000 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.include.internal.md32_common.h.p +++ /dev/null @@ -1,36 +0,0 @@ ---- crypto/include/internal/md32_common.h 2017-11-02 14:29:03.000000000 +0000 -+++ crypto/include/internal/md32_common.h 2018-07-23 20:12:11.228066913 +0100 -@@ -182,6 +182,9 @@ - # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l)) - # endif - # endif -+# elif defined(__mc68020) -+# define HOST_c2l(c,l) ({ asm volatile ("movel %0@+,%1" : "=a"(c), "=d"(l) : "0"(c)); }) -+# define HOST_l2c(l,c) ({ asm volatile ("movel %1,%0@+" : "=a"(c) : "d"(l), "0"(c)); }) - # endif - # endif - # if defined(__s390__) || defined(__s390x__) -@@ -215,6 +218,22 @@ - # define HOST_l2c(l,c) ({ asm ("strv %1,%0" \ - :"=m"(*(unsigned int *)(c)) :"d"(l));\ - (c)+=4; (l); }) -+# elif defined(__mc68020) -+# define HOST_c2l(c,l) ({ unsigned int r; \ -+ asm volatile ("movel %1@+,%0\n" \ -+ "rorw #8,%0\n" \ -+ "swap %0\n" \ -+ "rorw #8,%0\n" \ -+ : "=d"(r), "=a"(c) \ -+ : "1"(c)); \ -+ (l)=r; }) -+# define HOST_l2c(l,c) ({ unsigned int r=(l); \ -+ asm volatile ("rorw #8,%0\n" \ -+ "swap %0\n" \ -+ "rorw #8,%0\n" \ -+ "movel %0,%1@+\n" \ -+ : "=d"(r), "=a"(c) \ -+ : "0"(r), "1"(c)); }) - # endif - # endif - # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) - diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.rand.build.info.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.rand.build.info.p deleted file mode 100644 index 58b672f..0000000 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.rand.build.info.p +++ /dev/null @@ -1,9 +0,0 @@ ---- crypto/rand/build.info.orig 2017-11-22 11:36:06.585363219 +0000 -+++ crypto/rand/build.info 2017-11-22 11:36:39.267232034 +0000 -@@ -1,4 +1,4 @@ - LIBS=../../libcrypto - SOURCE[../../libcrypto]=\ -- md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \ -- rand_win.c rand_unix.c rand_vms.c -+ md_rand.c randfile.c rand_lib.c rand_err.c rand_amiga.c \ -+ rand_egd.c rand_win.c rand_unix.c rand_vms.c diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.ui.ui_openssl.c.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.ui.ui_openssl.c.p index 0448499..3407a48 100644 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.ui.ui_openssl.c.p +++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.ui.ui_openssl.c.p @@ -1,21 +1,21 @@ --- crypto/ui/ui_openssl.c.orig 2017-11-23 13:22:15.760078583 +0000 +++ crypto/ui/ui_openssl.c 2017-11-23 13:21:40.534382076 +0000 -@@ -99,6 +99,18 @@ +@@ -103,6 +103,18 @@ + # undef SGTTY + # endif - #endif - -+#if defined(OPENSSL_SYS_AMIGAOS3) -+#undef TERMIOS -+#undef TERMIO -+#undef SGTTY ++# if defined(OPENSSL_SYS_AMIGAOS3) ++# undef TERMIOS ++# undef TERMIO ++# undef SGTTY +struct termios { int foo; }; -+# define TTY_STRUCT struct termios -+# define TTY_FLAGS foo -+# define TTY_get(tty,data) /* tcgetattr(tty,data) */ -1 -+# define TTY_set(tty,data) /* tcsetattr(tty,TCSANOW,data) */ 0 -+# define ECHO 0 -+#endif ++# define TTY_STRUCT struct termios ++# define TTY_FLAGS foo ++# define TTY_get(tty,data) /* tcgetattr(tty,data) */ -1 ++# define TTY_set(tty,data) /* tcsetattr(tty,TCSANOW,data) */ 0 ++# define ECHO 0 ++# endif + - #ifdef TERMIOS - # include <termios.h> - # define TTY_STRUCT struct termios + # ifdef TERMIOS + # include <termios.h> + # define TTY_STRUCT struct termios diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/include.openssl.e_os2.h.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/include.openssl.e_os2.h.p deleted file mode 100644 index 6ea1ec8..0000000 --- a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/include.openssl.e_os2.h.p +++ /dev/null @@ -1,11 +0,0 @@ ---- include/openssl/e_os2.h.orig 2017-11-21 23:09:39.684814614 +0000 -+++ include/openssl/e_os2.h 2017-11-21 23:10:32.501369938 +0000 -@@ -223,6 +223,8 @@ - # define OSSL_SSIZE_MAX SSIZE_MAX - # elif defined(_POSIX_SSIZE_MAX) - # define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX -+# else -+# define OSSL_SSIZE_MAX INT_MAX - # endif - # endif - diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/providers.implementations.rands.seeding.build.info.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/providers.implementations.rands.seeding.build.info.p new file mode 100644 index 0000000..c887eff --- /dev/null +++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/providers.implementations.rands.seeding.build.info.p @@ -0,0 +1,12 @@ +--- providers/implementations/rands/seeding/build.info.orig 2017-11-21 22:49:00.185608040 +0000 ++++ providers/implementations/rands/seeding/build.info 2017-11-21 22:49:21.488219518 +0000 +@@ -5,6 +5,9 @@ + IF[{- $config{target} =~ /vms/i -}] + $COMMON=$COMMON rand_vms.c + ENDIF ++IF[{- $config{target} =~ /amiga/i -}] ++ $COMMON=$COMMON rand_amiga.c ++ENDIF + + SOURCE[../../../libdefault.a]=$COMMON + diff --git a/sdk/recipes/patches/openssl/newlib-no-strtoiumax.p b/sdk/recipes/patches/openssl/newlib-no-strtoiumax.p new file mode 100644 index 0000000..27f6a9d --- /dev/null +++ b/sdk/recipes/patches/openssl/newlib-no-strtoiumax.p @@ -0,0 +1,22 @@ +--- apps/lib/opt.c.orig 2017-10-10 15:19:45.611896396 +0100 ++++ apps/lib/opt.c 2017-10-17 15:42:25.304921197 +0100 +@@ -562,7 +562,7 @@ + + #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ + defined(INTMAX_MAX) && defined(UINTMAX_MAX) && \ +- !defined(OPENSSL_NO_INTTYPES_H) ++ !defined(OPENSSL_NO_INTTYPES_H) && !defined(OPENSSL_SYS_AMIGAOS3) && !defined(OPENSSL_SYS_AMIGAOS4) + + /* Parse an intmax_t, put it into *result; return 0 on failure, else 1. */ + int opt_intmax(const char *value, ossl_intmax_t *result) +--- test/params_conversion_test.c.orig 2017-10-10 15:19:45.611896396 +0100 ++++ test/params_conversion_test.c 2017-10-17 15:42:25.304921197 +0100 +@@ -15,7 +15,7 @@ + /* On machines that dont support <inttypes.h> just disable the tests */ + #if !defined(OPENSSL_NO_INTTYPES_H) + +-# ifdef OPENSSL_SYS_VMS ++# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4) + # define strtoumax strtoull + # define strtoimax strtoll + # endif diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/apps.include.http_server.h.p b/sdk/recipes/patches/openssl/ppc-amigaos/apps.include.http_server.h.p new file mode 100644 index 0000000..8d9684e --- /dev/null +++ b/sdk/recipes/patches/openssl/ppc-amigaos/apps.include.http_server.h.p @@ -0,0 +1,11 @@ +--- apps/include/http_server.h.orig 2017-11-21 22:49:00.185608040 +0000 ++++ apps/include/http_server.h 2017-11-21 22:49:21.488219518 +0000 +@@ -27,7 +27,7 @@ + # endif + + # if !defined(NO_FORK) && !defined(OPENSSL_NO_SOCK) \ +- && !defined(OPENSSL_NO_POSIX_IO) ++ && !defined(OPENSSL_NO_POSIX_IO) && !defined(NO_SYSLOG) + # define HTTP_DAEMON + # include <sys/types.h> + # include <sys/wait.h> diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/atomics-are-broken.p b/sdk/recipes/patches/openssl/ppc-amigaos/atomics-are-broken.p new file mode 100644 index 0000000..c6abf48 --- /dev/null +++ b/sdk/recipes/patches/openssl/ppc-amigaos/atomics-are-broken.p @@ -0,0 +1,22 @@ +--- include/internal/tsan_assist.h.orig 2017-11-21 22:49:00.185608040 +0000 ++++ include/internal/tsan_assist.h 2017-11-21 22:49:21.488219518 +0000 +@@ -48,7 +48,7 @@ + */ + + #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ +- && !defined(__STDC_NO_ATOMICS__) ++ && !defined(__STDC_NO_ATOMICS__) && !defined(__AMIGA__) + # include <stdatomic.h> + + # if defined(ATOMIC_POINTER_LOCK_FREE) \ +--- include/internal/refcount.h.orig 2017-11-21 22:49:00.185608040 +0000 ++++ include/internal/refcount.h 2017-11-21 22:49:21.488219518 +0000 +@@ -15,7 +15,7 @@ + + # if defined(OPENSSL_THREADS) && !defined(OPENSSL_DEV_NO_ATOMICS) + # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ +- && !defined(__STDC_NO_ATOMICS__) ++ && !defined(__STDC_NO_ATOMICS__) && !defined(__AMIGA__) + # include <stdatomic.h> + # define HAVE_C11_ATOMICS + # endif diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/crypto.bio_b_addr.c.p b/sdk/recipes/patches/openssl/ppc-amigaos/crypto.bio_b_addr.c.p index dd10e8c..ac14e86 100644 --- a/sdk/recipes/patches/openssl/ppc-amigaos/crypto.bio_b_addr.c.p +++ b/sdk/recipes/patches/openssl/ppc-amigaos/crypto.bio_b_addr.c.p @@ -1,6 +1,6 @@ ---- crypto/bio/b_addr.c.orig 2017-11-21 22:49:00.185608040 +0000 -+++ crypto/bio/b_addr.c 2017-11-21 22:49:21.488219518 +0000 -@@ -854,7 +854,7 @@ +--- crypto/bio/bio_addr.c.orig 2017-11-21 22:49:00.185608040 +0000 ++++ crypto/bio/bio_addr.c 2017-11-21 22:49:21.488219518 +0000 +@@ -910,7 +910,7 @@ addrlistp++) ; diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/crypto.ppccap.c.p b/sdk/recipes/patches/openssl/ppc-amigaos/crypto.ppccap.c.p index 56949ca..46d6213 100644 --- a/sdk/recipes/patches/openssl/ppc-amigaos/crypto.ppccap.c.p +++ b/sdk/recipes/patches/openssl/ppc-amigaos/crypto.ppccap.c.p @@ -1,15 +1,15 @@ --- crypto/ppccap.c.orig 2017-11-22 13:14:44.655536374 +0000 +++ crypto/ppccap.c 2017-11-22 13:16:03.666387174 +0000 -@@ -135,6 +135,8 @@ - } - #endif +@@ -34,6 +34,8 @@ + + static sigset_t all_masked; +#ifndef OPENSSL_SYS_AMIGAOS4 + static sigjmp_buf ill_jmp; static void ill_handler(int sig) { -@@ -341,3 +343,24 @@ +@@ -309,3 +311,29 @@ sigaction(SIGILL, &ill_oact, NULL); sigprocmask(SIG_SETMASK, &oset, NULL); } @@ -33,4 +33,9 @@ + OPENSSL_ppccap_P |= PPC_ALTIVEC; + } +} ++ ++uint32_t OPENSSL_rdtsc(void) ++{ ++ return 0; ++} +#endif diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/crypto.rand.build.info.p b/sdk/recipes/patches/openssl/ppc-amigaos/crypto.rand.build.info.p deleted file mode 100644 index 58b672f..0000000 --- a/sdk/recipes/patches/openssl/ppc-amigaos/crypto.rand.build.info.p +++ /dev/null @@ -1,9 +0,0 @@ ---- crypto/rand/build.info.orig 2017-11-22 11:36:06.585363219 +0000 -+++ crypto/rand/build.info 2017-11-22 11:36:39.267232034 +0000 -@@ -1,4 +1,4 @@ - LIBS=../../libcrypto - SOURCE[../../libcrypto]=\ -- md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \ -- rand_win.c rand_unix.c rand_vms.c -+ md_rand.c randfile.c rand_lib.c rand_err.c rand_amiga.c \ -+ rand_egd.c rand_win.c rand_unix.c rand_vms.c diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/include.openssl.e_os2.h.p b/sdk/recipes/patches/openssl/ppc-amigaos/include.openssl.e_os2.h.p deleted file mode 100644 index 6ea1ec8..0000000 --- a/sdk/recipes/patches/openssl/ppc-amigaos/include.openssl.e_os2.h.p +++ /dev/null @@ -1,11 +0,0 @@ ---- include/openssl/e_os2.h.orig 2017-11-21 23:09:39.684814614 +0000 -+++ include/openssl/e_os2.h 2017-11-21 23:10:32.501369938 +0000 -@@ -223,6 +223,8 @@ - # define OSSL_SSIZE_MAX SSIZE_MAX - # elif defined(_POSIX_SSIZE_MAX) - # define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX -+# else -+# define OSSL_SSIZE_MAX INT_MAX - # endif - # endif - diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/providers.implementations.rands.seeding.build.info.p b/sdk/recipes/patches/openssl/ppc-amigaos/providers.implementations.rands.seeding.build.info.p new file mode 100644 index 0000000..c887eff --- /dev/null +++ b/sdk/recipes/patches/openssl/ppc-amigaos/providers.implementations.rands.seeding.build.info.p @@ -0,0 +1,12 @@ +--- providers/implementations/rands/seeding/build.info.orig 2017-11-21 22:49:00.185608040 +0000 ++++ providers/implementations/rands/seeding/build.info 2017-11-21 22:49:21.488219518 +0000 +@@ -5,6 +5,9 @@ + IF[{- $config{target} =~ /vms/i -}] + $COMMON=$COMMON rand_vms.c + ENDIF ++IF[{- $config{target} =~ /amiga/i -}] ++ $COMMON=$COMMON rand_amiga.c ++ENDIF + + SOURCE[../../../libdefault.a]=$COMMON + diff --git a/sdk/recipes/patches/openssl/ppc-amigaos/test.rsa_complex.c.p b/sdk/recipes/patches/openssl/ppc-amigaos/test.rsa_complex.c.p index a5fa68a..969062b 100644 --- a/sdk/recipes/patches/openssl/ppc-amigaos/test.rsa_complex.c.p +++ b/sdk/recipes/patches/openssl/ppc-amigaos/test.rsa_complex.c.p @@ -1,14 +1,14 @@ --- test/rsa_complex.c.orig 2019-02-14 10:16:06.665734720 +0000 +++ test/rsa_complex.c 2019-02-14 10:16:18.581682332 +0000 -@@ -12,11 +12,6 @@ - * The former defines "I" as a macro and earlier versions of the latter use - * for function arguments. +@@ -16,11 +16,6 @@ */ --#if defined(__STDC_VERSION__) --# if __STDC_VERSION__ >= 199901L --# include <complex.h> + + #if !defined(__DJGPP__) +-# if defined(__STDC_VERSION__) +-# if __STDC_VERSION__ >= 199901L +-# include <complex.h> +-# endif -# endif --#endif - #include <openssl/rsa.h> + # include <openssl/rsa.h> + #endif #include <stdlib.h> - diff --git a/sdk/recipes/patches/openssl/test.drbgtest.c.p b/sdk/recipes/patches/openssl/test.drbgtest.c.p new file mode 100644 index 0000000..ecf3e81 --- /dev/null +++ b/sdk/recipes/patches/openssl/test.drbgtest.c.p @@ -0,0 +1,20 @@ +--- test/drbgtest.c.orig 2017-10-10 15:19:45.611896396 +0100 ++++ test/drbgtest.c 2017-10-17 15:42:25.304921197 +0100 +@@ -277,7 +277,7 @@ + } + + +-#if defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_RAND_SEED_EGD) ++#if defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_RAND_SEED_EGD) && !defined(OPENSSL_SYS_AMIGAOS3) && !defined(OPENSSL_SYS_AMIGAOS4) + /* number of children to fork */ + #define DRBG_FORK_COUNT 9 + /* two results per child, two for the parent */ +@@ -895,7 +895,7 @@ + int setup_tests(void) + { + ADD_TEST(test_rand_reseed); +-#if defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_RAND_SEED_EGD) ++#if defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_RAND_SEED_EGD) && !defined(OPENSSL_SYS_AMIGAOS3) && !defined(OPENSSL_SYS_AMIGAOS4) + ADD_ALL_TESTS(test_rand_fork_safety, RANDOM_SIZE); + #endif + ADD_TEST(test_rand_prediction_resistance); diff --git a/sdk/recipes/patches/windom/src.globals.h.p b/sdk/recipes/patches/windom/src.globals.h.p new file mode 100644 index 0000000..34a7901 --- /dev/null +++ b/sdk/recipes/patches/windom/src.globals.h.p @@ -0,0 +1,19 @@ +--- src/globals.h.orig 2023-10-01 03:02:16.247962097 +0100 ++++ src/globals.h 2023-10-01 03:03:20.403979699 +0100 +@@ -806,6 +806,8 @@ + RSC header and support struct + *******************************************************************************/ + ++#ifndef __RSXHDR ++#define __RSXHDR + typedef struct { /* fichier ressource tendu */ + UWORD rsh_vrsn; /* should be 3 */ + UWORD rsh_extvrsn; /* not used, initialised to 'IN' for Interface */ +@@ -827,6 +829,7 @@ + ULONG rsh_nimages; + ULONG rsh_rssize; /* total bytes in resource */ + } RSXHDR; ++#endif + + typedef struct { + unsigned long rlen; diff --git a/sdk/recipes/patches/zlib/arm-riscos-gnueabi/configure.p b/sdk/recipes/patches/zlib/arm-riscos-gnueabi/configure.p new file mode 100644 index 0000000..24d7a7e --- /dev/null +++ b/sdk/recipes/patches/zlib/arm-riscos-gnueabi/configure.p @@ -0,0 +1,42 @@ +--- configure.orig 2012-05-02 05:17:08.000000000 +0100 ++++ configure 2012-07-17 17:57:01.000000000 +0100 +@@ -423,18 +423,18 @@ + echo >> configure.log + + # check for large file support, and if none, check for fseeko() +-cat > $test.c <<EOF +-#include <sys/types.h> +-off64_t dummy = 0; +-EOF +-if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then +- CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" +- SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" +- ALL="${ALL} all64" +- TEST="${TEST} test64" +- echo "Checking for off64_t... Yes." | tee -a configure.log +- echo "Checking for fseeko... Yes." | tee -a configure.log +-else ++#cat > $test.c <<EOF ++##include <sys/types.h> ++#off64_t dummy = 0; ++#EOF ++#if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then ++# CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" ++# SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" ++# ALL="${ALL} all64" ++# TEST="${TEST} test64" ++# echo "Checking for off64_t... Yes." | tee -a configure.log ++# echo "Checking for fseeko... Yes." | tee -a configure.log ++#else + echo "Checking for off64_t... No." | tee -a configure.log + echo >> configure.log + cat > $test.c <<EOF +@@ -451,7 +451,7 @@ + SFLAGS="${SFLAGS} -DNO_FSEEKO" + echo "Checking for fseeko... No." | tee -a configure.log + fi +-fi ++##fi + + echo >> configure.log + diff --git a/x86_64-w64-mingw32/Makefile b/x86_64-w64-mingw32/Makefile index 240411b..154be8f 100644 --- a/x86_64-w64-mingw32/Makefile +++ b/x86_64-w64-mingw32/Makefile @@ -2,28 +2,27 @@ # mingw toolchain -UPSTREAM_GCC_VERSION := 4.8.4 -UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.bz2 +UPSTREAM_GCC_VERSION := 12.2.0 +UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.xz UPSTREAM_GCC_URI := http://ftpmirror.gnu.org/gcc/gcc-$(UPSTREAM_GCC_VERSION)/$(UPSTREAM_GCC_TARBALL) -UPSTREAM_BINUTILS_VERSION := 2.25 +UPSTREAM_BINUTILS_VERSION := 2.39 UPSTREAM_BINUTILS_TARBALL := binutils-$(UPSTREAM_BINUTILS_VERSION).tar.bz2 UPSTREAM_BINUTILS_URI := http://ftpmirror.gnu.org/binutils/$(UPSTREAM_BINUTILS_TARBALL) -UPSTREAM_GMP_VERSION := 4.3.2 +UPSTREAM_GMP_VERSION := 6.2.1 UPSTREAM_GMP_TARBALL := gmp-$(UPSTREAM_GMP_VERSION).tar.bz2 UPSTREAM_GMP_URI := http://ftp.gnu.org/gnu/gmp/$(UPSTREAM_GMP_TARBALL) -# Would use 3.0.0, but that dislikes in-tree gmp sources -UPSTREAM_MPFR_VERSION := 2.4.2 -UPSTREAM_MPFR_TARBALL := mpfr-$(UPSTREAM_MPFR_VERSION).tar.bz2 +UPSTREAM_MPFR_VERSION := 4.2.0 +UPSTREAM_MPFR_TARBALL := mpfr-$(UPSTREAM_MPFR_VERSION).tar.xz UPSTREAM_MPFR_URI := http://www.mpfr.org/mpfr-$(UPSTREAM_MPFR_VERSION)/$(UPSTREAM_MPFR_TARBALL) -UPSTREAM_MPC_VERSION := 0.8.2 +UPSTREAM_MPC_VERSION := 1.3.0 UPSTREAM_MPC_TARBALL := mpc-$(UPSTREAM_MPC_VERSION).tar.gz UPSTREAM_MPC_URI := http://www.multiprecision.org/downloads/$(UPSTREAM_MPC_TARBALL) -UPSTREAM_MINGW_VERSION := 3.3.0 +UPSTREAM_MINGW_VERSION := 10.0.0 UPSTREAM_MINGW_TARBALL := mingw-w64-v$(UPSTREAM_MINGW_VERSION).tar.bz2 UPSTREAM_MINGW_URI := "http://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/$(UPSTREAM_MINGW_TARBALL)?r=http%3A%2F%2Fmingw-w64.sourceforge.net%2Fdownload.php&ts=1426088797&use_mirror=cznic" @@ -62,7 +61,7 @@ $(BUILDSTEPS)/gcc-core.d: $(BUILDSTEPS)/srcdir-step3.d $(BUILDSTEPS)/binutils.d --prefix=$(PREFIX) --target=$(TARGET_NAME) \ --enable-languages=c,c++ --with-system-zlib --disable-multilib \ --enable-shared --enable-fully-dynamic-string - cd $(BUILDDIR)/gcc && PATH="$(PREFIX)/bin:$(PATH)" make all-gcc -j 4 + cd $(BUILDDIR)/gcc && PATH="$(PREFIX)/bin:$(PATH)" make all-gcc -j 8 cd $(BUILDDIR)/gcc && PATH="$(PREFIX)/bin:$(PATH)" make install-gcc touch $@ |