mirror of
git://git.savannah.gnu.org/guix/guix-cuirass.git
synced 2024-12-29 11:40:16 +01:00
build: Let 'make' generate 'src/cuirass/config.scm'.
* Makefile.am (src/cuirass/config.scm, $(go_files)): New targets. (do_subst, generate_file, go_files): New variables. (EXTRA_DIST): Distribute 'src/cuirass/config.scm.in'. (DISTCLEANFILES): Rename to ... (MOSTLYCLEANFILES): ... this. * configure.ac (AC_CONFIG_FILES): Remove 'src/cuirass/config.scm'. (@expanded_datadir@, @expanded_localstatedir@): Delete. (AC_PROG_MKDIR_P, AC_PROG_SED): Use them. * src/cuirass/config.scm (%datadir): Set it to $(localstatedir). (%localstatdir): Set it to $(datadir).
This commit is contained in:
parent
12d71ee098
commit
1e5012ca80
3 changed files with 50 additions and 14 deletions
44
Makefile.am
44
Makefile.am
|
@ -86,18 +86,60 @@ sql-check: src/schema.sql
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
.dir-locals.el \
|
.dir-locals.el \
|
||||||
bootstrap \
|
bootstrap \
|
||||||
|
src/cuirass/config.scm.in \
|
||||||
tests/gnu-system.scm \
|
tests/gnu-system.scm \
|
||||||
tests/guix-jobs.scm \
|
tests/guix-jobs.scm \
|
||||||
tests/hello-singleton.scm \
|
tests/hello-singleton.scm \
|
||||||
tests/hello-subset.scm \
|
tests/hello-subset.scm \
|
||||||
$(TESTS)
|
$(TESTS)
|
||||||
|
|
||||||
DISTCLEANFILES = src/cuirass/config.scm
|
MOSTLYCLEANFILES = src/cuirass/config.scm
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
$(nodist_guilesite_DATA) \
|
$(nodist_guilesite_DATA) \
|
||||||
$(dist_pkgmodule_DATA:%.scm=%.go) \
|
$(dist_pkgmodule_DATA:%.scm=%.go) \
|
||||||
src/cuirass/config.go
|
src/cuirass/config.go
|
||||||
|
|
||||||
|
## ----------------- ##
|
||||||
|
## Generated files. ##
|
||||||
|
## ----------------- ##
|
||||||
|
|
||||||
|
# 'AC_CONFIG_FILES' doesn't fully expand variables that depend on ${prefix}.
|
||||||
|
# To use such variables in source files and scripts while following GNU Coding
|
||||||
|
# Standards, let 'make' manage their replacement.
|
||||||
|
|
||||||
|
# Use config.status to substitute the remainder where a single expansion is
|
||||||
|
# sufficient. We use a funny notation here to avoid configure substitutions
|
||||||
|
# in our text.
|
||||||
|
do_subst = ( $(SED) \
|
||||||
|
-e "s,@configure_input[@],Generated from $$in. Do not edit by hand.,g" \
|
||||||
|
-e 's,@datadir[@],$(datadir),g' \
|
||||||
|
-e 's,@localstatedir[@],$(localstatedir),g' \
|
||||||
|
| $(SHELL) ./config.status --file=- )
|
||||||
|
|
||||||
|
# Generic instructions to perform the substitution. Generated files shouldn't
|
||||||
|
# contain unexpanded '@substitutions@', and should be made read-only, to
|
||||||
|
# prevent them from being edited by mistake instead of the file the are
|
||||||
|
# generated from.
|
||||||
|
generate_file = \
|
||||||
|
$(AM_V_GEN)rm -f $@ $@-t; \
|
||||||
|
$(MKDIR_P) $(@D); \
|
||||||
|
in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t; \
|
||||||
|
if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' $@-t; then \
|
||||||
|
echo "$@ contains unexpanded substitution (see lines above)"; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
chmod a-w $@-t; mv -f $@-t $@
|
||||||
|
|
||||||
|
# This file depends on Makefile so it is rebuilt if $(VERSION),
|
||||||
|
# $(datadir) or other do_subst'ituted variables change.
|
||||||
|
src/cuirass/config.scm: $(srcdir)/src/cuirass/config.scm.in Makefile
|
||||||
|
$(generate_file)
|
||||||
|
|
||||||
|
# Guile modules require 'src/cuirass/config.scm' to exist before being
|
||||||
|
# compiled.
|
||||||
|
go_files = $(nodist_guilesite_DATA) $(dist_pkgmodule_DATA:%.scm=%.go)
|
||||||
|
$(go_files): src/cuirass/config.scm
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Silent rules. ##
|
## Silent rules. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
13
configure.ac
13
configure.ac
|
@ -8,14 +8,8 @@ AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])
|
||||||
AM_SILENT_RULES([yes]) # enables silent rules by default
|
AM_SILENT_RULES([yes]) # enables silent rules by default
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
AC_PROG_MKDIR_P
|
||||||
# Prepare a version of installation directories that does not contain
|
AC_PROG_SED
|
||||||
# references to shell variables.
|
|
||||||
expanded_prefix="`eval echo $prefix | sed -e "s|NONE|/usr/local|g"`"
|
|
||||||
AC_SUBST([expanded_datadir],
|
|
||||||
[`eval echo $datarootdir | sed -e "s|NONE|$expanded_prefix|g"`])
|
|
||||||
AC_SUBST([expanded_localstatedir],
|
|
||||||
[`eval echo $localstatedir | sed -e "s|NONE|$expanded_prefix|g"`])
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
|
PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
|
||||||
AC_PATH_PROG([GUILE], [guile])
|
AC_PATH_PROG([GUILE], [guile])
|
||||||
|
@ -27,8 +21,7 @@ GUILE_MODULE_REQUIRED([guix])
|
||||||
GUILE_MODULE_REQUIRED([json])
|
GUILE_MODULE_REQUIRED([json])
|
||||||
GUILE_MODULE_REQUIRED([sqlite3])
|
GUILE_MODULE_REQUIRED([sqlite3])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile])
|
||||||
src/cuirass/config.scm])
|
|
||||||
AC_CONFIG_FILES([bin/cuirass], [chmod +x bin/cuirass])
|
AC_CONFIG_FILES([bin/cuirass], [chmod +x bin/cuirass])
|
||||||
AC_CONFIG_FILES([bin/evaluate], [chmod +x bin/evaluate])
|
AC_CONFIG_FILES([bin/evaluate], [chmod +x bin/evaluate])
|
||||||
AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
|
AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
;;; config.scm -- variables defined at configure time
|
;;;; config.scm -- constants defined by the build system.
|
||||||
|
;;; @configure_input@
|
||||||
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
|
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of Cuirass.
|
;;; This file is part of Cuirass.
|
||||||
|
@ -48,8 +49,8 @@
|
||||||
|
|
||||||
(define-public %datadir
|
(define-public %datadir
|
||||||
;; Define to DATADIR without reference to '${prefix}'.
|
;; Define to DATADIR without reference to '${prefix}'.
|
||||||
"@expanded_datadir@")
|
"@datadir@")
|
||||||
|
|
||||||
(define-public %localstatedir
|
(define-public %localstatedir
|
||||||
;; Define to LOCALSTATEDIR without reference to '${prefix}'.
|
;; Define to LOCALSTATEDIR without reference to '${prefix}'.
|
||||||
"@expanded_localstatedir@")
|
"@localstatedir@")
|
||||||
|
|
Loading…
Reference in a new issue