[buildout] extends = ../gcc/buildout.cfg ../unzip/buildout.cfg ../zip/buildout.cfg parts = bazel # The bazel binary contains a zip file. It must not be stripped. do-not-strip-path = ${buildout:parts-directory}/bazel/bin/bazel [zulu] recipe = hexagonit.recipe.download ignore-existing = true url = http://cdn.azul.com/zulu/bin/zulu8.20.0.5-jdk8.0.121-linux_x64.tar.gz md5sum = e5f4b1d997e50ffe4998c68c8ec45403 strip-top-level-dir = true [template-bazel-crosstool] recipe = slapos.recipe.template:jinja2 location = ${buildout:parts-directory}/${:_buildout_section_name_} mode = 640 filename = bazel_tools_cpp_CROSSTOOL template = ${:_profile_base_location_}/${:filename}.in rendered = ${:location}/${:filename} cpp_path = ${gcc:location}/bin/cpp gcc_path = ${gcc:location}/bin/gcc binutils_path = ${binutils:location}/bin gconv_path = ${gcc:location}/bin/gconv include_path = ${gcc:location}/include gcc_lib64_path = ${gcc:location}/lib64 context = key cpp_path template-bazel-crosstool:cpp_path key gcc_path template-bazel-crosstool:gcc_path key binutils_path template-bazel-crosstool:binutils_path key gconv_path template-bazel-crosstool:gconv_path key include_path template-bazel-crosstool:include_path key gcc_lib64_path template-bazel-crosstool:gcc_lib64_path [template-bazel-src-main-cpp-build] recipe = slapos.recipe.template:jinja2 location = ${buildout:parts-directory}/${:_buildout_section_name_} mode = 640 filename = bazel_src_main_cpp_BUILD template = ${:_profile_base_location_}/${:filename}.in rendered = ${:location}/${:filename} linkopts = -Wl,-rpath,${gcc:location}/lib64 context = key linkopts template-bazel-src-main-cpp-build:linkopts [template-bazel-src-main-tools-build] <= template-bazel-src-main-cpp-build filename = bazel_src_main_tools_BUILD [template-bazel-src-tools-singlejar-build] <= template-bazel-src-main-cpp-build filename = bazel_src_tools_singlejar_BUILD [bazel] recipe = slapos.recipe.build url = https://github.com/bazelbuild/bazel/releases/download/0.6.1/bazel-0.6.1-dist.zip md5sum = 8c5c827e33d3ff74c263c1299810b485 patch-binary = ${patch:location}/bin/patch patch-file-path = ${:_profile_base_location_}/bazel-0.6.1.patch bazel-crosstool-modified-file-path = ${template-bazel-crosstool:rendered} bazel-src-main-cpp-build-path = ${template-bazel-src-main-cpp-build:rendered} bazel-src-main-tools-build-path = ${template-bazel-src-main-tools-build:rendered} bazel-src-tools-singlejar-build-path = ${template-bazel-src-tools-singlejar-build:rendered} unzip-bin = ${unzip:location}/bin zip-bin = ${zip:location}/bin gcc-bin = ${gcc:location}/bin gcc-lib = ${gcc:location}/lib gcc-lib64 = ${gcc:location}/lib64 java_home = ${zulu:location} bazelrc = ${:_profile_base_location_}/bazelrc script = extract_dir = self.extract(self.download(self.options['url'], self.options['md5sum'])) crosstool_path = os.path.join(extract_dir, 'tools', 'cpp', 'CROSSTOOL') os.chmod(crosstool_path, 0644) shutil.copy(self.options['bazel-crosstool-modified-file-path'], crosstool_path) src_main_cpp_build_path = os.path.join(extract_dir, 'src', 'main', 'cpp', 'BUILD') os.chmod(src_main_cpp_build_path, 0644) shutil.copy(self.options['bazel-src-main-cpp-build-path'], src_main_cpp_build_path) src_main_tools_build_path = os.path.join(extract_dir, 'src', 'main', 'tools', 'BUILD') os.chmod(src_main_tools_build_path, 0644) shutil.copy(self.options['bazel-src-main-tools-build-path'], src_main_tools_build_path) src_tools_singlejar_build_path = os.path.join(extract_dir, 'src', 'tools', 'singlejar', 'BUILD') os.chmod(src_tools_singlejar_build_path, 0644) shutil.copy(self.options['bazel-src-tools-singlejar-build-path'], src_tools_singlejar_build_path) target_path = extract_dir+'/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleImplementationFunctions.java' os.chmod(target_path, 0644) call([self.buildout['bazel']['patch-binary'], '-p1', '-d', extract_dir, '-i', self.buildout['bazel']['patch-file-path']]) path = ':'.join(( self.options['unzip-bin'], self.options['zip-bin'], self.options['gcc-bin'], os.environ['PATH'] )) env = {'JAVA_HOME':self.options['java_home'], 'PATH':path, 'LD_LIBRARY_PATH':':'.join(( self.options['gcc-lib'], self.options['gcc-lib64'], os.environ.get('LD_LIBRARY_PATH', '') )), 'LDFLAGS':'-Wl,-rpath='+self.options['gcc-lib64'], 'CC':self.options['gcc-bin']+'/gcc', 'CXX':self.options['gcc-bin']+'/g++', 'BAZELRC':self.options['bazelrc'], 'VERBOSE':'yes', } bin_dir = os.path.join(self.options['location'], 'bin') os.makedirs(bin_dir) call(['bash', 'compile.sh', 'compile'], cwd=extract_dir, env=env) shutil.copy(os.path.join(extract_dir, 'output', 'bazel'), os.path.join(bin_dir, 'bazel'))