diff --git a/.gitignore b/.gitignore index 11cc5ed..56554f1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,6 @@ build *.o *.min.js -/bouquins +bouquins externals -ksql.h +bouquins*.tar.gz diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db15175..0039ab6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,11 +7,7 @@ build: - make artifacts: paths: - - '*.o' - - bouquins - - '*.min.js' - - '*.html' - - '*.min.js' + - bouquins.tar.gz expire_in: 1 hour tags: - kcgi diff --git a/Makefile b/Makefile index ca720f4..187550e 100644 --- a/Makefile +++ b/Makefile @@ -60,11 +60,19 @@ sinclude GNUmakefile.local DATABASE = metadata.db OBJS = db.o db_author.o db_book.o db_series.o json.o main.o +EXT = externals + +BOOTSTRAP_VERSION = 3.3.7 +BOOTSTRAP_DIST = bootstrap-$(BOOTSTRAP_VERSION)-dist +BOOTSTRAP_URL = https://github.com/twbs/bootstrap/releases/download/v$(BOOTSTRAP_VERSION)/$(BOOTSTRAP_DIST).zip +BOOTSTRAP_TMP_ZIP = $(EXT)/bootstrap.zip +VUE_URL = https://vuejs.org/js/vue.min.js + +VUEJS = $(EXT)/vue.min.js HTMLS = index.html book.html author.html series.html search.html -JSMINS = index.min.js book.min.js author.min.js series.min.js search.min.js -EXTJS = externals/vue.min.js -CSS = externals/bootstrap.min.css -FONTS = externals/fonts/* +JSMINS = index.min.js book.min.js author.min.js series.min.js search.min.js $(VUEJS) +CSS = $(EXT)/$(BOOTSTRAP_DIST)/css/bootstrap.min.css +FONTS = $(EXT)/$(BOOTSTRAP_DIST)/fonts/* CFLAGS += -g -W -Wall -O2 $(SECURE) CFLAGS += -DLOGFILE=\"$(LOGFILE)\" @@ -80,10 +88,37 @@ all: $(TARGET) $(HTMLS) $(JSMINS) api: swagger.json +$(BOOTSTRAP_TMP_ZIP): + fetch -o $(BOOTSTRAP_TMP_ZIP) $(BOOTSTRAP_URL) + +$(EXT)/$(BOOTSTRAP_DIST): $(BOOTSTRAP_TMP_ZIP) + unzip -d $(EXT) $(BOOTSTRAP_TMP_ZIP) + +$(VUEJS): + fetch -o $(VUEJS) $(VUE_URL) + +$(EXT): $(EXT)/$(BOOTSTRAP_DIST) $(VUEJS) + +packwww: $(EXT) $(HTMLS) $(JSMINS) + mkdir -p build build/css build/fonts build/js + cp $(HTMLS) build + cp $(JSMINS) $(VUEJS) build/js + cp $(CSS) build/css + cp $(FONTS) build/fonts + +packcgi: $(TARGET) + mkdir -p build/cgi-bin + cp $(TARGET) build/cgi-bin + cp $(OBJS) build/cgi-bin + +package: packcgi packwww + tar czf bouquins.tar.gz -C build cgi-bin $(HTMLS) css js fonts + rm -rf build/* + installwww: all mkdir -p $(HTDOCS) $(HTDOCS)/css $(HTDOCS)/fonts $(HTDOCS)/js install -m 0444 $(HTMLS) $(HTDOCS) - install -m 0444 $(JSMINS) $(EXTJS) $(HTDOCS)/js + install -m 0444 $(JSMINS) $(HTDOCS)/js install -m 0444 $(CSS) $(HTDOCS)/css install -m 0444 $(FONTS) $(HTDOCS)/fonts