|
root / devel / gcc / build.sh
build.sh Bash 53 lines 1.3 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Build script for GCC

set -e
cd "$SRCDIR"

export PATH="/usr/gnu/bin:$PATH"
export CC="gcc -m64"
export CXX="g++ -m64"
export CFLAGS="-m64 -O2"
export CXXFLAGS="-m64 -O2"
# Note: Don't add -L/usr/lib/amd64 to LDFLAGS - it picks up system's libgcc-unwind.map
export LDFLAGS="-m64 $LDFLAGS"

# GCC must be built in a separate directory
mkdir -p build
cd build

../configure \
    --prefix=$PREFIX \
    --libdir=$PREFIX/lib \
    --libexecdir=$PREFIX/libexec \
    --enable-languages=c,c++ \
    --enable-shared \
    --enable-threads=posix \
    --enable-__cxa_atexit \
    --enable-clocale=gnu \
    --enable-gnu-unique-object \
    --enable-linker-build-id \
    --disable-multilib \
    --disable-werror \
    --disable-bootstrap \
    --disable-libstdcxx-pch \
    --disable-lto \
    --with-gmp=$PREFIX \
    --with-mpfr=$PREFIX \
    --with-mpc=$PREFIX \
    --with-gnu-as \
    --with-gnu-ld \
    --with-system-zlib

gmake -j${JOBS:-1}
gmake install DESTDIR="$PKGDIR"

# Create cc symlink
ln -sf gcc "$PKGDIR$PREFIX/bin/cc"

# Ensure runtime libraries have .so symlinks without version
cd "$PKGDIR$PREFIX/lib"
[[ -f libstdc++.so.6 ]] && ln -sf libstdc++.so.6 libstdc++.so
[[ -f libgcc_s.so.1 ]] && ln -sf libgcc_s.so.1 libgcc_s.so
[[ -f libatomic.so.1 ]] && ln -sf libatomic.so.1 libatomic.so