-
Notifications
You must be signed in to change notification settings - Fork 37
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 gcc and binutils packages #60
Closed
cosmicexplorer
wants to merge
26
commits into
pantsbuild:master
from
cosmicexplorer:add-gcc-binutils-packages
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
aee1351
add compiler.tar.gz for osx and linux using cmake 3.9.5
cosmicexplorer 215c1de
refactor packaging to use common function for macos and linux
cosmicexplorer bcb3062
...osx find doesn't support '+' in -exec
cosmicexplorer ad67ff4
change package name to clang
cosmicexplorer 7911496
run make with one job due to race conditions
cosmicexplorer 7753893
add comment describing the include/ subdir
cosmicexplorer 423efa4
refactor to add c++ stdlib
cosmicexplorer e168d63
add linux-only linker packaging script
cosmicexplorer e63816a
add binutils
cosmicexplorer 4dbe79f
add gcc package script
cosmicexplorer 31b436a
add binaries (REBASED: NO MORE BIG BINARIES HERE)
cosmicexplorer d45d02a
make gcc script executable
cosmicexplorer 1852bee
update gcc
cosmicexplorer aaa7eab
make a small update to the gcc packaging script
cosmicexplorer 9b016be
finish recovering a ton of work i lost
cosmicexplorer a5b67e8
minor comment tweaks
cosmicexplorer 9bf404d
Add buildozer 0.6.0-80c7f0d45d7e40fa1f7362852697d4a03df557b3 (#56)
illicitonion 1598e82
Synchronize docker instructions with pantsbuild/pants. (#58)
f0ab05c
Add clang (#57)
cosmicexplorer 3a2d27d
tone down the verbosity because i think it's making the build slower
cosmicexplorer bbc3ae3
made a few docs updates
cosmicexplorer a7aad2b
gotta figure out why github is telling me the files i had already upl…
cosmicexplorer 662f917
osx gcc doesn't have a libexec dir........
cosmicexplorer 10e4d82
try revamping the toolchain generation for maintainability
cosmicexplorer 5bffa44
change how we generate gzipped packages
cosmicexplorer c3b9f0a
make populate-native-toolchain.sh work
cosmicexplorer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
source ./utils.bash | ||
|
||
set_strict_mode | ||
|
||
function fetch_extract_binutils_source_release { | ||
local -r extracted_dirname="binutils-${BINUTILS_VERSION}" | ||
local -r archive_filename="${extracted_dirname}.tar.xz" | ||
local -r release_url="https://ftpmirror.gnu.org/binutils/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
extract_for "$downloaded_archive" "$extracted_dirname" | ||
} | ||
|
||
function build_binutils_with_configure { | ||
local -a configure_cmd_line=("$@") | ||
|
||
"${configure_cmd_line[@]}" | ||
|
||
make "-j${MAKE_JOBS}" | ||
|
||
make install | ||
} | ||
|
||
function build_linux { | ||
local -r source_extracted_abs="$(fetch_extract_binutils_source_release)" | ||
|
||
local -r build_dir_abs="$(mkdirp_absolute_path 'binutils-build')" | ||
local -r install_dir_abs="$(mkdirp_absolute_path 'binutils-install')" | ||
|
||
with_pushd >&2 "$build_dir_abs" \ | ||
build_binutils_with_configure \ | ||
"${source_extracted_abs}/configure" \ | ||
--prefix="$install_dir_abs" | ||
|
||
with_pushd "$install_dir_abs" \ | ||
create_gz_package 'binutils' bin | ||
} | ||
|
||
## Interpret arguments and execute build. | ||
|
||
readonly TARGET_PLATFORM="$1" BINUTILS_VERSION="$2" | ||
|
||
MAKE_JOBS="${MAKE_JOBS:-2}" | ||
|
||
case "$TARGET_PLATFORM" in | ||
linux) | ||
with_pushd "$(mkdirp_absolute_path "binutils-${BINUTILS_VERSION}-linux")" \ | ||
build_linux | ||
;; | ||
*) | ||
die "binutils doesnot support building for '${TARGET_PLATFORM}'" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#!/bin/bash | ||
|
||
source ./utils.bash | ||
|
||
set_strict_mode | ||
|
||
## Build for OSX from LLVM's binary release package. | ||
|
||
function build_osx { | ||
|
||
local -r normal_release_dirname="clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin" | ||
# The top-level directory in the release archive is not always the same across | ||
# releases. The `-final-` part may be to signify that this is the last release | ||
# of that major version. | ||
local -r final_release_dirname="clang+llvm-${LLVM_VERSION}-final-x86_64-apple-darwin" | ||
|
||
local -r archive_filename="${normal_release_dirname}.tar.xz" | ||
local -r release_url="https://releases.llvm.org/${LLVM_VERSION}/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
local -r extracted_dir="$(extract_for "$downloaded_archive" "$normal_release_dirname" "$final_release_dirname")" | ||
|
||
with_pushd "$extracted_dir" \ | ||
create_gz_package 'clang' | ||
} | ||
|
||
|
||
## Build for Linux from LLVM's multi-part source release packages. | ||
|
||
function fetch_extract_llvm_source_release { | ||
local -r extracted_dirname="$1" | ||
|
||
local -r archive_filename="${extracted_dirname}.tar.xz" | ||
local -r release_url="https://releases.llvm.org/${LLVM_VERSION}/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
extract_for "$downloaded_archive" "$extracted_dirname" | ||
} | ||
|
||
function build_llvm_with_cmake { | ||
local -r cmake_exe="$1" install_dir="$2" cfe_dir="$3" llvm_dir="$4" | ||
|
||
# This didn't immediately compile right off the bat -- I'd recommend to anyone | ||
# watching that Homebrew formulas are good places to learn about how to provide | ||
# high-quality toolchains on OSX. I found https://llvm.org/docs/CMake.html | ||
# "helpful" for this line as well. | ||
"$cmake_exe" \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX="$install_dir_abs" \ | ||
-DLLVM_EXTERNAL_CLANG_SOURCE_DIR="$cfe_dir" \ | ||
-DLLVM_EXTERNAL_PROJECTS='clang' \ | ||
-DLLVM_TARGETS_TO_BUILD='X86' \ | ||
-DBACKEND_PACKAGE_STRING="Pants-packaged LLVM for ${TARGET_PLATFORM}, version ${LLVM_VERSION}" \ | ||
"$llvm_dir" | ||
|
||
# NB: There appear to be race conditions when running make with any | ||
# parallelism here in a Docker image. | ||
make "-j${MAKE_JOBS}" | ||
|
||
make install | ||
} | ||
|
||
function build_linux { | ||
local -r cmake_exe="$1" | ||
|
||
# Properties of the downloaded release tarball. | ||
local -r llvm_src_dirname="llvm-${LLVM_VERSION}.src" | ||
local -r cfe_src_dirname="cfe-${LLVM_VERSION}.src" | ||
|
||
# Set up an out-of-tree build and install | ||
local -r build_dir_abs="$(mkdirp_absolute_path 'clang-llvm-build')" | ||
local -r install_dir_abs="$(mkdirp_absolute_path 'clang-llvm-install')" | ||
|
||
# LLVM requires you to download the source for LLVM and the Clang frontend | ||
# separately. One alternative is checking out their SVN repo, but that takes | ||
# much longer. | ||
local -r llvm_src_extracted_abs="$(fetch_extract_llvm_source_release "$llvm_src_dirname")" | ||
local -r cfe_src_extracted_abs="$(fetch_extract_llvm_source_release "$cfe_src_dirname")" | ||
|
||
with_pushd >&2 "$build_dir_abs" \ | ||
build_llvm_with_cmake "$cmake_exe" "$install_dir_abs" "$cfe_src_extracted_abs" "$llvm_src_extracted_abs" | ||
|
||
with_pushd "$install_dir_abs" \ | ||
create_gz_package 'clang' | ||
} | ||
|
||
function validate_cmake { | ||
if [[ ! -f "$CMAKE_EXE" ]]; then | ||
die_here <<EOF | ||
To build clang for Linux, the environment variable \$CMAKE_EXE=${CMAKE_EXE} must | ||
be an absolute path to a 'cmake' binary that is executable on the current host. | ||
EOF | ||
fi | ||
echo "$CMAKE_EXE" | ||
} | ||
|
||
|
||
## Interpret arguments and execute build. | ||
|
||
# $1 = | ||
# $2 = | ||
# $CMAKE_EXE = | ||
# $MAKE_JOBS = | ||
|
||
readonly TARGET_PLATFORM="$1" LLVM_VERSION="$2" | ||
|
||
readonly MAKE_JOBS="${MAKE_JOBS:-2}" | ||
|
||
case "$TARGET_PLATFORM" in | ||
osx) | ||
with_pushd "$(mkdirp_absolute_path "clang-llvm-${LLVM_VERSION}-osx-binary")" \ | ||
build_osx | ||
;; | ||
linux) | ||
with_pushd "$(mkdirp_absolute_path "clang-llvm-${LLVM_VERSION}-linux")" \ | ||
build_linux "$(validate_cmake)" | ||
;; | ||
*) | ||
die "clang does not support building for '${TARGET_PLATFORM}'" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
source ./utils.bash | ||
|
||
set_strict_mode | ||
|
||
readonly CMAKE_VERSION_PATTERN='^([0-9]+\.[0-9]+)\.[0-9]+$' | ||
|
||
function extract_minor_version { | ||
local -r version_string="$1" | ||
|
||
echo "$version_string" | sed -re "s#${CMAKE_VERSION_PATTERN}#\\1#g" | ||
} | ||
|
||
function fetch_extract_cmake_binary_release { | ||
local -r extracted_dirname="$1" | ||
|
||
local -r cmake_minor_version="$(extract_minor_version "$CMAKE_VERSION")" | ||
|
||
local -r archive_filename="${extracted_dirname}.tar.gz" | ||
local -r release_url="https://cmake.org/files/v${cmake_minor_version}/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
extract_for "$downloaded_archive" "$extracted_dirname" | ||
} | ||
|
||
function package_cmake { | ||
local -r installed_dir_abs="$1" | ||
|
||
with_pushd "$installed_dir_abs" \ | ||
create_gz_package 'cmake' bin share | ||
} | ||
|
||
function build_osx { | ||
local -r cmake_platform_description="cmake-${CMAKE_VERSION}-Darwin-x86_64" | ||
|
||
local -r extracted_dir="$(fetch_extract_cmake_binary_release "$cmake_platform_description")" | ||
|
||
package_cmake "${extracted_dir}/CMake.app/Contents" | ||
} | ||
|
||
function build_linux { | ||
local -r cmake_platform_description="cmake-${CMAKE_VERSION}-Linux-x86_64" | ||
|
||
local -r extracted_dir="$(fetch_extract_cmake_binary_release "$cmake_platform_description")" | ||
|
||
package_cmake "$extracted_dir" | ||
} | ||
|
||
|
||
## Interpret arguments and execute build. | ||
|
||
readonly TARGET_PLATFORM="$1" CMAKE_VERSION="$2" | ||
|
||
case "$TARGET_PLATFORM" in | ||
osx) | ||
with_pushd "$(mkdirp_absolute_path "cmake-${CMAKE_VERSION}-osx")" \ | ||
build_osx | ||
;; | ||
linux) | ||
with_pushd "$(mkdirp_absolute_path "cmake-${CMAKE_VERSION}-linux")" \ | ||
build_linux | ||
;; | ||
*) | ||
die "cmake does not support building for '${TARGET_PLATFORM}'" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
|
||
source ./utils.bash | ||
|
||
set_strict_mode | ||
|
||
function fetch_extract_gcc_source_release { | ||
local -r extracted_dirname="gcc-${GCC_VERSION}" | ||
local -r archive_filename="${extracted_dirname}.tar.gz" | ||
local -r release_url="https://ftpmirror.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
extract_for "$downloaded_archive" "$extracted_dirname" | ||
} | ||
|
||
function build_gcc_with_configure { | ||
local -a configure_cmd_line=("$@") | ||
|
||
"${configure_cmd_line[@]}" | ||
|
||
make "-j${MAKE_JOBS}" | ||
|
||
make install | ||
} | ||
|
||
function build_gcc_out_of_tree { | ||
local -a configure_args=("$@") | ||
|
||
local -r source_extracted_abs="$(fetch_extract_gcc_source_release)" | ||
|
||
with_pushd >&2 "$source_extracted_abs" \ | ||
./contrib/download_prerequisites | ||
|
||
local -r build_dir_abs="$(mkdirp_absolute_path 'gcc-build')" | ||
local -r install_dir_abs="$(mkdirp_absolute_path 'gcc-install')" | ||
|
||
with_pushd >&2 "$build_dir_abs" \ | ||
build_gcc_with_configure \ | ||
"${source_extracted_abs}/configure" \ | ||
--prefix="$install_dir_abs" \ | ||
"${configure_args[@]}" | ||
|
||
with_pushd "$install_dir_abs" \ | ||
create_gz_package 'gcc' | ||
} | ||
|
||
function build_osx { | ||
build_gcc_out_of_tree \ | ||
--host='x86_64-apple-darwin' \ | ||
--target='x86_64-apple-darwin' \ | ||
AR="$(which ar)" \ | ||
"${CONFIGURE_BASE_ARGS[@]}" | ||
} | ||
|
||
function build_linux { | ||
build_gcc_out_of_tree \ | ||
"${CONFIGURE_BASE_ARGS[@]}" | ||
} | ||
|
||
## Interpret arguments and execute build. | ||
|
||
readonly TARGET_PLATFORM="$1" GCC_VERSION="$2" | ||
|
||
readonly MAKE_JOBS="${MAKE_JOBS:-2}" | ||
|
||
readonly SUPPORTED_LANGS='c,c++,objc,obj-c++,fortran' | ||
|
||
readonly -a CONFIGURE_BASE_ARGS=( | ||
--disable-multilib | ||
--enable-languages="${SUPPORTED_LANGS}" | ||
--enable-checking='release' | ||
--with-pkgversion="Pants-packaged GCC (${GCC_VERSION})" | ||
--with-bugurl='https://github.com/pantsbuild/pants/issues' | ||
) | ||
|
||
case "$TARGET_PLATFORM" in | ||
osx) | ||
with_pushd "$(mkdirp_absolute_path "gcc-${GCC_VERSION}-osx")" \ | ||
build_osx | ||
;; | ||
linux) | ||
with_pushd "$(mkdirp_absolute_path "gcc-${GCC_VERSION}-linux")" \ | ||
build_linux | ||
;; | ||
*) | ||
die "gcc does not support building for '${TARGET_PLATFORM}'" | ||
;; | ||
esac |
Binary file not shown.
Binary file added
BIN
+4.06 MB
...pport/bin/buildozer/linux/x86_64/0.6.0-80c7f0d45d7e40fa1f7362852697d4a03df557b3/buildozer
Binary file not shown.
Binary file added
BIN
+4.01 MB
...-support/bin/buildozer/mac/10.13/0.6.0-80c7f0d45d7e40fa1f7362852697d4a03df557b3/buildozer
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../10.7/3.9.5 |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete?