-
Notifications
You must be signed in to change notification settings - Fork 70
/
1Stop-CMake
executable file
·131 lines (97 loc) · 2.89 KB
/
1Stop-CMake
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
#!/bin/sh
# Create default Hyperion build directory, if it does not exist.
# Then configure using the arguments.
# Your current working directory MUST be the one where this file resides
# DO NOT source this script.
where=$PWD
gitconf=.git/config
sfdir=SoftFloat-3a
build=../$(uname -m)/$(basename "$where")
obj=../$(uname -m)/s3fh
# Look for SoftFloat; clone if not present; build it if it isn't
# Decode the git configure url statement
testurl () {
if [ $1 != url ] || [ $2 != "=" ] ; then
echo "Git configuration for url not in proper format." >&2
echo "Want 'url' have '$1'; want '=' have '$2'."
return 14
fi
pfx=$(echo $3|"cut" -d . -f 1)
case "$pfx" in
git@github)
[email protected]:hercules-390/$sfdir.git
;;
https://github)
clone=https://github.com/hercules-390/$sfdir.git
;;
*)
echo "Git url '$3' does not seem to be correct format." >&2
echo "It should start 'git@github' or 'https://github'."
return 15
;;
esac
(cd .. && git clone $clone)
rv=$?
if [ $rv -ne 0 ] ; then
echo "git clone of $sfdir failed rv=$rv."
return 16
fi
return 0
}
# Try to determine how Hyperion was cloned so that SoftFloat
# can be cloned the same way.
testSoftFloat () {
if [ -d ../$sfdir ] ; then
echo "$sfdir is installed." >&2
else
# Need to download and install softfloat. Try to determine how
# Hyperion was cloned and then use same method
if [ ! -d .git ] || [ ! -f $gitconf ] ; then
echo "Hyperion git configuration file '$gitconf' not found." >&2
return 12
fi
remote=$("sed" -n -e '/\[remote/,/\[/p' $gitconf | "grep" 'url *=')
if [ -z "$remote" ] ; then
echo "Cannot determine how Hyperion was cloned." >&2
return 13
fi
testurl $remote
rv=$?
if [ 0 -ne $rv ] ; then return $rv ; fi
fi
if [ -f $obj/include/softfloat.h ] ; then return 0 ; fi
(cd ../$sfdir && ./1Stop)
rv=$?
if [ 0 -ne $rv ] ; then
echo "Could not build $sfdir rv=$rv."
return 17
fi
return 0
}
dodir () {
if [ ! -d $1 ] ; then
mkdir $1
if [ $? -ne 0 ] ; then
echo "Cannot create directory '$1'. Terminating."
exit 12
fi
echo "Created '$1'." >&2
else
echo "'$1' exists." >&2
fi
}
testSoftFloat
rv=$?
if [ 0 -ne $rv ] ; then exit $rv ; fi
echo "$sfdir installed and built."
dodir ../$(uname -m)
dodir $build
# Run cmake. Go to build directory.
cd "$build"
# If no arguments are specified and config.log exists, it would be nice
# get the arguments used last time configure was run, but alas; they
# are not shown quoted. The shell cannotdo.
cmake $where -DS3FH_DIR="../s3fh" "$@"
rv=$?
if [ 0 -ne $rv ] ; then exit $rv ; fi
make