Skip to content

Commit 381351b

Browse files
authored
Add support for building g++-1.27 (#29)
* Add support for building g++-1.27 * replace fixed `1.27` with `MAJOR_MINOR` * remove unnecessary workaround * add support for `-Wl,...` command line flag * merge g++-1.27 build into gcc-1.27 build script
1 parent 2101228 commit 381351b

File tree

3 files changed

+553
-7
lines changed

3 files changed

+553
-7
lines changed

build/build-1.27.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,24 @@ else
1717
OUTPUT=${2-/root/gcc-${VERSION}.tar.xz}
1818
fi
1919

20-
# Workaround for Ubuntu builds
21-
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
2220
STAGING_DIR=/opt/compiler-explorer/gcc-${VERSION}
2321

2422
MAJOR=1
2523
MAJOR_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

3132
applyPatchesAndConfig() {
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

5859
pushd gcc-${MAJOR_MINOR}
5960
ln -s config-i386v.h config.h
@@ -69,6 +70,25 @@ make -j$(nproc) CC=stage1/gcc CFLAGS="-Bstage1/ -Iinclude"
6970
make -j$(nproc) install
7071
popd
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+
7292
export XZ_DEFAULTS="-T 0"
7393
tar Jcf ${OUTPUT} --transform "s,^./,./gcc-${VERSION}/," -C ${STAGING_DIR} .
7494

0 commit comments

Comments
 (0)