summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-02-11 23:04:35 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-02-15 10:06:09 +0100
commit3045a96d37f551f60482e9cc74513d60b0590600 (patch)
tree503784b454b0d59236295e53f431d4040c6e3442
parent92d471b8c10d09795737b695533a43dd08a6b693 (diff)
downloadgnutls-3045a96d37f551f60482e9cc74513d60b0590600.tar.gz
guile: Build and install .go files on Guile 2.x.
* configure.ac: Check for 'guild' and substitute 'GUILD'. Define 'HAVE_GUILD'. Substitute 'guileobjectdir'. Don't output guile/modules/Makefile and guile/tests/Makefile. * guile/modules/Makefile.am, guile/tests/Makefile.am: Remove. Move contents to... * guile/Makefile.am: ... here. (SUBDIRS): Remove 'modules' and 'tests'.
-rw-r--r--configure.ac19
-rw-r--r--guile/Makefile.am118
-rw-r--r--guile/modules/Makefile.am38
-rw-r--r--guile/tests/Makefile.am43
4 files changed, 131 insertions, 87 deletions
diff --git a/configure.ac b/configure.ac
index 6a5600c52a..8440def4ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-# Copyright (C) 2000-2012 Free Software Foundation, Inc.
+# Copyright (C) 2000-2012, 2016 Free Software Foundation, Inc.
#
# Author: Nikos Mavrogiannopoulos, Simon Josefsson
#
@@ -730,9 +730,14 @@ if test "$opt_guile_bindings" = "yes"; then
AC_PATH_PROG([guile_snarf], [guile-snarf])
if test "x$guile_snarf" = "x"; then
- AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found. Guile bindings not built.])
+ AC_MSG_WARN([`guile-snarf' from Guile not found. Guile bindings not built.])
opt_guile_bindings=no
else
+ dnl Check for 'guild', which can be used to compile Scheme code
+ dnl on Guile 2.x.
+ AC_PATH_PROG([GUILD], [guild])
+ AC_SUBST([GUILD])
+
GUILE_PROGS
GUILE_FLAGS
@@ -789,6 +794,10 @@ if test "$opt_guile_bindings" = "yes"; then
AC_MSG_RESULT([$guile_effective_version])
guileextensiondir="$libdir/guile/$guile_effective_version"
AC_SUBST([guileextensiondir])
+
+ # The location of .go files.
+ guileobjectdir="$libdir/guile/$guile_effective_version/site-ccache"
+ AC_SUBST([guileobjectdir])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([A sufficiently recent GNU Guile not found. Guile bindings not built.])
@@ -796,7 +805,9 @@ if test "$opt_guile_bindings" = "yes"; then
fi
fi
fi
-AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
+
+AM_CONDITIONAL([HAVE_GUILE], [test "$opt_guile_bindings" = "yes"])
+AM_CONDITIONAL([HAVE_GUILD], [test "x$GUILD" != "x"])
LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
LIBGNUTLS_CFLAGS="-I${includedir}"
@@ -886,9 +897,7 @@ AC_CONFIG_FILES([
gl/Makefile
gl/tests/Makefile
guile/Makefile
- guile/modules/Makefile
guile/src/Makefile
- guile/tests/Makefile
lib/Makefile
lib/accelerated/Makefile
lib/accelerated/x86/Makefile
diff --git a/guile/Makefile.am b/guile/Makefile.am
index ed9b8ba1d7..98ac7a1d65 100644
--- a/guile/Makefile.am
+++ b/guile/Makefile.am
@@ -15,6 +15,122 @@
# License along with GnuTLS; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SUBDIRS = modules src tests
+# First of all, built the DSO. We cannot compile the Scheme code until this
+# is done.
+SUBDIRS = src
+
EXTRA_DIST = .dir-locals.el
+
+guilemoduledir = $(GUILE_SITE)
+guilemodulesubdir = $(GUILE_SITE)/gnutls
+
+nodist_guilemodule_DATA = modules/gnutls.scm
+dist_guilemodulesub_DATA = modules/gnutls/extra.scm
+
+documentation_modules = \
+ modules/system/documentation/README \
+ modules/system/documentation/c-snarf.scm \
+ modules/system/documentation/output.scm
+
+helper_modules = \
+ modules/gnutls/build/enums.scm \
+ modules/gnutls/build/smobs.scm \
+ modules/gnutls/build/utils.scm \
+ modules/gnutls/build/tests.scm
+
+EXTRA_DIST += modules/gnutls.in $(helper_modules) $(documentation_modules)
+
+CLEANFILES = modules/gnutls.scm
+
+.in.scm:
+ cat "$^" | $(SED) -e's|[@]guileextensiondir[@]|$(guileextensiondir)|g' \
+ > "$@.tmp"
+ mv "$@.tmp" "$@"
+
+
+#
+# Scheme code compilation.
+#
+
+if HAVE_GUILD
+
+guileobjectsubdir = $(guileobjectdir)/gnutls
+nodist_guileobject_DATA = modules/gnutls.go
+nodist_guileobjectsub_DATA = modules/gnutls/extra.go
+
+GOBJECTS = \
+ $(nodist_guileobject_DATA) \
+ $(nodist_guileobjectsub_DATA)
+
+CLEANFILES += $(GOBJECTS)
+
+AM_V_GUILEC = $(AM_V_GUILEC_$(V))
+AM_V_GUILEC_ = $(AM_V_GUILEC_$(AM_DEFAULT_VERBOSITY))
+AM_V_GUILEC_0 = @echo " GUILEC " $@;
+
+# Make sure 'gnutls.scm' is built first.
+# Unset 'GUILE_LOAD_COMPILED_PATH' so we can be sure that any .go file that we
+# load comes from the build directory.
+# XXX: Use the C locale for when Guile lacks
+# <http://git.sv.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=e2c6bf3866d1186c60bacfbd4fe5037087ee5e3f>.
+%.go: %.scm modules/gnutls.scm
+ $(AM_V_GUILEC)$(MKDIR_P) "`dirname "$@"`" ; \
+ $(AM_V_P) && out=1 || out=- ; \
+ unset GUILE_LOAD_COMPILED_PATH ; LC_ALL=C \
+ GNUTLS_GUILE_EXTENSION_DIR="$(abs_top_builddir)/guile/src" \
+ $(GUILD) compile --target="$(host)" \
+ -L "$(top_builddir)/guile/modules" \
+ -L "$(top_srcdir)/guile/modules" \
+ -Wformat -Wunbound-variable -Warity-mismatch \
+ -o "$@" "$<" >&$$out
+
+SUFFIXES = .go
+
+endif HAVE_GUILD
+
+
+#
+# Tests.
+#
+
+TESTS = \
+ tests/anonymous-auth.scm \
+ tests/session-record-port.scm \
+ tests/pkcs-import-export.scm \
+ tests/errors.scm \
+ tests/x509-certificates.scm \
+ tests/x509-auth.scm \
+ tests/priorities.scm
+
+if ENABLE_OPENPGP
+TESTS += \
+ tests/openpgp-keys.scm \
+ tests/openpgp-keyring.scm \
+ tests/openpgp-auth.scm
+endif
+
+if ENABLE_SRP
+TESTS += \
+ tests/srp-base64.scm
+endif
+
+TESTS_ENVIRONMENT = \
+ GUILE_AUTO_COMPILE=0 \
+ GUILE_WARN_DEPRECATED=detailed
+
+LOG_COMPILER = $(top_builddir)/guile/pre-inst-guile -L $(srcdir)/tests
+
+
+EXTRA_DIST += \
+ $(TESTS) \
+ tests/openpgp-pub.asc \
+ tests/openpgp-sec.asc \
+ tests/openpgp-elg-pub.asc \
+ tests/openpgp-elg-sec.asc \
+ tests/openpgp-keyring.gpg \
+ tests/openpgp-keyring.asc \
+ tests/rsa-parameters.pem \
+ tests/dh-parameters.pem \
+ tests/x509-certificate.pem \
+ tests/x509-key.pem
diff --git a/guile/modules/Makefile.am b/guile/modules/Makefile.am
deleted file mode 100644
index 71e3d6878b..0000000000
--- a/guile/modules/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-# GnuTLS --- Guile bindings for GnuTLS.
-# Copyright (C) 2007-2012, 2014 Free Software Foundation, Inc.
-#
-# GnuTLS is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# GnuTLS 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with GnuTLS; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-guilemoduledir = $(GUILE_SITE)
-
-nobase_nodist_guilemodule_DATA = gnutls.scm
-nobase_dist_guilemodule_DATA = gnutls/extra.scm
-
-documentation_modules = system/documentation/README \
- system/documentation/c-snarf.scm \
- system/documentation/output.scm
-
-EXTRA_DIST = gnutls/build/enums.scm gnutls/build/smobs.scm \
- gnutls/build/utils.scm \
- gnutls/build/tests.scm \
- gnutls.in \
- $(documentation_modules)
-
-CLEANFILES = gnutls.scm
-
-.in.scm:
- cat "$^" | $(SED) -e's|[@]guileextensiondir[@]|$(guileextensiondir)|g' \
- > "$@.tmp"
- mv "$@.tmp" "$@"
diff --git a/guile/tests/Makefile.am b/guile/tests/Makefile.am
deleted file mode 100644
index 6b1cfd8a1b..0000000000
--- a/guile/tests/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-# GnuTLS --- Guile bindings for GnuTLS.
-# Copyright (C) 2007-2013 Free Software Foundation, Inc.
-#
-# GnuTLS is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# GnuTLS 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with GnuTLS; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-TESTS = anonymous-auth.scm session-record-port.scm \
- pkcs-import-export.scm \
- errors.scm \
- x509-certificates.scm x509-auth.scm \
- priorities.scm
-
-if ENABLE_OPENPGP
-TESTS += openpgp-keys.scm openpgp-keyring.scm openpgp-auth.scm
-endif
-
-if ENABLE_SRP
-TESTS += srp-base64.scm
-endif
-
-TESTS_ENVIRONMENT = \
- GUILE_AUTO_COMPILE=0 \
- GUILE_WARN_DEPRECATED=detailed
-
-LOG_COMPILER = $(top_builddir)/guile/pre-inst-guile -L $(srcdir)
-
-
-EXTRA_DIST = $(TESTS) openpgp-pub.asc openpgp-sec.asc \
- openpgp-elg-pub.asc openpgp-elg-sec.asc \
- openpgp-keyring.gpg openpgp-keyring.asc \
- rsa-parameters.pem dh-parameters.pem \
- x509-certificate.pem x509-key.pem