-
Notifications
You must be signed in to change notification settings - Fork 21
/
build-base.sh
executable file
·143 lines (108 loc) · 3.55 KB
/
build-base.sh
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env bash
# Written and placed in public domain by Jeffrey Walton
# This script builds a handful of packages that are used by most GNU packages.
# The primary packages built by this script are Patchelf, Ncurses, Readline,
# iConvert and GetText.
#
# The primary packages have prerequisites, so secondary packages include
# libunistring, libxml2, PCRE2 and IDN2. GetText is rebuilt a final time
# after libunitstring and libxml2 are ready.
#
# GetText is the real focus of this script. GetText is built in two stages.
# First, the iConv/GetText pair is built due to circular dependency. Second,
# the final GetText is built which includes libunistring and libxml2.
#
# Most GNU packages will just call build-base.sh to get the common packages
# out of the way. Non-GNU packages can call the script, too.
PKG_NAME=gnu-base
###############################################################################
# PKG_NAME trick does not work here... Export INSTX_BASE_RECURSION_GUARD
# to avoid reentering this script for recipes like IDN2 and PCRE2.
# INSTX_BASE_RECURSION_GUARD goes out of scope when this shell dies.
if [[ "$INSTX_BASE_RECURSION_GUARD" == "yes" ]]; then
exit 0
else
INSTX_BASE_RECURSION_GUARD=yes
export INSTX_BASE_RECURSION_GUARD
fi
###############################################################################
# Get the environment as needed.
if [[ "${SETUP_ENVIRON_DONE}" != "yes" ]]; then
if ! source ./setup-environ.sh
then
echo "Failed to set environment"
exit 1
fi
fi
if [[ -e "${INSTX_PKG_CACHE}/${PKG_NAME}" ]]; then
echo ""
echo "$PKG_NAME is already installed."
exit 0
fi
# The password should die when this subshell goes out of scope
if [[ "${SUDO_PASSWORD_DONE}" != "yes" ]]; then
if ! source ./setup-password.sh
then
echo "Failed to process password"
exit 1
fi
fi
# GetText will be checked in build-gettext-final.sh
export INSTX_DISABLE_GETTEXT_CHECK=1
###############################################################################
if ! ./build-cacert.sh
then
echo "Failed to install CA Certs"
exit 1
fi
###############################################################################
if ! ./build-ncurses-readline.sh
then
echo "Failed to build Ncurses and Readline"
exit 1
fi
###############################################################################
if ! ./build-iconv-gettext.sh
then
echo "Failed to build iConv and GetText"
exit 1
fi
###############################################################################
if ! ./build-unistr.sh
then
echo "Failed to build Unistring"
exit 1
fi
###############################################################################
if ! ./build-libxml2.sh
then
echo "Failed to build libxml2"
exit 1
fi
###############################################################################
# GetText is checked in build-gettext-final.sh
unset INSTX_DISABLE_GETTEXT_CHECK
if ! ./build-gettext-final.sh
then
echo "Failed to build GetText final"
exit 1
fi
###############################################################################
# Trigger a rebuild of PCRE2
rm -f "${INSTX_PKG_CACHE}/pcre2"
if ! ./build-pcre2.sh
then
echo "Failed to build PCRE2"
exit 1
fi
###############################################################################
# Trigger a rebuild of IDN2
rm -f "${INSTX_PKG_CACHE}/idn2"
if ! ./build-idn2.sh
then
echo "Failed to build IDN2"
exit 1
fi
###############################################################################
touch "${INSTX_PKG_CACHE}/${PKG_NAME}"
exit 0