From 8900c7d95edb024a6849d5762ce4baf2e19c0a2f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 13 Sep 2018 20:59:52 -0700 Subject: [PATCH] Add datadir (share) configure, Makefile and ircd::fs related. --- Makefile.am | 1 + configure.ac | 34 ++++++++++++++++++++++++++++++++++ include/ircd/fs/fs.h | 1 + ircd/fs.cc | 1 + share/Makefile.am | 22 ++++++++++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 share/Makefile.am diff --git a/Makefile.am b/Makefile.am index 91fb1ea87..24826a60b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include/ircd SUBDIRS += ircd SUBDIRS += modules +SUBDIRS += share SUBDIRS += construct .PHONY: subdirs $(SUBDIRS) diff --git a/configure.ac b/configure.ac index 9ee7c27e3..52f822a41 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,7 @@ AC_CONFIG_FILES(\ construct/Makefile \ ircd/Makefile \ modules/Makefile \ + share/Makefile \ ) AM_INIT_AUTOMAKE([subdir-objects]) @@ -768,6 +769,21 @@ dnl RB_DEFINE_UNQUOTED([CONF_DIR], ["$(sysconfdir)"], [Prefix where config files are installed.]) AC_SUBST_DIR([sysconfdir]) +dnl +dnl datarootdir +dnl + +dnl Avoid name collisions. +RB_DEFINE_UNQUOTED([DATAROOT_DIR], ["$(datarootdir)"], [Prefix where read-only assets go]) +AC_SUBST_DIR([datarootdir]) + +dnl +dnl datadir +dnl + +RB_DEFINE_UNQUOTED([DATA_DIR], ["$(datadir)/${PACKAGE_TARNAME}"], [Directory where read-only assets go.]) +AC_SUBST_DIR([datadir]) + dnl dnl Check for --with-dbdir dnl @@ -819,6 +835,24 @@ AC_ARG_WITH(moduledir, [AC_HELP_STRING([--with-moduledir=DIR], [Directory to ins RB_DEFINE_UNQUOTED([MODULE_DIR], ["$moduledir"], [Prefix where modules are installed.]) AC_SUBST_DIR([moduledir]) +dnl +dnl Check for --with-webappdir +dnl + +AC_MSG_CHECKING([whether to modify webappdir]) +AC_ARG_WITH(webappdir, [AC_HELP_STRING([--with-webappdir=DIR], [Directory to install served assets])], +[ + AC_MSG_RESULT(yes) + webappdir=`echo $withval | sed 's/\/$//'` +], [ + AC_MSG_RESULT(no) + webappdir="${datadir}/webapp" +]) + +RB_DEFINE_UNQUOTED([WEBAPP_DIR], ["$webappdir"], [Prefix where website assets are served from.]) +AC_SUBST_DIR([webappdir]) + + dnl *************************************************************************** dnl dnl Third party diff --git a/include/ircd/fs/fs.h b/include/ircd/fs/fs.h index b8049e488..a918df1c5 100644 --- a/include/ircd/fs/fs.h +++ b/include/ircd/fs/fs.h @@ -75,6 +75,7 @@ enum ircd::fs::index PREFIX, BIN, CONF, + DATA, DB, LOG, MODULES, diff --git a/ircd/fs.cc b/ircd/fs.cc index d23dc18ec..ef4534250 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -75,6 +75,7 @@ ircd::fs::syspaths { "installation prefix", RB_PREFIX }, { "binary directory", RB_BIN_DIR }, { "configuration directory", RB_CONF_DIR }, + { "data directory", RB_DATA_DIR }, { "database directory", RB_DB_DIR }, { "log directory", RB_LOG_DIR }, { "module directory", RB_MODULE_DIR }, diff --git a/share/Makefile.am b/share/Makefile.am new file mode 100644 index 000000000..26e8b773f --- /dev/null +++ b/share/Makefile.am @@ -0,0 +1,22 @@ +################################################################################ +# +# IRCd read-only data (share) assets. +# + +datadir = @datadir@/$(PACKAGE_TARNAME) +data_DATA = share/ + +install-mkdirs: + -@if test ! -d $(datadir); then \ + echo "mkdir -p $(datadir)"; \ + mkdir -p $(datadir); \ + fi + +install: install-mkdirs + @echo "ircd: installing shared assets" + @for i in $(srcdir)/*; do \ + if [[ "$$i" != "./Makefile"* ]] && [[ "$$i" != "README.md" ]]; then \ + echo "installing $$i to $(DESTDIR)$(datadir)"; \ + cp -r $$i $(DESTDIR)$(datadir); \ + fi \ + done