23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
"${_download}" "${url}" "${archive}" "${hash}" || return 1
fi
(
gzip -dc "${archive}" | tar -xf - || exit 1
cd "${yajlbuilddir}" || exit 1
if [ "${KC_CROSSCOMPILE}" = '1' ]; then
case "${KC_CROSSCOMPILE_HOST_OS}" in
*-mingw32|*-mingw32msvc|*-mingw64)
cmake_system_name='Windows'
;;
*)
cmake_system_name="$(
echo "${KC_CROSSCOMPILE_HOST_OS}" | \
cut -f 3 -d - | \
sed 's@[0-9\.]*$@@' | \
awk '{ f = substr($1, 1, 1); r = substr($1, 2); print toupper(f) tolower(r) }' | \
sed 's@bsd$@BSD@;s@^Aix@AIX@;s@^Hpux@HPUX@'
)"
;;
esac
./configure -p "$(pwd)/INST" || exit 1
cmake_extra=(
-DCMAKE_SYSTEM_NAME="${cmake_system_name}"
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
-DCMAKE_CROSSCOMPILING=1
)
else
cmake_extra=()
fi
if [ -n "${CC}" ]; then
CC_path="$(echo "${CC}" | cut -f 1 -d ' ')"
CC_flags="$(echo "${CC}" | cut -f 2- -d ' ')"
cmake_extra=("${cmake_extra[@]}" -DCMAKE_C_COMPILER="${CC_path}")
if [ -n "${CC_flags}" ]; then
cmake_extra=("${cmake_extra[@]}" -DCMAKE_C_FLAGS="${CC_flags}")
fi
fi
if [ -n "${CXX}" ]; then
CXX_path="$(echo "${CXX}" | cut -f 1 -d ' ')"
CXX_flags="$(echo "${CXX}" | cut -f 2- -d ' ')"
cmake_extra=("${cmake_extra[@]}" -DCMAKE_CXX_COMPILER="${CXX_path}")
if [ -n "${CXX_flags}" ]; then
cmake_extra=("${cmake_extra[@]}" -DCMAKE_CXX_FLAGS="${CXX_flags}")
fi
fi
cmake \
-DCMAKE_INSTALL_PREFIX="${yajlbuilddir}/INST" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_STATIC_LIBS=ON \
"${cmake_extra[@]}" . || exit 1
${MAKE:-make} || exit 1
${MAKE:-make} install || exit 1
rm -f INST/lib/*.so*
mv INST/lib/libyajl_s.a INST/lib/libyajl.a || exit 1
|