Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: provide snapcraft yaml for cross distribution packaging #43

Open
wants to merge 5 commits into
base: unleashed
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,49 @@ MAIN := tuo.exe
SRCS := $(wildcard *.cpp)
OBJS := $(patsubst %.cpp,obj/%.o,$(SRCS))
INCS := $(wildcard *.h)
PREFIX ?= /usr/local

CPPFLAGS := -Wall -Werror -std=gnu++11 -O3 -DNDEBUG
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex

ifdef SYSTEMROOT
RM = del /Q
FixPath = $(subst /,\,$1)
MKDIR = mkdir
else
ifeq ($(shell uname), Linux)
RM = rm -f
FixPath = $1
MKDIR = mkdir -p
endif
endif

all: $(MAIN)

obj/%.o: %.cpp $(INCS)
prep:
$(MKDIR) obj

obj/%.o: %.cpp $(INCS) prep
$(CXX) $(CPPFLAGS) -o $@ -c $<

$(MAIN): $(OBJS)
$(CXX) -o $@ $(OBJS) $(LDFLAGS)

clean:
del /q $(MAIN).exe obj\*.o
$(RM) $(call FixPath,obj/*.o)

.PHONY: install
install:
$(MKDIR) $(DESTDIR)$(PREFIX)/bin
cp tuo.exe $(DESTDIR)$(PREFIX)/bin/
cp update_xml.sh $(DESTDIR)$(PREFIX)/bin/

.PHONY: uninstall
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/tuo.exe
$(RM) $(DESTDIR)$(PREFIX)/bin/update_xml.sh

# build a snap for cross distribution availability
# cleanbuild uses snapcracft and lxd
snap:
snapcraft cleanbuild
27 changes: 27 additions & 0 deletions README.snap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# tyrant-unleashed-optimizer snap usage

This is about using the snap'ed version of tyrant-unleashed-optimizer (tuo)

Working features:
- updating local card database
- simulating fights

Exposed commands:
- tyrant-unleashed-optimizer.updatexml
- tyrant-unleashed-optimizer.sim

Known issues:
- To get to your card data files the home plug needs to be connected manually
after snap install. This is due to file access being a potential risk (and
snaps are a lot about security and isolation). To connect the home plug
call:
"sudo snap connect tyrant-unleashed-optimizer:home ubuntu-core:home"

Card-Update:
- Note: As usual if you don't have a "data" dir yet you have to create one via ``mkdir data``
- Then to actually call it:
``tyrant-unleashed-optimizer.updatexml``

Simulate:
- Note: as usual with tuo you have to run this where you have your ``data`` dir.
- tyrant-unleashed-optimizer.sim "Lord Silus, Extreme Barrager #2" "Lord Silus, Atomic Wardriver #2" sim 100
33 changes: 33 additions & 0 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: tyrant-unleashed-optimizer
version: daily
summary: Tyrant Unleashed Optimizer
description: |
Simulator app for the game Tarant Unleashed that can be used to optimize your
card deck for certain raids, or temporary buffs as well as growth planning in
general.
confinement: strict

apps:
sim:
command: usr/local/bin/tuo.exe
plugs: [home]
updatexml:
command: usr/local/bin/update_xml.sh
plugs: [home, network]

parts:
tyrant-unleashed-optimizer:
# as we are part of the tuo git tree then just build locally
source: .
plugin: make
build-packages:
- g++
- make
- build-essential
- libboost1.58-dev
- libboost-system1.58-dev
- libboost-thread1.58-dev
- libboost-filesystem1.58-dev
- libboost-regex1.58-dev
stage-packages:
- curl