-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuildenv
103 lines (82 loc) · 3.83 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
# bump: coreutils-version /COREUTILS_VERSION="(.*)"/ https://ftp.gnu.org/gnu/coreutils/|re:/href="coreutils-([\d.]+).tar.gz"/$1/|semver:*
COREUTILS_VERSION="9.6"
export ZOPEN_BUILD_LINE="STABLE"
export ZOPEN_STABLE_URL="https://ftp.gnu.org/gnu/coreutils/coreutils-${COREUTILS_VERSION}.tar.gz"
export ZOPEN_STABLE_DEPS="make gzip tar curl perl automake autoconf m4 sed gettext zoslib diffutils findutils"
export ZOPEN_BOOTSTRAP="skip"
export ZOPEN_EXTRA_CPPFLAGS="-DSLOW_BUT_NO_HACKS=1 -DNO_ASM -D_LARGE_TIME_API"
export ZOPEN_EXTRA_CONFIGURE_OPTS="--disable-dependency-tracking"
export ZOPEN_CHECK_TIMEOUT=30000 # 8 hours and a bit
export PERL="/bin/env perl"
export ZOPEN_COMP=CLANG
zopen_check_results()
{
chkrefined="$1/$2_check_refined.log"
refinetool="$1/../tools/refine-test-results" # blech
export ZOPEN_TEST_CATEGORIES="cat cksum cp date echo fmt groups install misc nproc od ptx readlink stdbuf shred shuf sort stat sync touch tr wc seq tac timeout truncate users"
expectedFailures=44
expectedErrors=2
refinedresults=$( "${refinetool}" "${chklog}" ${ZOPEN_TEST_CATEGORIES} )
echo "${refinedresults}" >"${chkrefined}"
totalTests=$( cat "${chkrefined}" | wc -l )
actualPass=$(echo "${refinedresults}" | grep -E "^PASS:" | wc -l )
actualFailures=$(echo "${refinedresults}" | grep -E "^FAIL:" | wc -l )
actualErrors=$(echo "${refinedresults}" | grep -E "^ERROR:" | wc -l )
actualSkip=$(echo "${refinedresults}" | grep -E "^SKIP:" | wc -l )
totalExpectedFailures=$(($expectedFailures+$expectedErrors))
totalActualFailures=$(($actualFailures+$actualErrors))
totalRunTests=$(($totalTests-$actualSkip))
cat <<ZZ
actualFailures:$totalActualFailures
totalTests:$totalRunTests
expectedFailures:$totalExpectedFailures
ZZ
}
zopen_pre_patch()
{
export CFLAGS="$CFLAGS $CPPFLAGS"
}
zopen_post_install()
{
export ZOPEN_COREUTILS="b2sum base32 base64 basename blake2 cat chcon chgrp chmod chown chroot chksum comm cp csplit cut date dd dir dircolors dirname df du echo env expand expr factor false fmt groups head id install join ls md5sum mkfifo mktemp mknod nproc numfmt od pinky ptx readlink realpath sha1sum sha224sum sha256sum sha384sum sha512sum shasum stdbuf shred shuf sort stat stdbuf sync sleep touch tr tty vdir wc yes seq tac timeout truncate users"
findstring="find . -type f"
for cmd in $ZOPEN_COREUTILS; do
findstring="${findstring} ! -name ${cmd}"
done
# remove unsupported binaries: run as a child process so the directory change does not 'survive'
(cd "$1/bin" && ${findstring} -print | xargs rm)
mkdir $ZOPEN_INSTALL_DIR/altbin
mkdir -p $ZOPEN_INSTALL_DIR/share/altman/man1
findstring="find . -type f"
for cmd in $ZOPEN_COREUTILS; do
findstring="${findstring} ! -name ${cmd}.1"
done
# remove unsupported man pages: run as a child process so the directory change does not 'survive'
(cd "$1/share/man/man1" && ${findstring} -print | xargs rm)
# Add g prefix to all collding tools and manpages in bin/ and create symlinks
find $1/bin -type f -exec sh -c '
for file; do
dir=$(dirname "$file")
base=$(basename "$file")
if [ -f "/bin/$base" ]; then
mv "$file" "$dir/g$base"
ln -s "../bin/g$base" "$ZOPEN_INSTALL_DIR/altbin/$base"
mv "$ZOPEN_INSTALL_DIR/share/man/man1/$base.1" "$ZOPEN_INSTALL_DIR/share/man/man1/g$base.1"
ln -s "../../man/man1/g$base.1" "$ZOPEN_INSTALL_DIR/share/altman/man1/$base.1"
fi
done
' sh {} +
}
zopen_install_caveats()
{
cat <<ZZ
GNU coreutils have been installed with the prefix "g" under bin/ to avoid collision with z/OS /bin/ tools.
The conflicting manpages have been installed under the share/altman dir. You can use zotman to view them.
If you prefer to use the coreutils as is, source zopen-config with the option --override-zos-tools.
ZZ
}
zopen_get_version()
{
# pick one of the tools
./src/cp --version | head -1 | awk '{print $4; }'
}