Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build script for Thrift 0.11.0 #83

Merged
merged 7 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
97 changes: 97 additions & 0 deletions build-support/bin/thrift/mac/10.12/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
StephanErb marked this conversation as resolved.
Show resolved Hide resolved
# 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.12/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 2.5.1 20140715)"
cp "$result" ./thrift
1 change: 1 addition & 0 deletions build-support/bin/thrift/mac/10.13/0.11.0
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this useful extension!

tar zxf "$archive_path"
;;
*)
die "Unrecognized file extension for compressed archive at '${archive_path}'."
;;
Expand Down