Skip to content

Commit 6d50232

Browse files
committed
upgrades to ubuntu-latest and adds ghidra installation script
1 parent 9338ae7 commit 6d50232

File tree

8 files changed

+53
-21
lines changed

8 files changed

+53
-21
lines changed

.github/workflows/full.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# tests all packages, including bap-extra
2-
# it requires ghidra, so it works only on ubuntu-20.04
2+
# it requires ghidra, so it works only on ubuntu-latest
33
name: full
44
run-name: Testing everything in ${{ github.ref }}
55

@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212
env:
1313
BAP_LOG_DIR: $HOME/log
1414
OPAMRETRES: 8
@@ -17,14 +17,15 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@v3
1919

20-
- name: Install Ghidra and Dejagnu
20+
- name: Install Dejagnu
2121
run: |
22-
sudo add-apt-repository ppa:ivg/ghidra -y
2322
sudo apt-get update -y
24-
sudo apt-get install libghidra-dev -y
25-
sudo apt-get install libghidra-data -y
2623
sudo apt-get install dejagnu -y
2724
25+
- name: Build and Install Ghidra
26+
run: |
27+
sudo sh ./tools/install-ghidra.sh
28+
2829
- name: Install OCaml
2930
uses: ocaml/setup-ocaml@v3
3031
with:

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os:
11-
- ubuntu-20.04
11+
- ubuntu-latest
1212
ocaml-compiler:
1313
- 4.08.x
1414
- 4.14.x
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/checkout@v4
3030

3131
- name: Prepare Ubuntu
32-
if: matrix.os == 'ubuntu-20.04'
32+
if: matrix.os == 'ubuntu-latest'
3333
run: |
3434
sudo apt-get update -y
3535
sudo apt-get install dejagnu -y

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
os:
14-
- ubuntu-20.04
14+
- ubuntu-latest
1515
ocaml-compiler:
1616
- 4.14.x
1717
- 4.08.x

.github/workflows/oasis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os:
11-
- ubuntu-20.04
11+
- ubuntu-latest
1212
ocaml-compiler:
1313
- 4.14.x
1414

@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@v4
2929

3030
- name: Prepare Ubuntu
31-
if: matrix.os == 'ubuntu-20.04'
31+
if: matrix.os == 'ubuntu-latest'
3232
run: |
3333
sudo apt-get update -y
3434
sudo apt-get install dejagnu -y

.github/workflows/opam.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- 4.14.x
1212
- 4.08.x
1313

14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-latest
1515

1616
env:
1717
OPAMJOBS: 2
@@ -21,14 +21,15 @@ jobs:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
2323

24-
- name: Install Ghidra and Dejagnu
24+
- name: Install Dejagnu
2525
run: |
26-
sudo add-apt-repository ppa:ivg/ghidra -y
2726
sudo apt-get update -y
28-
sudo apt-get install libghidra-dev -y
29-
sudo apt-get install libghidra-data -y
3027
sudo apt-get install dejagnu -y
3128
29+
- name: Build and Install Ghidra
30+
run: |
31+
sudo sh ./tools/install-ghidra.sh
32+
3233
- name: Install OCaml ${{ matrix.ocaml-compiler }}
3334
uses: ocaml/setup-ocaml@v3
3435
with:

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build:
10-
runs-on: ubuntu-18.04
10+
runs-on: ubuntu-latest
1111

1212
env:
1313
OPAMJOBS: 2
@@ -24,11 +24,9 @@ jobs:
2424
ocaml-compiler: ocaml-variants.4.14.2+flambda
2525
dune-cache: true
2626

27-
- name: Install Ghidra
27+
- name: Build and Install Ghidra
2828
run: |
29-
sudo add-apt-repository ppa:ivg/ghidra -y
30-
sudo apt-get install libghidra-dev -y
31-
sudo apt-get install libghidra-data -y
29+
sudo sh ./tools/install-ghidra.sh
3230
3331
- name: Add the testing Repository
3432
run: opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing

bap-llvm.opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ build: [
2626
[
2727
"ocaml" "tools/configure.ml"
2828
"--with-llvm-config=%{conf-bap-llvm:config}%"
29+
"--%{llvm-shared?disable:enable}%-llvm-static"
2930
]
3031
[
3132
"dune"

tools/install-ghidra.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# usage: install-ghidra.sh [[dst] buildir]
2+
PREFIX=$(realpath ${1:-/usr})
3+
BUILDDIR=${2:-$(mktemp -d)}
4+
GHIDRA_VERSION=10.0.4
5+
GHIDRA_BASENAME=Ghidra_${GHIDRA_VERSION}_build
6+
GHIDRA_TARBALL=${GHIDRA_BASENAME}.tar.gz
7+
GHIDRA_BASE_URL=https://github.com/NationalSecurityAgency/ghidra/archive/refs/tags/
8+
GHIDRA_SRC_URL=${GHIDRA_BASE_URL}/${GHIDRA_TARBALL}
9+
GHIDRA_SHA256=76f1bd9604d49a2e59c47b347aedb90484bcfe51217c792e8cc771fc6481147c
10+
GHIDRA_ROOT=ghidra-${GHIDRA_BASENAME}
11+
LIBGHIDRA_PATH=${GHIDRA_ROOT}/Ghidra/Features/Decompiler/src/decompile/cpp
12+
LIBGHIDRA_FLAGS="-O2 -std=c++11 -fPIC"
13+
LIBGHIDRA_HEADERS_INSTALL_DIR=${PREFIX}/include/ghidra
14+
LIBGHIDRA_LIBRARY_INSTALL_DIR=${PREFIX}/lib/ghidra
15+
LIBGHIDRA_PROCESSORS_INSTALL_DIR=${PREFIX}/share/ghidra/Ghidra/Processors
16+
17+
set -x \
18+
&& cd ${BUILDDIR} \
19+
&& curl -sS -L -o ${GHIDRA_TARBALL} ${GHIDRA_SRC_URL} \
20+
&& echo "${GHIDRA_SHA256} ${GHIDRA_TARBALL}" | sha256sum --check \
21+
&& tar xzvf ${GHIDRA_TARBALL} \
22+
&& rm ${LIBGHIDRA_PATH}/*bfd*.* ${LIBGHIDRA_PATH}/codedata.* \
23+
&& make -C ${LIBGHIDRA_PATH} OPT_CXXFLAGS="${LIBGHIDRA_FLAGS}" libdecomp.a libsla.a \
24+
&& make -C ${LIBGHIDRA_PATH} sleigh_opt \
25+
&& ${LIBGHIDRA_PATH}/sleigh_opt -a ${GHIDRA_ROOT}/Ghidra \
26+
&& install -d ${LIBGHIDRA_HEADERS_INSTALL_DIR} \
27+
&& install -d ${LIBGHIDRA_LIBRARY_INSTALL_DIR} \
28+
&& install -d ${LIBGHIDRA_PROCESSORS_INSTALL_DIR} \
29+
&& install -t ${LIBGHIDRA_HEADERS_INSTALL_DIR} ${LIBGHIDRA_PATH}/*.h* \
30+
&& install -t ${LIBGHIDRA_LIBRARY_INSTALL_DIR} ${LIBGHIDRA_PATH}/*.a \
31+
&& cp -R ${GHIDRA_ROOT}/Ghidra/Processors/x86 ${LIBGHIDRA_PROCESSORS_INSTALL_DIR} \

0 commit comments

Comments
 (0)