Statistics
| Branch: | Tag: | Revision:

root / setup_guile_test_env.in @ 0b5f6611

History | View | Annotate | Download (3.9 kB)

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