blob: cbf3690daf3bda086954b00af266e63c3f05cb08 (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#!/bin/sh
# Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This is keactrl script responsible for starting up Kea processes.
# This script is used to run Kea from installation directory,
# as well as for running tests.
# Exit with error if commands exit with non-zero and if undefined variables are
# used.
set -eu
cql_lib="cassandra"
if test "$(uname -s)" = "Darwin"; then
DIR=$(stat -f %N "$0" | xargs dirname)
else
DIR=$(readlink -f "$0" | xargs dirname)
fi
if ! [ -f "${DIR}/cql_config_defines.sh" ] || ! [ -x "${DIR}/cql_config_defines.sh" ]; then
echo "missing path configuration file for Cassandra (cql_config_defines.sh)"
exit 1
fi
# Shellcheck tries to follow this link and gets confused about not being able
# to find the file.
# shellcheck disable=SC1090
. "${DIR}/cql_config_defines.sh"
if [ $# -ne 1 ] && [ $# -ne 2 ]; then
echo "run: \`$0 --help\` for more help"
exit 1
fi
if [ "$1" = "--help" ]; then
echo "cql_config 'option' ['library']"
echo "options:"
echo "--help"
echo " print this help message"
echo "--cflags-only-other"
echo " get cpp compilation flags"
echo "--cflags-only-I"
echo " get include path"
echo "--libs"
echo " get lib path"
echo "--modversion"
echo " get version"
echo "--print-errors"
echo " check existence"
echo "libraries:"
echo " cassandra"
echo " cassandra_static"
exit 0
fi
if [ $# -ne 2 ]; then
echo "run: \`$0 --help\` for more help"
exit 1
elif [ "$2" != "cassandra" ] && [ "$2" != "cassandra_static" ]; then
echo "library $2 not supported"
echo "run: \`$0 --help\` for more help"
exit 1
else
cql_lib=$2
fi
if [ "$1" = "--cflags-only-other" ]; then
exit 0
fi
if [ "$1" = "--cflags-only-I" ]; then
echo "-I${CPP_DRIVER_PATH}/include/"
exit 0
fi
if [ "$1" = "--libs" ]; then
echo "-L${CPP_DRIVER_PATH}/build/ -l${cql_lib} -lssl -lcrypto -luv -lz"
exit 0
fi
if [ "$1" = "--modversion" ]; then
MAJOR=$(grep VERSION_MAJOR "${CPP_DRIVER_PATH}/include/cassandra.h" | cut -d " " -f 3)
MINOR=$(grep VERSION_MINOR "${CPP_DRIVER_PATH}/include/cassandra.h" | cut -d " " -f 3)
PATCH=$(grep VERSION_PATCH "${CPP_DRIVER_PATH}/include/cassandra.h" | cut -d " " -f 3)
echo "${MAJOR}.${MINOR}.${PATCH}"
exit 0
fi
if [ "$1" = "--print-errors" ]; then
exit 0
fi
echo "wrong parameter"
echo "run: \`$0 --help\` for more help"
exit 1
|