[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 01/03: build: Add preliminary Autotools infrastructure.
From: |
Ludovic Courtès |
Subject: |
[gnunet] 01/03: build: Add preliminary Autotools infrastructure. |
Date: |
Thu, 05 Nov 2015 16:52:10 +0000 |
civodul pushed a commit to branch master
in repository gnunet.
commit f862f2b82cc07679826f06ca6e8fa4f97e3e6f92
Author: Ludovic Courtès <address@hidden>
Date: Thu Nov 5 17:26:59 2015 +0100
build: Add preliminary Autotools infrastructure.
* Makefile.am, configure.ac, pre-inst-env.in: New files.
---
.gitignore | 13 ++++++++++
Makefile.am | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 44 ++++++++++++++++++++++++++++++++++
pre-inst-env.in | 39 ++++++++++++++++++++++++++++++
4 files changed, 167 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..25aecae
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+/INSTALL
+*~
+Makefile.in
+/aclocal.m4
+/autom4te.cache/
+/build-aux/
+/config.cache
+/config.status
+/configure
+/pre-inst-env
+*.go
+/Makefile
+/config.log
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..2fab021
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,71 @@
+# Guile-GNUnet --- Guile bindings for GNUnet.
+# Copyright © 2015 Ludovic Courtès <address@hidden>
+#
+# This file is part of Guile-GNUnet.
+#
+# Guile-GNUnet 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 3 of the License, or (at
+# your option) any later version.
+#
+# Guile-GNUnet 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-GNUnet. If not, see <http://www.gnu.org/licenses/>.
+
+MODULES = \
+ system/foreign/unions-read-write.scm \
+ system/foreign/unions.scm \
+ gnu/gnunet/common.scm \
+ gnu/gnunet/scheduler.scm \
+ gnu/gnunet/binding-utils.scm \
+ gnu/gnunet/container/metadata.scm \
+ gnu/gnunet/fs.scm \
+ gnu/gnunet/configuration.scm \
+ gnu/gnunet/identity.scm \
+ gnu/gnunet/fs/progress-info.scm \
+ gnu/gnunet/fs/uri.scm
+
+GOBJECTS = $(MODULES:%.scm=%.go)
+CLEANFILES = $(GOBJECTS)
+
+nobase_dist_guilemodule_DATA = $(MODULES)
+nobase_nodist_guilemodule_DATA = $(GOBJECTS)
+
+# TODO: Handle tests.
+
+AM_V_GUILEC = $(AM_V_GUILEC_$(V))
+AM_V_GUILEC_ = $(AM_V_GUILEC_$(AM_DEFAULT_VERBOSITY))
+AM_V_GUILEC_0 = @echo " GUILEC" $@;
+
+# Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if
+# $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files in
+# there that are newer than the local .scm files (for instance because the
+# user ran 'make install' recently). When that happens, we end up loading
+# those previously-installed .go files, which may be stale, thereby breaking
+# the whole thing.
+#
+# XXX: Use the C locale for when Guile lacks
+#
<http://git.sv.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=e2c6bf3866d1186c60bacfbd4fe5037087ee5e3f>.
+.scm.go:
+ $(AM_V_GUILEC)$(MKDIR_P) `dirname "$@"` ; \
+ unset GUILE_LOAD_COMPILED_PATH ; \
+ LC_ALL=C \
+ $(top_builddir)/pre-inst-env \
+ $(GUILD) compile -L "$(top_builddir)" -L "$(top_srcdir)" \
+ -Wformat -Wunbound-variable -Warity-mismatch \
+ --target="$(host)" \
+ -o "$@" "$<"
+
+SUFFIXES = .go
+
+# Make sure source files are installed first, so that the mtime of
+# installed compiled files is greater than that of installed source
+# files. See
+# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
+# for details.
+guix_install_go_files = install-nobase_nodist_guilemoduleDATA
+$(guix_install_go_files): install-nobase_dist_guilemoduleDATA
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..119db9b
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,44 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.69)
+AC_INIT([Guile-GNUnet], [0.0], address@hidden, [guix],
+ [http://www.gnu.org/software/guix/])
+AC_CONFIG_AUX_DIR([build-aux])
+
+AM_INIT_AUTOMAKE([1.12 foreign silent-rules subdir-objects \
+ color-tests parallel-tests -Woverride -Wno-portability])
+
+# Enable silent rules by default.
+AM_SILENT_RULES([yes])
+
+AC_CONFIG_SRCDIR([gnu/gnunet/identity.scm])
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_CANONICAL_HOST
+
+dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
+dnl Make sure they are available.
+m4_pattern_forbid([PKG_CHECK_MODULES])
+m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
+
+PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
+AC_PATH_PROG([GUILE], [guile])
+AC_PATH_PROG([GUILD], [guild])
+if test "x$GUILD" = "x"; then
+ AC_MSG_ERROR(['guild' binary not found; please check your Guile 2.x
installation.])
+fi
+
+guilemoduledir="${datarootdir}/guile/site/2.0"
+AC_SUBST([guilemoduledir])
+
+AC_CACHE_SAVE
+
+PKG_CHECK_MODULES([GNUNETUTIL], [gnunetutil])
+PKG_CHECK_MODULES([GNUNETFS], [gnunetfs])
+PKG_CHECK_MODULES([GNUNETIDENTITY], [gnunetidentity])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
+
+AC_OUTPUT
diff --git a/pre-inst-env.in b/pre-inst-env.in
new file mode 100644
index 0000000..33995a4
--- /dev/null
+++ b/pre-inst-env.in
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Guile-GNUnet --- Guile bindings for GNUnet.
+# Copyright © 2015 Ludovic Courtès <address@hidden>
+#
+# This file is part of Guile-GNUnet.
+#
+# Guile-GNUnet 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 3 of the License, or (at
+# your option) any later version.
+#
+# Guile-GNUnet 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-GNUnet. If not, see <http://www.gnu.org/licenses/>.
+
+# Usage: ./pre-inst-env COMMAND ARG...
+#
+# Run COMMAND in a pre-installation environment. Typical use is
+# "./pre-inst-env guile".
+
+# By default we may end up with absolute directory names that contain '..',
+# which get into $GUILE_LOAD_PATH, leading to '..' in the module file names
+# recorded by Guile. To avoid that, make sure we get a real absolute
+# directory name. Additionally, use '-P' to get the canonical directory name
+# so that Guile's 'relative' %file-port-name-canonicalization can actually
+# work (see <http://bugs.gnu.org/17935>.)
+abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd -P`"
+abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd -P`"
+
+GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
+GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
+export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
+
+exec "$@"