1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Build
|
4 | #
|
5 | # Usage:
|
6 | # soil/cpp-build.sh
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | #REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
|
13 | #source soil/common.sh
|
14 |
|
15 | OILS_VERSION=$(head -n 1 oil-version.txt)
|
16 |
|
17 | build-like-ninja() {
|
18 | local tar=_release/oils-for-unix.tar
|
19 |
|
20 | if test -f build.ninja; then
|
21 | # Just use Ninja
|
22 |
|
23 | local -a targets=()
|
24 | for variant in "$@"; do
|
25 | targets+=( _bin/cxx-$variant/{oils-for-unix,osh,ysh} )
|
26 | done
|
27 | ninja "${targets[@]}"
|
28 |
|
29 | elif test -f $tar; then
|
30 | # Build out of the tarball, but put in WHERE NINJA would have put it
|
31 |
|
32 | local tmp=_tmp/native-tar-test # like oil-tar-test
|
33 |
|
34 | # Don't defeat SKIP_REBUILD
|
35 | #rm -r -f $tmp
|
36 |
|
37 | mkdir -p $tmp
|
38 | pushd $tmp
|
39 |
|
40 | tar -x < ../../$tar
|
41 |
|
42 | # Leaving out version
|
43 | pushd oils-for-unix-$OILS_VERSION
|
44 |
|
45 | ./configure
|
46 |
|
47 | for variant in "$@"; do
|
48 | time _build/oils.sh '' $variant SKIP_REBUILD
|
49 | done
|
50 |
|
51 | popd
|
52 | popd
|
53 |
|
54 | # Hack: copy to NInja location. So the interface is the same.
|
55 | for variant in "$@"; do
|
56 | mkdir -v -p _bin/cxx-$variant
|
57 | cp -v \
|
58 | $tmp/oils-for-unix-$OILS_VERSION/_bin/cxx-$variant-sh/{oils-for-unix,osh,ysh} \
|
59 | _bin/cxx-$variant
|
60 | done
|
61 |
|
62 | else
|
63 | echo "Expected either build.ninja or $tar"
|
64 | exit 1
|
65 | fi
|
66 | }
|
67 |
|
68 | "$@"
|