-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible: build gn from source on Linux PPC/s390x
Add `build-test-v8` meta-role for installing prerequisites for V8 building/testing. Add roles to build `gn` and `ninja` binaries from source and call those from the `build-test-v8` role for Linux on ppc64/s390x.
- Loading branch information
1 parent
c189af0
commit 35e20e1
Showing
9 changed files
with
174 additions
and
19 deletions.
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
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,17 @@ | ||
argument_specs: | ||
main: | ||
short_description: The main task for prereqs for build/testing V8. | ||
options: | ||
tools_dest_dir: | ||
description: The location to place the symlink to the binaries. | ||
required: yes | ||
type: "str" | ||
tools_git_dir: | ||
description: The location to put git checkouts. | ||
required: yes | ||
type: "str" | ||
tools_user: | ||
default: "{{ server_user|default(omit) }}" | ||
description: The user to install binaries under. | ||
type: "str" | ||
|
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,16 @@ | ||
# Build/testing V8 requires ninja and gn. V8's depot_tools toolchain provides | ||
# prebuilt binaries for x64 but for ppc64 and s390x we need to compile these | ||
# ourselves. | ||
dependencies: | ||
- role: ninja | ||
when: arch == 'ppc64' or arch == 's390x' | ||
vars: | ||
ninja_dest_dir: "{{ tools_dest_dir }}" | ||
ninja_git_dir: "{{ tools_git_dir }}/ninja" | ||
ninja_user: "{{ tools_user }}" | ||
- role: gn | ||
when: arch == 'ppc64' or arch == 's390x' | ||
vars: | ||
gn_dest_dir: "{{ tools_dest_dir }}" | ||
gn_git_dir: "{{ tools_git_dir }}/gn" | ||
gn_user: "{{ tools_user }}" |
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,17 @@ | ||
argument_specs: | ||
main: | ||
short_description: The main task for compiling gn from source. | ||
options: | ||
gn_dest_dir: | ||
description: The location to place the symlink to the gn binary. | ||
required: yes | ||
type: "str" | ||
gn_git_dir: | ||
description: The location to put the git checkout. | ||
required: yes | ||
type: "str" | ||
gn_user: | ||
default: "{{ server_user|default(omit) }}" | ||
description: The user to install gn under. | ||
type: "str" | ||
|
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,45 @@ | ||
- name: check existing gn | ||
ansible.builtin.command: "{{ gn_dest_dir }}/gn --version" | ||
changed_when: no | ||
failed_when: no | ||
register: gn_installed_version | ||
|
||
- name: clone/update gn repository | ||
ansible.builtin.git: | ||
dest: "{{ gn_git_dir }}" | ||
repo: "https://gn.googlesource.com/gn" | ||
become: "{{ gn_user|default(omit)|bool }}" | ||
become_user: "{{ gn_user|default(omit) }}" | ||
register: gn_git | ||
|
||
# `gn --version` includes the first seven characters of the commit hash the | ||
# binary was built from: e.g. 1620 (570aaed) | ||
- name: check if gn needs to be rebuilt | ||
ansible.builtin.set_fact: | ||
rebuild_gn: "{{ not gn_installed_version.stdout|default('') is search(gn_git.after[:7]) }}" | ||
|
||
# Requires a C++17 compiler. At the moment we're only building on CentOS/RHEL | ||
# so have devtoolset-8 available. | ||
- name: build gn | ||
ansible.builtin.shell: | | ||
python3 build/gen.py && \ | ||
. /opt/rh/devtoolset-8/enable && \ | ||
{{ gn_dest_dir }}/ninja -C out && \ | ||
out/gn_unittests | ||
args: | ||
chdir: "{{ gn_git_dir }}" | ||
become: "{{ gn_user|default(omit)|bool }}" | ||
become_user: "{{ gn_user|default(omit) }}" | ||
environment: | ||
CC: gcc | ||
CXX: g++ | ||
when: rebuild_gn | ||
|
||
- name: create symlink | ||
ansible.builtin.file: | ||
dest: "{{ gn_dest_dir }}/gn" | ||
src: "{{ gn_git_dir }}/out/gn" | ||
state: link | ||
become: "{{ gn_user|default(omit)|bool }}" | ||
become_user: "{{ gn_user|default(omit) }}" | ||
when: rebuild_gn |
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,17 @@ | ||
argument_specs: | ||
main: | ||
short_description: The main task for compiling ninja from source. | ||
options: | ||
ninja_dest_dir: | ||
description: The location to place the symlink to the ninja binary. | ||
required: yes | ||
type: "str" | ||
ninja_git_dir: | ||
description: The location to put the git checkout. | ||
required: yes | ||
type: "str" | ||
ninja_user: | ||
default: "{{ server_user|default(omit) }}" | ||
description: The user to install ninja under. | ||
type: "str" | ||
|
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,45 @@ | ||
- name: check existing ninja | ||
ansible.builtin.command: "{{ ninja_dest_dir }}/ninja --version" | ||
changed_when: no | ||
failed_when: no | ||
register: ninja_installed_version | ||
|
||
- name: get Ninja release information from GitHub | ||
ansible.builtin.uri: | ||
return_content: yes | ||
url: https://api.github.com/repos/ninja-build/ninja/releases/latest | ||
register: ninja_latest | ||
|
||
# Tag in GitHub is prefixed with 'v' but the output from `ninja --version` is not. | ||
- name: check if Ninja needs to be rebuilt | ||
ansible.builtin.set_fact: | ||
rebuild_ninja: "{{ not ninja_installed_version.stdout|default('') == ninja_latest.json.tag_name[1:] }}" | ||
|
||
- name: clone/update ninja-build repository | ||
ansible.builtin.git: | ||
dest: "{{ ninja_git_dir }}" | ||
repo: https://github.com/ninja-build/ninja | ||
version: "{{ ninja_latest.json.tag_name }}" | ||
become: "{{ ninja_user|default(omit)|bool }}" | ||
become_user: "{{ ninja_user|default(omit) }}" | ||
when: rebuild_ninja | ||
|
||
- name: build Ninja | ||
ansible.builtin.shell: | | ||
python3 ./configure.py --bootstrap && \ | ||
./ninja ninja_test && ./ninja_test | ||
args: | ||
chdir: "{{ ninja_git_dir }}" | ||
become: "{{ ninja_user|default(omit)|bool }}" | ||
become_user: "{{ ninja_user|default(omit) }}" | ||
when: rebuild_ninja | ||
|
||
- name: create symlink | ||
ansible.builtin.file: | ||
dest: "{{ ninja_dest_dir }}/ninja" | ||
src: "{{ ninja_git_dir }}/ninja" | ||
state: link | ||
become: "{{ ninja_user|default(omit)|bool }}" | ||
become_user: "{{ ninja_user|default(omit) }}" | ||
when: rebuild_ninja | ||
|