Skip to content

Commit

Permalink
Add build script for Thrift 0.11.0 (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanErb authored and Stu Hood committed Nov 6, 2018
1 parent c803d9f commit 6075ed4
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 0 deletions.
97 changes: 97 additions & 0 deletions build-support/bin/thrift/linux/x86_64/0.11.0/build-thrift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 --wthout-* 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
6 changes: 6 additions & 0 deletions build-support/bin/thrift/linux/x86_64/0.11.0/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

yum install -y flex flex-devel

readonly result="$(./build-thrift.sh 0.11.0 2.5.1 20140715)"
cp "$result" ./thrift
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.10/0.11.0
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.11/0.11.0
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.12/0.11.0
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.13/0.11.0
97 changes: 97 additions & 0 deletions build-support/bin/thrift/mac/10.14/0.11.0/build-thrift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
4 changes: 4 additions & 0 deletions build-support/bin/thrift/mac/10.14/0.11.0/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

readonly result="$(./build-thrift.sh 0.11.0 3.2 20140715)"
cp "$result" ./thrift
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.8/0.11.0
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.9/0.11.0
3 changes: 3 additions & 0 deletions utils.v1.bash
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ function do_extract {
*.tar.gz)
tar zxf "$archive_path"
;;
*.tgz)
tar zxf "$archive_path"
;;
*)
die "Unrecognized file extension for compressed archive at '${archive_path}'."
;;
Expand Down

0 comments on commit 6075ed4

Please sign in to comment.