Skip to content

Commit 737ef72

Browse files
committed
build gmp/mpfr/mpc/isl libs separately
1 parent 2192cc7 commit 737ef72

File tree

8 files changed

+43
-30
lines changed

8 files changed

+43
-30
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
run: |
6262
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
6363
sudo apt-get update
64-
sudo apt-get install bison flex curl make texinfo zlib1g-dev tar bzip2 gzip xz-utils unzip dos2unix libtool-bin gcc-11 g++-11 cmake help2man python2-dev nasm libslang2-dev ccache libmpfr-dev libgmp-dev
64+
sudo apt-get install bison flex curl make texinfo zlib1g-dev tar bzip2 gzip xz-utils unzip dos2unix libtool-bin gcc-11 g++-11 cmake help2man python2-dev nasm libslang2-dev ccache
6565
echo "CC=gcc-12" >> $GITHUB_ENV
6666
echo "CXX=g++-12" >> $GITHUB_ENV
6767
mkdir -p ~/.ccache
@@ -72,7 +72,7 @@ jobs:
7272
if: contains(matrix.os, 'macos')
7373
run: |
7474
brew update
75-
brew install bash bison flex curl make texinfo zlib bzip2 gzip xz unzip dos2unix libtool cmake help2man nasm s-lang ccache mpfr gmp
75+
brew install bash bison flex curl make texinfo zlib bzip2 gzip xz unzip dos2unix libtool cmake help2man nasm s-lang ccache
7676
mkdir -p ~/.ccache
7777
echo "CCACHE_DIR=~/.ccache" >> $GITHUB_ENV
7878
echo "$(brew --prefix)/opt/ccache/libexec" >> $GITHUB_PATH

build-djgpp.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,6 @@ if [ ! -z ${GCC_VERSION} ]; then
211211

212212
cd ${BUILDDIR}/gnu/gcc-${GCC_VERSION} || exit 1
213213

214-
if [ ! -z ${BUILD_DEB} ]; then
215-
echo "Unpacking gcc dependencies"
216-
for URL in $GMP_ARCHIVE $MPFR_ARCHIVE $MPC_ARCHIVE $ISL_ARCHIVE; do
217-
FILE=`basename $URL`
218-
untar ${FILE}
219-
mv ${FILE%.*.*} ${FILE%%-*} || exit 1
220-
done
221-
else
222-
echo "Downloading gcc dependencies"
223-
sed -i 's/ftp/http/g' contrib/download_prerequisites
224-
./contrib/download_prerequisites || exit 1
225-
fi
226-
227214
# apply extra patches if necessary
228215
cat ${BASE}/patch/djgpp-gcc-${GCC_VERSION}/* | patch -p1 -u || exit 1
229216

@@ -331,7 +318,6 @@ if [ ! -z ${GCC_VERSION} ]; then
331318
echo "Installing gcc (stage 2)"
332319
${SUDO} ${MAKE_J} install-strip || \
333320
${SUDO} ${MAKE_J} install-strip || exit 1
334-
${SUDO} ${MAKE_J} -C mpfr install DESTDIR=${TMPINST}
335321

336322
CFLAGS="$TEMP_CFLAGS"
337323
CXXFLAGS="$TEMP_CXXFLAGS"

debian/control

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Build-Depends:
2121
nasm,
2222
libslang2-dev,
2323
pkg-config,
24-
libgmp-dev,
25-
libmpfr-dev,
2624
debhelper (>= 11)
2725
Standards-Version: 4.1.2
2826
Homepage: https://github.com/jwt27/build-gcc

script/build-avr-gcc.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if [ ! -z ${GCC_VERSION} ]; then
5454

5555
GCC_CONFIGURE_OPTIONS+=" --target=${TARGET} --prefix=${PREFIX} ${HOST_FLAG} ${BUILD_FLAG}
5656
--enable-languages=${ENABLE_LANGUAGES}
57-
--with-avrlibc"
57+
--with-avrlibc ${WITH_LIBS}"
5858
strip_whitespace GCC_CONFIGURE_OPTIONS
5959

6060
if [ ! -e configure-prefix ] || [ ! "`cat configure-prefix`" == "${GCC_CONFIGURE_OPTIONS}" ]; then
@@ -117,7 +117,6 @@ if [ ! -z ${GCC_VERSION} ]; then
117117
echo "Installing gcc"
118118
${SUDO} ${MAKE_J} install-strip || \
119119
${SUDO} ${MAKE_J} install-strip || exit 1
120-
${SUDO} ${MAKE_J} -C mpfr install DESTDIR=${BASE}/build/tmpinst
121120

122121
CFLAGS="$TEMP_CFLAGS"
123122
CXXFLAGS="$TEMP_CXXFLAGS"

script/build-gdb.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ if [ ! -z ${GDB_VERSION} ]; then
1515

1616
echo "Building gdb"
1717

18-
GDB_CONFIGURE_OPTIONS+=" --target=${TARGET} --prefix=${PREFIX} ${HOST_FLAG} ${BUILD_FLAG}"
19-
[ -e ${BASE}/build/tmpinst${PREFIX}/lib/libmpfr.a ] && GDB_CONFIGURE_OPTIONS+=" --with-mpfr=${BASE}/build/tmpinst${PREFIX}"
18+
GDB_CONFIGURE_OPTIONS+=" --target=${TARGET} --prefix=${PREFIX} ${HOST_FLAG} ${BUILD_FLAG} ${WITH_LIBS}"
2019
strip_whitespace GDB_CONFIGURE_OPTIONS
2120

2221
if [ ! -e configure-prefix ] || [ ! "`cat configure-prefix`" = "${GDB_CONFIGURE_OPTIONS}" ]; then

script/build-newlib-gcc.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if [ ! -z ${GCC_VERSION} ]; then
4646

4747
GCC_CONFIGURE_OPTIONS+=" --target=${TARGET} --prefix=${PREFIX} ${HOST_FLAG} ${BUILD_FLAG}
4848
--enable-languages=${ENABLE_LANGUAGES}
49-
--with-newlib"
49+
--with-newlib ${WITH_LIBS}"
5050
strip_whitespace GCC_CONFIGURE_OPTIONS
5151

5252
if [ ! -e configure-prefix ] || [ ! "`cat configure-prefix`" == "${GCC_CONFIGURE_OPTIONS}" ]; then
@@ -110,7 +110,6 @@ if [ ! -z ${GCC_VERSION} ]; then
110110
echo "Installing gcc"
111111
${SUDO} ${MAKE_J} install-strip || \
112112
${SUDO} ${MAKE_J} install-strip || exit 1
113-
${SUDO} ${MAKE_J} -C mpfr install DESTDIR=${BASE}/build/tmpinst
114113

115114
CFLAGS="$TEMP_CFLAGS"
116115
CXXFLAGS="$TEMP_CXXFLAGS"

script/build-tools.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cd ${BASE}/build || exit 1
55

66
# build GNU sed if needed.
77
if [ ! -z "${SED_VERSION}" ]; then
8-
if [ ! "$(${BASE}/build/tmpinst/sed-version 2> /dev/null)" == "${SED_VERSION}" ]; then
8+
if [ ! "$(cat ${BASE}/build/tmpinst/sed-version 2> /dev/null)" == "${SED_VERSION}" ]; then
99
echo "Building sed"
1010
untar ${SED_ARCHIVE} || exit 1
1111
cd sed-${SED_VERSION}/
@@ -18,3 +18,29 @@ if [ ! -z "${SED_VERSION}" ]; then
1818
echo ${SED_VERSION} > ${BASE}/build/tmpinst/sed-version
1919
fi
2020
fi
21+
22+
build_lib()
23+
{
24+
local display_name=$1
25+
local name=${2:-${display_name,,}}
26+
local archive_var=${3:-${name^^}_ARCHIVE}
27+
local version_var=${4:-${name^^}_VERSION}
28+
local archive=${!archive_var}
29+
local version=${!version_var}
30+
if [ ! -z "$version" ]; then
31+
if [ "$(cat ${BASE}/build/tmpinst/${name}-version 2> /dev/null)" != "$version" ]; then
32+
echo "Building $display_name $version"
33+
untar $archive || exit 1
34+
cd $name-$version/ || exit 1
35+
./configure --prefix=${BASE}/build/tmpinst --disable-shared || exit 1
36+
${MAKE_J} || exit 1
37+
${MAKE_J} DESTDIR= install || exit 1
38+
echo $version > ${BASE}/build/tmpinst/${name}-version
39+
fi
40+
fi
41+
}
42+
43+
build_lib GMP
44+
build_lib MPFR
45+
build_lib MPC
46+
build_lib ISL

script/check-deps-and-confirm.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,24 @@ case $TARGET in
2222
*) unset DJCROSS_GCC_ARCHIVE OLD_DJCROSS_GCC_ARCHIVE ;;
2323
esac
2424

25-
if [ ! -z ${BUILD_DEB} ] && [ ! -z ${GCC_VERSION} ]; then
26-
GMP_VERSION=${GMP_VERSION:-6.2.1}
27-
MPFR_VERSION=${MPFR_VERSION:-4.1.0}
28-
MPC_VERSION=${MPC_VERSION:-1.2.1}
29-
ISL_VERSION=${ISL_VERSION:-0.24}
25+
if [ ! -z ${GCC_VERSION} ] || [ ! -z ${GDB_VERSION} ]; then
26+
GMP_VERSION=${GMP_VERSION:-6.3.0}
27+
MPFR_VERSION=${MPFR_VERSION:-4.2.1}
3028

3129
GMP_ARCHIVE="http://ftpmirror.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.xz"
3230
MPFR_ARCHIVE="http://ftpmirror.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.xz"
31+
fi
32+
33+
if [ ! -z ${GCC_VERSION} ]; then
34+
MPC_VERSION=${MPC_VERSION:-1.3.1}
35+
ISL_VERSION=${ISL_VERSION:-0.24}
36+
3337
MPC_ARCHIVE="http://ftpmirror.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz"
3438
ISL_ARCHIVE="http://gcc.gnu.org/pub/gcc/infrastructure/isl-${ISL_VERSION}.tar.bz2"
3539
fi
3640

41+
WITH_LIBS=--with-{gmp,mpfr,mpc,isl}="${BASE}/build/tmpinst"
42+
3743
# check GNU sed is installed or not.
3844
# It is for OSX, which doesn't ship with GNU sed.
3945
if ! sed --version 2>/dev/null | grep "GNU sed" > /dev/null ;then

0 commit comments

Comments
 (0)