Skip to content

Commit

Permalink
GitHub Actions: add Nintendo Switch as build target (#3928)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-derevenetz authored Aug 1, 2021
1 parent 285a0dd commit 76a3aad
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,40 @@ jobs:
allowUpdates: true
prerelease: true
replacesArtifacts: true
build-switch:
name: Make (Nintendo Switch)
runs-on: ubuntu-latest
container: devkitpro/devkita64:latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext
- name: Build
run: |
export PATH=$DEVKITPRO/tools/bin:$DEVKITPRO/portlibs/switch/bin:$DEVKITPRO/devkitA64/bin:$PATH
make -f Makefile.switch -j 2
cd files/lang
make -j 2
env:
FHEROES2_STRICT_COMPILATION: ON
DEVKITPRO: /opt/devkitpro
- name: Create package
if: ${{ github.event_name == 'push' }}
run: |
cp docs/README.txt .
zip fheroes2_switch_sdl2.zip fheroes2.nro LICENSE fheroes2.key changelog.txt README.txt files/lang/*.mo
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' }}
with:
artifacts: fheroes2_switch_sdl2.zip
body: ${{ github.event.commits[0].message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: Nintendo Switch build with SDL 2.0 support (latest commit)
tag: fheroes2-switch-sdl2_dev
allowUpdates: true
prerelease: true
replacesArtifacts: true
44 changes: 44 additions & 0 deletions Makefile.switch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
###########################################################################
# Free Heroes of Might and Magic II: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2021 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
###########################################################################

TARGET := fheroes2
MAKE := make

PROJECT_TITLE := fheroes2
PROJECT_AUTHOR := fheroes2 resurrection team
PROJECT_VERSION := 0.9.5

all: package

package: $(TARGET).nro

$(TARGET).nro: $(TARGET).elf $(TARGET).nacp
elf2nro $(TARGET).elf $(TARGET).nro --icon=files/images/platform/switch/icon.png --nacp=$(TARGET).nacp

$(TARGET).nacp:
nacptool --create "$(PROJECT_TITLE)" "$(PROJECT_AUTHOR)" "$(PROJECT_VERSION)" $(TARGET).nacp

$(TARGET).elf:
$(MAKE) -f Makefile -C src PLATFORM=switch RELEASE=true
@cp src/dist/$(TARGET) $(TARGET).elf

clean:
$(MAKE) -f Makefile -C src clean
@rm -rf $(TARGET).elf $(TARGET).nacp $(TARGET).nro
21 changes: 9 additions & 12 deletions Makefile.vita
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,33 @@ MAKE := make

PROJECT_TITLE := Free Heroes of Might & Magic II
PROJECT_TITLEID := FHOMM0002
PROJECT := fheroes2

all: package

package: $(PROJECT).vpk
package: $(TARGET).vpk

$(PROJECT).vpk: eboot.bin param.sfo
$(TARGET).vpk: eboot.bin param.sfo
vita-pack-vpk -s param.sfo -b eboot.bin \
--add files/images/platform/psv/sce_sys/icon0.png=sce_sys/icon0.png \
--add files/images/platform/psv/sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \
--add files/images/platform/psv/sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \
--add files/images/platform/psv/sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \
$(PROJECT).vpk
$(TARGET).vpk

eboot.bin: $(PROJECT).velf
vita-make-fself $(PROJECT).velf eboot.bin
eboot.bin: $(TARGET).velf
vita-make-fself $(TARGET).velf eboot.bin

param.sfo:
vita-mksfoex -s TITLE_ID="$(PROJECT_TITLEID)" "$(PROJECT_TITLE)" param.sfo

$(PROJECT).velf: $(PROJECT).elf
$(TARGET).velf: $(TARGET).elf
arm-vita-eabi-strip -g $<
vita-elf-create $< $@

$(PROJECT).elf:
$(TARGET).elf:
$(MAKE) -f Makefile -C src FHEROES2_VITA=true RELEASE=true
$(MAKE) -f files/lang/Makefile
@cp src/dist/$(TARGET) ./$(PROJECT).elf
@cp src/dist/$(TARGET) $(TARGET).elf

clean:
$(MAKE) -f Makefile -C src clean
$(MAKE) -f files/lang/Makefile clean
@rm -rf $(TARGET).velf $(TARGET).elf $(OBJS) $(TARGET).elf.unstripped.elf $(TARGET).vpk eboot.bin sce_sys/param.sfo ./param.sfo
@rm -rf $(TARGET).velf $(TARGET).elf $(TARGET).vpk eboot.bin param.sfo
Binary file added files/images/platform/switch/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76a3aad

Please sign in to comment.