Skip to content

Commit

Permalink
Build for x86_64-w64-mingw32 target
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Nov 1, 2023
1 parent 217e85e commit 7e22ae8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ env:

jobs:
run-script:
strategy:
matrix:
target: [aarch64, x86_64]

runs-on: ubuntu-latest

env:
TARGET_ARCH: ${{ matrix.target }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build-aarch64-w64-mingw32/
.vscode/
build-*/
code/
downloads/
*.exe
Expand All @@ -9,4 +10,4 @@ downloads/
*.pdb
*.dump
*.log
*.a
*.a
45 changes: 26 additions & 19 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ MINGW_REPO=https://github.com/ZacWalk/mingw-woarm64.git
MINGW_BRANCH=${MINGW_BRANCH:-woarm64}
MINGW_VERSION=mingw-w64-master

# TARGET_ARCH=x86_64
TARGET_ARCH=aarch64
BUILD=x86_64-linux-gnu
TARGET_ARCH=${TARGET_ARCH:-aarch64}
TARGET=$TARGET_ARCH-w64-mingw32
INSTALL_PATH=~/cross
RUN_DOWNLOAD=1
RUN_CONFIG=1
MSYS2_CONFIG=1
TARGET=$TARGET_ARCH-w64-mingw32
# TARGET=$TARGET_ARCH-pc-cygwin
BUILD_DIR=build-$TARGET
PARALLEL_MAKE=-j6
Expand All @@ -42,6 +42,15 @@ WGET_OPTIONS="-nc -P downloads"

export PATH=$INSTALL_PATH/bin:$PATH

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

make_folders()
{
mkdir -p code
Expand All @@ -50,7 +59,6 @@ make_folders()
mkdir -p $BUILD_DIR/gcc
mkdir -p $BUILD_DIR/mingw-headers
mkdir -p $BUILD_DIR/mingw
mkdir -p $BUILD_DIR/mingw
}

download_sources()
Expand Down Expand Up @@ -88,7 +96,9 @@ config_binutils()
echo "==== config binutils"
cd $BUILD_DIR/binutils
../../code/$BINUTILS_VERSION/configure \
--prefix=$INSTALL_PATH --target=$TARGET
--prefix=$INSTALL_PATH \
--build=$BUILD \
--target=$TARGET
cd ../..
}

Expand All @@ -110,6 +120,7 @@ config_gcc_compiler()
# REMOVED --with-{gmp,mpfr,mpc,isl}=/usr
../../code/$GCC_VERSION/configure \
--prefix=$INSTALL_PATH \
--build=$BUILD \
--target=$TARGET \
--enable-languages=c,lto,c++,fortran \
--enable-shared \
Expand Down Expand Up @@ -140,7 +151,9 @@ config_gcc_compiler()
--with-gnu-ld
else
../../code/$GCC_VERSION/configure \
--prefix=$INSTALL_PATH --target=$TARGET \
--prefix=$INSTALL_PATH \
--build=$BUILD \
--target=$TARGET \
--enable-languages=c,c++,fortran \
--disable-libunwind-exceptions \
--enable-seh-exceptions \
Expand All @@ -164,6 +177,7 @@ config_mingw_headers()
cd $BUILD_DIR/mingw-headers
../../code/$MINGW_VERSION/mingw-w64-headers/configure \
--prefix=$INSTALL_PATH/$TARGET \
--build=$BUILD \
--host=$TARGET \
--with-default-msvcrt=msvcrt
cd ../..
Expand All @@ -185,16 +199,12 @@ config_mingw_crt()
echo "==== config mingw crt"
cd $BUILD_DIR/mingw
../../code/$MINGW_VERSION/mingw-w64-crt/configure \
--build=x86_64-linux-gnu \
--with-sysroot=$INSTALL_PATH \
--prefix=$INSTALL_PATH/$TARGET \
--build=$BUILD \
--host=$TARGET \
--enable-libarm64 \
--disable-lib32 \
--disable-lib64 \
--disable-libarm32 \
--disable-shared \
--with-default-msvcrt=msvcrt
--with-sysroot=$INSTALL_PATH \
--with-default-msvcrt=msvcrt \
$MING_CONF
cd ../..
}

Expand All @@ -213,14 +223,11 @@ config_mingw_libs()
cd $BUILD_DIR/mingw
../../code/$MINGW_VERSION/configure \
--prefix=$INSTALL_PATH/$TARGET \
--build=$BUILD \
--host=$TARGET \
--enable-libarm64 \
--disable-lib32 \
--disable-lib64 \
--disable-libarm32 \
--disable-shared \
--with-libraries=libmangle,pseh,winpthreads \
--with-default-msvcrt=msvcrt
$MING_CONF
cd ../..
}

Expand Down

0 comments on commit 7e22ae8

Please sign in to comment.