shithub: newlib

Download patch

ref: 536cef2b2ad9ba00df99f38b8eee764297562799
author: kws <kws@cirno>
date: Mon Aug 5 16:35:45 EDT 2024

basic newlib recipes

diff: cannot open b/host-recipes//null: file does not exist: 'b/host-recipes//null' diff: cannot open b/patches/binutils//null: file does not exist: 'b/patches/binutils//null' diff: cannot open b/patches/gcc-host//null: file does not exist: 'b/patches/gcc-host//null' diff: cannot open b/patches/newlib//null: file does not exist: 'b/patches/newlib//null' diff: cannot open b/patches//null: file does not exist: 'b/patches//null' diff: cannot open b/recipes//null: file does not exist: 'b/recipes//null' diff: cannot open b/source-recipes//null: file does not exist: 'b/source-recipes//null'
--- /dev/null
+++ b/.gitignore
@@ -1,0 +1,9 @@
+.jinx-cache
+builds
+host-builds
+host-pkgs
+pkgs
+sources
+sysroot
+jinx
+jinx-user-config
--- /dev/null
+++ b/COPYING
@@ -1,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program 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 2 of the License, or
+    (at your option) any later version.
+
+    This program 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 this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
--- /dev/null
+++ b/host-recipes/autoconf-2.69
@@ -1,0 +1,16 @@
+name=autoconf-2.69
+from_source=autoconf-2.69
+revision=1
+
+build() {
+    "${source_dir}"/configure --prefix="${prefix}"
+
+    make -j${parallelism}
+}
+
+package() {
+    DESTDIR="${dest_dir}" make install
+
+        strip_command=strip \
+    post_package_strip
+}
--- /dev/null
+++ b/host-recipes/automake-1.15.1
@@ -1,0 +1,18 @@
+name=automake-1.15.1
+from_source=automake-1.15.1
+revision=1
+hostdeps="autoconf-2.69"
+imagedeps="gcc"
+
+build() {
+    "${source_dir}"/configure --prefix="${prefix}"
+
+    make -j${parallelism}
+}
+
+package() {
+    DESTDIR="${dest_dir}" make install
+
+        strip_command=strip \
+    post_package_strip
+}
--- /dev/null
+++ b/host-recipes/binutils
@@ -1,0 +1,24 @@
+name=binutils
+from_source=binutils
+revision=1
+imagedeps="gcc"
+hostdeps="autoconf-2.69 automake-1.15.1"
+
+build() {
+    "${source_dir}"/configure \
+        --prefix="${prefix}" \
+        --target=${OS_TRIPLET} \
+        --with-sysroot="${sysroot_dir}" \
+        --disable-gdb \
+        --disable-nls \
+        --disable-werror
+
+    make -j${parallelism}
+}
+
+package() {
+    DESTDIR="${dest_dir}" make install
+
+        strip_command=strip \
+    post_package_strip
+}
--- /dev/null
+++ b/host-recipes/bootstrap-gcc
@@ -1,0 +1,37 @@
+name=bootstrap-gcc
+from_source=gcc-host
+revision=1
+imagedeps="gcc"
+hostdeps="autoconf-2.69 automake-1.15.1"
+hostrundeps="binutils"
+
+build() {
+    cp -rp "${source_dir}"/. ./
+
+    mkdir build && cd build
+
+        CXXFLAGS_FOR_TARGET="$CXXFLAGS" \
+        CFLAGS_FOR_TARGET="$CFLAGS" \
+    ../configure \
+        --prefix="${prefix}" \
+        --target=${OS_TRIPLET} \
+        --with-sysroot="${sysroot_dir}" \
+        --disable-nls \
+        --disable-lto \
+        --disable-tls \
+        --enable-languages=c \
+        --without-headers \
+        --with-newlib
+
+    make -j${parallelism} all-gcc all-target-libgcc
+}
+
+package() {
+    cd build
+    DESTDIR="${dest_dir}" make install-gcc install-target-libgcc
+
+    ln -s ${OS_TRIPLET}-gcc "${dest_dir}${prefix}/bin/${OS_TRIPLET}-cc"
+
+        strip_command=strip \
+    post_package_strip
+}
--- /dev/null
+++ b/host-recipes/gcc
@@ -1,0 +1,36 @@
+name=gcc
+from_source=gcc-host
+revision=1
+imagedeps="gcc"
+hostdeps="autoconf-2.69 automake-1.15.1"
+hostrundeps="binutils"
+deps="newlib"
+
+build() {
+    cp -rp "${source_dir}"/. ./
+
+    mkdir build && cd build
+
+        CXXFLAGS_FOR_TARGET="$CXXFLAGS" \
+        CFLAGS_FOR_TARGET="$CFLAGS" \
+    ../configure \
+        --prefix="${prefix}" \
+        --target=${OS_TRIPLET} \
+        --with-sysroot="${sysroot_dir}" \
+        --disable-nls \
+        --disable-tls \
+        --enable-languages=c,c++ \
+        --with-newlib
+
+    make -j${parallelism}
+}
+
+package() {
+    cd build
+    DESTDIR="${dest_dir}" make install
+
+    ln -s ${OS_TRIPLET}-gcc "${dest_dir}${prefix}/bin/${OS_TRIPLET}-cc"
+
+        strip_command=strip \
+    post_package_strip
+}
--- /dev/null
+++ b/jinx-config
@@ -1,0 +1,58 @@
+JINX_MAJOR_VER=0.2
+
+export CFLAGS="-O2 -pipe"
+export CXXFLAGS="${CFLAGS}"
+export LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed"
+
+OS_TRIPLET=x86_64-9front-plan9
+
+post_package_strip() {
+    if [ -z "$strip_command" ]; then
+        strip_command="${OS_TRIPLET}-strip"
+    fi
+
+    for f in $(find "${dest_dir}"); do
+        if file "$f" | grep 'not stripped' >/dev/null; then
+            echo "* stripping '$f'..."
+            stripped_file="$(mktemp)"
+            ${strip_command} "$f" -o "$stripped_file"
+            chmod --reference="$f" "$stripped_file"
+            mv -f "$stripped_file" "$f"
+        fi
+    done
+}
+
+autotools_configure() {
+    if [ -z "${configure_script_path}" ]; then
+        configure_script_path="${source_dir}/configure"
+    fi
+
+        ac_cv_func_malloc_0_nonnull=yes \
+        ac_cv_func_calloc_0_nonnull=yes \
+        ac_cv_func_realloc_0_nonnull=yes \
+    ${configure_script_path} \
+        --host=${OS_TRIPLET} \
+        --with-sysroot=${sysroot} \
+        --prefix=${prefix} \
+        --sysconfdir=/etc \
+        --localstatedir=/var \
+        --bindir=${prefix}/bin \
+        --sbindir=${prefix}/bin \
+        --libdir=${prefix}/lib \
+        --enable-static \
+        --disable-shared \
+        --disable-malloc0returnsnull \
+        "$@"
+}
+
+autotools_recursive_regen() {
+    ACLOCAL_INCLUDE=""
+    if [ -d ${sysroot_dir}/usr/share/aclocal ]; then
+        ACLOCAL_INCLUDE="-I${sysroot_dir}/usr/share/aclocal"
+    fi
+
+    for f in $(find . -name configure.ac -o -name configure.in -type f | sort | grep -v contrib); do
+        echo "* autotools regen in '$(dirname $f)'..."
+        ( cd "$(dirname "$f")" && autoreconf -fvi "$@" $ACLOCAL_INCLUDE )
+    done
+}
--- /dev/null
+++ b/patches/binutils/jinx-working-patch.patch
@@ -1,0 +1,133 @@
+diff --git binutils-clean/bfd/config.bfd binutils-workdir/bfd/config.bfd
+index bbf1244..0a996e6 100644
+--- binutils-clean/bfd/config.bfd
++++ binutils-workdir/bfd/config.bfd
+@@ -735,6 +735,10 @@ case "${targ}" in
+     targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec"
+     want64=true
+     ;;
++  x86_64-*-plan9*)
++    targ_defvec=x86_64_elf64_vec
++    want64=true
++    ;;
+ #endif
+   i[3-7]86-*-lynxos*)
+     targ_defvec=i386_elf32_vec
+diff --git binutils-clean/gas/configure.tgt binutils-workdir/gas/configure.tgt
+index 7c66734..ce65a06 100644
+--- binutils-clean/gas/configure.tgt
++++ binutils-workdir/gas/configure.tgt
+@@ -231,6 +231,7 @@ case ${generic_target} in
+   i386-*-elf*)				fmt=elf ;;
+   i386-*-fuchsia*)			fmt=elf ;;
+   i386-*-haiku*)			fmt=elf em=haiku ;;
++  i386-*-plan9*)			fmt=elf ;;
+   i386-*-genode*)			fmt=elf ;;
+   i386-*-bsd*)				fmt=aout em=386bsd ;;
+   i386-*-netbsd*-gnu* | \
+diff --git binutils-clean/gprofng/libcollector/configure.ac binutils-workdir/gprofng/libcollector/configure.ac
+index b0ef678..c1f54fe 100644
+--- binutils-clean/gprofng/libcollector/configure.ac
++++ binutils-workdir/gprofng/libcollector/configure.ac
+@@ -18,7 +18,6 @@ dnl <http://www.gnu.org/licenses/>.
+ 
+ m4_include([../../bfd/version.m4])
+ AC_INIT([gprofng], BFD_VERSION)
+-AC_CONFIG_MACRO_DIRS([../../config ../..])
+ AC_CONFIG_AUX_DIR(../..)
+ AC_CANONICAL_TARGET
+ AM_INIT_AUTOMAKE
+diff --git binutils-clean/ld/Makefile.am binutils-workdir/ld/Makefile.am
+index f9ee05b..85e681e 100644
+--- binutils-clean/ld/Makefile.am
++++ binutils-workdir/ld/Makefile.am
+@@ -463,6 +463,7 @@ ALL_64_EMULATION_SOURCES = \
+ 	eelf_x86_64.c \
+ 	eelf_x86_64_cloudabi.c \
+ 	eelf_x86_64_fbsd.c \
++	eelf_x86_64_plan9.c \
+ 	eelf_x86_64_haiku.c \
+ 	eelf_x86_64_sol2.c \
+ 	ehppa64linux.c \
+diff --git binutils-clean/ld/configure.tgt binutils-workdir/ld/configure.tgt
+index f937f78..50e27ff 100644
+--- binutils-clean/ld/configure.tgt
++++ binutils-workdir/ld/configure.tgt
+@@ -1023,6 +1023,8 @@ x86_64-*-linux-*)	targ_emul=elf_x86_64
+ x86_64-*-redox*)	targ_emul=elf_x86_64
+ 			targ_extra_emuls=elf_i386
+ 			;;
++x86_64-*-plan9*)	targ_emul=elf_x86_64_plan9
++			;;
+ x86_64-*-solaris2*)	targ_emul=elf_x86_64_sol2
+ 			targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu"
+ 			targ_extra_libpath=$targ_extra_emuls
+diff --git binutils-workdir/ld/emulparams/elf_x86_64_plan9.sh binutils-workdir/ld/emulparams/elf_x86_64_plan9.sh
+new file mode 100644
+index 0000000..2948b21
+--- /dev/null
++++ binutils-workdir/ld/emulparams/elf_x86_64_plan9.sh
+@@ -0,0 +1,8 @@
++source_sh ${srcdir}/emulparams/elf_x86_64.sh
++SCRIPT_NAME=plan9
++TEXT_START_ADDR=0x200000
++DATA_ADDR="ALIGN (0x200000)"
++GENERATE_RELRO_SCRIPT=
++GENERATE_COMBRELOC_SCRIPT=
++GENERATE_SHLIB_SCRIPT=
++GENERATE_PIE_SCRIPT=
+diff --git binutils-workdir/ld/scripttempl/plan9.sc binutils-workdir/ld/scripttempl/plan9.sc
+new file mode 100644
+index 0000000..15bd83a
+--- /dev/null
++++ binutils-workdir/ld/scripttempl/plan9.sc
+@@ -0,0 +1,49 @@
++# Copyright (C) 2024 Plan 9 Foundation.
++#
++# Copying and distribution of this file, with or without modification,
++# are permitted in any medium without royalty provided the copyright
++# notice and this notice are preserved.
++
++cat <<EOF
++/* Copyright (C) 2024 Plan 9 Foundation.
++
++   Copying and distribution of this script, with or without modification,
++   are permitted in any medium without royalty provided the copyright
++   notice and this notice are preserved.  */
++
++OUTPUT_FORMAT("${OUTPUT_FORMAT}")
++OUTPUT_ARCH(${ARCH})
++
++PHDRS
++{
++  text  PT_LOAD FILEHDR PHDRS;
++  data  PT_LOAD;
++}
++
++SECTIONS
++{
++  . = ${TEXT_START_ADDR} + SIZEOF_HEADERS;
++
++  .text : {
++    *(.text*)
++    *(.init*)
++    *(.fini*)
++  } :text
++
++  . = ${DATA_ADDR};
++
++  .data : {
++    *(.data*)
++    *(.ctors*)
++    *(.dtors*)
++    *(.rodata*)
++    *(.eh_frame*)
++  } :data
++
++  .bss : {
++    *(.bss*)
++  } :data
++
++  end = .;
++}
++EOF
--- /dev/null
+++ b/patches/gcc-host/jinx-working-patch.patch
@@ -1,0 +1,90 @@
+diff --git gcc-host-workdir/gcc/config/plan9.h gcc-host-workdir/gcc/config/plan9.h
+new file mode 100644
+index 0000000..83a3cb1
+--- /dev/null
++++ gcc-host-workdir/gcc/config/plan9.h
+@@ -0,0 +1,42 @@
++/* Base configuration file for all Plan 9 targets.
++   Copyright (C) 2024 Plan 9 Foundation.
++
++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/>.  */
++
++#undef TARGET_PLAN9
++#define TARGET_PLAN9 1
++
++#undef LIB_SPEC
++#define LIB_SPEC "-lc"
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
++
++#undef  TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS()            \
++  do                                        \
++    {                                       \
++       builtin_define ("__unix__");         \
++       builtin_define ("__plan9__");        \
++       builtin_assert ("system=unix");      \
++       builtin_assert ("system=posix");     \
++       builtin_assert ("system=plan9");     \
++    }                                       \
++  while (0)
+diff --git gcc-host-clean/gcc/config.gcc gcc-host-workdir/gcc/config.gcc
+index 95c91ee..e67b9ca 100644
+--- gcc-host-clean/gcc/config.gcc
++++ gcc-host-workdir/gcc/config.gcc
+@@ -722,6 +722,12 @@ x86_cpus="generic intel"
+ 
+ # Common parts for widely ported systems.
+ case ${target} in
++*-*-plan9*)
++  gas=yes
++  gnu_ld=yes
++  default_use_cxa_atexit=yes
++  use_gcc_stdint=wrap
++  ;;
+ *-*-darwin*)
+   tmake_file="t-darwin "
+   tm_file="${tm_file} darwin.h"
+@@ -1189,6 +1195,9 @@ case ${target} in
+ esac
+ 
+ case ${target} in
++x86_64-*-plan9*)
++	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h plan9.h"
++	;;
+ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
+ 	tm_file="${tm_file} elfos.h newlib-stdint.h"
+ 	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h"
+diff --git gcc-host-clean/libgcc/config.host gcc-host-workdir/libgcc/config.host
+index e75a7af..ab549d1 100644
+--- gcc-host-clean/libgcc/config.host
++++ gcc-host-workdir/libgcc/config.host
+@@ -1569,6 +1569,10 @@ nvptx-*)
+ 	tmake_file="$tmake_file nvptx/t-nvptx"
+ 	extra_parts="crt0.o"
+ 	;;
++x86_64-*-plan9*)
++	extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o"
++	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
++	;;
+ *)
+ 	echo "*** Configuration ${host} not supported" 1>&2
+ 	exit 1
--- /dev/null
+++ b/patches/newlib/jinx-working-patch.patch
@@ -1,0 +1,468 @@
+diff --git newlib-clean/libgloss/Makefile.am newlib-workdir/libgloss/Makefile.am
+index 0d4460b..6becea9 100644
+--- newlib-clean/libgloss/Makefile.am
++++ newlib-workdir/libgloss/Makefile.am
+@@ -60,9 +60,6 @@ include $(top_srcdir)/../multilib.am
+ 
+ TEXINFO_TEX = ../texinfo/texinfo.tex
+ 
+-if HAVE_DOC
+-include doc/Makefile.inc
+-endif
+ if CONFIG_AARCH64
+ include aarch64/Makefile.inc
+ endif
+diff --git newlib-clean/newlib/configure.host newlib-workdir/newlib/configure.host
+index 3861834..5c61502 100644
+--- newlib-clean/newlib/configure.host
++++ newlib-workdir/newlib/configure.host
+@@ -434,6 +434,9 @@ case "${host}" in
+ 	signal_dir=
+ 	sys_dir=netware
+ 	;;
++  *-*-plan9*)
++	sys_dir=plan9
++	;;
+   *-*-rtems*)			# generic RTEMS support
+ 	sys_dir=rtems
+ 	posix_dir=posix
+@@ -600,6 +603,12 @@ case "${host}" in
+ 	newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DGETREENT_PROVIDED -DSIGNAL_PROVIDED -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED -DHAVE_CHDIR -DHAVE_FCHDIR"
+ 	syscall_dir=syscalls
+ 	;;
++  *-*-plan9*)
++	default_newlib_io_long_long="yes"
++	default_newlib_io_c99_formats="yes"
++	newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
++	syscall_dir=
++	;;
+ # RTEMS supplies its own versions of some routines:
+ #       malloc()            (reentrant version)
+ #       exit()              RTEMS has a "global" reent to flush
+diff --git newlib-clean/newlib/libc/acinclude.m4 newlib-workdir/newlib/libc/acinclude.m4
+index 24148b1..7e3a850 100644
+--- newlib-clean/newlib/libc/acinclude.m4
++++ newlib-workdir/newlib/libc/acinclude.m4
+@@ -19,6 +19,7 @@ m4_foreach_w([SYS_DIR], [
+   m88kbug mmixware
+   netware
+   or1k
++  plan9
+   rdos rtems
+   sh sysmec sysnec810 sysnecv850 sysvi386 sysvnecv70
+   tic80 tirtos
+diff --git newlib-clean/newlib/libc/include/sys/stat.h newlib-workdir/newlib/libc/include/sys/stat.h
+index 98f5add..4c7fad8 100644
+--- newlib-clean/newlib/libc/include/sys/stat.h
++++ newlib-workdir/newlib/libc/include/sys/stat.h
+@@ -142,7 +142,7 @@ int	mkfifo (const char *__path, mode_t __mode );
+ int	stat (const char *__restrict __path, struct stat *__restrict __sbuf );
+ mode_t	umask (mode_t __mask );
+ 
+-#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__)
++#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) || defined(__plan9__)
+ int	lstat (const char *__restrict __path, struct stat *__restrict __buf );
+ int	mknod (const char *__path, mode_t __mode, dev_t __dev );
+ #endif
+diff --git newlib-clean/newlib/libc/sys/Makefile.inc newlib-workdir/newlib/libc/sys/Makefile.inc
+index 24d8407..7be8031 100644
+--- newlib-clean/newlib/libc/sys/Makefile.inc
++++ newlib-workdir/newlib/libc/sys/Makefile.inc
+@@ -31,6 +31,9 @@ endif
+ if HAVE_LIBC_SYS_OR1K_DIR
+ include %D%/or1k/Makefile.inc
+ endif
++if HAVE_LIBC_SYS_PLAN9_DIR
++include %D%/plan9/Makefile.inc
++endif
+ if HAVE_LIBC_SYS_RDOS_DIR
+ include %D%/rdos/Makefile.inc
+ endif
+diff --git newlib-workdir/newlib/libc/sys/plan9/Makefile.inc newlib-workdir/newlib/libc/sys/plan9/Makefile.inc
+new file mode 100644
+index 0000000..9e2a599
+--- /dev/null
++++ newlib-workdir/newlib/libc/sys/plan9/Makefile.inc
+@@ -0,0 +1,2 @@
++libc_a_SOURCES += \
++	%D%/syscalls.c %D%/syscall.S
+diff --git newlib-workdir/newlib/libc/sys/plan9/crt0.S newlib-workdir/newlib/libc/sys/plan9/crt0.S
+new file mode 100644
+index 0000000..61e4904
+--- /dev/null
++++ newlib-workdir/newlib/libc/sys/plan9/crt0.S
+@@ -0,0 +1,12 @@
++	.global _start
++_start:
++	mov	_fini, %rdi
++	call	atexit
++
++	call	_init
++
++	mov	0x00(%rsp), %edi
++	lea	0x08(%rsp), %rsi
++	call	main
++
++	call	_exit
+diff --git newlib-workdir/newlib/libc/sys/plan9/include/sys/utime.h newlib-workdir/newlib/libc/sys/plan9/include/sys/utime.h
+new file mode 100644
+index 0000000..4180825
+--- /dev/null
++++ newlib-workdir/newlib/libc/sys/plan9/include/sys/utime.h
+@@ -0,0 +1,25 @@
++/*
++ *  $Id$
++ */
++
++#ifndef __UTIME_h__
++#define __UTIME_h__
++
++#include <sys/types.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++struct utimbuf {
++  time_t actime;
++  time_t modtime;
++};
++
++int utime(const char *path, const struct utimbuf *times);
++
++#ifdef __cplusplus
++};
++#endif
++
++#endif /* _SYS_UTIME_H */
+diff --git newlib-workdir/newlib/libc/sys/plan9/sys.h newlib-workdir/newlib/libc/sys/plan9/sys.h
+new file mode 100644
+index 0000000..91b9f12
+--- /dev/null
++++ newlib-workdir/newlib/libc/sys/plan9/sys.h
+@@ -0,0 +1,52 @@
++#define	SYS_SYSR1		0
++#define	SYS__ERRSTR		1
++#define	SYS_BIND		2
++#define	SYS_CHDIR		3
++#define	SYS_CLOSE		4
++#define	SYS_DUP			5
++#define	SYS_ALARM		6
++#define	SYS_EXEC		7
++#define	SYS_EXITS		8
++#define	SYS__FSESSION		9
++#define	SYS_FAUTH		10
++#define	SYS__FSTAT		11
++#define	SYS_SEGBRK		12
++#define	SYS__MOUNT		13
++#define	SYS_OPEN		14
++#define	SYS__READ		15
++#define	SYS_OSEEK		16
++#define	SYS_SLEEP		17
++#define	SYS__STAT		18
++#define	SYS_RFORK		19
++#define	SYS__WRITE		20
++#define	SYS_PIPE		21
++#define	SYS_CREATE		22
++#define	SYS_FD2PATH		23
++#define	SYS_BRK_		24
++#define	SYS_REMOVE		25
++#define	SYS__WSTAT		26
++#define	SYS__FWSTAT		27
++#define	SYS_NOTIFY		28
++#define	SYS_NOTED		29
++#define	SYS_SEGATTACH		30
++#define	SYS_SEGDETACH		31
++#define	SYS_SEGFREE		32
++#define	SYS_SEGFLUSH		33
++#define	SYS_RENDEZVOUS		34
++#define	SYS_UNMOUNT		35
++#define	SYS__WAIT		36
++#define	SYS_SEMACQUIRE		37
++#define	SYS_SEMRELEASE		38
++#define	SYS_SEEK		39
++#define	SYS_FVERSION		40
++#define	SYS_ERRSTR		41
++#define	SYS_STAT		42
++#define	SYS_FSTAT		43
++#define	SYS_WSTAT		44
++#define	SYS_FWSTAT		45
++#define	SYS_MOUNT		46
++#define	SYS_AWAIT		47
++#define	SYS_PREAD		50
++#define	SYS_PWRITE		51
++#define	SYS_TSEMACQUIRE		52
++#define SYS__NSEC		53
+diff --git newlib-workdir/newlib/libc/sys/plan9/syscall.S newlib-workdir/newlib/libc/sys/plan9/syscall.S
+new file mode 100644
+index 0000000..3b82807
+--- /dev/null
++++ newlib-workdir/newlib/libc/sys/plan9/syscall.S
+@@ -0,0 +1,17 @@
++	.global syscall
++syscall:
++	sub	$0x40, %rsp
++	mov	%rbp, 0x28(%rsp)
++	mov	%rbx, 0x30(%rsp)
++
++	mov	%rdi, %rbp
++	mov	%rsi, 0x08(%rsp)
++	mov	%rdx, 0x10(%rsp)
++	mov	%rcx, 0x18(%rsp)
++	mov	%r8, 0x20(%rsp)
++	syscall
++
++	mov	0x28(%rsp), %rbp
++	mov	0x30(%rsp), %rbx
++	add	$0x40, %rsp
++	ret
+diff --git newlib-workdir/newlib/libc/sys/plan9/syscalls.c newlib-workdir/newlib/libc/sys/plan9/syscalls.c
+new file mode 100644
+index 0000000..78ae945
+--- /dev/null
++++ newlib-workdir/newlib/libc/sys/plan9/syscalls.c
+@@ -0,0 +1,244 @@
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <sys/fcntl.h>
++#include <sys/times.h>
++#include <sys/errno.h>
++#include <sys/time.h>
++#include <stdio.h>
++#include <utime.h>
++
++#include "sys.h"
++
++extern long long syscall(long, ...);
++
++// TODO:
++// * Check for errors and set errno
++// * Finish remaining wrappers
++
++extern char end[];
++
++int
++dup2(int fildes, int fildes2)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++pipe(int fildes[2])
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++utime(const char *path, const struct utimbuf *times)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++access(const char *path, int amode)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++chdir(const char *path)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++mode_t
++umask(mode_t mask)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++
++ int
++dup(int fd)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++fchmod(int fd, mode_t mode)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++rmdir(const char *path)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++chmod(const char *path, mode_t mode)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++fcntl(int fd, int cmd, ...)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++char *
++getwd(char *buf)
++{
++	errno = ENOSYS;
++	return NULL;
++}
++
++long
++sysconf(int name)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++lstat(const char *path, struct stat *buf)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++void _exit(int code) {
++	syscall(SYS_EXITS, code ? "error" : 0);
++}
++
++caddr_t sbrk(int n) {
++	static char *bloc = { end };
++
++	uintptr_t bl;
++
++	bl = ((uintptr_t)bloc + 7) & ~7;
++	if(syscall(SYS_BRK_, (void*)(bl+n)) < 0)
++		return (void*)-1;
++	bloc = (char*)bl + n;
++	return (caddr_t)bl;
++}
++
++int write(int fd, char *buf, int len) {
++	return syscall(SYS_PWRITE, fd, buf, len, -1LL);
++}
++
++int close(int fd) {
++	return syscall(SYS_CLOSE, fd);
++}
++
++enum {
++	RFPROC = 1<<4,
++	RFFDG = 1<<2,
++	RFREND = 1<<13,
++};
++
++int fork() {
++	return syscall(SYS_RFORK, RFPROC|RFFDG|RFREND);
++}
++
++int fstat(int fd, struct stat *st) {
++	// TODO
++	errno = ENOSYS;
++	return -1;
++}
++
++int lseek(int fd, int ptr, int dir) {
++	// TODO
++	errno = ENOSYS;
++	return -1;
++}
++
++int open(const char *name, int flags, ...) {
++	// TODO
++	errno = ENOSYS;
++	return -1;
++}
++
++int read(int fd, char *buf, int len) {
++	return syscall(SYS_PREAD, fd, buf, len, -1LL);
++}
++
++int isatty(int fd) {
++	return 1;
++}
++
++int
++execv(const char *path, char * const argv[])
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++execve(char *name, char **argv, char **env) {
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++execvp(const char *__file, char * const __argv[])
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int
++sleep(unsigned int seconds)
++{
++	errno = ENOSYS;
++	return -1;
++}
++
++int getpid() {
++	errno = ENOSYS;
++	return -1;
++}
++
++int link(char *old, char *new) {
++	errno = ENOSYS;
++	return -1;
++}
++
++int kill(int pid, int sig) {
++	errno = ENOSYS;
++	return -1;
++}
++
++int stat(const char *fd, struct stat *st) {
++	errno = ENOSYS;
++	return -1;
++}
++
++clock_t times(struct tms *buf) {
++	errno = ENOSYS;
++	return -1;
++}
++
++int unlink(char *name) {
++	errno = ENOSYS;
++	return -1;
++}
++
++int wait(int *status) {
++	errno = ENOSYS;
++	return -1;
++}
++
++int gettimeofday(struct timeval *p, void *z) {
++	errno = ENOSYS;
++	return -1;
++}
--- /dev/null
+++ b/recipes/binutils
@@ -1,0 +1,36 @@
+name=binutils
+version=2.42
+revision=1
+tarball_url="https://ftp.gnu.org/gnu/binutils/binutils-${version}.tar.xz"
+tarball_blake2b="e67a5c028fba70e70088fd11b38ec8c9c4ed5a019badefda25abeb6275997b16f0891e7ff3424c4b82bbfae92e8992669826920dd53df61cd48469d8f7cd5bd1"
+source_hostdeps="autoconf-2.69 automake-1.15.1"
+imagedeps="gcc"
+hostdeps="gcc autoconf-2.69 automake-1.15.1"
+deps="core-libs"
+
+regenerate() {
+    autotools_recursive_regen -I"$(realpath ./config)"
+}
+
+build() {
+    autotools_configure \
+        --target=${OS_TRIPLET} \
+        --with-build-sysroot=${sysroot_dir} \
+        --disable-gdb \
+        --disable-nls \
+        --disable-werror
+
+    make -j${parallelism}
+}
+
+package() {
+    DESTDIR="${dest_dir}" make install
+
+    # Remove unnecessary directory
+    rm -rf "${dest_dir}${prefix}"/${OS_TRIPLET}
+
+    # Remove static libraries
+    rm -rf "${dest_dir}${prefix}"/lib/*.a
+
+    post_package_strip
+}
--- /dev/null
+++ b/recipes/core-libs
@@ -1,0 +1,3 @@
+name=core-libs
+revision=1
+deps="newlib libgcc libstdc++"
--- /dev/null
+++ b/recipes/libgcc
@@ -1,0 +1,28 @@
+name=libgcc
+revision=1
+hostdeps="gcc autoconf-2.69 automake-1.15.1"
+imagedeps="gcc"
+deps="newlib"
+
+build() {
+    cd "${base_dir}"/host-builds/gcc/build
+
+    make -j${parallelism} all-target-libgcc
+}
+
+package() {
+    cd "${base_dir}"/host-builds/gcc/build
+
+    rm -rf tmp_libgcc_dir
+    mkdir tmp_libgcc_dir
+
+    DESTDIR="$(realpath tmp_libgcc_dir)" make install-target-libgcc
+
+    mkdir -p "${dest_dir}${prefix}"
+
+    cp -r tmp_libgcc_dir/usr/local/lib "${dest_dir}${prefix}"/
+
+    # Copy libgcc into GCC's tree else it will complain.
+    mkdir -p "${base_dir}"/host-pkgs/gcc/usr/local/lib
+    cp -r tmp_libgcc_dir/usr/local/lib/* "${base_dir}"/host-pkgs/gcc/usr/local/lib/
+}
--- /dev/null
+++ b/recipes/libstdc++
@@ -1,0 +1,33 @@
+name=libstdc++
+revision=1
+hostdeps="gcc autoconf-2.69 automake-1.15.1"
+imagedeps="gcc"
+deps="newlib libgcc"
+
+build() {
+    cd "${base_dir}"/host-builds/gcc/build
+
+    make -j${parallelism} all-target-libstdc++-v3
+}
+
+package() {
+    cd "${base_dir}"/host-builds/gcc/build
+
+    rm -rf tmp_libstdc++_dir
+    mkdir tmp_libstdc++_dir
+
+    DESTDIR="$(realpath tmp_libstdc++_dir)" make install-target-libstdc++-v3
+
+    # For some reason this also installs libgcc even though it shouldn't...
+    # Remove it.
+    rm -fv tmp_libstdc++_dir/usr/local/${OS_TRIPLET}/lib/libgcc*
+
+    mkdir -p "${dest_dir}${prefix}"
+
+    cp -r tmp_libstdc++_dir/usr/local/share "${dest_dir}${prefix}"/
+    cp -r tmp_libstdc++_dir/usr/local/${OS_TRIPLET}/* "${dest_dir}${prefix}"/
+
+    # Copy libstdc++ and headers into GCC's tree else it will complain.
+    mkdir -p "${base_dir}"/host-pkgs/gcc/usr/local/${OS_TRIPLET}
+    cp -r tmp_libstdc++_dir/usr/local/${OS_TRIPLET}/* "${base_dir}"/host-pkgs/gcc/usr/local/${OS_TRIPLET}/
+}
--- /dev/null
+++ b/recipes/newlib
@@ -1,0 +1,27 @@
+name=newlib
+version=4.4.0.20231231
+revision=1
+tarball_url="ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz"
+tarball_blake2b="1df810c7776aa1fe2806682509ab45df642f5e80d6069b7c6ca513b3d820440fc73abdf7505d1f3149d0a07f0c5558a48620d2824f1698c2f1df5f6473105eb4"
+source_hostdeps="autoconf-2.69 automake-1.15.1"
+imagedeps="gcc"
+hostdeps="bootstrap-gcc autoconf-2.69 automake-1.15.1"
+
+regenerate() {
+    autotools_recursive_regen
+}
+
+build() {
+    "${source_dir}"/configure \
+        --target=${OS_TRIPLET} \
+        --with-sysroot=${sysroot} \
+        --prefix=${prefix}
+
+    make -j${parallelism}
+}
+
+package() {
+    DESTDIR="${dest_dir}" make install
+    cp -ar "${dest_dir}/usr/${OS_TRIPLET}/." "${dest_dir}/usr/"
+    rm -rf "${dest_dir}/usr/${OS_TRIPLET}"
+}
--- /dev/null
+++ b/source-recipes/autoconf-2.69
@@ -1,0 +1,4 @@
+name=autoconf-2.69
+version=2.69
+tarball_url="https://ftp.gnu.org/gnu/autoconf/autoconf-${version}.tar.gz"
+tarball_blake2b="7e8a513bbfcabadad1577919c048cc05ca0a084788850b42570f88afc2fa9c25fb32277412f135b81ba1c0d8079465a6b581d2d78662c991d2183b739fac407c"
--- /dev/null
+++ b/source-recipes/automake-1.15.1
@@ -1,0 +1,4 @@
+name=automake-1.15.1
+version=1.15.1
+tarball_url="https://ftp.gnu.org/gnu/automake/automake-${version}.tar.gz"
+tarball_blake2b="b541591caf13994473d4ea4fa3ebb1116cfa6924553132be191867a7bdb131d2cfc6a31f448f9c0210476bf54a139812ee4368c3ab2b00c3f4d1c5f22e005b49"
--- /dev/null
+++ b/source-recipes/gcc-host
@@ -1,0 +1,16 @@
+name=gcc-host
+version=14.1.0
+tarball_url="https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"
+tarball_blake2b="7efd6574b8bca081de6e31480ec0565c6d7fb773383e8e1fdcc17e35bba2bf44b3f4f995cdbcccd001689926e96a6563ef3d099902fe3b37ab09dcf553ab0596"
+hostdeps="automake-1.15.1 autoconf-2.69"
+imagedeps="git"
+allow_network="yes"
+
+regenerate() {
+    ./contrib/download_prerequisites
+
+    # Gettext causes issues and we don't want it anyways.
+    rm -rf gettext*
+
+    autotools_recursive_regen -I"$(realpath ./config)"
+}