forked from adoptium/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unixPB: Install capstone 4 from repositories or source (adoptium#3119)
* unixPB: Install capstone 4 from repositories or source * Add checksums to capstone download Signed-off-by: Stewart X Addison <sxa@redhat.com> * Only build correct capstone support for the machine --------- Signed-off-by: Stewart X Addison <sxa@redhat.com>
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 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
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
85 changes: 85 additions & 0 deletions
85
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/capstone/tasks/main.yml
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,85 @@ | ||
--- | ||
########################## | ||
# Install capstone 4.0.2 # | ||
########################## | ||
# Required to build with hsdis disassembler support. | ||
# Note that at present this is only supported in the openjdk codebase | ||
# on x64 and aarch64, but this installs on all archs except RISC-V | ||
|
||
- name: Set capstone version | ||
set_fact: | ||
capstone_version: 4.0.2 | ||
tags: capstone_source | ||
|
||
# check if it is installed in custom location or as system | ||
|
||
- name: Test if capstone 4 is installed | ||
shell: test -f /usr/local/lib/libcapstone.so.4 || test -f /usr/lib/libcapstone.so.4 | ||
when: | ||
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES") | ||
register: capstone_installed | ||
changed_when: false | ||
failed_when: false | ||
tags: capstone_source | ||
|
||
- name: Download capstone {{ capstone_version }} | ||
get_url: | ||
url: https://github.com/capstone-engine/capstone/archive/{{ capstone_version }}.tar.gz | ||
dest: /tmp/capstone-{{ capstone_version }}.tar.gz | ||
force: no | ||
mode: 0440 | ||
checksum: sha512:7f93534517307b737422a8825b66b2a1f3e1cca2049465d60ab12595940154aaf843ba40ed348fce58de58b990c19a0caef289060eb72898cb008a88c470970e | ||
when: | ||
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES") | ||
- capstone_installed.rc != 0 | ||
- (ansible_architecture != "riscv64") | ||
tags: capstone_source | ||
|
||
- name: Extract capstone {{ capstone_version }} | ||
unarchive: | ||
src: /tmp/capstone-{{ capstone_version }}.tar.gz | ||
dest: /tmp | ||
copy: False | ||
when: | ||
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES") | ||
- capstone_installed.rc != 0 | ||
- (ansible_architecture != "riscv64") | ||
tags: capstone_source | ||
|
||
- name: Set architecture variable for x64 | ||
set_fact: capstone_architecture=x86 | ||
when: ansible_architecture == "x86_64" | ||
|
||
- name: Set architecture variable for arm32 | ||
set_fact: capstone_architecture=arm | ||
when: ansible_architecture == "armv7l" | ||
|
||
- name: Set architecture variable for aarch64 | ||
set_fact: capstone_architecture=aarch64 | ||
when: ansible_architecture == "aarch64" | ||
|
||
- name: Set architecture variable for ppc64le | ||
set_fact: capstone_architecture=powerpc | ||
when: ansible_architecture == "ppc64le" | ||
|
||
- name: Set architecture variable for s390x | ||
set_fact: capstone_architecture=systemz | ||
when: ansible_architecture == "s390x" | ||
|
||
- name: Build and install capstone {{ capstone_version }} | ||
shell: cd /tmp/capstone-{{ capstone_version }} && CAPSTONE_ARCHS={{ capstone_architecture }} ./make.sh && PREFIX=/usr/local ./make.sh install | ||
when: | ||
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES") | ||
- capstone_installed.rc != 0 | ||
- (ansible_architecture != "riscv64") | ||
tags: capstone_source | ||
|
||
- name: Remove downloaded packages for capstone {{ capstone_version }} | ||
file: | ||
path: /tmp/capstone-{{ capstone_version }}.tar.gz | ||
state: absent | ||
failed_when: false | ||
when: | ||
- (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "Ubuntu" or ansible_distribution == "SLES") | ||
- capstone_installed.rc != 0 | ||
tags: capstone_source |