Skip to content

Commit

Permalink
Implement win32 support for Github Actions
Browse files Browse the repository at this point in the history
commit 93b628415fb33a107556f5b1e78b73439aeceaec
Author: Domenico Iezzi <[email protected]>
Date:   Mon Oct 21 09:49:24 2024 +0200

    Add step for installing missing dependencies

commit 2ef1836d911305dc03a2f0b85264235514bacf12
Author: Domenico Iezzi <[email protected]>
Date:   Mon Oct 21 09:49:07 2024 +0200

    Remove AWK and GREP from configure.ac checks

commit 144fd09
Author: Domenico Iezzi <[email protected]>
Date:   Mon Oct 21 09:23:04 2024 +0200

    Modify all target deps, add more clean targets

commit f61ec96
Author: Domenico Iezzi <[email protected]>
Date:   Mon Oct 21 09:18:25 2024 +0200

    Add GCC stage2 step for windows

commit cd0deb4
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 23:03:51 2024 +0200

    Add mingw gcc to dependencies

commit 5f04194
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 22:57:50 2024 +0200

    Test new layout

commit 272036b
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 22:31:41 2024 +0200

    Test makefile target

commit cebb306
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 22:14:53 2024 +0200

    Test msys2 make executable

commit 8a331a6
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 21:54:26 2024 +0200

    Make windows build clone recursively

commit 8caa31f
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 21:49:56 2024 +0200

    Update actions/checkout package version

commit 00475b2
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 21:45:37 2024 +0200

    Fix windows build in CI script

commit fb12929
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 21:39:40 2024 +0200

    Fix Windows build script

commit 6274691
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 21:39:13 2024 +0200

    Disable sysroot option in Makefile

commit ce07d1e
Author: Domenico Iezzi <[email protected]>
Date:   Sun Oct 20 19:01:35 2024 +0200

    Test MSYS2 win32 ci
  • Loading branch information
NoMore201 committed Oct 21, 2024
1 parent 7bf8a3d commit 3d73f30
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 344 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
linux-build:
name: Toolchain Linux build
name: Toolchain build
runs-on: ubuntu-22.04

steps:
Expand All @@ -23,26 +23,31 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install build-essential build-essential gcc-mingw-w64 g++-mingw-w64 texinfo flex bison libmpfr-dev libgmp-dev libmpc-dev zip libdebuginfod-dev
sudo apt-get -y install build-essential build-essential texinfo \
flex bison libmpfr-dev libgmp-dev libmpc-dev zip libdebuginfod-dev \
gcc-mingw-w64 g++-mingw-w64
- name: Build Linux
- name: Build
run: |
mkdir build
cd build
export CFLAGS="-O2"
export CXXFLAGS="-O2"
export LDFLAGS="-s"
export LDFLAGS="-static -s"
../configure --prefix /opt/gcc
make -j$(nproc)
- name: Package
run: |
cd /opt/gcc
cd /opt/gcc/linux
zip -r9 ../linux.zip .
cd /opt/gcc/win32
zip -r9 ../win32.zip .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: tricore-gcc-artifacts
path: /opt/linux.zip
path: /opt/gcc/*.zip

11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Build folder
BUILD

# Install folder
INSTALL

# Log folder
LOG
autom4te.cache
configure~
BUILD
169 changes: 142 additions & 27 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,46 @@ BINUTILS_SRCDIR := @with_binutils_src@
NEWLIB_SRCDIR := @with_newlib_src@
GCC_SRCDIR := @with_gcc_src@

CONFIGURE_HOST = @configure_host@

all: stamps/build-binutils-mcs stamps/build-binutils-tc stamps/build-gcc-stage2
all: stamps/build-gcc-stage2-win

clean-binutils-tc:
rm -rf build-binutils-tc stamps/build-binutils-tc

clean-binutils-mcs:
rm -rf build-binutils-mcs stamps/build-binutils-mcs

clean-gcc-stage1:
rm -rf build-gcc-stage1 stamps/build-gcc-stage1

clean-newlib:
rm -rf build-newlib stamps/build-newlib

clean-gcc-stage2:
rm -rf build-gcc-stage2 stamps/build-gcc-stage2

clean-binutils-tc-win:
rm -rf build-binutils-tc-win stamps/build-binutils-tc-win

clean-binutils-mcs-win:
rm -rf build-binutils-mcs-win stamps/build-binutils-mcs-win

clean-gcc-stage2-win:
rm -rf build-gcc-stage2-win stamps/build-gcc-stage2-win

clean:
rm -rf build-* stamps

stamps/install-deps: $(GCC_SRCDIR)
if test -f $</contrib/download_prerequisites && test "@NEED_GCC_EXTERNAL_LIBRARIES@" = "true"; then cd $< && ./contrib/download_prerequisites; fi
mkdir -p $(dir $@) && touch $@

stamps/build-binutils-mcs: $(BINUTILS_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--target=mcs-elf \
--program-prefix=mcs-elf- \
--prefix=$(INSTALL_DIR) \
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR)/linux \
--disable-threads \
--enable-nls \
--disable-itcl \
Expand All @@ -50,15 +69,14 @@ stamps/build-binutils-mcs: $(BINUTILS_SRCDIR)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-binutils-tc: $(BINUTILS_SRCDIR)
stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--target=tricore-elf \
--enable-targets=mcs-elf \
--program-prefix=tricore-elf- \
--prefix=$(INSTALL_DIR) \
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR)/linux \
--disable-threads \
--enable-nls \
--disable-itcl \
Expand All @@ -82,14 +100,14 @@ stamps/build-binutils-tc: $(BINUTILS_SRCDIR)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-gcc-stage1: $(GCC_SRCDIR)
stamps/build-gcc-stage1: $(GCC_SRCDIR) stamps/install-deps stamps/build-binutils-tc
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
CFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \
CXXFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \
--target=tricore-elf \
--prefix=$(INSTALL_DIR) \
--prefix=$(INSTALL_DIR)/linux \
--enable-lib32 \
--disable-lib64 \
--enable-languages=c,c++ \
Expand All @@ -103,7 +121,6 @@ stamps/build-gcc-stage1: $(GCC_SRCDIR)
--disable-shared \
--with-headers=yes \
--with-newlib=yes \
--with-sysroot=$(INSTALL_DIR)/tricore-elf \
--enable-mingw-wildcard \
--disable-libstdcxx-pch \
--enable-newlib-elix-level=3 \
Expand All @@ -119,28 +136,29 @@ stamps/build-newlib: $(NEWLIB_SRCDIR) stamps/build-gcc-stage1
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
CC_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-gcc \
CXX_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-c++ \
GCC_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-gcc \
AR_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-ar \
AS_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-as \
LD_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-ld \
NM_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-nm \
OBJDUMP_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-objdump \
RANLIB_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-ranlib \
STRIP_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-strip \
READELF_FOR_TARGET=$(INSTALL_DIR)/bin/tricore-elf-readelf \
CC_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-gcc \
CXX_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-c++ \
GCC_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-gcc \
AR_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-ar \
AS_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-as \
LD_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-ld \
NM_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-nm \
OBJDUMP_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-objdump \
RANLIB_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-ranlib \
STRIP_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-strip \
READELF_FOR_TARGET=$(INSTALL_DIR)/linux/bin/tricore-elf-readelf \
CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffunction-sections -mfast-div -fno-common' \
CXXFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffunction-sections -mfast-div -fno-common' \
--target=tricore-elf \
--prefix=$(INSTALL_DIR) \
--prefix=$(INSTALL_DIR)/linux \
--host=i686-w64-mingw32 \
--build=i686-pc-mingw32
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) all
$(MAKE) -C $(notdir $@) install
$(MAKE) -C $(notdir $@) install prefix=$(INSTALL_DIR)/win32
mkdir -p $(dir $@) && touch $@

stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/build-newlib
stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/install-deps stamps/build-newlib
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
Expand All @@ -149,8 +167,7 @@ stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/build-newlib
--target=tricore-elf \
--enable-lib32 \
--disable-lib64 \
--prefix=$(INSTALL_DIR) \
$(CONFIGURE_HOST) \
--prefix=$(INSTALL_DIR)/linux \
--enable-languages=c,c++ \
--enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \
--enable-c99 \
Expand All @@ -171,6 +188,104 @@ stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/build-newlib
--disable-newlib-supplied-syscalls \
--disable-libssp \
--disable-test-suite
$(MAKE) -C $(notdir $@) all
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-binutils-mcs-win: $(BINUTILS_SRCDIR) stamps/build-gcc-stage2
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--target=mcs-elf \
--program-prefix=mcs-elf- \
--host=x86_64-w64-mingw32 \
--prefix=$(INSTALL_DIR)/win32 \
--disable-threads \
--enable-nls \
--disable-itcl \
--disable-tk \
--disable-tcl \
--disable-winsup \
--disable-gdbtk \
--disable-libgui \
--disable-rda \
--disable-sid \
--disable-sim \
--disable-gdb \
--disable-newlib \
--disable-libgloss \
--disable-test-suite \
--enable-checking=release \
--with-gnu-ld \
--with-gnu-as \
--disable-werror
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-binutils-tc-win: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs-win
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
--target=tricore-elf \
--enable-targets=mcs-elf \
--program-prefix=tricore-elf- \
--host=x86_64-w64-mingw32 \
--prefix=$(INSTALL_DIR)/win32 \
--disable-threads \
--enable-nls \
--disable-itcl \
--disable-tk \
--disable-tcl \
--disable-winsup \
--disable-gdbtk \
--disable-libgui \
--disable-rda \
--disable-sid \
--disable-sim \
--disable-gdb \
--disable-newlib \
--disable-libgloss \
--disable-test-suite \
--enable-checking=release \
--with-gnu-ld \
--with-gnu-as \
--disable-werror
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

stamps/build-gcc-stage2-win: $(GCC_SRCDIR) stamps/install-deps stamps/build-binutils-tc-win
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && PATH=$(INSTALL_DIR)/linux/bin:$$PATH $</configure \
CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \
CPPFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \
--target=tricore-elf \
--enable-lib32 \
--disable-lib64 \
--host=x86_64-w64-mingw32 \
--prefix=$(INSTALL_DIR)/win32 \
--enable-languages=c,c++ \
--enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \
--enable-c99 \
--enable-long-long \
--enable-checking \
--enable-nls \
--enable-static \
--disable-threads \
--disable-shared \
--with-headers=yes \
--with-gnu-ld \
--with-gnu-as \
--with-newlib=yes \
--enable-mingw-wildcard \
--disable-libstdcxx-pch \
--enable-newlib-elix-level=3 \
--enable-newlib-io-long-long \
--disable-newlib-supplied-syscalls \
--disable-libssp \
--disable-test-suite
$(MAKE) -C $(notdir $@) all
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Loading

0 comments on commit 3d73f30

Please sign in to comment.