-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathbuild-thrift.sh
More file actions
executable file
·97 lines (80 loc) · 3.43 KB
/
Copy pathbuild-thrift.sh
File metadata and controls
executable file
·97 lines (80 loc) · 3.43 KB
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
#!/bin/bash
source "$(git rev-parse --show-toplevel)/utils.v1.bash"
set_strict_mode
function build_bison {
local -r extracted_dirname="bison-${BISON_VERSION}"
local -r archive_filename="${extracted_dirname}.tar.gz"
local -r release_url="http://ftp.gnu.org/gnu/bison/${archive_filename}"
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")"
local -r source_extracted_abs="$(extract_for "$downloaded_archive" "$extracted_dirname")"
with_pushd >&2 "$source_extracted_abs" sh ./configure --prefix="$source_extracted_abs/$INSTALL_PREFIX"
with_pushd >&2 "$source_extracted_abs" make install
export PATH="$source_extracted_abs/$INSTALL_PREFIX/bin:$PATH"
}
function build_byacc {
local -r extracted_dirname="byacc-${BYACC_VERSION}"
local -r archive_filename="${extracted_dirname}.tgz"
local -r release_url="https://www.mirrorservice.org/sites/lynx.invisible-island.net/byacc/${archive_filename}"
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")"
local -r source_extracted_abs="$(extract_for "$downloaded_archive" "$extracted_dirname")"
with_pushd >&2 "$source_extracted_abs" sh ./configure --prefix="$source_extracted_abs/$INSTALL_PREFIX"
with_pushd >&2 "$source_extracted_abs" make install
export PATH="$source_extracted_abs/$INSTALL_PREFIX/bin:$PATH"
}
function build_thrift {
local -r extracted_dirname="thrift-${THRIFT_VERSION}"
local -r archive_filename="${extracted_dirname}.tar.gz"
local -r release_url="http://archive.apache.org/dist/thrift/${THRIFT_VERSION}/${archive_filename}"
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")"
local -r source_extracted_abs="$(extract_for "$downloaded_archive" "$extracted_dirname")"
# NB: The configure --without-* flags just disable building any runtime libs
# for the generated code. We only want the codegen side of things.
with_pushd >&2 "$source_extracted_abs" \
sh ./configure \
--disable-shared \
--without-cpp \
--without-c_glib \
--without-csharp \
--without-erlang \
--without-java \
--without-erlang \
--without-lua \
--without-python \
--without-perl \
--without-php \
--without-php_extension \
--without-qt4 \
--without-qt5 \
--without-dart \
--without-ruby \
--without-haskell \
--without-go \
--without-nodejs \
--without-rs \
--without-haxe \
--without-dotnetcore \
--without-d
with_pushd >&2 "$source_extracted_abs" make clean
with_pushd >&2 "$source_extracted_abs" make LDFLAGS="-all-static"
echo "$source_extracted_abs/compiler/cpp/thrift"
}
## Interpret arguments and execute build.
readonly THRIFT_VERSION="$1"
readonly BISON_VERSION="$2"
readonly BYACC_VERSION="$3"
readonly INSTALL_PREFIX=install_dir
case "$(uname)" in
Darwin)
with_pushd "$(mkdirp_absolute_path "bison-${BISON_VERSION}-osx")" build_bison
with_pushd "$(mkdirp_absolute_path "byacc-${BYACC_VERSION}-osx")" build_byacc
with_pushd "$(mkdirp_absolute_path "thrift-${THRIFT_VERSION}-osx")" build_thrift
;;
Linux)
with_pushd "$(mkdirp_absolute_path "bison-${BISON_VERSION}-linux")" build_bison
with_pushd "$(mkdirp_absolute_path "byacc-${BYACC_VERSION}-linux")" build_byacc
with_pushd "$(mkdirp_absolute_path "thrift-${THRIFT_VERSION}-linux")" build_thrift
;;
*)
die "make does not support building for '$(uname)'"
;;
esac