Added autoconf to manage building and installation flow

master
Brady McDonough 10 months ago
parent c0092d57e6
commit 49d9e4e5d1

11
.gitignore vendored

@ -1,6 +1,9 @@
**/.*
# emacs buffers and backup files # emacs buffers and backup files
**/*~ **/*~
**/*# **/*#
**/.#*
# elm buildfiles # elm buildfiles
frontend/elm-stuff/ frontend/elm-stuff/
@ -8,4 +11,10 @@ frontend/www/elm.js
# backend logs and data # backend logs and data
backend/*.log backend/*.log
backend/repo/ backend/repo/
# autoconf products
**/Makefile
configure.scan
config.log
config.status

@ -1,15 +0,0 @@
ELM := $(shell command -v elm 2>/dev/null)
GUILE := $(shell command -v guile 2>/dev/null)
ART := $(shell command -v art)
ifndef ELM
ELM = $(error "elm installation not found in PATH")
endif
ifndef GUILE
GUILE = $(error "guile installation not found in PATH")
endif
ifndef ART
ART = $(error "artanis installation not found in PATH")
endif
ELM_TARGET = frontend/www/elm.js

@ -0,0 +1,22 @@
.PHONY: all back front install
all: back front
back:
cd backend && ${MAKE}
front:
cd frontend && ${MAKE}
@public_dir@:
cd frontend && ${MAKE} install
@nginx_config@: m4/environment.m4 nginx/yacswa.conf.m4
m4 m4/environment.m4 nginx/yacswa.conf.m4 > @nginx_config@
install: @public_dir@ @nginx_config@
up: install
sudo $(LN_S) /etc/nginx/sites_available/yacswa.conf /etc/nginx/sites_enabled/
cd backend && ${MAKE} up

@ -0,0 +1,20 @@
.PHONY: all deps tk csv up down
all: deps
deps: tk csv
tk:
cd deps/guile-toolkit && ${MAKE} && sudo ${MAKE} install
csv:
cd deps/guile-csv && ${MAKE} && sudo ${MAKE} install
up: deps .backend.lock
.backend.lock: main.scm
@nohup $(GUILE) ./main.scm > yacswa-backend.log & export PID=$$! & echo "Server spawned with PID $${PID}"; echo $${PID} > .backend.lock; unset PID
down:
@export PID=`cat .backend.lock`; kill -15 $${PID}; rm .backend.lock; rm bc; echo "Server on PID $${PID} down."; unset PID

3115
configure vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,28 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.72])
AC_INIT([Yet Another Covid Statistics Web App], [1.0], [me@bradymcd.ca])
# Pull in environment variables
AC_SUBST([server_name], [yacswa.home])
AC_SUBST([public_dir], [/srv/yacswa.home])
AC_SUBST([nginx_config], [yacswa.home.conf])
# Checks for programs.
AC_PROG_MAKE_SET
AC_CHECK_PROG(GUILE, [guile], [guile], [no])
test "$GUILE" == "no" && AC_MSG_ERROR([Guile's interpreter: 'guile' not found.])
AC_CHECK_PROG(GUILD, [guild], [guild], [no])
test "$GUILD" == "no" && AC_MSG_ERROR([Guile's compiler: 'guild' not found.])
AC_CHECK_PROG(ART, [art], [art], [no])
test "$ART" == "no" && AC_MSG_ERROR([Guile Artanis webserver: 'art' not found.])
AC_CHECK_PROG(ELM, [elm], [elm], [no])
test "$ELM" == "no" && AC_MSG_ERROR([Elm's compiler: 'elm' not found.])
AC_PROG_LN_S
AC_CONFIG_FILES([Makefile
backend/Makefile
frontend/Makefile])
AC_OUTPUT

@ -0,0 +1,16 @@
.PHONY: all
all: www/elm.js
www/elm.js:
$(ELM) make src/Main.elm --output=www/elm.js
install: www/elm.js @public_dir@
@public_dir@:
mkdir @public_dir@
cp ./www/ @public_dir@
uninstall:
rm -rf @public_dir@

@ -0,0 +1,30 @@
server {
listen 80;
listen [::]:80;
server_name @server_name@ www.@server_name@;
root _PUBLIC_DIR_;
try_files $uri $uri/ /not_found;
location /json/pc {
proxy_pass 127.0.0.1:1665/json/pc
}
location /json/hr {
proxy_pass 127.0.0.1:1665/json/hr
}
location /json/batch {
proxy_pass 127.0.0.1:1665/json/batch
}
location /update {
proxy_pass 127.0.0.1:1665/update
}
location /not_found {
return 404;
}
}
Loading…
Cancel
Save