-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.in
56 lines (48 loc) · 1.84 KB
/
run.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
# libnbd 'run' programs locally script
# Copyright (C) 2011-2022 Red Hat Inc.
#
# @configure_input@
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#----------------------------------------------------------------------
# With this script you can compile and run OCaml libvirt programs
# without needing to install the bindings first.
#
# ../libvirt-ocaml/run ./configure # configure another project
# ../libvirt-ocaml/run make # build another project
#
# ../libvirt-ocaml/run rlwrap ocaml # run toplevel
# #use "topfind";;
# #require "libvirt";;
#----------------------------------------------------------------------
# Function to intelligently prepend a path to an environment variable.
# See http://stackoverflow.com/a/9631350
prepend()
{
eval $1="$2\${$1:+:\$$1}"
}
# Source and build directories (absolute paths so this works from any
# directory).
s="$(cd @abs_srcdir@ && pwd)"
b="$(cd @abs_builddir@ && pwd)"
# For OCaml.
prepend CAML_LD_LIBRARY_PATH "$b/libvirt"
export CAML_LD_LIBRARY_PATH
# For findlib. This has to point to the "local" META file.
prepend OCAMLPATH "$b/libvirt/local"
export OCAMLPATH
# Run the program.
exec "$@"