diff options
-rw-r--r-- | Guile-TODO | 6 | ||||
-rw-r--r-- | config/grc_build.m4 | 1 | ||||
-rw-r--r-- | config/grc_gnuradio_core.m4 | 2 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | gnuradio-core/gnuradio-core.pc.in | 1 | ||||
-rw-r--r-- | gnuradio-core/src/guile/run_guile_tests.in | 12 | ||||
-rw-r--r-- | setup_guile_test_env.in | 129 |
7 files changed, 115 insertions, 37 deletions
diff --git a/Guile-TODO b/Guile-TODO index bd81e96b4..7cbf5ac60 100644 --- a/Guile-TODO +++ b/Guile-TODO @@ -34,9 +34,6 @@ In no particular order: 13) Change guile libnames to libguile-gnuradio-<module-name> -14) Add support to setup_guile_test_env.in for - "withlibs", OS/X (DYLD_LIBRARY_PATH), windows (PATH) - 15) Rewrite gr-run-waveform as C/C++ code that embeds guile. See if we can't statically link libguile into this. Will need to figure out which packages provide libguile.a. @@ -84,4 +81,7 @@ These are done: 8) [DONE] Fix gr_message_{sink,source} so that they work under guile. (Not sure if I disabled one or both of these...) +14) [DONE] Add support to setup_guile_test_env.in for + "withlibs", OS/X (DYLD_LIBRARY_PATH), windows (PATH) + 17) [DONE] Get std::vector< std::complex<float> > working diff --git a/config/grc_build.m4 b/config/grc_build.m4 index 77b59db6b..121c4feb6 100644 --- a/config/grc_build.m4 +++ b/config/grc_build.m4 @@ -259,6 +259,7 @@ AC_DEFUN([_GRC_BUILD_CONDITIONAL],[ GRC_ADD_TO_LIST($3, PYDIRPATH, ":") GRC_ADD_TO_LIST($3, SWIGDIRPATH, ":") GRC_ADD_TO_LIST($3, LIBDIRPATH, ":") + GRC_ADD_TO_LIST($3, GUILE_LOAD_PATH, ":") AC_MSG_RESULT([Component $1 will be included from a pre-installed library and includes.]) $3[_with]=yes else diff --git a/config/grc_gnuradio_core.m4 b/config/grc_gnuradio_core.m4 index 8cbba49ef..ff3df8c60 100644 --- a/config/grc_gnuradio_core.m4 +++ b/config/grc_gnuradio_core.m4 @@ -26,6 +26,8 @@ AC_DEFUN([GRC_GNURADIO_CORE],[ gnuradio_core_I="$gnuradio_core_SWIGDIRPATH/gnuradio.i" gnuradio_core_SWIG_INCLUDES="-I$gnuradio_core_SWIGDIRPATH" gnuradio_core_PYDIRPATH=$pythondir + gnuradio_core_GUILE_LOAD_PATH="`pkg-config --variable=guile_load_path gnuradio-core`" + gnuradio_core_LIBDIRPATH="`pkg-config --variable=libdir gnuradio-core`" ]) dnl Don't do gnuradio-core if gruel skipped diff --git a/configure.ac b/configure.ac index fe32ccf5e..00527d383 100644 --- a/configure.ac +++ b/configure.ac @@ -411,6 +411,7 @@ AC_SUBST(with_SWIG_INCLUDES) AC_SUBST(with_PYDIRPATH) AC_SUBST(with_SWIGDIRPATH) AC_SUBST(with_LIBDIRPATH) +AC_SUBST(with_GUILE_LOAD_PATH) # Local files tweaked by AC AC_CONFIG_FILES([\ diff --git a/gnuradio-core/gnuradio-core.pc.in b/gnuradio-core/gnuradio-core.pc.in index 5d743a4e9..40c26a129 100644 --- a/gnuradio-core/gnuradio-core.pc.in +++ b/gnuradio-core/gnuradio-core.pc.in @@ -2,6 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/gnuradio +guile_load_path=@prefix@/share/guile/site Name: gnuradio-core Description: GNU Software Radio toolkit diff --git a/gnuradio-core/src/guile/run_guile_tests.in b/gnuradio-core/src/guile/run_guile_tests.in index 3aca7bdb0..61968065e 100644 --- a/gnuradio-core/src/guile/run_guile_tests.in +++ b/gnuradio-core/src/guile/run_guile_tests.in @@ -2,14 +2,16 @@ . @top_builddir@/setup_guile_test_env +# Since we're in gnuradio-core, we don't need to add anything, +# but we do need to call add_local_paths to set everything up + # 1st argument is absolute path to hand coded guile source directory # 2nd argument is absolute path to component C++ shared library build directory # 3nd argument is absolute path to component SWIG build directory -# We're in gnuradio-core, we don't need these -# add_local_paths \ -# "" \ -# "" \ -# "" +add_local_paths \ + "" \ + "" \ + "" @GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@/tests diff --git a/setup_guile_test_env.in b/setup_guile_test_env.in index ee7e9ea46..f143685c0 100644 --- a/setup_guile_test_env.in +++ b/setup_guile_test_env.in @@ -1,16 +1,26 @@ -#!/bin/sh +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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, or (at your option) +# any later version. +# +# GNU Radio 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 <http://www.gnu.org/licenses/>. +# # This is sourced by run_guile_tests to establish the environment # variables required to run the tests in the build tree. -abs_top_srcdir=@abs_top_srcdir@ -abs_top_builddir=@abs_top_builddir@ - - -# FIXME add in OS/X DYLD_LIBRARY_PATH -# FIXME add in cywin*/win*/mingw* PATH -# FIXME add in withdirs - +# add_local_paths is the only "public" function in this file # 1st argument is absolute path to hand coded guile source directory # 2nd argument is absolute path to component C++ shared library build directory @@ -22,12 +32,23 @@ function add_local_paths(){ echo "$0: requires 3 args" 1>&2 exit 1 fi - [ -n "$1" ] && prepend GUILE_LOAD_PATH "$1" - [ -n "$2" ] && prepend LTDL_LIBRARY_PATH "$2/.libs" - [ -n "$3" -a "$2" != "$3" ] && prepend LTDL_LIBRARY_PATH "$3/.libs" - [ -n "$3" ] && prepend GUILE_LOAD_PATH "$3" + + # Add local dirs to the front + prepend_to_guile_load_path "$1" + prepend_to_libpath "$2/.libs" + [ "$2" != "$3" ] && prepend_to_libpath "$3/.libs" + prepend_to_guile_load_path "$3" + + # Add withdirs to the end + append_to_guile_load_path "@with_GUILE_LOAD_PATH@" + append_to_libpath "@with_LIBDIRPATH@" } +# ------------------------------------------------------------------------ + +abs_top_srcdir=@abs_top_srcdir@ +abs_top_builddir=@abs_top_builddir@ + # usage: prepend <path-varname> <dir> function prepend(){ if [ $# -ne 2 ] @@ -37,9 +58,6 @@ function prepend(){ fi local path="$1" dir="$2" contents="" eval "contents=\$$path" - #echo "path = $path" - #echo "dir = $dir" - #echo "contents = $contents" if [ "$dir" != "" ] then if [ "$contents" = "" ] @@ -49,32 +67,85 @@ function prepend(){ eval "$path=\"$dir:$contents\"" fi fi - #echo end-of-prepend: $path=${!path} } +# usage: append <path-varname> <dir> +function append(){ + if [ $# -ne 2 ] + then + echo "$0: append needs 2 args" 1>&2 + exit 1 + fi + local path="$1" dir="$2" contents="" + eval "contents=\$$path" + if [ "$dir" != "" ] + then + if [ "$contents" = "" ] + then + eval "$path=\"$dir\"" + else + eval "$path=\"$contents:$dir\"" + fi + fi + #echo end-of-append: $path=${!path} +} + +function prepend_to_guile_load_path(){ + prepend GUILE_LOAD_PATH "$1" + export GUILE_LOAD_PATH +} + +function append_to_guile_load_path(){ + append GUILE_LOAD_PATH "$1" + export GUILE_LOAD_PATH +} + +function prepend_to_libpath(){ + prepend LTDL_LIBRARY_PATH "$1" + export LTDL_LIBRARY_PATH + case "@host_os@" in + darwin*) + prepend DYLD_LIBRARY_PATH "$1" + export DYLD_LIBRARY_PATH + ;; + cygwin*|win*|mingw*) + prepend PATH "$1" + export PATH + ;; + esac +} + +function append_to_libpath(){ + append LTDL_LIBRARY_PATH "$1" + export LTDL_LIBRARY_PATH + case "@host_os@" in + darwin*) + append DYLD_LIBRARY_PATH "$1" + export DYLD_LIBRARY_PATH + ;; + cygwin*|win*|mingw*) + append PATH "$1" + export PATH + ;; + esac +} + # ------------------------------------------------------------------------ # Everybody gets gruel and gnuradio-core for free. # FIXME Eventually this should be gruel and gnuradio-runtime. # ------------------------------------------------------------------------ # Where to search for not yet installed C++ shared libraries -prepend mylibdir $abs_top_builddir/gruel/src/lib/.libs -prepend mylibdir $abs_top_builddir/gnuradio-core/src/lib/.libs +prepend_to_libpath $abs_top_builddir/gruel/src/lib/.libs +prepend_to_libpath $abs_top_builddir/gnuradio-core/src/lib/.libs # Where to search for not yet installed swig generated guile libs -prepend mylibdir $abs_top_builddir/gnuradio-core/src/lib/swig/.libs +prepend_to_libpath $abs_top_builddir/gnuradio-core/src/lib/swig/.libs # Where to seach for guile code. -prepend guile_load_path $abs_top_srcdir/gnuradio-core/src/guile -prepend guile_load_path $abs_top_builddir/gnuradio-core/src/lib/swig - -#echo "mylibdir = $mylibdir" -#echo "guile_load_path = $guile_load_path" +prepend_to_guile_load_path $abs_top_srcdir/gnuradio-core/src/guile +prepend_to_guile_load_path $abs_top_builddir/gnuradio-core/src/lib/swig -prepend LTDL_LIBRARY_PATH "$mylibdir" -prepend GUILE_LOAD_PATH "$guile_load_path" -export LTDL_LIBRARY_PATH -export GUILE_LOAD_PATH export GUILE_WARN_DEPRECATED=no |