From 3d73f30323319f31c441f0a8a5ef24bcc828bd2e Mon Sep 17 00:00:00 2001 From: Domenico Iezzi Date: Mon, 21 Oct 2024 09:59:25 +0200 Subject: [PATCH] Implement win32 support for Github Actions commit 93b628415fb33a107556f5b1e78b73439aeceaec Author: Domenico Iezzi Date: Mon Oct 21 09:49:24 2024 +0200 Add step for installing missing dependencies commit 2ef1836d911305dc03a2f0b85264235514bacf12 Author: Domenico Iezzi Date: Mon Oct 21 09:49:07 2024 +0200 Remove AWK and GREP from configure.ac checks commit 144fd09ef2328134e2e15b3a0f74147a306e1d51 Author: Domenico Iezzi Date: Mon Oct 21 09:23:04 2024 +0200 Modify all target deps, add more clean targets commit f61ec96ef59755bd86a5c287dc4e7e16d216008d Author: Domenico Iezzi Date: Mon Oct 21 09:18:25 2024 +0200 Add GCC stage2 step for windows commit cd0deb4ee67815b7dfedd3be5cf3053c25db2240 Author: Domenico Iezzi Date: Sun Oct 20 23:03:51 2024 +0200 Add mingw gcc to dependencies commit 5f041945235706e82ce0307cb645d5f3d9adee69 Author: Domenico Iezzi Date: Sun Oct 20 22:57:50 2024 +0200 Test new layout commit 272036b8b8d378443aa75d45d0a9d9d6d2e45837 Author: Domenico Iezzi Date: Sun Oct 20 22:31:41 2024 +0200 Test makefile target commit cebb30659b4da18bb7d4499d0cfcce455d9cf3ac Author: Domenico Iezzi Date: Sun Oct 20 22:14:53 2024 +0200 Test msys2 make executable commit 8a331a60ef2d1660e4b5aa22a3e8f3b53a34429a Author: Domenico Iezzi Date: Sun Oct 20 21:54:26 2024 +0200 Make windows build clone recursively commit 8caa31f9103755d2969aa564d15ee7ab5119639d Author: Domenico Iezzi Date: Sun Oct 20 21:49:56 2024 +0200 Update actions/checkout package version commit 00475b2b191ce0f80f0bd268992a244abc877a6a Author: Domenico Iezzi Date: Sun Oct 20 21:45:37 2024 +0200 Fix windows build in CI script commit fb12929dd288476e562d689ae7bc169ddd509725 Author: Domenico Iezzi Date: Sun Oct 20 21:39:40 2024 +0200 Fix Windows build script commit 6274691094b02dd0f97b29ccd5e54ff2a09e5a50 Author: Domenico Iezzi Date: Sun Oct 20 21:39:13 2024 +0200 Disable sysroot option in Makefile commit ce07d1e7197e01575782433f929b52cb80e72616 Author: Domenico Iezzi Date: Sun Oct 20 19:01:35 2024 +0200 Test MSYS2 win32 ci --- .github/workflows/build.yml | 17 ++- .gitignore | 11 +- Makefile.in | 169 +++++++++++++++++---- configure | 290 +----------------------------------- configure.ac | 14 -- 5 files changed, 157 insertions(+), 344 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17624f8..91d6617 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: jobs: linux-build: - name: Toolchain Linux build + name: Toolchain build runs-on: ubuntu-22.04 steps: @@ -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 + diff --git a/.gitignore b/.gitignore index cc999e5..69a3178 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ -# Build folder -BUILD - -# Install folder -INSTALL - -# Log folder -LOG +autom4te.cache +configure~ +BUILD \ No newline at end of file diff --git a/Makefile.in b/Makefile.in index 9580178..08f8412 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,9 +6,7 @@ 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 @@ -16,17 +14,38 @@ clean-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 $/dev/null then : as_have_required=yes @@ -618,11 +617,8 @@ LIBOBJS with_gcc_src with_newlib_src with_binutils_src -configure_host NEED_GCC_EXTERNAL_LIBRARIES BASH -FGREP -GREP LEXLIB LEX_OUTPUT_ROOT LEX @@ -635,7 +631,6 @@ CFLAGS CC YFLAGS YACC -AWK target_alias host_alias build_alias @@ -678,7 +673,6 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -with_host with_binutils_src with_newlib_src with_gcc_src @@ -1311,9 +1305,6 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-host=x86_64-w64-mingw32 - Sets the host for the tools, you probably want - nothing --with-binutils-src Set binutils source path, use builtin source by default --with-newlib-src Set newlib source path, use builtin source by @@ -2175,53 +2166,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Checks for programs. -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AWK+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -printf "%s\n" "$AWK" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$AWK" && break -done - for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -3545,217 +3489,6 @@ fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -printf %s "checking for fgrep... " >&6; } -if test ${ac_cv_path_FGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in fgrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -printf "%s\n" "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - # Extract the first word of "bash", so it can be a program name with args. set dummy bash; ac_word=$2 @@ -3950,26 +3683,6 @@ else $as_nop fi -# Check whether --with-host was given. -if test ${with_host+y} -then : - withval=$with_host; -else $as_nop - with_host=default - -fi - - -if test "x$with_host" != xdefault -then : - configure_host=--host=$with_host - -else $as_nop - configure_host="" - -fi - - # Check whether --with-binutils-src was given. if test ${with_binutils_src+y} then : @@ -4632,7 +4345,6 @@ gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' -AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF diff --git a/configure.ac b/configure.ac index 70c5b48..d353d4c 100644 --- a/configure.ac +++ b/configure.ac @@ -4,12 +4,9 @@ AC_INIT([tricore-toolchain],[1.0]) # Checks for programs. -AC_PROG_AWK AC_PROG_YACC AC_PROG_CC AC_PROG_LEX -AC_PROG_FGREP -AC_PROG_GREP AC_PATH_PROG([BASH], [bash], [AC_MSG_ERROR([bash not found])]) @@ -25,17 +22,6 @@ AS_IF([test x"$need_gcc_external_libraries" != xno], [AC_SUBST(NEED_GCC_EXTERNAL_LIBRARIES,true)], [AC_SUBST(NEED_GCC_EXTERNAL_LIBRARIES,false)]) -AC_ARG_WITH(host, - [AS_HELP_STRING([--with-host=x86_64-w64-mingw32], - [Sets the host for the tools, you probably want nothing])], - [], - [with_host=default] - ) - -AS_IF([test "x$with_host" != xdefault], - [AC_SUBST(configure_host,--host=$with_host)], - [AC_SUBST(configure_host,"")]) - AC_ARG_WITH(binutils-src, [AS_HELP_STRING([--with-binutils-src],[Set binutils source path, use builtin source by default])], [],