From cb61a526c82153c09ed357901166a42b48ba9d3b Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Thu, 2 Sep 2021 22:26:46 +0530
Subject: website: Add website.
* website/style.css: New file.
* build-aux/build-home-page.el: New file.
* configure.ac: Look for emacs.
* Makefile.am (EMACS_GEN, EMACS_GEN_, EMACS_GEN_0, EMACS_GEN_1): New
variables.
(website, website/index.html): New target.
(CLEANFILES): Add website/index.html.
* .gitignore: Add website/index.html.
---
.gitignore | 3 +++
Makefile.am | 16 ++++++++++++++++
build-aux/build-home-page.el | 42 ++++++++++++++++++++++++++++++++++++++++++
configure.ac | 3 +++
website/style.css | 20 ++++++++++++++++++++
5 files changed, 84 insertions(+)
create mode 100644 build-aux/build-home-page.el
create mode 100644 website/style.css
diff --git a/.gitignore b/.gitignore
index fa3a889..0432bfc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,5 +21,8 @@ xapian/*.go
xapian/wrap.scm
xapian_wrap.cc
+# website
+website/index.html
+
# other
pre-inst-env
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
index 71f83da..c06bc57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,14 @@
# along with guile-xapian. If not, see
# .
+# Prefix variables for silencing various commands. See "(automake)
+# Automake Silent Rules" for details.
+
+EMACS_GEN = $(EMACS_GEN_$(V))
+EMACS_GEN_ = $(EMACS_GEN_$(AM_DEFAULT_VERBOSITY))
+EMACS_GEN_0 = @echo " EMACS" $@;
+EMACS_GEN_1 =
+
# Xapian wrapper
lib_LTLIBRARIES = libguilexapian.la
@@ -55,3 +63,11 @@ SUFFIXES = .scm .go
# Building xapian/xapian.scm additionally requires the libguilexapian
# shared library.
xapian/xapian.go: xapian/xapian.scm libguilexapian.la
+
+# Build website
+
+website: website/index.html
+
+CLEANFILES += website/index.html
+website/index.html: README.org
+ $(EMACS_GEN)$(EMACS) -Q --batch --load build-aux/build-home-page.el --funcall build-website
diff --git a/build-aux/build-home-page.el b/build-aux/build-home-page.el
new file mode 100644
index 0000000..d5faa9a
--- /dev/null
+++ b/build-aux/build-home-page.el
@@ -0,0 +1,42 @@
+;;; guile-xapian --- Guile bindings for Xapian
+;;; Copyright © 2020 Arun Isaac
+;;;
+;;; This file is part of guile-xapian.
+;;;
+;;; guile-xapian 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 2 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; guile-xapian 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 guile-xapian. If not, see
+;;; .
+
+;;; Commentary:
+
+;; This Emacs script generates the home page of the website from
+;; README.org.
+
+;;; Code:
+
+(require 'ox-html)
+(require 'seq)
+
+(setq make-backup-files nil
+ org-export-with-section-numbers nil
+ org-export-with-sub-superscripts nil
+ org-export-with-toc nil
+ org-html-head ""
+ org-html-head-include-default-style nil
+ org-html-head-include-scripts nil
+ org-html-postamble nil)
+
+(defun build-website ()
+ (with-temp-file "foo.org"
+ (insert-file-contents "README.org")
+ (org-export-to-file 'html "website/index.html")))
diff --git a/configure.ac b/configure.ac
index 6045c42..693dfd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,9 @@ GUILE_PROGS
PKG_CHECK_MODULES([XAPIAN], [xapian-core])
PKG_CHECK_MODULES([ZLIB], [zlib])
+# To build the website
+AC_PATH_PROG([EMACS], [emacs])
+
dnl pkg-config does not output xapian include flags when the include
dnl path is already in CPATH. See
dnl https://unix.stackexchange.com/questions/362289/why-is-pkg-config-cflags-openssl-returning-nothing-on-rhel-6-8
diff --git a/website/style.css b/website/style.css
new file mode 100644
index 0000000..a53b9b1
--- /dev/null
+++ b/website/style.css
@@ -0,0 +1,20 @@
+body {
+ margin: 40px auto;
+ max-width: 900px;
+ line-height: 1.6;
+ font-size: 18px;
+ padding: 0 10px;
+}
+
+pre, code {
+ background-color: #f0f0f0;
+}
+
+pre {
+ padding: 1em;
+}
+
+/* Make the SVG badges clickable. */
+object {
+ pointer-events: none;
+}
--
cgit v1.2.3