1717 OUTPUT=${2-/ root/ gcc-${VERSION} .tar.xz}
1818fi
1919
20- # Workaround for Ubuntu builds
21- export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
2220STAGING_DIR=/opt/compiler-explorer/gcc-${VERSION}
2321
2422MAJOR=1
2523MAJOR_MINOR=1.27
2624
27- URL=https://gcc.gnu.org/pub/gcc/old-releases/gcc-${MAJOR} /gcc-${MAJOR_MINOR} .tar.bz2
25+ GCC_URL=https://gcc.gnu.org/pub/gcc/old-releases/gcc-${MAJOR} /gcc-${MAJOR_MINOR} .tar.bz2
26+ GPLUSPLUS_URL=https://gcc.gnu.org/pub/gcc/old-releases/gcc-${MAJOR} /g++-${MAJOR_MINOR} .0.tar.bz2
2827
29- curl -L ${URL} | tar jxf -
28+ # “unload the tapes”
29+ curl -L ${GCC_URL} | tar jxf -
30+ curl -L ${GPLUSPLUS_URL} | tar jxf -
3031
3132applyPatchesAndConfig () {
3233 local PATCH_DIR=${ROOT} /patches/$1
3334 local PATCH=" "
3435 if [[ -d ${PATCH_DIR} ]]; then
3536 echo " Applying patches from ${PATCH_DIR} "
36- pushd gcc- ${VERSION}
37+ pushd $2
3738 for PATCH in ${PATCH_DIR} /* ; do
3839 echo " ...${PATCH} "
3940 patch -p1 < ${PATCH}
@@ -52,8 +53,8 @@ applyPatchesAndConfig() {
5253 fi
5354}
5455
55- applyPatchesAndConfig gcc${MAJOR }
56- applyPatchesAndConfig gcc ${MAJOR_MINOR}
56+ applyPatchesAndConfig gcc${MAJOR_MINOR} gcc- ${MAJOR_MINOR }
57+ applyPatchesAndConfig g++ ${MAJOR_MINOR} src-g++
5758
5859pushd gcc-${MAJOR_MINOR}
5960ln -s config-i386v.h config.h
@@ -69,6 +70,25 @@ make -j$(nproc) CC=stage1/gcc CFLAGS="-Bstage1/ -Iinclude"
6970make -j$( nproc) install
7071popd
7172
73+ mkdir g++
74+
75+ pushd g++
76+ ln -s ../src-g++/* .
77+ ln -s ../gcc-${MAJOR_MINOR} /* .[chy] . || true
78+ ln -s ../gcc-${MAJOR_MINOR} /* .def . || true
79+ ln -s ../gcc-${MAJOR_MINOR} /* .md . || true
80+ ln -s ../gcc-${MAJOR_MINOR} /move-if-change . || true
81+ ln -s ../gcc-${MAJOR_MINOR} /config-i386v.h config.h || true
82+ ln -s ../gcc-${MAJOR_MINOR} /tm-i386v.h tm.h || true
83+ ln -s ../gcc-${MAJOR_MINOR} /i386.md md || true
84+ ln -s ../gcc-${MAJOR_MINOR} /output-i386.c aux-output.c || true
85+
86+ sed -i " s|^prefix =.*|prefix = /opt/compiler-explorer/gcc-${VERSION} |g" Makefile
87+
88+ make -j$( nproc)
89+ make -j$( nproc) install
90+ popd
91+
7292export XZ_DEFAULTS=" -T 0"
7393tar Jcf ${OUTPUT} --transform " s,^./,./gcc-${VERSION} /," -C ${STAGING_DIR} .
7494
0 commit comments