Skip to content

Commit c56b4b9

Browse files
committed
Only build correct capstone support for the machine
1 parent 9419d4b commit c56b4b9

File tree

2 files changed

+35
-13
lines changed
  • ansible/playbooks/AdoptOpenJDK_Unix_Playbook

2 files changed

+35
-13
lines changed

ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
- role: cmake # OpenJ9 / OpenJFX
7979
when: ansible_distribution != "Solaris" # Compile fails on Solaris
8080
tags: [build_tools, build_tools_openj9, build_tools_openjfx]
81+
- role: capstone
82+
tags: [build_tools]
8183
- role: ccache
8284
when: ansible_distribution != "Solaris" # Compile fails on Solaris
8385
- role: nasm # OpenJ9

ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/capstone/tasks/main.yml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
---
2-
###################
3-
# OpenSSL v1.1.1 #
4-
###################
5-
# Required by OpenJ9 for out-of-process JIT compilation (aka JITaaS)
6-
# Currently only used by the alternate openj9 branch at https://github.com/eclipse/openj9/tree/jitaas
7-
8-
# Note: some systems have already OpenSSL 1.1.1 instaled (as system)
9-
# do not install 1.1.1b on them
2+
##########################
3+
# Install capstone 4.0.2 #
4+
##########################
5+
# Required to build with hsdis disassembler support.
6+
# Note that at present this is only supported in the openjdk codebase
7+
# on x64 and aarch64, but this installs on all archs except RISC-V
108

119
- name: Set capstone version
1210
set_fact:
@@ -18,8 +16,7 @@
1816
- name: Test if capstone 4 is installed
1917
shell: test -f /usr/local/lib/libcapstone.so.4 || test -f /usr/lib/libcapstone.so.4
2018
when:
21-
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "SLES")
22-
- capstone_installed.rc != 0
19+
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES")
2320
register: capstone_installed
2421
changed_when: false
2522
failed_when: false
@@ -33,8 +30,9 @@
3330
mode: 0440
3431
checksum: sha512:7f93534517307b737422a8825b66b2a1f3e1cca2049465d60ab12595940154aaf843ba40ed348fce58de58b990c19a0caef289060eb72898cb008a88c470970e
3532
when:
36-
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "SLES")
33+
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES")
3734
- capstone_installed.rc != 0
35+
- (ansible_architecture != "riscv64")
3836
tags: capstone_source
3937

4038
- name: Extract capstone {{ capstone_version }}
@@ -43,15 +41,37 @@
4341
dest: /tmp
4442
copy: False
4543
when:
46-
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "SLES")
44+
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES")
4745
- capstone_installed.rc != 0
46+
- (ansible_architecture != "riscv64")
4847
tags: capstone_source
4948

49+
- name: Set architecture variable for x64
50+
set_fact: capstone_architecture=x86
51+
when: ansible_architecture == "x86_64"
52+
53+
- name: Set architecture variable for arm32
54+
set_fact: capstone_architecture=arm
55+
when: ansible_architecture == "armv7l"
56+
57+
- name: Set architecture variable for aarch64
58+
set_fact: capstone_architecture=aarch64
59+
when: ansible_architecture == "aarch64"
60+
61+
- name: Set architecture variable for ppc64le
62+
set_fact: capstone_architecture=powerpc
63+
when: ansible_architecture == "ppc64le"
64+
65+
- name: Set architecture variable for s390x
66+
set_fact: capstone_architecture=systemz
67+
when: ansible_architecture == "s390x"
68+
5069
- name: Build and install capstone {{ capstone_version }}
51-
shell: cd /tmp/capstone-{{ capstone_version }}} && ./make.sh && PREFIX=/usr/local ./make.sh install
70+
shell: cd /tmp/capstone-{{ capstone_version }} && CAPSTONE_ARCHS={{ capstone_architecture }} ./make.sh && PREFIX=/usr/local ./make.sh install
5271
when:
5372
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES")
5473
- capstone_installed.rc != 0
74+
- (ansible_architecture != "riscv64")
5575
tags: capstone_source
5676

5777
- name: Remove downloaded packages for capstone {{ capstone_version }}

0 commit comments

Comments
 (0)