root / setup_guile_test_env.in @ 8f9eb3d4
History | View | Annotate | Download (3.9 kB)
| 1 | ff62557a | Eric Blossom | # |
|---|---|---|---|
| 2 | ff62557a | Eric Blossom | # Copyright 2010 Free Software Foundation, Inc. |
| 3 | ff62557a | Eric Blossom | # |
| 4 | ff62557a | Eric Blossom | # This file is part of GNU Radio |
| 5 | ff62557a | Eric Blossom | # |
| 6 | ff62557a | Eric Blossom | # GNU Radio is free software; you can redistribute it and/or modify |
| 7 | ff62557a | Eric Blossom | # it under the terms of the GNU General Public License as published by |
| 8 | ff62557a | Eric Blossom | # the Free Software Foundation; either version 3, or (at your option) |
| 9 | ff62557a | Eric Blossom | # any later version. |
| 10 | ff62557a | Eric Blossom | # |
| 11 | ff62557a | Eric Blossom | # GNU Radio is distributed in the hope that it will be useful, |
| 12 | ff62557a | Eric Blossom | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ff62557a | Eric Blossom | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ff62557a | Eric Blossom | # GNU General Public License for more details. |
| 15 | ff62557a | Eric Blossom | # |
| 16 | ff62557a | Eric Blossom | # You should have received a copy of the GNU General Public License |
| 17 | ff62557a | Eric Blossom | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | ff62557a | Eric Blossom | # |
| 19 | 81867e5d | Eric Blossom | |
| 20 | d1d80474 | Eric Blossom | # This is sourced by run_guile_tests to establish the environment |
| 21 | d1d80474 | Eric Blossom | # variables required to run the tests in the build tree. |
| 22 | d1d80474 | Eric Blossom | |
| 23 | ff62557a | Eric Blossom | # add_local_paths is the only "public" function in this file |
| 24 | d1d80474 | Eric Blossom | |
| 25 | 76e2fa79 | Eric Blossom | # 1st argument is absolute path to hand coded guile source directory |
| 26 | 76e2fa79 | Eric Blossom | # 2nd argument is absolute path to component C++ shared library build directory |
| 27 | 81867e5d | Eric Blossom | # 3nd argument is absolute path to component SWIG build directory |
| 28 | 81867e5d | Eric Blossom | |
| 29 | d1d80474 | Eric Blossom | function add_local_paths(){
|
| 30 | d1d80474 | Eric Blossom | if [ $# -ne 3 ] |
| 31 | d1d80474 | Eric Blossom | then |
| 32 | d1d80474 | Eric Blossom | echo "$0: requires 3 args" 1>&2 |
| 33 | d1d80474 | Eric Blossom | exit 1 |
| 34 | d1d80474 | Eric Blossom | fi |
| 35 | ff62557a | Eric Blossom | |
| 36 | ff62557a | Eric Blossom | # Add local dirs to the front |
| 37 | ff62557a | Eric Blossom | prepend_to_guile_load_path "$1" |
| 38 | ff62557a | Eric Blossom | prepend_to_libpath "$2/.libs" |
| 39 | ff62557a | Eric Blossom | [ "$2" != "$3" ] && prepend_to_libpath "$3/.libs" |
| 40 | ff62557a | Eric Blossom | prepend_to_guile_load_path "$3" |
| 41 | ff62557a | Eric Blossom | |
| 42 | ff62557a | Eric Blossom | # Add withdirs to the end |
| 43 | ff62557a | Eric Blossom | append_to_guile_load_path "@with_GUILE_LOAD_PATH@" |
| 44 | ff62557a | Eric Blossom | append_to_libpath "@with_LIBDIRPATH@" |
| 45 | d1d80474 | Eric Blossom | } |
| 46 | 81867e5d | Eric Blossom | |
| 47 | ff62557a | Eric Blossom | # ------------------------------------------------------------------------ |
| 48 | ff62557a | Eric Blossom | |
| 49 | ff62557a | Eric Blossom | abs_top_srcdir=@abs_top_srcdir@ |
| 50 | ff62557a | Eric Blossom | abs_top_builddir=@abs_top_builddir@ |
| 51 | ff62557a | Eric Blossom | |
| 52 | d1d80474 | Eric Blossom | # usage: prepend <path-varname> <dir> |
| 53 | 81867e5d | Eric Blossom | function prepend(){
|
| 54 | 81867e5d | Eric Blossom | if [ $# -ne 2 ] |
| 55 | 81867e5d | Eric Blossom | then |
| 56 | 81867e5d | Eric Blossom | echo "$0: prepend needs 2 args" 1>&2 |
| 57 | 81867e5d | Eric Blossom | exit 1 |
| 58 | 81867e5d | Eric Blossom | fi |
| 59 | 81867e5d | Eric Blossom | local path="$1" dir="$2" contents="" |
| 60 | 81867e5d | Eric Blossom | eval "contents=\$$path" |
| 61 | 81867e5d | Eric Blossom | if [ "$dir" != "" ] |
| 62 | 81867e5d | Eric Blossom | then |
| 63 | 81867e5d | Eric Blossom | if [ "$contents" = "" ] |
| 64 | 81867e5d | Eric Blossom | then |
| 65 | 81867e5d | Eric Blossom | eval "$path=\"$dir\"" |
| 66 | 81867e5d | Eric Blossom | else |
| 67 | 81867e5d | Eric Blossom | eval "$path=\"$dir:$contents\"" |
| 68 | 81867e5d | Eric Blossom | fi |
| 69 | 81867e5d | Eric Blossom | fi |
| 70 | 81867e5d | Eric Blossom | #echo end-of-prepend: $path=${!path}
|
| 71 | 81867e5d | Eric Blossom | } |
| 72 | 81867e5d | Eric Blossom | |
| 73 | ff62557a | Eric Blossom | # usage: append <path-varname> <dir> |
| 74 | ff62557a | Eric Blossom | function append(){
|
| 75 | ff62557a | Eric Blossom | if [ $# -ne 2 ] |
| 76 | ff62557a | Eric Blossom | then |
| 77 | ff62557a | Eric Blossom | echo "$0: append needs 2 args" 1>&2 |
| 78 | ff62557a | Eric Blossom | exit 1 |
| 79 | ff62557a | Eric Blossom | fi |
| 80 | ff62557a | Eric Blossom | local path="$1" dir="$2" contents="" |
| 81 | ff62557a | Eric Blossom | eval "contents=\$$path" |
| 82 | ff62557a | Eric Blossom | if [ "$dir" != "" ] |
| 83 | ff62557a | Eric Blossom | then |
| 84 | ff62557a | Eric Blossom | if [ "$contents" = "" ] |
| 85 | ff62557a | Eric Blossom | then |
| 86 | ff62557a | Eric Blossom | eval "$path=\"$dir\"" |
| 87 | ff62557a | Eric Blossom | else |
| 88 | ff62557a | Eric Blossom | eval "$path=\"$contents:$dir\"" |
| 89 | ff62557a | Eric Blossom | fi |
| 90 | ff62557a | Eric Blossom | fi |
| 91 | ff62557a | Eric Blossom | #echo end-of-append: $path=${!path}
|
| 92 | ff62557a | Eric Blossom | } |
| 93 | ff62557a | Eric Blossom | |
| 94 | ff62557a | Eric Blossom | function prepend_to_guile_load_path(){
|
| 95 | ff62557a | Eric Blossom | prepend GUILE_LOAD_PATH "$1" |
| 96 | ff62557a | Eric Blossom | export GUILE_LOAD_PATH |
| 97 | ff62557a | Eric Blossom | } |
| 98 | ff62557a | Eric Blossom | |
| 99 | ff62557a | Eric Blossom | function append_to_guile_load_path(){
|
| 100 | ff62557a | Eric Blossom | append GUILE_LOAD_PATH "$1" |
| 101 | ff62557a | Eric Blossom | export GUILE_LOAD_PATH |
| 102 | ff62557a | Eric Blossom | } |
| 103 | ff62557a | Eric Blossom | |
| 104 | ff62557a | Eric Blossom | function prepend_to_libpath(){
|
| 105 | ff62557a | Eric Blossom | prepend LTDL_LIBRARY_PATH "$1" |
| 106 | ff62557a | Eric Blossom | export LTDL_LIBRARY_PATH |
| 107 | ff62557a | Eric Blossom | case "@host_os@" in |
| 108 | ff62557a | Eric Blossom | darwin*) |
| 109 | ff62557a | Eric Blossom | prepend DYLD_LIBRARY_PATH "$1" |
| 110 | ff62557a | Eric Blossom | export DYLD_LIBRARY_PATH |
| 111 | ff62557a | Eric Blossom | ;; |
| 112 | ff62557a | Eric Blossom | cygwin*|win*|mingw*) |
| 113 | ff62557a | Eric Blossom | prepend PATH "$1" |
| 114 | ff62557a | Eric Blossom | export PATH |
| 115 | ff62557a | Eric Blossom | ;; |
| 116 | ff62557a | Eric Blossom | esac |
| 117 | ff62557a | Eric Blossom | } |
| 118 | ff62557a | Eric Blossom | |
| 119 | ff62557a | Eric Blossom | function append_to_libpath(){
|
| 120 | ff62557a | Eric Blossom | append LTDL_LIBRARY_PATH "$1" |
| 121 | ff62557a | Eric Blossom | export LTDL_LIBRARY_PATH |
| 122 | ff62557a | Eric Blossom | case "@host_os@" in |
| 123 | ff62557a | Eric Blossom | darwin*) |
| 124 | ff62557a | Eric Blossom | append DYLD_LIBRARY_PATH "$1" |
| 125 | ff62557a | Eric Blossom | export DYLD_LIBRARY_PATH |
| 126 | ff62557a | Eric Blossom | ;; |
| 127 | ff62557a | Eric Blossom | cygwin*|win*|mingw*) |
| 128 | ff62557a | Eric Blossom | append PATH "$1" |
| 129 | ff62557a | Eric Blossom | export PATH |
| 130 | ff62557a | Eric Blossom | ;; |
| 131 | ff62557a | Eric Blossom | esac |
| 132 | ff62557a | Eric Blossom | } |
| 133 | ff62557a | Eric Blossom | |
| 134 | 81867e5d | Eric Blossom | # ------------------------------------------------------------------------ |
| 135 | d1d80474 | Eric Blossom | # Everybody gets gruel and gnuradio-core for free. |
| 136 | d1d80474 | Eric Blossom | # FIXME Eventually this should be gruel and gnuradio-runtime. |
| 137 | 81867e5d | Eric Blossom | # ------------------------------------------------------------------------ |
| 138 | 81867e5d | Eric Blossom | |
| 139 | 81867e5d | Eric Blossom | # Where to search for not yet installed C++ shared libraries |
| 140 | ff62557a | Eric Blossom | prepend_to_libpath $abs_top_builddir/gruel/src/lib/.libs |
| 141 | ff62557a | Eric Blossom | prepend_to_libpath $abs_top_builddir/gnuradio-core/src/lib/.libs |
| 142 | 81867e5d | Eric Blossom | |
| 143 | 81867e5d | Eric Blossom | # Where to search for not yet installed swig generated guile libs |
| 144 | ff62557a | Eric Blossom | prepend_to_libpath $abs_top_builddir/gnuradio-core/src/lib/swig/.libs |
| 145 | 81867e5d | Eric Blossom | |
| 146 | 81867e5d | Eric Blossom | # Where to seach for guile code. |
| 147 | ff62557a | Eric Blossom | prepend_to_guile_load_path $abs_top_srcdir/gnuradio-core/src/guile |
| 148 | ff62557a | Eric Blossom | prepend_to_guile_load_path $abs_top_builddir/gnuradio-core/src/lib/swig |
| 149 | 81867e5d | Eric Blossom | |
| 150 | 81867e5d | Eric Blossom | |
| 151 | a79986e0 | Eric Blossom | export GUILE_WARN_DEPRECATED=no |