forked from zopencommunity/gitport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildenv
175 lines (151 loc) · 5.31 KB
/
buildenv
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#
# Set up environment variables for general build tool to operate
#
export ZOPEN_BUILD_LINE="STABLE"
export ZOPEN_CATEGORIES="development source_control"
# bump: git-version /GIT_VERSION="(.*)"/ https://github.com/git/git.git|*
GIT_VERSION="2.47.0"
export ZOPEN_DEV_URL="https://github.com/git/git.git"
export ZOPEN_DEV_DEPS="curl git make m4 perl autoconf automake help2man texinfo xz zlib openssl expat gettext coreutils diffutils bash tar"
export ZOPEN_STABLE_URL="https://github.com/git/git.git"
export ZOPEN_STABLE_TAG="v${GIT_VERSION}"
export ZOPEN_STABLE_DEPS="curl git make m4 perl autoconf automake help2man texinfo xz zlib openssl expat gettext gzip tar coreutils zoslib diffutils ncurses bash sed libpcre2 tar"
#
# Note the 'man' tarball release is numbered independently from the 'git' release.
#
export ZOPEN_TARBALL_MAN_URL="https://mirrors.edge.kernel.org/pub/software/scm/git/git-manpages-${GIT_VERSION}.tar.xz"
export ZOPEN_RUNTIME_DEPS="perl bash less ncurses" # If building with shared libs, add openssl, curl
export ZOPEN_BOOTSTRAP="make"
export ZOPEN_BOOTSTRAP_OPTS="configure"
export ZOPEN_MAKE="zopen_build_all"
export ZOPEN_MAKE_OPTS=""
export ZOPEN_INSTALL="zopen_install_all"
export ZOPEN_INSTALL_OPTS=""
export ZOPEN_CHECK_OPTS='test'
export ZOPEN_COMP=CLANG
export ZOPEN_EXTRA_CONFIGURE_OPTS="--with-zlib=\${ZLIB_HOME} --with-curl=\${CURL_HOME} --with-openssl=\${OPENSSL_HOME} --with-libpcre2=\${PCRE2_HOME}"
export ZOPEN_EXTRA_CPPFLAGS="-I\${OPENSSL_HOME}/include -I\${GETTEXT_HOME}/include -I\${ZLIB_HOME}/include -I\${NCURSES_HOME}/include -I\${ZOPEN_ROOT}/patches/include -I\${CURL_HOME}/include -I\${EXPAT_HOME}/include"
export ZOPEN_EXTRA_LDFLAGS="-L\${GETTEXT_HOME}/lib -L\${OPENSSL_HOME}/lib -L\${ZLIB_HOME}/lib -L\${NCURSES_HOME}/lib -L\${CURL_HOME}/lib -L\${EXPAT_HOME}/lib"
export ZOPEN_EXTRA_LIBS="${ZOPEN_EXTRA_LIBS} -lz -lcurl -lssl -lcrypto"
export ZOPEN_EXTRA_CFLAGS="-O2"
export CURL_LDFLAGS="-lcurl"
export CURL_CFLAGS="-I\${CURL_HOME}/include"
export CURL_CONFIG="no"
zopen_init() {
# prevent -dirty suffix
echo "${GIT_VERSION}" > version
}
zopen_build_all()
{
make -j$ZOPEN_NUM_JOBS "$@"
if [ $? -gt 0 ]; then
return 4;
fi
(cd contrib/subtree && make -j$ZOPEN_NUM_JOBS "$@")
if [ $? -gt 0 ]; then
return 4;
fi
}
zopen_install_all()
{
make -j$ZOPEN_NUM_JOBS install "$@"
if [ $? -gt 0 ]; then
return 4;
fi
(cd contrib/subtree && make -j$ZOPEN_NUM_JOBS install "$@")
if [ $? -gt 0 ]; then
return 4;
fi
# Copy new contributor tools git-jump as per instructions
cp contrib/git-jump/git-jump $ZOPEN_INSTALL_DIR/bin
}
# Run a 'zopen_pre_check' routine to clean out any GIT environment variables
# that might interfere with a new GIT operation during the test run
#
zopen_pre_check()
{
unset GIT_EXEC_PATH
unset GIT_HOME
unset GIT_MAN_PATH
unset GIT_PAGER
unset GIT_ROOT
unset GIT_SHELL
unset GIT_SSL_CAINFO
unset GIT_TEMPLATE_DIR
}
zopen_check_results()
{
chk="$1/$2_check.log"
successes=$(egrep "^ok [0-9]" "${chk}" | wc -l | xargs)
failuretests=$(egrep "^not ok [0-9]" "${chk}")
failures=$(echo "${failuretests}" | wc -l | xargs)
totalTests=$((failures+successes))
echo "${failuretests}" >"$1/$2_check_failures.log"
cat <<ZZ
actualFailures:$failures
totalTests:$totalTests
expectedFailures:3
ZZ
}
zopen_post_install()
{
# Validate that git clone work for https and git protocols
set -e
$1/bin/git clone https://github.com/ZOSOpenTools/gitport.git httpgitport
$1/bin/git clone git@github.com:ZOSOpenTools/gitport.git gitport
set +e
mkdir -p "$1/etc"
touch "$1/etc/gitconfig" # empty it out to avoid error with --system option
# Install a cacert.pem to be used (optionally) by the customer
if ! $MYDIR/zopen update-cacert -f $1 ; then
printSoftError "zopen update-cacert failed"
return 4
fi
# Install man pages from ${GIT_MANPAGES_URL}
GIT_SRC_DIR="${PWD}"
GIT_ROOT="${GIT_SRC_DIR}/.."
GIT_MAN_REL_DIR="git-manpages"
GIT_MAN_DIR="${GIT_ROOT}/${GIT_MAN_REL_DIR}"
GIT_MAN_TARBALL="${GIT_ROOT}/${GIT_MAN_REL_DIR}.tar.xz"
if ! [ -d "${GIT_MAN_TARBALL}" ]; then
if ! curl -L "${ZOPEN_TARBALL_MAN_URL}" -o "${GIT_MAN_TARBALL}" ; then
printSoftError "Unable to download ${GIT_MAN_TARBALL} from ${ZOPEN_TARBALL_MAN_URL}"
return 4
fi
fi
if ! rm -rf "${GIT_MAN_DIR}" || ! mkdir "${GIT_MAN_DIR}" || ! tar -C "${GIT_MAN_DIR}" -axf "${GIT_MAN_TARBALL}" ; then
printSoftError "Unable to untar and create directory ${GIT_MAN_DIR}"
return 4
fi
if (! cd "${GIT_MAN_DIR}" || ! git init || ! git checkout -b master || ! git add . || ! git commit -m 'base' ) ; then
printSoftError "Unable to set up local git repo for ${GIT_MAN_DIR}"
return 4
fi
if ! make quick-install-man ; then
printSoftError "Unable to install git man pages"
return 4
fi
}
zopen_append_to_env()
{
cat <<ZZ
if [ -n "\$GIT_TEMPLATE_DIR" ]; then
unset GIT_TEMPLATE_DIR
fi
if [ -n "\$GIT_EXEC_PATH" ]; then
unset GIT_EXEC_PATH
fi
ZZ
}
zopen_append_to_zoslib_env() {
cat <<EOF
GIT_TEMPLATE_DIR|set|PROJECT_ROOT/share/git-core/templates
GIT_EXEC_PATH|set|PROJECT_ROOT/libexec/git-core
ZOPEN_GIT_SSL_CAINFO|set|PROJECT_ROOT/cacert.pem
ASCII_TERMINFO|set|PROJECT_ROOT/../../ncurses/ncurses/share/terminfo/
GIT_CONFIG_SYSTEM|set|PROJECT_ROOT/etc/gitconfig
EOF
}
zopen_get_version() {
./git --version | awk -F" " '{print $3}'
}