Skip to content

Commit

Permalink
Preparations for mintelf toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
th-otto committed Sep 12, 2023
1 parent 62db3cb commit 18ba8b0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux build
pname: Linux build

on:
push:
Expand All @@ -9,21 +9,25 @@ 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
if: ${{ github.event_name == 'push' }}
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
Expand Down
9 changes: 5 additions & 4 deletions .scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
12 changes: 9 additions & 3 deletions .scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion .scripts/install-freemint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down
3 changes: 3 additions & 0 deletions .scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" = "" ]
Expand Down

0 comments on commit 18ba8b0

Please sign in to comment.