Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share same config between build scripts #49

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/scripts/build-binutils.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
#!/bin/bash

BINUTILS_VERSION=${BINUTILS_VERSION:-binutils-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)
INSTALL_PATH=${INSTALL_PATH:-~/cross}

export PATH=$INSTALL_PATH/bin:$PATH

set -e # exit on error
set -x # echo on
source `dirname $0`/config.sh

mkdir -p $BUILD_PATH/binutils
cd $BUILD_PATH/binutils

echo "::group::Configure binutils"
../../code/$BINUTILS_VERSION/configure \
$SOURCE_PATH/$BINUTILS_VERSION/configure \
--prefix=$INSTALL_PATH \
--target=$TARGET
echo "::endgroup::"
Expand Down
6 changes: 1 addition & 5 deletions .github/scripts/build-gcc-libs.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash

TARGET=${TARGET:-aarch64-w64-mingw32}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)

export PATH=$INSTALL_PATH/bin:$PATH
source `dirname $0`/config.sh

cd $BUILD_PATH/gcc

Expand Down
14 changes: 2 additions & 12 deletions .github/scripts/build-gcc.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
#!/bin/bash

GCC_VERSION=${GCC_VERSION:-gcc-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)
INSTALL_PATH=${INSTALL_PATH:-~/cross}

export PATH=$INSTALL_PATH/bin:$PATH

set -e # exit on error
set -x # echo on
source `dirname $0`/config.sh

mkdir -p $BUILD_PATH/gcc

Expand All @@ -19,7 +9,7 @@ cd $BUILD_PATH/gcc
echo "::group::Configure GCC"
# REMOVED --libexecdir=/opt/lib
# REMOVED --with-{gmp,mpfr,mpc,isl}=/usr
../../code/$GCC_VERSION/configure \
$SOURCE_PATH/$GCC_VERSION/configure \
--prefix=$INSTALL_PATH \
--target=$TARGET \
--enable-languages=c,lto,c++,fortran \
Expand Down
6 changes: 1 addition & 5 deletions .github/scripts/build-libgcc.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash

TARGET=${TARGET:-aarch64-w64-mingw32}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)

export PATH=$INSTALL_PATH/bin:$PATH
source `dirname $0`/config.sh

cd $BUILD_PATH/gcc

Expand Down
33 changes: 2 additions & 31 deletions .github/scripts/build-mingw-crt.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,12 @@
#!/bin/bash

MINGW_VERSION=${MINGW_VERSION:-mingw-w64-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
CRT=${CRT:-msvcrt}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)
INSTALL_PATH=${INSTALL_PATH:-~/cross}

case "$TARGET" in
x86_64*)
MINGW_CONF="$MINGW_CONF --disable-lib32 --enable-lib64 --disable-libarm32 --disable-libarm64"
;;
aarch64*)
MINGW_CONF="$MINGW_CONF --disable-lib32 --disable-lib64 --disable-libarm32 --enable-libarm64"
;;
esac

case "$CRT" in
ucrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=ucrt"
;;
msvcrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=msvcrt"
;;
esac

export PATH=$INSTALL_PATH/bin:$PATH

set -e # exit on error
set -x # echo on
source `dirname $0`/config-mingw.sh

mkdir -p $BUILD_PATH/mingw
cd $BUILD_PATH/mingw

echo "::group::Configure MinGW CRT"
../../code/$MINGW_VERSION/mingw-w64-crt/configure \
$SOURCE_PATH/$MINGW_VERSION/mingw-w64-crt/configure \
--prefix=$INSTALL_PATH/$TARGET \
--build=x86_64-linux-gnu \
--host=$TARGET \
Expand Down
24 changes: 2 additions & 22 deletions .github/scripts/build-mingw-headers.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
#!/bin/bash

MINGW_VERSION=${MINGW_VERSION:-mingw-w64-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
CRT=${CRT:-msvcrt}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)
INSTALL_PATH=${INSTALL_PATH:-~/cross}

case "$CRT" in
ucrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=ucrt"
;;
msvcrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=msvcrt"
;;
esac

export PATH=$INSTALL_PATH/bin:$PATH

set -e # exit on error
set -x # echo on
source `dirname $0`/config-mingw.sh

mkdir -p $BUILD_PATH/mingw-headers
cd $BUILD_PATH/mingw-headers

echo "::group::Configure MinGW headers"
../../code/$MINGW_VERSION/mingw-w64-headers/configure \
$SOURCE_PATH/$MINGW_VERSION/mingw-w64-headers/configure \
--prefix=$INSTALL_PATH/$TARGET \
--host=$TARGET \
$MINGW_CONF
Expand Down
33 changes: 2 additions & 31 deletions .github/scripts/build-mingw.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
#!/bin/bash

MINGW_VERSION=${MINGW_VERSION:-mingw-w64-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
CRT=${CRT:-msvcrt}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)
INSTALL_PATH=${INSTALL_PATH:-~/cross}

case "$TARGET" in
x86_64*)
MINGW_CONF="$MINGW_CONF --disable-lib32 --enable-lib64 --disable-libarm32 --disable-libarm64"
;;
aarch64*)
MINGW_CONF="$MINGW_CONF --disable-lib32 --disable-lib64 --disable-libarm32 --enable-libarm64"
;;
esac

case "$CRT" in
ucrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=ucrt"
;;
msvcrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=msvcrt"
;;
esac

export PATH=$INSTALL_PATH/bin:$PATH

set -e # exit on error
set -x # echo on
source `dirname $0`/config-mingw.sh

cd $BUILD_PATH/mingw

echo "::group::Configure MinGW libraries"
../../code/$MINGW_VERSION/configure \
$SOURCE_PATH/$MINGW_VERSION/configure \
--prefix=$INSTALL_PATH/$TARGET \
--host=$TARGET \
--disable-shared \
Expand Down
7 changes: 1 addition & 6 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/bin/bash

set -e # exit on error
set -x # echo on

export TARGET=${TARGET:-aarch64-w64-mingw32}
export CRT=${CRT:-msvcrt}
eukarpov marked this conversation as resolved.
Show resolved Hide resolved
export INSTALL_PATH=${INSTALL_PATH:-~/cross}
source `dirname $0`/config-mingw.sh

.github/scripts/build-binutils.sh
.github/scripts/build-mingw-headers.sh
Expand Down
24 changes: 24 additions & 0 deletions .github/scripts/config-mingw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

source `dirname $0`/config.sh

MINGW_VERSION=${MINGW_VERSION:-mingw-w64-master}
CRT=${CRT:-msvcrt}

case "$TARGET" in
x86_64*)
MINGW_CONF="$MINGW_CONF --disable-lib32 --enable-lib64 --disable-libarm32 --disable-libarm64"
;;
aarch64*)
MINGW_CONF="$MINGW_CONF --disable-lib32 --disable-lib64 --disable-libarm32 --enable-libarm64"
;;
esac

case "$CRT" in
ucrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=ucrt"
;;
msvcrt)
MINGW_CONF="$MINGW_CONF --with-default-msvcrt=msvcrt"
;;
esac
15 changes: 15 additions & 0 deletions .github/scripts/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e # exit on error
set -x # echo on

GCC_VERSION=${GCC_VERSION:-gcc-master}
BINUTILS_VERSION=${BINUTILS_VERSION:-binutils-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
SOURCE_PATH=${SOURCE_PATH:-$PWD/code}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=${BUILD_MAKE_OPTIONS:--j$(nproc)}
INSTALL_PATH=${INSTALL_PATH:-~/cross}

PATH=$INSTALL_PATH/bin:$PATH
3 changes: 1 addition & 2 deletions .github/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

set -e # stop at first error
set -x # echo on
source `dirname $0`/config.sh

echo "::group::Install Dependencies"
sudo apt update
Expand Down
13 changes: 4 additions & 9 deletions .github/scripts/install-libraries.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#!/bin/bash

BINUTILS_VERSION=${BINUTILS_VERSION:-binutils-master}
GCC_VERSION=${GCC_VERSION:-gcc-master}
source `dirname $0`/config.sh

CODE_PATH=${CODE_PATH:-$PWD/code}
MPFR_VERSION=mpfr-4.1.0
GMP_VERSION=gmp-6.2.1
MPC_VERSION=mpc-1.2.1
ISL_VERSION=isl-0.24
WGET_OPTIONS="-nc -P downloads"

set -e # exit on error
set -x # echo on

echo "::group::Install libraries"

# Download packages
Expand All @@ -22,18 +17,18 @@ wget $WGET_OPTIONS https://gcc.gnu.org/pub/gcc/infrastructure/$MPC_VERSION.tar.g
wget $WGET_OPTIONS https://gcc.gnu.org/pub/gcc/infrastructure/$ISL_VERSION.tar.bz2

# Extract everything
cd $CODE_PATH
cd $SOURCE_PATH
for f in ../downloads/*.tar*; do tar xf $f --skip-old-files; done

# Symbolic links for binutils dependencies
cd $CODE_PATH/$BINUTILS_VERSION
cd $SOURCE_PATH/$BINUTILS_VERSION
ln -sf `ls -1d ../mpfr-*/` mpfr
ln -sf `ls -1d ../gmp-*/` gmp
ln -sf `ls -1d ../mpc-*/` mpc
ln -sf `ls -1d ../isl-*/` isl

# Symbolic links for GCC dependencies
cd $CODE_PATH/$GCC_VERSION
cd $SOURCE_PATH/$GCC_VERSION
ln -sf `ls -1d ../mpfr-*/` mpfr
ln -sf `ls -1d ../gmp-*/` gmp
ln -sf `ls -1d ../mpc-*/` mpc
Expand Down