From 18ba8b05f27c270f401e725d4f190720e60833df Mon Sep 17 00:00:00 2001 From: Thorsten Otto Date: Tue, 12 Sep 2023 17:54:59 +0200 Subject: [PATCH] Preparations for mintelf toolchains --- .github/workflows/build.yml | 14 +++++++++----- .scripts/build.sh | 9 +++++---- .scripts/deploy.sh | 12 +++++++++--- .scripts/install-freemint.sh | 7 ++++++- .scripts/setup_env.sh | 3 +++ 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b9803c..940c4d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Linux build +pname: Linux build on: push: @@ -9,6 +9,9 @@ on: jobs: build: runs-on: ubuntu-20.04 + strategy: + matrix: + cross_tool: [ "m68k-atari-mint", "m68k-atari-mintelf" ] steps: - uses: actions/checkout@v3 - name: Install SSH keys @@ -16,14 +19,15 @@ jobs: env: SSH_ID: ${{ secrets.SSH_ID }} run: ./.scripts/install_ssh_id.sh - - name: Install packages - run: | - SYSROOT_DIR="/" ./.scripts/install-freemint.sh binutils gcc - ./.scripts/install-freemint.sh mintlib - name: Setup environment env: PROJECT_VERSION: "0.4" + CROSS_TOOL: ${{ matrix.cross_tool }} run: ./.scripts/setup_env.sh + - name: Install packages + run: | + SYSROOT_DIR="/" ./.scripts/install-freemint.sh binutils gcc + ./.scripts/install-freemint.sh mintlib - name: build run: ./.scripts/build.sh - name: deploy diff --git a/.scripts/build.sh b/.scripts/build.sh index 09866c2..8d0a694 100755 --- a/.scripts/build.sh +++ b/.scripts/build.sh @@ -5,16 +5,17 @@ export ACLOCAL=aclocal export AUTOMAKE=automake +CROSS_TOOL=${CROSS_TOOL:-m68k-atari-mint} # wrong: we need the cross-compiler version here -# CC=m68k-atari-mint-gcc RANLIB=m68k-atari-mint-ranlib ./configure --prefix=/usr --disable-nls --host=m68k-atari-mint --target=m68k-atari-mint && make +# CC=${CROSS_TOOL}-gcc RANLIB=m68k-atari-mint-ranlib ./configure --prefix=/usr --disable-nls --host=${CROSS_TOOL} --target=${CROSS_TOOL} && make -CC=gcc ./configure --prefix=/usr --disable-nls --target=m68k-atari-mint +CC=gcc ./configure --prefix=/usr --disable-nls --target=${CROSS_TOOL} make DESTDIR="${INSTALL_DIR}" install rm -f "${INSTALL_DIR}/usr/share/info/dir" rm -rf "${INSTALL_DIR}/usr/include" -# find "${INSTALL_DIR}" -type f -perm -a=x -exec m68k-atari-mint-strip -s {} \; -# find "${INSTALL_DIR}" -type f \( -name '*.a' -o -name '*.o' \) -exec m68k-atari-mint-strip -S -X -w -N '.L[0-9]*' {} \; +# find "${INSTALL_DIR}" -type f -perm -a=x -exec ${CROSS_TOOL}-strip -s {} \; +# find "${INSTALL_DIR}" -type f \( -name '*.a' -o -name '*.o' \) -exec ${CROSS_TOOL}-strip -S -X -w -N '.L[0-9]*' {} \; strip ${INSTALL_DIR}/usr/bin/* diff --git a/.scripts/deploy.sh b/.scripts/deploy.sh index 2fa5e05..c821d3f 100755 --- a/.scripts/deploy.sh +++ b/.scripts/deploy.sh @@ -9,11 +9,13 @@ then DEPLOY_ARCHIVE="zip" fi +toolsuffix=${CROSS_TOOL##*-} + if [ -n "${CPU_TARGET+x}" ] then - ARCHIVE_NAME="${PROJECT_NAME}-${PROJECT_VERSION}-${SHORT_ID}-${CPU_TARGET}.${DEPLOY_ARCHIVE}" + ARCHIVE_NAME="${PROJECT_NAME}-${PROJECT_VERSION}-${toolsuffix}-${SHORT_ID}-${CPU_TARGET}.${DEPLOY_ARCHIVE}" else - ARCHIVE_NAME="${PROJECT_NAME}-${PROJECT_VERSION}-${SHORT_ID}.${DEPLOY_ARCHIVE}" + ARCHIVE_NAME="${PROJECT_NAME}-${PROJECT_VERSION}-${toolsuffix}-${SHORT_ID}.${DEPLOY_ARCHIVE}" fi ARCHIVE_PATH="${DEPLOY_DIR}/${ARCHIVE_NAME}" @@ -70,7 +72,11 @@ link_file() { upload_file "$ARCHIVE_PATH" "${UPLOAD_DIR}/${PROJECT_DIR}/${ARCHIVE_NAME}" if test -z "${CPU_TARGET}" then - link_file "$ARCHIVE_NAME" "${PROJECT_DIR}-latest.${DEPLOY_ARCHIVE}" + link_file "$ARCHIVE_NAME" "${PROJECT_DIR}-${toolsuffix}-latest.${DEPLOY_ARCHIVE}" + # traditionally, that link did not contain the cross toolchain suffix + if test "$toolsuffix" = "mint"; then + link_file "$ARCHIVE_NAME" "${PROJECT_DIR}-latest.${DEPLOY_ARCHIVE}" + fi fi echo ${PROJECT_NAME}-${PROJECT_VERSION}-${SHORT_ID} > .latest_version diff --git a/.scripts/install-freemint.sh b/.scripts/install-freemint.sh index 61cfa6c..6a7d8ce 100755 --- a/.scripts/install-freemint.sh +++ b/.scripts/install-freemint.sh @@ -3,8 +3,13 @@ # -u: Treat unset variables as an error when substituting. # -x: Display expanded script commands +# no need to install anything here. +# we just need the hosts compiler +exit 0 + DOWNLOAD_DIR=http://tho-otto.de/snapshots -SYSROOT_DIR=${SYSROOT_DIR:-"/usr/m68k-atari-mint/sys-root/usr"} +CROSS_TOOL=${CROSS_TOOL:-m68k-atari-mint} +SYSROOT_DIR=${SYSROOT_DIR:-"/usr/$CROSS_TOOL/sys-root/usr"} sudo mkdir -p "${SYSROOT_DIR}" && cd "${SYSROOT_DIR}" diff --git a/.scripts/setup_env.sh b/.scripts/setup_env.sh index c168ac3..22cc9bd 100755 --- a/.scripts/setup_env.sh +++ b/.scripts/setup_env.sh @@ -23,6 +23,9 @@ BRANCH=$(echo "${GITHUB_REF}" | cut -d '/' -f 3) if test "$CPU_TARGET" != ""; then echo "CPU_TARGET=$CPU_TARGET" >> $GITHUB_ENV fi +if test "$CROSS_TOOL" != ""; then + echo "CROSS_TOOL=$CROSS_TOOL" >> $GITHUB_ENV +fi # GITHUB_HEAD_REF is only set for pull requests if [ "${GITHUB_HEAD_REF}" = "" ]