@@ -627,12 +627,19 @@ if ! [ -f "${gcc_tarball}" ]; then
627627
628628 if (( gcc_major >= 4 .0 && gcc_major <= 4 .2 )) ; then
629629 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-4.0/0001-Add-host-support-for-x64-MinGW.patch"
630+ elif (( gcc_major == 2 .95 )) ; then
631+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Add-host-support-for-x64-MinGW.patch"
630632 elif (( gcc_major <= 3 .3 )) ; then
631633 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Add-host-support-for-x64-MinGW.patch"
632634 elif (( gcc_major <= 3 .4 )) ; then
633635 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.4/0001-Add-host-support-for-x64-MinGW.patch"
634636 fi
635637
638+ if (( gcc_major == 2 .95 )) ; then
639+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Add-host-support-for-x86_64.patch"
640+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Restore-source-files-with-stripped-license-headers.patch"
641+ fi
642+
636643 if (( gcc_major == 11 )) ; then
637644 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-11/0001-Unpoison-calloc-on-musl-hosts.patch"
638645 fi
@@ -653,6 +660,8 @@ if ! [ -f "${gcc_tarball}" ]; then
653660 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-5/0001-Fix-definition-of-abort-on-Windows.patch"
654661 elif (( gcc_major >= 3 .4 && gcc_major <= 4 .9 )) ; then
655662 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.4/0001-Fix-definition-of-abort-on-Windows.patch"
663+ elif (( gcc_major == 2 .95 )) ; then
664+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Fix-definition-of-abort-on-Windows.patch"
656665 elif (( gcc_major <= 3 .3 )) ; then
657666 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Fix-definition-of-abort-on-Windows.patch"
658667 fi
@@ -667,6 +676,11 @@ if ! [ -f "${gcc_tarball}" ]; then
667676
668677 if (( gcc_major <= 4 .9 )) ; then
669678 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-strerror.c-Do-not-declare-sys_nerr-or-sys_errlist-if-already-macros.patch"
679+ fi
680+
681+ if (( gcc_major == 2 .95 )) ; then
682+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Avoid-incorrectly-declaring-the-caddr_t-alias-on-Linux.patch"
683+ elif (( gcc_major <= 4 .9 )) ; then
670684 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Avoid-incorrectly-declaring-the-caddr_t-alias-on-Linux.patch"
671685 fi
672686
@@ -682,18 +696,26 @@ if ! [ -f "${gcc_tarball}" ]; then
682696 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Allow-compilation-with-GCC-4.4-and-up.patch"
683697 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Fix-redeclaration-error.patch"
684698 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Fix-locale-support-for-glibc-2.3.patch"
699+ elif (( gcc_major == 2 .95 )) ; then
700+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Allow-compilation-with-GCC-4.4-and-up.patch"
701+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Fix-redeclaration-error.patch"
702+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Fix-locale-support-for-glibc-2.3.patch"
685703 fi
686704
687705 if (( gcc_major >= 3 .1 && gcc_major <= 3 .2 )) ; then
688706 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Don-t-error-out-for-unknown-platforms.patch"
689707 elif (( gcc_major == 3 .3 )) ; then
690708 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.3/0001-Don-t-error-out-for-unknown-platforms.patch"
709+ elif (( gcc_major == 2 .95 )) ; then
710+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Don-t-error-out-for-unknown-platforms.patch"
691711 fi
692712
693713 if (( gcc_major >= 3 .3 && gcc_major <= 3 .4 )) ; then
694714 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-${gcc_major} /0001-Handle-enable-checking-release.patch"
695715 elif (( gcc_major >= 3 .1 && gcc_major <= 3 .2 )) ; then
696716 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Handle-enable-checking-release.patch"
717+ elif (( gcc_major == 2 .95 )) ; then
718+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Handle-enable-checking-release.patch"
697719 fi
698720
699721 if (( gcc_major >= 4 .5 && gcc_major <= 4 .8 )) ; then
@@ -704,6 +726,8 @@ if ! [ -f "${gcc_tarball}" ]; then
704726 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Add-missing-_attribute__-__gnu_inline__.patch"
705727 elif (( gcc_major == 3 .3 )) ; then
706728 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.3/0001-Add-missing-_attribute__-__gnu_inline__.patch"
729+ elif (( gcc_major == 2 .95 )) ; then
730+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Add-missing-_attribute__-__gnu_inline__.patch"
707731 fi
708732
709733 if (( gcc_major >= 4 .1 && gcc_major <= 4 .7 )) ; then
@@ -714,6 +738,8 @@ if ! [ -f "${gcc_tarball}" ]; then
714738 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Disable-building-documentation.patch"
715739 elif (( gcc_major == 3 .3 )) ; then
716740 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.3/0001-Disable-building-documentation.patch"
741+ elif (( gcc_major == 2 .95 )) ; then
742+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Disable-building-documentation.patch"
717743 fi
718744
719745 if (( gcc_major >= 4 .2 && gcc_major <= 4 .4 )) ; then
@@ -734,6 +760,8 @@ if ! [ -f "${gcc_tarball}" ]; then
734760 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-${gcc_major} /0001-Prevent-use-of-_unlocked-functions-and-disable-inclusion-of-malloc.h.patch"
735761 elif (( gcc_major >= 3 .1 && gcc_major <= 3 .3 )) ; then
736762 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0001-Prevent-use-of-_unlocked-functions-and-disable-inclusion-of-malloc.h.patch"
763+ elif (( gcc_major == 2 .95 )) ; then
764+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0001-Prevent-use-of-_unlocked-functions-and-disable-inclusion-of-malloc.h.patch"
737765 fi
738766
739767 if (( gcc_major == 6 )) ; then
@@ -777,6 +805,8 @@ if ! [ -f "${gcc_tarball}" ]; then
777805 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-6/0007-Add-relative-RPATHs-to-GCC-host-tools.patch"
778806 elif (( gcc_major >= 3 .1 && gcc_major <= 3 .3 )) ; then
779807 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0007-Add-relative-RPATHs-to-GCC-host-tools.patch"
808+ elif (( gcc_major == 2 .95 )) ; then
809+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0007-Add-relative-RPATHs-to-GCC-host-tools.patch"
780810 else
781811 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-${gcc_major} /0007-Add-relative-RPATHs-to-GCC-host-tools.patch"
782812 fi
@@ -793,6 +823,8 @@ if ! [ -f "${gcc_tarball}" ]; then
793823 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-${gcc_major} /0010-Prefer-DT_RPATH-over-DT_RUNPATH.patch"
794824 elif (( gcc_major >= 3 .1 )) ; then
795825 patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-3.1/0010-Prefer-DT_RPATH-over-DT_RUNPATH.patch"
826+ elif (( gcc_major == 2 .95 )) ; then
827+ patch --directory=" ${gcc_directory} " --strip=' 1' --input=" ${workdir} /patches/gcc-2.9/0010-Prefer-DT_RPATH-over-DT_RUNPATH.patch"
796828 fi
797829
798830 if (( gcc_major == 3 .1 )) ; then
@@ -1183,6 +1215,10 @@ if (( gcc_major <= 4.0 )); then
11831215 targets=(" ${(@ )targets:# arm-unknown-linux-gnueabi} " )
11841216fi
11851217
1218+ if (( gcc_major <= 3 .0 )) ; then
1219+ targets=(" ${(@ )targets:# x86_64-unknown-linux-gnu} " )
1220+ fi
1221+
11861222for target in " ${targets[@]} " ; do
11871223 check_target_exists " ${gcc_targets} " " ${target} " || continue
11881224
@@ -1302,6 +1338,18 @@ for target in "${targets[@]}"; do
13021338 cp " ${binutils_gnu_wrapper} " " ${bin} "
13031339 done
13041340
1341+ if (( gcc_major == 2 .95 )) ; then
1342+ # This version of GCC looks up the target's system headers in
1343+ # '<tooldir>/bin/include' (the C-preprocessor adds '/include'
1344+ # to every -B directory it was started with)
1345+ ln \
1346+ --symbolic \
1347+ --relative \
1348+ --force \
1349+ " ${toolchain_directory} /${triplet} /include" \
1350+ " ${toolchain_directory} /${triplet} /bin/include"
1351+ fi
1352+
13051353 rm --force --recursive " ${PWD} "
13061354
13071355 if (( gcc_major >= 6 )) && ( [ " ${triplet} " = ' x86_64-unknown-linux-gnu' ] || [ " ${triplet} " = ' i386-unknown-linux-gnu' ] ); then
@@ -1461,10 +1509,18 @@ for target in "${targets[@]}"; do
14611509 unlink " ${toolchain_directory} /${triplet} /usr"
14621510 fi
14631511
1464- if (( gcc_major <= 4 .1 )) ; then
1512+ if (( gcc_major >= 3 .0 && gcc_major <= 4 .1 )) ; then
1513+ # GCC 2.95 keeps its C++ headers in '<prefix>/include/g++-3',
1514+ # whose path is hard-coded into the compiler
14651515 mv \
14661516 " ${toolchain_directory} /include/c++" \
14671517 " ${toolchain_directory} /${triplet} /include"
1518+ elif (( gcc_major == 2 .95 )) ; then
1519+ mkdir --parent " ${toolchain_directory} /${triplet} /include/c++"
1520+
1521+ mv \
1522+ " ${toolchain_directory} /include/g++-3" \
1523+ " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} "
14681524 fi
14691525
14701526 if (( gcc_major <= 3 .3 )) ; then
@@ -1497,11 +1553,13 @@ for target in "${targets[@]}"; do
14971553 " ${toolchain_directory} /lib/gcc/${triplet} /${gcc_major} ." * \
14981554 " ${toolchain_directory} /lib/gcc/${triplet} /${gcc_major} "
14991555
1500- ln \
1501- --symbolic \
1502- --relative \
1503- " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} ." * \
1504- " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} "
1556+ if (( gcc_major >= 3 .0 )) ; then
1557+ ln \
1558+ --symbolic \
1559+ --relative \
1560+ " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} ." * \
1561+ " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} "
1562+ fi
15051563 fi
15061564
15071565 if (( gcc_major >= 4 .3 && gcc_major <= 11 )) ; then
@@ -1526,6 +1584,22 @@ for target in "${targets[@]}"; do
15261584 cd ' ../lib'
15271585 fi
15281586
1587+ if (( gcc_major == 2 .95 )) ; then
1588+ ln \
1589+ --symbolic \
1590+ --relative \
1591+ --force \
1592+ ' libstdc++-libc6.1-2.so.3' \
1593+ ' libstdc++.so'
1594+
1595+ ln \
1596+ --symbolic \
1597+ --relative \
1598+ --force \
1599+ ' libstdc++-3-libc6.1-2-2.10.0.a' \
1600+ ' libstdc++.a'
1601+ fi
1602+
15291603 " ${triplet} -strip" " ${PWD} /lib" * ' .so' 2> /dev/null || true
15301604
15311605 if (( gcc_major >= 13 && gcc_major <= 15 )) ; then
@@ -1542,6 +1616,10 @@ for target in "${targets[@]}"; do
15421616 LDFLAGS=" ${linkflags} "
15431617 fi
15441618
1619+ if (( gcc_major == 2 .95 )) ; then
1620+ rm " ${toolchain_directory} /lib/gcc/${triplet} /${gcc_major} /libstdc++" *
1621+ fi
1622+
15451623 ln \
15461624 --symbolic \
15471625 --relative \
@@ -1595,7 +1673,9 @@ for target in "${targets[@]}"; do
15951673 cp " ${toolchain_directory} /bin/${triplet} -g++${exe} " " ${toolchain_directory} /bin/${triplet} -c++${exe} "
15961674 fi
15971675
1598- cat " ${workdir} /patches/c++config.h" >> " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} /${triplet} /bits/c++config.h"
1676+ if (( gcc_major >= 3 .0 )) ; then
1677+ cat " ${workdir} /patches/c++config.h" >> " ${toolchain_directory} /${triplet} /include/c++/${gcc_major} /${triplet} /bits/c++config.h"
1678+ fi
15991679
16001680 if (( gcc_major >= 4 .6 )) ; then
16011681 if [[ " ${host} " = * ' -mingw32' ]]; then
@@ -1889,6 +1969,10 @@ while read item; do
18891969 continue
18901970 fi
18911971
1972+ if (( gcc_major <= 3 .0 )) && [[ " ${triplet} " = ' x86_64-' * ]]; then
1973+ continue
1974+ fi
1975+
18921976 declare repository=" $( jq --raw-output ' .repository.url' <<< " ${item}" ) "
18931977 declare release=" $( jq --raw-output ' .repository.release' <<< " ${item}" ) "
18941978 declare resource=" $( jq --raw-output ' .repository.resource' <<< " ${item}" ) "
@@ -2213,3 +2297,4 @@ if ( find "${toolchain_directory}" -xtype 'l' -print -quit | grep -q . ); then
22132297fi
22142298
22152299cp " ${workdir} /README.md" " ${toolchain_directory} "
2300+
0 commit comments