Skip to content

Commit

Permalink
Add Bazel v0.27.1 package (required by TF v2.1.0).
Browse files Browse the repository at this point in the history
  • Loading branch information
psyhtest committed Apr 3, 2020
1 parent 7806c81 commit 9421b06
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 0 deletions.
1 change: 1 addition & 0 deletions package/.cm/alias-a-tool-bazel-0.27.1-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a06a0394f188f5c3
1 change: 1 addition & 0 deletions package/.cm/alias-u-a06a0394f188f5c3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tool-bazel-0.27.1-linux
1 change: 1 addition & 0 deletions package/tool-bazel-0.27.1-linux/.cm/desc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
15 changes: 15 additions & 0 deletions package/tool-bazel-0.27.1-linux/.cm/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"backup_data_uid": "a06a0394f188f5c3",
"backup_module_uid": "1dc07ee0f4742028",
"backup_module_uoa": "package",
"control": {
"engine": "CK",
"iso_datetime": "2020-04-03T11:58:47.715112",
"version": [
"1",
"12",
"2"
]
},
"data_name": "tool-bazel-0.27.1-linux"
}
38 changes: 38 additions & 0 deletions package/tool-bazel-0.27.1-linux/.cm/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"customize": {
"extra_dir": "",
"git_src_dir": "src",
"install_env": {
"BAZEL_PATCH1": "javac-max-heap-500mb.patch",
"BAZEL_PATCH2": "non-64bit-unix-warning.patch",
"BAZEL_URL": "https://github.com/bazelbuild/bazel/releases/download/0.27.1/bazel-0.27.1-dist.zip",
"BAZEL_ZIP": "bazel-0.27.1-dist.zip"
},
"use_git_revision": "no",
"version": "0.27.1"
},
"deps": {},
"end_full_path": {
"linux": "install/bin/bazel"
},
"need_cpu_info": "yes",
"only_for_host_os_tags": [
"linux"
],
"only_for_target_os_tags": [
"linux"
],
"process_script": "install",
"soft_uoa": "359f7730bd23ec60",
"suggested_path": "tool-bazel",
"tags": [
"tool",
"bazel",
"v0.27.1",
"v0.27",
"v0",
"channel-stable"
],
"template": "yes",
"template_type": "Bazel"
}
3 changes: 3 additions & 0 deletions package/tool-bazel-0.27.1-linux/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pre-requisites:
* zip (sudo apt-get install zip)
* protobuf 3.6.0 or newer (pip install -U protobuf)
127 changes: 127 additions & 0 deletions package/tool-bazel-0.27.1-linux/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#! /bin/bash

#
# Installation script for Bazel on (AArch64) Linux platforms.
#
# See CK LICENSE.txt for licensing details.
# See CK COPYRIGHT.txt for copyright details.
#
# Developer(s):
# - Anton Lokhmotov, 2017.
#

#
# NB: Implicit dependencies (not yet in metadata):
# - Java SDK (but detected via soft description?)
# - C++ compiler
#

# PACKAGE_DIR
# INSTALL_DIR

export BAZEL_SRC_DIR=${INSTALL_DIR}/src
export BAZEL_TMP_DIR=/tmp

################################################################################
export BAZEL_INSTALL_LOG=${INSTALL_DIR}/ck-install.log

echo
echo "Logging into '${BAZEL_INSTALL_LOG}' ..."

echo "** DATE **" >> ${BAZEL_INSTALL_LOG}
date >> ${BAZEL_INSTALL_LOG}

echo "** SET **" >> ${BAZEL_INSTALL_LOG}
set >> ${BAZEL_INSTALL_LOG}

################################################################################
echo ""
echo "Downloading Bazel from '${BAZEL_URL}' ..."

echo "** WGET **" >> ${BAZEL_INSTALL_LOG}
cd ${BAZEL_TMP_DIR}
wget ${BAZEL_URL} -O ${BAZEL_ZIP} --no-check-certificate \
>> ${BAZEL_INSTALL_LOG} 2>&1

if [ "${?}" != "0" ] ; then
echo "Error: Downloading Bazel from '${BAZEL_URL}' failed!"
exit 1
fi

################################################################################
echo ""
echo "Unpacking Bazel to '${BAZEL_SRC_DIR}' ..."

echo "** UNZIP **" >> ${BAZEL_INSTALL_LOG}
rm -rf ${BAZEL_SRC_DIR}
mkdir ${BAZEL_SRC_DIR}
unzip ${BAZEL_ZIP} -d ${BAZEL_SRC_DIR} \
>> ${BAZEL_INSTALL_LOG} 2>&1

if [ "${?}" != "0" ] ; then
echo "Error: Unpacking Bazel to '${BAZEL_SRC_DIR}' failed!"
exit 1
fi

rm ${BAZEL_ZIP}

#################################################################################
export MACH=$(uname -m)

echo
echo "Patching Bazel ..."

echo "** PATCH **" >> ${BAZEL_INSTALL_LOG}
# Apply patch for arm machine to prevent javac running out of heap memory.
if [ "${HOSTTYPE}" == "arm" ] ; then
echo "Applying patch '${BAZEL_PATCH1}' ..."
cd ${BAZEL_SRC_DIR} && patch -p1 < ${PACKAGE_DIR}/${BAZEL_PATCH1} >> ${BAZEL_INSTALL_LOG} 2>&1
fi

# Apply patch for 32-bit OS to convert error to warning in mapped_file.h.
if [ ${CK_TARGET_CPU_BITS} == 32 ]; then
echo "Applying patch '${BAZEL_PATCH2}' ..."
cd ${BAZEL_SRC_DIR} && patch -p1 < ${PACKAGE_DIR}/${BAZEL_PATCH2} >> ${BAZEL_INSTALL_LOG} 2>&1
fi

if [ "${?}" != "0" ] ; then
echo "Error: Patching Bazel failed!"
exit 1
fi

################################################################################
echo ""
echo "Compiling Bazel ..."

echo "** COMPILE **" >> ${BAZEL_INSTALL_LOG}
cd ${BAZEL_SRC_DIR}

if [ "$CK_SHOW_BAZEL_OUTPUT" == "yes" ] || [ "$CK_SHOW_BAZEL_OUTPUT" == "YES" ] ; then
./compile.sh
else
./compile.sh >> ${BAZEL_INSTALL_LOG} 2>&1
fi

if [ "${?}" != "0" ] ; then
echo "Error: Compiling Bazel failed!"
exit 1
fi

################################################################################
echo ""
echo "Installing Bazel ..."

echo "** INSTALL **" >> ${BAZEL_INSTALL_LOG}
mkdir -p ${INSTALL_DIR}/install
mkdir -p ${INSTALL_DIR}/install/bin
cp ${BAZEL_SRC_DIR}/output/bazel ${INSTALL_DIR}/install/bin/ >> ${BAZEL_INSTALL_LOG} 2>&1

if [ "${?}" != "0" ] ; then
echo "Error: Installing Bazel failed!"
exit 1
fi

###############################################################################
echo ""
echo "Successfully installed Bazel into '${INSTALL_DIR}'."
echo
13 changes: 13 additions & 0 deletions package/tool-bazel-0.27.1-linux/javac-max-heap-500mb.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 494c1a1..068f62a 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -121,7 +121,7 @@ function java_compilation() {

run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \
-d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \
- -encoding UTF-8 "@${paramfile}"
+ -encoding UTF-8 "@${paramfile}" -J-Xmx500M

log "Extracting helper classes for $name..."
for f in ${library_jars} ; do
13 changes: 13 additions & 0 deletions package/tool-bazel-0.27.1-linux/non-64bit-unix-warning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/tools/singlejar/mapped_file.h b/src/tools/singlejar/mapped_file.h
index b6c5e34..7c85b4d 100644
--- a/src/tools/singlejar/mapped_file.h
+++ b/src/tools/singlejar/mapped_file.h
@@ -37,7 +37,7 @@
*/
#if !((defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)) && \
__SIZEOF_POINTER__ == 8)
-#error This code for 64 bit Unix.
+#warning This code for 64 bit Unix.
#endif

class MappedFile {

0 comments on commit 9421b06

Please sign in to comment.