Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions ansible/roles/build-test-v8/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# prebuilt binaries for x64 but for ppc64 and s390x we need to compile these
# ourselves.
dependencies:
- role: ninja-build
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:
Expand Down
8 changes: 1 addition & 7 deletions ansible/roles/build-test-v8/tasks/partials/rhel8-ppc64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@
# Install packages for V8 builds.
#

# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
- name: enable codeready-builder repository
community.general.rhsm_repository:
name: codeready-builder-for-rhel-8-ppc64le-rpms
state: enabled

# V8 builds still require Python 2.
# rhel_llvm_version and rhel_rust_version from ansible/roles/baselayout/vars/main.yml
- name: install packages required to build V8
ansible.builtin.dnf:
name: ['glib2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'ninja-build', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
name: ['glib2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
state: present
notify: package updated

Expand Down
8 changes: 1 addition & 7 deletions ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@
# Install packages for V8 builds.
#

# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
- name: enable codeready-builder repository
community.general.rhsm_repository:
name: codeready-builder-for-rhel-8-s390x-rpms
state: enabled

# Older V8 builds still require Python 2.
# rhel_llvm_version and rhel_rust_version from ansible/roles/baselayout/vars/main.yml
- name: install packages required to build V8
ansible.builtin.dnf:
name: ['GConf2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'ninja-build', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
name: ['GConf2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
state: present
notify: package updated

Expand Down
8 changes: 8 additions & 0 deletions ansible/roles/gn/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Building gn requires ninja.
dependencies:
- role: ninja-build
when: arch == 'ppc64' or arch == 's390x'
vars:
ninja_dest_dir: "{{ gn_dest_dir }}"
ninja_git_dir: "{{ tools_git_dir }}/ninja"
ninja_user: "{{ tools_user }}"
2 changes: 1 addition & 1 deletion ansible/roles/gn/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
ansible.builtin.shell: |
python3 build/gen.py && \
{{ gn_select_compiler }} && \
ninja -C out && \
{{ gn_dest_dir }}/ninja -C out && \
out/gn_unittests
args:
chdir: "{{ gn_git_dir }}"
Expand Down
8 changes: 0 additions & 8 deletions ansible/roles/gn/tasks/partials/rhel8-ppc64.yml

This file was deleted.

8 changes: 0 additions & 8 deletions ansible/roles/gn/tasks/partials/rhel8-s390x.yml

This file was deleted.

4 changes: 2 additions & 2 deletions ansible/roles/gn/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ compiler: {
}

gn_select_compiler: "{{ compiler[os]|default(compiler[os|stripversion])|default('true') }}"
gn_version: c0a46c5e8c316010baf1a0eb2d2ee5a86f73e4c2
gn_version: 304bbef6c7e9a86630c12986b99c8654eb7fe648

packages: {
'rhel8': 'ninja-build,gcc-toolset-12'
'rhel8': 'gcc-toolset-12'
}
17 changes: 17 additions & 0 deletions ansible/roles/ninja-build/meta/argument_specs.yml
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"

61 changes: 61 additions & 0 deletions ansible/roles/ninja-build/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
- name: install ninja build dependencies
include_tasks: "{{ v8deps_include }}"
loop_control:
loop_var: v8deps_include
with_first_found:
- files:
- "{{ role_path }}/tasks/partials/{{ os }}-{{ arch }}.yml"
- "{{ role_path }}/tasks/partials/{{ os }}.yml"
- "{{ role_path }}/tasks/partials/{{ os|stripversion }}.yml"
skip: true

- name: check existing ninja
ansible.builtin.command: "{{ ninja_dest_dir }}/ninja --version"
changed_when: no
failed_when: no
register: ninja_installed_version

# `ninja --version` does not include the 'v' prefix.
- name: check if ninja needs to be rebuilt
ansible.builtin.set_fact:
rebuild_ninja: "{{ not ninja_installed_version.stdout|default('') is search(ninja_version[1:]) }}"

- name: clone/update ninja repository
ansible.builtin.git:
dest: "{{ ninja_git_dir }}"
repo: "{{ ninja_git_repository }}"
version: "{{ ninja_version|default(omit) }}"
become: "{{ ninja_user|default(omit)|bool }}"
become_user: "{{ ninja_user|default(omit) }}"
register: ninja_git
when: rebuild_ninja

- name: clean git checkout
ansible.builtin.shell: git clean -fdX
args:
chdir: "{{ ninja_git_dir }}"
become: "{{ ninja_user|default(omit)|bool }}"
become_user: "{{ ninja_user|default(omit) }}"
when: rebuild_ninja

- name: build ninja
ansible.builtin.shell: |
{{ ninja_select_compiler }} && \
./configure.py --bootstrap
args:
chdir: "{{ ninja_git_dir }}"
become: "{{ ninja_user|default(omit)|bool }}"
become_user: "{{ ninja_user|default(omit) }}"
environment:
CC: gcc
CXX: g++
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
16 changes: 16 additions & 0 deletions ansible/roles/ninja-build/tasks/partials/rhel8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# Install ninja build dependencies for RHEL 8

- name: install ninja build dependencies for {{ os }}-{{ arch }}
package:
name: "{{ package }}"
state: present
use: dnf
loop_control:
loop_var: package
notify: package updated
with_items:
# ansible doesn't like empty lists
- "{{ packages[os+'_'+arch]|default('[]') }}"
- "{{ packages[os]|default('[]') }}"
- "{{ packages[os|stripversion]|default('[]') }}"
13 changes: 13 additions & 0 deletions ansible/roles/ninja-build/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

compiler: {
'rhel8': '. /opt/rh/gcc-toolset-12/enable'
}

ninja_git_repository: 'https://github.com/ninja-build/ninja'
ninja_select_compiler: '{{ compiler[os]|default(compiler[os|stripversion])|default("true") }}'
ninja_version: 'v1.13.2'

packages: {
'rhel8': 'gcc-toolset-12'
}