Skip to content

Commit

Permalink
Fix for older versions of love2d (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhartland authored Jun 19, 2022
1 parent 22f25bb commit 4780ffd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ jobs:
# Build the Hello World test application
build-hello_world:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v2
- uses: nhartland/love-build@dev
id: love-build
with:
app_name: 'hello_world'
love_version: '11.3'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/hello_world'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v1
Expand All @@ -36,13 +40,17 @@ jobs:
# Build the Game of Life test application
build-game_of_life:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v2
- uses: nhartland/love-build@dev
id: love-build
with:
app_name: 'game_of_life'
love_version: '11.3'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/game_of_life'
dependencies: 'tests/game_of_life/dependencies-1-1.rockspec'
# Upload the resulting artifacts
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ jobs:
# Build the Hello World test application
build-hello_world:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v2
- uses: nhartland/love-build@master
id: love-build
with:
app_name: 'hello_world'
love_version: '11.3'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/hello_world'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v1
Expand All @@ -36,13 +40,17 @@ jobs:
# Build the Game of Life test application
build-game_of_life:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v2
- uses: nhartland/love-build@master
id: love-build
with:
app_name: 'game_of_life'
love_version: '11.3'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/game_of_life'
dependencies: 'tests/game_of_life/dependencies-1-1.rockspec'
# Upload the resulting artifacts
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@ applications running, for example icons are not yet configurable.
Furthermore the macOS build is unverified by Apple and therefore will need
to be manually opened in the Security and Preferences pane at least for the
first time it is run.

Only projects based on LÖVE version 0.8.0 or greater are supported. Before
0.8.0, , no win64 binaries were provided.
39 changes: 24 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ build_lovefile(){
if [ -n "${INPUT_DEPENDENCIES}" ]; then
depsfile="${GITHUB_WORKSPACE}/${INPUT_DEPENDENCIES}"
# Build the dependencies into a local luarocks tree
luarocks make "${depsfile}" --lua-version=5.1 --tree lb_modules
luarocks make "${depsfile}" --deps-mode one --lua-version=5.1 --tree lb_modules
# Add custom require paths
cat /love-build/module_loader.lua main.lua > new_main.lua
mv new_main.lua main.lua
Expand All @@ -62,12 +62,10 @@ build_macos(){
(
# Change to build dir (subshell to preserve cwd)
cd "${bm_build_dir}"

# Download love for macos
if [ $(echo $INPUT_LOVE_VERSION | cut -c1-1) = 0 ]; then
get_love_binaries "macosx-x64"
else
get_love_binaries "macos"
fi
# Older (pre v11) labelled this as "macosx-x64" or "macosx-ub"
get_love_binaries "macos" || get_love_binaries "macosx-x64" || get_love_binaries "macosx-ub"

# Copy Data
cp "application.love" "love.app/Contents/Resources/"
Expand Down Expand Up @@ -95,19 +93,30 @@ build_windows(){
(
# Change to build dir (subshell to preserve cwd)
cd "${bw_build_dir}"
# Download love for macos
get_love_binaries "${bw_arch}"

mv "love-${INPUT_LOVE_VERSION}-${bw_arch}" "${INPUT_APP_NAME}_${bw_arch}"
# Fetch the appropriate binaries
case $bw_arch in
win32)
get_love_binaries "win32" || get_love_binaries "win-x86"
;;

win64)
get_love_binaries "win64" || get_love_binaries "win-x64"
;;
esac

# Get unpacked directory name (can vary a bit, e.g 11.4, 11.2.0) and rename
love_dir=$(find . -type d -regex ".*/love-.*" | head -n1)
mv "${love_dir}" "${bw_target}"

# Copy data
cat "${bw_target}/love.exe" "application.love" > "${bw_target}/${INPUT_APP_NAME}.exe"
# Delete unneeded files
rm "${bw_target}/love.exe"
rm "${bw_target}/lovec.exe"
rm "${bw_target}/love.ico"
rm "${bw_target}/changes.txt"
rm "${bw_target}/readme.txt"
rm "${bw_target}/lovec.exe" || true
rm "${bw_target}/love.ico" || true
rm "${bw_target}/changes.txt" || true
rm "${bw_target}/readme.txt" || true

# Setup final archive
zip -ry "${bw_target}.zip" "${bw_target}"
Expand Down Expand Up @@ -144,8 +153,8 @@ main() {
### macOS/win builds ##############################################

build_macos
build_windows win32
build_windows win64
build_windows "win32";
build_windows "win64";

}

Expand Down

0 comments on commit 4780ffd

Please sign in to comment.