14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
pkg="$(echo "$1" | sed 's@/*$@@;s@^\.*/*@@')"
if [ -z "${pkg}" ]; then
echo "Usage: build [--cpio] <package>" 2>&1
exit 1
fi
function verifyRequiredPackages() {
local pkg pkgdomain pkgversion
local pkgdir pkgconfigdir pkgfound
for pkg in "${require[@]}"; do
pkgdomain=''
pkgversion=''
case "${pkg}" in
*/*@*)
pkgdomain="$(echo "${pkg}" | cut -f 2 -d '@')"
pkgversion="$(echo "${pkg}" | cut -f 2 -d '/' | cut -f 1 -d '@')"
pkg="$(echo "${pkg}" | cut -f 1 -d '/')"
;;
*/*)
pkgversion="$(echo "${pkg}" | cut -f 2 -d '/')"
pkg="$(echo "${pkg}" | cut -f 1 -d '/')"
;;
*@*)
pkgdomain="$(echo "${pkg}" | cut -f 2 -d '@')"
pkg="$(echo "${pkg}" | cut -f 1 -d '@')"
;;
esac
if [ -z "${pkgdomain}" ]; then
pkgdomain="${domain}"
fi
pkgfound='0'
for pkgdir in "/opt/appfs/${pkgdomain}/${pkg}/platform"/${pkgversion:-*}; do
pkgconfigdir="${pkgdir}/lib/pkgconfig"
if [ -d "${pkgdir}" ]; then
pkgfound='1'
fi
CFLAGS="${CFLAGS} -I${pkgdir}/include"
CPPFLAGS="${CPPFLAGS} -I${pkgdir}/include"
LDFLAGS="${LDFLAGS} -L${pkgdir}/lib"
export CFLAGS CPPFLAGS LDFLAGS
if [ -d "${pkgconfigdir}" ]; then
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${pkgconfigdir}"
export PKG_CONFIG_PATH
fi
done
if [ "${pkgfound}" = '0' ]; then
die "Package ${pkg}/${pkgversion:-*}@${pkgdomain} not found."
fi
done
}
function verifyPrerequisites() {
:
}
function determineOsArch() {
os="$(uname -s | dd conv=lcase 2>/dev/null)"
arch="$(uname -m | dd conv=lcase 2>/dev/null)"
case "${arch}" in
i?86)
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
-
-
-
-
+
+
+
+
+
|
glibcdir="/opt/appfs/core.appfs.rkeene.org/glibc/platform/${glibcvers}"
dynlinker="$(ls "${glibcdir}"/lib/ld-linux*.so.* | tail -n 1)"
if [ ! -d "${glibcdir}" ]; then
die 'glibc directory is not available (appfs running/working?)'
fi
CFLAGS="-I${glibcdir}/include"
CPPFLAGS="-I${glibcdir}/include"
LDFLAGS="-Wl,--rpath,${glibcdir}/lib -Wl,--dynamic-linker,${dynlinker}"
export CFLAGS CPPFLAGS LDFLAGS
CFLAGS="${CFLAGS} -I${glibcdir}/include"
CPPFLAGS="${CPPFLAGS} -I${glibcdir}/include"
LDFLAGS="${LDFLAGS} -Wl,--rpath,${glibcdir}/lib -Wl,--dynamic-linker,${dynlinker}"
PKG_CONFIG_LIBDIR="${glibcdir}/lib/pkgconfig"
export CFLAGS CPPFLAGS LDFLAGS PKG_CONFIG_LIBDIR
./configure --prefix="${prefix}" --sysconfdir=/etc --localstatedir=/var
}
function prebuild() {
:
}
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
+
+
+
+
|
# If we just have one directory, use that directory
dir="$(echo *)"
if [ -e "${dir}" ]; then
mv "${dir}"/* .
fi
# Verify pre-requisites are met
verifyRequiredPackages || die 'Required packages missing'
verifyPrerequisites || die 'Prerequisities failed'
# Start logging
set -x
# Determine properties
determinePrefix
# Start the build
|