Nethack Launcher
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.9 KiB

GOC=go build
GOFLAGS=-a -ldflags '-s'
CGOR=CGO_ENABLED=0
5 years ago
OS_PERMS=sudo
5 years ago
NETHACK_DIR=$(shell pwd)/hack
IMAGE_NAME=nethack_launch
all: stat
run:
go run \
nethack-launcher/check_dir.go \
nethack-launcher/cleanup.go \
nethack-launcher/create_initial_files.go \
nethack-launcher/create_user_files.go \
nethack-launcher/janitor.go \
nethack-launcher/library.go \
nethack-launcher/nethack-launcher.go \
nethack-launcher/print_change_password_screen.go \
nethack-launcher/print_high_scores.go \
nethack-launcher/print_login_screen.go \
nethack-launcher/print_progress_screen.go \
nethack-launcher/print_register_screen.go \
nethack-launcher/print_user_screen.go \
nethack-launcher/print_welcome_screen.go \
nethack-launcher/recover_save.go \
nethack-launcher/run_game.go \
nethack-launcher/start_watcher.go
stat:
mkdir -p bin/
$(CGOR) $(GOC) $(GOFLAGS) -o bin/nethack-launcher nethack-launcher/*.go
dependencies:
go mod init git.bitnuke.io/mfaltys/nethack-launcher
go mod tidy
build_docker: fetch_sotw
5 years ago
mkdir -p stage.tmp/
cp deps/Dockerfile stage.tmp/
cp config.gcfg stage.tmp/config.gcfg
5 years ago
cp bin/nethack-launcher stage.tmp/
cp deps/redis.conf stage.tmp/
cp deps/run.sh stage.tmp/
cp deps/nethackrc stage.tmp/
cp deps/chowner.sh stage.tmp/
cp deps/run_nethack.sh stage.tmp/
cp deps/reclist.c stage.tmp/
cp deps/link_sotw.sh stage.tmp/
cp deps/clean.sh stage.tmp/
cp deps/scores.dat stage.tmp/
5 years ago
cd stage.tmp/ && \
$(OS_PERMS) docker build -t $(IMAGE_NAME) .
fetch_sotw:
mkdir -p stage.tmp/
cp deps/shadow-of-the-wyrm-release-1.6.5.tar.gz stage.tmp/sotw.tar.gz
5 years ago
run_docker:
$(OS_PERMS) docker run \
-d \
-p 2223:22 \
--name=nethackdev \
-v $(NETHACK_DIR):/hack-dev:rw \
--restart always \
$(IMAGE_NAME)
stop_docker:
$(OS_PERMS) docker stop -t 0 nethackdev
$(OS_PERMS) docker rm nethackdev
5 years ago
clean:
rm -rf bin/
rm -rf stage.tmp/