Skip to content

Revert install fluidsynth library and fetch more required dependencies #515

Revert install fluidsynth library and fetch more required dependencies

Revert install fluidsynth library and fetch more required dependencies #515

Workflow file for this run

name: macOS builds
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
macOS_CI_build:
permissions:
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
contents: read # for actions/checkout to fetch code
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: macos-12
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Install libraries
run: |
brew install autoconf automake nasm glfw glew sdl_net sdl2 coreutils sevenzip
mkdir -p package/dosbox-x
mkdir -p package/dosbox-x-sdl2
cd vs/sdlnet && ./build-dosbox.sh
- name: Update build info
run: |
echo "timestamp=`git show -s --format=%at | xargs -I# gdate -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV
export shortsha=`echo ${GITHUB_SHA} | cut -c1-7`
export copyrightyear=`git show -s --format=%at | xargs -I# gdate -d @# +'%Y'`
export updatestr=`git show -s --format=%at | xargs -I# gdate -d @# +'%b %d, %Y %I:%M:%S%P'`
echo '/* auto generated */' > include/build_timestamp.h
echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h
echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h
echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h
cat include/build_timestamp.h
- name: Build macOS SDL1
run: |
top=`pwd`
./build-macos
strip $top/src/dosbox-x
make dosbox-x.app
echo "install lib"
cd dosbox-x.app/Contents/MacOS
echo "get list of libraries required"
INSTALL_LIBS=($(otool -L dosbox-x | grep '\w*@executable.*' - | sed -n -r 's#.+/(lib.*dylib).*#\1#p'))
for i in ${INSTALL_LIBS[@]}
do
j=($(echo $i | sed -E 's|([^¥.^¥-]+).*dylib|\1|p'))
echo $j
FILE=($(find -H /usr/local/opt/** -name $j*.*.dylib 2>/dev/null))
if [ -z $FILE ]
then
FILE=($(find -H /usr/** -name $j*.*.dylib 2>/dev/null))
fi
if [ ! -z $FILE ]
then
echo ${FILE}
cp ${FILE} arm64/$i
#cp ${FILE} x86_64/$i #currently searches arm64 directory regardless of platform
fi
done
cd arm64 #currently libraries are saved in this directory regardless of platform
for ((loop=0;loop<3;loop++)) # better to make this recursively
do
for LIBS in *.dylib # fetch more dependencies required
do
INSTALL_LIBS=($(otool -L $LIBS | grep '\w*/usr/local/.*' - | sed -n -r 's#.+/(lib.*dylib).*#\1#p'))
for i in ${INSTALL_LIBS[@]}
do
j=($(echo $i | sed -E 's|([^¥.^¥-]+).*dylib|\1|p'))
FILE=($(find -H /usr/local/** -name $j*.*.dylib 2>/dev/null))
if [ ! -z $FILE ]
then
echo ${FILE}
cp -n ${FILE} $i 2>/dev/null
#cp -n ${FILE} $i 2>/dev/null #currently searches arm64 directory regardless of platform
fi
done
done
done
cd $top
mv dosbox-x.app $top/package/dosbox-x
cd $top/package/dosbox-x/dosbox-x.app/Contents/MacOS/
for FILE in arm64/*.dylib;do chmod +x $FILE; done
chmod +x dosbox-x
cd $top
- name: Build macOS SDL2
run: |
top=`pwd`
./build-macos-sdl2
strip $top/src/dosbox-x
make dosbox-x.app
cd dosbox-x.app/Contents/MacOS
INSTALL_LIBS=($(otool -L dosbox-x | grep '\w*@executable.*' - | sed -n -r 's#.+/(lib.*dylib).*#\1#p'))
for i in ${INSTALL_LIBS[@]}
do
j=($(echo $i | sed -E 's|([^¥.^¥-]+).*dylib|\1|p'))
echo $j
FILE=($(find -H /usr/local/opt/** -name $j*.*.dylib 2>/dev/null))
if [ -z $FILE ]
then
FILE=($(find -H /usr/** -name $j*.*.dylib 2>/dev/null))
fi
if [ ! -z $FILE ]
then
echo ${FILE}
cp ${FILE} arm64/$i
#cp ${FILE} x86_64/$i #currently searches arm64 directory regardless of platform
fi
done
cd $top
mv dosbox-x.app $top/package/dosbox-x-sdl2
cd $top/package/dosbox-x-sdl2/dosbox-x.app/Contents/MacOS/
for FILE in arm64/*.dylib;do chmod +x $FILE; done
chmod +x dosbox-x
cd $top
- name: Unit testing
run: |
top=`pwd`
chmod +x $top/package/dosbox-x/dosbox-x.app/Contents/MacOS/dosbox-x $top/package/dosbox-x-sdl2/dosbox-x.app/Contents/MacOS/dosbox-x
$top/package/dosbox-x/dosbox-x.app/Contents/MacOS/dosbox-x -tests
$top/package/dosbox-x-sdl2/dosbox-x.app/Contents/MacOS/dosbox-x -tests
- name: Package build
run: |
top=`pwd`
cp $top/CHANGELOG $top/package/dosbox-x/CHANGELOG.txt
cp $top/COPYING $top/package/dosbox-x/COPYING.txt
cp $top/contrib/macos/readme.txt $top/package/dosbox-x/README.txt
cp $top/CHANGELOG $top/package/dosbox-x-sdl2/CHANGELOG.txt
cp $top/COPYING $top/package/dosbox-x-sdl2/COPYING.txt
cp $top/contrib/macos/readme.txt $top/package/dosbox-x-sdl2/README.txt
cd $top/package/
7zz a $top/dosbox-x-macosx-x86_64-${{ env.timestamp }}.zip *
cd $top
- name: Upload preview package
uses: actions/[email protected]
with:
name: dosbox-x-macosx-x86_64-${{ env.timestamp }}
path: ${{ github.workspace }}/dosbox-x-macosx-x86_64-${{ env.timestamp }}.zip
- name: Upload release package
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dosbox-x-macosx-x86_64-${{ env.timestamp }}.zip