From b36ec7d9155a905bf09d316433bf6a3be0df675d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 5 Nov 2015 17:35:54 +0100 Subject: [PATCH] build: Capture the location of the GNUnet libraries. * gnu/gnunet/config.scm.in: New file. * gnu/gnunet/common.scm: Use (gnu gnunet config). (gnunet-util-ffi, gnunet-fs-ffi, gnunet-identity-ffi): Use the new %libgnunet-util etc. variables. * configure.ac: Substitute GNUNETUTIL_LIBDIR, GNUNETFS_LIBDIR, and GNUNETIDENTITY_LIBDIR. * Makefile.am (GOBJECTS): Add gnu/gnunet/config.go. --- .gitignore | 1 + Makefile.am | 2 +- configure.ac | 10 +++++++++- gnu/gnunet/common.scm | 7 ++++--- gnu/gnunet/config.scm.in | 30 ++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 gnu/gnunet/config.scm.in diff --git a/.gitignore b/.gitignore index 25aecae..faf7a4b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ Makefile.in *.go /Makefile /config.log +/gnu/gnunet/config.scm diff --git a/Makefile.am b/Makefile.am index 2fab021..5be7334 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ MODULES = \ gnu/gnunet/fs/progress-info.scm \ gnu/gnunet/fs/uri.scm -GOBJECTS = $(MODULES:%.scm=%.go) +GOBJECTS = $(MODULES:%.scm=%.go) gnu/gnunet/config.go CLEANFILES = $(GOBJECTS) nobase_dist_guilemodule_DATA = $(MODULES) diff --git a/configure.ac b/configure.ac index 119db9b..37b1700 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,15 @@ PKG_CHECK_MODULES([GNUNETUTIL], [gnunetutil]) PKG_CHECK_MODULES([GNUNETFS], [gnunetfs]) PKG_CHECK_MODULES([GNUNETIDENTITY], [gnunetidentity]) -AC_CONFIG_FILES([Makefile]) +GNUNETUTIL_LIBDIR="`$PKG_CONFIG --variable=libdir gnunetutil`" +GNUNETFS_LIBDIR="`$PKG_CONFIG --variable=libdir gnunetfs`" +GNUNETIDENTITY_LIBDIR="`$PKG_CONFIG --variable=libdir gnunetidentity`" + +AC_SUBST([GNUNETUTIL_LIBDIR]) +AC_SUBST([GNUNETFS_LIBDIR]) +AC_SUBST([GNUNETIDENTITY_LIBDIR]) + +AC_CONFIG_FILES([Makefile gnu/gnunet/config.scm]) AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env]) AC_OUTPUT diff --git a/gnu/gnunet/common.scm b/gnu/gnunet/common.scm index eeb3c48..488e46d 100644 --- a/gnu/gnunet/common.scm +++ b/gnu/gnunet/common.scm @@ -21,6 +21,7 @@ #:use-module (rnrs bytevectors) #:use-module (ice-9 match) #:use-module (gnu gnunet binding-utils) + #:use-module (gnu gnunet config) #:export (gnunet-ok gnunet-system-error gnunet-yes @@ -85,9 +86,9 @@ (define gnunet-yes 1) (define gnunet-no 0) -(define gnunet-util-ffi (dynamic-link "libgnunetutil")) -(define gnunet-fs-ffi (dynamic-link "libgnunetfs")) -(define gnunet-identity-ffi (dynamic-link "libgnunetidentity")) +(define gnunet-util-ffi (dynamic-link %libgnunet-util)) +(define gnunet-fs-ffi (dynamic-link %libgnunet-fs)) +(define gnunet-identity-ffi (dynamic-link %libgnunet-identity)) (define-syntax define-foreign-definer diff --git a/gnu/gnunet/config.scm.in b/gnu/gnunet/config.scm.in new file mode 100644 index 0000000..2da0b77 --- /dev/null +++ b/gnu/gnunet/config.scm.in @@ -0,0 +1,30 @@ +;;;; -*- mode: Scheme; indent-tabs-mode: nil; fill-column: 80; -*- +;;;; +;;;; Copyright © 2015 Ludovic Courtès +;;;; +;;;; This program 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. +;;;; +;;;; This program 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 this program. If not, see . + +(define-module (gnu gnunet config) + #:export (%libgnunet-util + %libgnunet-fs + %libgnunet-identity)) + +(define %libgnunet-util + "@GNUNETUTIL_LIBDIR@/libgnunetutil") + +(define %libgnunet-fs + "@GNUNETFS_LIBDIR@/libgnunetfs") + +(define %libgnunet-identity + "@GNUNETIDENTITY_LIBDIR@/libgnunetidentity")