Browse Source

build system

pull/1/head
Ivan Polyakov 3 years ago
parent
commit
3b6786ebe0
  1. 58
      Makefile
  2. 11
      README.md
  3. 23
      config.mk
  4. 20
      hyde.scm
  5. 1
      scripts/minify-html.sed

58
Makefile

@ -0,0 +1,58 @@
# Copyright (C) 2022 Ivan Polyakov
#
# This file is part of vilor's website.
#
# Vilor's website 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 3 of the License, or
# (at your option) any later version.
#
# Vilor's website 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, see <https://www.gnu.org/licenses/>.
include config.mk
DIRS := $(shell find $(SRCDIR)/pages/* -type d | sed 's/$(SRCDIR)\/pages/$(OUTDIR)/')
SRCPAGES := $(shell find $(SRCDIR)/pages/* -name '*.scm')
SRCSTYLES := $(shell find $(SRCDIR)/styles/* -name '*.scm')
OUTSTYLES := $(shell find $(SRCDIR)/styles/ -type f -name '*.scm' | sed 's/$(SRCDIR)\/styles/$(OUTDIR)/')
OUTSTYLES := $(OUTSTYLES:%.scm=%.css)
SRCJS := $(shell find $(SRCDIR)/scripts/* -name '*.js')
OUTJS := $(shell find $(SRCDIR)/scripts/ -type f -name '*.js' | sed 's/$(SRCDIR)\/scripts/$(OUTDIR)/')
all: $(OUTDIR) $(STATICDIR) pages $(OUTSTYLES) $(OUTJS)
pages: $(SRCPAGES)
for page in $(SRCPAGES) ; do \
$(SCHEME) $(SCHEMEFLAGS) $$page \
| sed -f scripts/minify-html.sed \
> $$(echo $$page | sed 's/.*\/pages/dist/' | sed 's/scm/xhtml/') \
; done
$(OUTSTYLES): $(SRCSTYLES)
$(SCHEME) $(SCHEMEFLAGS) $< > $@
$(OUTJS): $(SRCJS)
for script in $(SRCJS) ; do \
cp $$script $$(echo $$script | sed 's/.*\/scripts/dist/') \
; done
$(OUTDIR):
mkdir -p $(OUTDIR)
mkdir -p $(DIRS)
$(STATICDIR): $(OUTDIR)
cp -rf $@/* $< || echo $(STATICDIR) "dir is empty"
cp COPYING dist/
clean:
rm -rf $(OUTDIR)
.PHONY: all $(OUTDIR) $(STATICDIR) clean

11
README.md

@ -3,11 +3,14 @@ website
Dependencies Dependencies
------------ ------------
Chicken Scheme: http://www.call-cc.org/ Chicken Scheme: http://www.call-cc.org/
Hyde egg: http://wiki.call-cc.org/eggref/5/hyde sxml-serializer egg: http://wiki.call-cc.org/eggref/5/sxml-serializer
scss egg: http://wiki.call-cc.org/eggref/5/scss
Usage Building
----- --------
See `hyde --help`. ```
make
```
License License
------- -------

23
config.mk

@ -0,0 +1,23 @@
# Copyright (C) 2022 Ivan Polyakov
#
# This file is part of vilor's website.
#
# Vilor's website 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 3 of the License, or
# (at your option) any later version.
#
# Vilor's website 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, see <https://www.gnu.org/licenses/>.
SCHEME=csi
SCHEMEFLAGS=-s
SRCDIR=src
STATICDIR=public
OUTDIR=dist

20
hyde.scm

@ -1,20 +0,0 @@
;; Copyright (C) 2022 Ivan Polyakov
;;
;; This file is part of vilor's website.
;;
;; Vilor's website 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 3 of the License, or
;; (at your option) any later version.
;;
;; Vilor's website 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, see <https://www.gnu.org/licenses/>.
(import hyde)
(output-dir "dist")

1
scripts/minify-html.sed

@ -0,0 +1 @@
:a;N;$!ba;s/>\s*</></g
Loading…
Cancel
Save