2020-03-31 08:06:42 +00:00
|
|
|
#
|
|
|
|
# spec file for package ghidra
|
|
|
|
#
|
|
|
|
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2024-11-20 11:13:01 +00:00
|
|
|
%define java_version 21
|
2020-03-31 08:06:42 +00:00
|
|
|
|
|
|
|
Name: ghidra
|
2025-06-29 06:56:24 +00:00
|
|
|
Version: 11.4
|
2020-03-31 08:06:42 +00:00
|
|
|
Release: 0
|
|
|
|
Summary: Software Reverse Engineering Framework
|
|
|
|
License: Apache-2.0
|
|
|
|
Group: Development/Libraries/Java
|
Accepting request 849627 from home:kwk:branches:security:forensics
- Update to 9.2
New Features
* Graphing. A new graph service and implementation was
created. The graph service provides basic graphing capabilities.
It was also used to generate several different types of graphs
including code block graphs, call graphs, and AST graphs.
In addition, an export graph service was created that supports
various formats. (GP-211)
* PDB. Added a new, prototype, platform-independent PDB analyzer
that processes and applies data types and symbols to a program
from acraw (non-XML-converted) PDB file, allowing users to more
easily take advantage of PDB information. (GT-3112)
* Processors. Added M8C SLEIGH processor specification. (GT-3052)
* Processors. Added support for the RISC-V processor. (GT-3389, Issue #932)
* Processors. Added support for the Motorola 6809 processor. (GT-3390, Issue #1201)
* Processors. Added CP1600-series processor support. (GT-3426, Issue #1383)
* Processors. Added V850 processor module. (GT-3523, Issue #1430)
See https://ghidra-sre.org/releaseNotes_9.2.html#9_2 for full
list of changes.
- drop 0002-adapt-properties.patch
OBS-URL: https://build.opensuse.org/request/show/849627
OBS-URL: https://build.opensuse.org/package/show/security:forensics/ghidra?expand=0&rev=7
2020-11-23 14:12:22 +00:00
|
|
|
Url: https://ghidra-sre.org
|
2025-03-22 14:21:29 +00:00
|
|
|
Source0: https://github.com/NationalSecurityAgency/%{name}/archive/refs/tags/%{name}-Ghidra_%{version}_build.tar.gz
|
2020-03-31 08:06:42 +00:00
|
|
|
Source1: %{name}-rpmlintrc
|
2021-04-21 13:59:53 +00:00
|
|
|
Source2: %{name}.desktop
|
2025-02-16 11:45:38 +00:00
|
|
|
# from https://github.com/kkaempf/ghidra-vax
|
|
|
|
Source3: ghidra-vax-main.zip
|
|
|
|
# from https://github.com/kkaempf/ghidra-nmos
|
|
|
|
Source4: ghidra-nmos-ii-main.zip
|
2025-05-06 08:10:34 +00:00
|
|
|
Source5: ghidra-alpha-main.zip
|
|
|
|
Source6: %{name}-kit.tar
|
2023-07-06 12:03:09 +00:00
|
|
|
|
|
|
|
Patch1: 0003-Introduce-operand_offset.patch
|
2024-08-01 17:17:07 +00:00
|
|
|
Patch2: 0004-Add-offset-to-sleigh-Java.patch
|
|
|
|
Patch3: 0006-exclude-generated-sleigh-files-from-IP-scan.patch
|
2020-03-31 08:06:42 +00:00
|
|
|
|
2025-06-29 06:56:24 +00:00
|
|
|
ExclusiveArch: x86_64 aarch64
|
|
|
|
|
2020-03-31 08:06:42 +00:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: bison
|
2023-07-06 12:03:09 +00:00
|
|
|
BuildRequires: cabextract
|
|
|
|
BuildRequires: docbook5-xsl-stylesheets
|
2020-03-31 08:06:42 +00:00
|
|
|
BuildRequires: fdupes
|
|
|
|
BuildRequires: flex
|
2023-07-06 12:03:09 +00:00
|
|
|
BuildRequires: findutils
|
2020-03-31 08:06:42 +00:00
|
|
|
BuildRequires: gcc-c++
|
2023-07-22 11:19:51 +00:00
|
|
|
BuildRequires: gradle
|
2023-03-29 07:00:34 +00:00
|
|
|
BuildRequires: java-devel = %{java_version}
|
2025-02-16 11:43:26 +00:00
|
|
|
BuildRequires: python3 >= 3.9
|
2024-08-01 17:17:07 +00:00
|
|
|
BuildRequires: python3-pip
|
2020-03-31 08:06:42 +00:00
|
|
|
BuildRequires: sed
|
|
|
|
BuildRequires: unzip
|
2024-02-12 12:15:00 +00:00
|
|
|
BuildRequires: zip
|
2021-04-21 13:59:53 +00:00
|
|
|
|
2021-08-31 10:16:52 +00:00
|
|
|
Requires: cabextract >= 1.6
|
2025-06-29 06:56:24 +00:00
|
|
|
# yes, Ghidra requires a Java compiler at runtime :-/
|
|
|
|
Requires: java-devel >= %{java_version}
|
2020-03-31 08:06:42 +00:00
|
|
|
|
|
|
|
%description
|
|
|
|
Ghidra is a software reverse engineering (SRE) framework created and
|
|
|
|
maintained by the National Security Agency Research Directorate. This
|
|
|
|
framework includes a suite of full-featured, high-end software
|
|
|
|
analysis tools that enable users to analyze compiled code on a variety
|
|
|
|
of platforms including Windows, macOS, and Linux.
|
|
|
|
|
2022-07-09 22:14:04 +00:00
|
|
|
%package apidocs
|
|
|
|
Summary: Ghidra API documentation
|
2023-07-06 12:03:09 +00:00
|
|
|
BuildArch: noarch
|
2022-07-09 22:14:04 +00:00
|
|
|
|
|
|
|
%description apidocs
|
2023-07-06 12:03:09 +00:00
|
|
|
Ghidra API documentation in HTML or JSON format.
|
|
|
|
|
|
|
|
%package javadocs
|
|
|
|
Summary: Ghidra JAVA documentation
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%description javadocs
|
|
|
|
Ghidra JAVA documentation in HTML format.
|
|
|
|
|
|
|
|
%package doc
|
|
|
|
Summary: Ghidra generic documentation
|
|
|
|
|
|
|
|
%description doc
|
|
|
|
Ghidra documentation in HTML.
|
2020-03-31 08:06:42 +00:00
|
|
|
|
|
|
|
%prep
|
Accepting request 849627 from home:kwk:branches:security:forensics
- Update to 9.2
New Features
* Graphing. A new graph service and implementation was
created. The graph service provides basic graphing capabilities.
It was also used to generate several different types of graphs
including code block graphs, call graphs, and AST graphs.
In addition, an export graph service was created that supports
various formats. (GP-211)
* PDB. Added a new, prototype, platform-independent PDB analyzer
that processes and applies data types and symbols to a program
from acraw (non-XML-converted) PDB file, allowing users to more
easily take advantage of PDB information. (GT-3112)
* Processors. Added M8C SLEIGH processor specification. (GT-3052)
* Processors. Added support for the RISC-V processor. (GT-3389, Issue #932)
* Processors. Added support for the Motorola 6809 processor. (GT-3390, Issue #1201)
* Processors. Added CP1600-series processor support. (GT-3426, Issue #1383)
* Processors. Added V850 processor module. (GT-3523, Issue #1430)
See https://ghidra-sre.org/releaseNotes_9.2.html#9_2 for full
list of changes.
- drop 0002-adapt-properties.patch
OBS-URL: https://build.opensuse.org/request/show/849627
OBS-URL: https://build.opensuse.org/package/show/security:forensics/ghidra?expand=0&rev=7
2020-11-23 14:12:22 +00:00
|
|
|
%setup -q -n %{name}-Ghidra_%{version}_build
|
2024-11-20 11:13:01 +00:00
|
|
|
%patch -P1 -p1
|
|
|
|
%patch -P2 -p1
|
|
|
|
%patch -P3 -p1
|
2025-05-06 08:10:34 +00:00
|
|
|
tar xf %{S:6}
|
2020-03-31 08:06:42 +00:00
|
|
|
|
|
|
|
%build
|
|
|
|
find . -name .gitignore_disabled_by_tetra -exec rm '{}' \;
|
|
|
|
rm -rf GPL/CabExtract
|
|
|
|
|
|
|
|
export GRADLE_USER_HOME=/tmp/gradle
|
|
|
|
export GRADLE_CACHE=/tmp/gradle-cache
|
|
|
|
export BUILD_VCS_NUMBER=%{version}
|
2021-08-31 10:16:52 +00:00
|
|
|
export M2_HOME=`pwd`/dependencies/m2
|
2020-03-31 08:06:42 +00:00
|
|
|
export GRADLE_OPTS="-Xmx1024m"
|
|
|
|
export LANG=en_US.UTF-8
|
2024-01-15 10:07:39 +00:00
|
|
|
export JAVA_HOME=%{_libdir}/jvm/java-%{java_version}-openjdk-%{java_version}/
|
2023-03-29 07:00:34 +00:00
|
|
|
|
2020-03-31 08:06:42 +00:00
|
|
|
mkdir build
|
|
|
|
mkdir -p ~/.m2
|
|
|
|
rm -rf ~/.m2/repository
|
|
|
|
ln -sf $M2_HOME ~/.m2/repository
|
|
|
|
|
2023-07-06 12:03:09 +00:00
|
|
|
(cd Ghidra/Processors;
|
|
|
|
unzip %{S:3};
|
|
|
|
mv ghidra-vax-main VAX)
|
|
|
|
|
|
|
|
(cd Ghidra/Processors;
|
|
|
|
unzip %{S:4};
|
|
|
|
mv ghidra-nmos-ii-main NMOS-II)
|
2022-07-09 22:14:04 +00:00
|
|
|
|
2025-05-06 08:10:34 +00:00
|
|
|
(cd Ghidra/Processors;
|
|
|
|
unzip %{S:5};
|
|
|
|
mv ghidra-alpha-main Alpha)
|
|
|
|
|
2023-07-22 11:19:51 +00:00
|
|
|
# --stacktrace --info --debug \
|
|
|
|
# --no-parallel \
|
|
|
|
# --no-daemon \
|
|
|
|
|
2020-03-31 08:06:42 +00:00
|
|
|
gradle \
|
|
|
|
--gradle-user-home $GRADLE_USER_HOME \
|
|
|
|
--project-cache-dir $GRADLE_CACHE \
|
|
|
|
-Dfile.encoding=UTF-8 \
|
2023-03-29 07:00:34 +00:00
|
|
|
-Djava.home=$JAVA_HOME \
|
2020-03-31 08:06:42 +00:00
|
|
|
--project-prop finalRelease=true \
|
|
|
|
--offline \
|
|
|
|
buildGhidra
|
|
|
|
|
2023-07-06 12:03:09 +00:00
|
|
|
gradle --stop
|
|
|
|
|
|
|
|
(cd Ghidra/Features/FunctionID/src/main/doc;
|
|
|
|
sed -i 's|http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl|/usr/share/xml/docbook/stylesheet/nwalsh5/1.79.2/html/chunk.xsl|' fid_html.xsl;
|
|
|
|
xsltproc fid_html.xsl fid.xml)
|
2020-03-31 08:06:42 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
|
|
|
|
mkdir -p %{buildroot}%{_libdir}
|
2022-07-09 22:14:04 +00:00
|
|
|
|
|
|
|
unzip build/dist/ghidra*linux*.zip -d %{buildroot}%{_libdir}
|
2020-03-31 08:06:42 +00:00
|
|
|
mv %{buildroot}%{_libdir}/%{name}* %{buildroot}%{_libdir}/%{name}
|
|
|
|
|
2021-04-21 13:59:53 +00:00
|
|
|
mkdir -p %{buildroot}%{_datadir}/applications
|
|
|
|
install -m 644 %{S:2} %{buildroot}%{_datadir}/applications
|
|
|
|
|
2025-06-29 06:56:24 +00:00
|
|
|
for i in 16 24 32 40 48 64 128 256
|
|
|
|
do
|
|
|
|
mkdir -p %{buildroot}%{_iconsdir}/hicolor/${i}x${i}
|
|
|
|
cp Ghidra/Framework/Gui/src/main/resources/images/GhidraIcon$i.png %{buildroot}%{_iconsdir}/hicolor/${i}x${i}/GhidraIcon.png
|
|
|
|
done
|
|
|
|
|
2022-07-09 22:14:04 +00:00
|
|
|
mkdir -p %{buildroot}%{_docdir}/%{name}
|
2023-07-06 12:03:09 +00:00
|
|
|
mv %{buildroot}%{_libdir}/%{name}/docs/* %{buildroot}%{_docdir}/%{name}
|
|
|
|
# creates 'api' subdir
|
2022-07-09 22:14:04 +00:00
|
|
|
unzip build/tmp/GhidraAPI_javadoc.zip -d %{buildroot}%{_docdir}/%{name}
|
|
|
|
|
2020-03-31 08:06:42 +00:00
|
|
|
# please rpmlint:
|
|
|
|
%fdupes %{buildroot}%{_libdir}/%{name}
|
|
|
|
|
|
|
|
# This script uses 'env' as an interpreter.
|
2020-12-26 19:33:53 +00:00
|
|
|
%if 0%{?suse_version} > 1500
|
2020-03-31 08:06:42 +00:00
|
|
|
sed -i 's|#!/usr/bin/env bash|#!/usr/bin/bash|' %{buildroot}%{_libdir}/%{name}/ghidraRun
|
|
|
|
find %{buildroot}%{_libdir}/%{name}/server/* -exec sed -i 's|#!/usr/bin/env bash|#!/usr/bin/bash|' "{}" \;
|
|
|
|
find %{buildroot}%{_libdir}/%{name}/support/* -exec sed -i 's|#!/usr/bin/env bash|#!/usr/bin/bash|' "{}" \;
|
2020-12-26 19:33:53 +00:00
|
|
|
%else
|
|
|
|
sed -i 's|#!/usr/bin/env bash|#!/bin/bash|' %{buildroot}%{_libdir}/%{name}/ghidraRun
|
|
|
|
find %{buildroot}%{_libdir}/%{name}/server/* -exec sed -i 's|#!/usr/bin/env bash|#!/bin/bash|' "{}" \;
|
|
|
|
find %{buildroot}%{_libdir}/%{name}/support/* -exec sed -i 's|#!/usr/bin/env bash|#!/bin/bash|' "{}" \;
|
|
|
|
%endif
|
2020-03-31 08:06:42 +00:00
|
|
|
find %{buildroot}%{_libdir}/%{name} -name \*.py -exec sed -i 's|#!/usr/bin/env python|#!/usr/bin/python|' "{}" \;
|
|
|
|
|
|
|
|
# jar is packaged with world writable permissions (0100777)
|
|
|
|
chmod 644 %{buildroot}%{_libdir}/%{name}/Ghidra/Features/FileFormats/lib/*.jar
|
|
|
|
|
|
|
|
mkdir %{buildroot}%{_bindir}
|
|
|
|
ln -s %{_libdir}/%{name}/ghidraRun %{buildroot}%{_bindir}/%{name}
|
2022-09-11 14:11:28 +00:00
|
|
|
ln -s %{_libdir}/%{name}/support/analyzeHeadless %{buildroot}%{_bindir}
|
2025-06-29 06:56:24 +00:00
|
|
|
%ifarch aarch64
|
|
|
|
ln -s %{_libdir}/%{name}/Ghidra/Features/Decompiler/os/linux_arm_64/decompile %{buildroot}%{_bindir}
|
|
|
|
ln -s %{_libdir}/%{name}/Ghidra/Features/Decompiler/os/linux_arm_64/sleigh %{buildroot}%{_bindir}
|
|
|
|
%else
|
2022-09-11 16:55:45 +00:00
|
|
|
ln -s %{_libdir}/%{name}/Ghidra/Features/Decompiler/os/linux_x86_64/decompile %{buildroot}%{_bindir}
|
|
|
|
ln -s %{_libdir}/%{name}/Ghidra/Features/Decompiler/os/linux_x86_64/sleigh %{buildroot}%{_bindir}
|
2025-06-29 06:56:24 +00:00
|
|
|
%endif
|
2020-03-31 08:06:42 +00:00
|
|
|
|
2023-07-06 16:38:37 +00:00
|
|
|
# cspec docs
|
2023-07-06 12:03:09 +00:00
|
|
|
(cd Ghidra/Features/Decompiler/src/main/doc;
|
2023-07-06 16:38:37 +00:00
|
|
|
sed -i 's|http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl|/usr/share/xml/docbook/stylesheet/nwalsh5/1.79.2/html/chunk.xsl|' cspec_html.xsl;
|
|
|
|
xsltproc cspec_html.xsl cspec.xml;
|
2023-07-06 12:03:09 +00:00
|
|
|
mkdir -p %{buildroot}%{_docdir}/%{name}/cspec;
|
2023-07-06 16:38:37 +00:00
|
|
|
mv index.html cspec*.html %{buildroot}%{_docdir}/%{name}/cspec)
|
|
|
|
|
|
|
|
# Decompiler docs
|
|
|
|
cp -a Ghidra/Features/Decompiler/build/resources/main/help/topics/DecompilePlugin %{buildroot}%{_docdir}/%{name}
|
|
|
|
cp Ghidra/Features/Decompiler/build/resources/main/images/decompileFunction.gif %{buildroot}%{_docdir}/%{name}/DecompilePlugin/images
|
|
|
|
cp Ghidra/Framework/Project/build/resources/main/images/* %{buildroot}%{_docdir}/%{name}/DecompilePlugin/images
|
|
|
|
cp Ghidra/Features/Base/build/resources/main/images/* %{buildroot}%{_docdir}/%{name}/DecompilePlugin/images || true
|
|
|
|
cp Ghidra/Framework/Gui/build/resources/main/images/* %{buildroot}%{_docdir}/%{name}/DecompilePlugin/images
|
2023-07-06 12:03:09 +00:00
|
|
|
|
2023-07-06 16:38:37 +00:00
|
|
|
# (Windows) FunctionId docs
|
2023-07-06 12:03:09 +00:00
|
|
|
(cd Ghidra/Features/FunctionID/src/main/doc;
|
|
|
|
mkdir -p %{buildroot}%{_docdir}/%{name}/functionid;
|
|
|
|
cp *.html %{buildroot}%{_docdir}/%{name}/functionid)
|
|
|
|
|
|
|
|
cp DevGuide.md %{buildroot}%{_docdir}/%{name}
|
2025-06-29 06:56:24 +00:00
|
|
|
cp Ghidra/RuntimeScripts/Common/support/analyzeHeadlessREADME.md %{buildroot}%{_docdir}/%{name}
|
2023-07-06 12:03:09 +00:00
|
|
|
|
2024-01-15 10:07:39 +00:00
|
|
|
# executable-docs (Badness: 900)
|
2025-02-16 11:45:38 +00:00
|
|
|
chmod -x GhidraDocs/GhidraClass/BSim/*.*
|
2023-07-06 12:03:09 +00:00
|
|
|
cp -a GhidraDocs/* %{buildroot}%{_docdir}/%{name}
|
|
|
|
rm -f %{buildroot}%{_docdir}/%{name}/*.zip
|
|
|
|
|
|
|
|
cp -a build/tmp/javadoc %{buildroot}%{_docdir}/%{name}
|
|
|
|
|
|
|
|
%fdupes %{buildroot}%{_docdir}/%{name}
|
|
|
|
|
2020-03-31 08:06:42 +00:00
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
2022-07-09 22:14:04 +00:00
|
|
|
%license LICENSE
|
|
|
|
%doc README.md
|
|
|
|
%doc NOTICE
|
|
|
|
%doc DISCLAIMER.md
|
2020-03-31 08:06:42 +00:00
|
|
|
%dir %{_libdir}/%{name}
|
|
|
|
%{_libdir}/%{name}
|
|
|
|
%{_bindir}/*
|
2021-04-21 13:59:53 +00:00
|
|
|
%{_datadir}/applications/%{name}.desktop
|
2025-06-29 06:56:24 +00:00
|
|
|
%dir %{_iconsdir}/hicolor
|
|
|
|
%dir %{_iconsdir}/hicolor/*
|
|
|
|
%{_iconsdir}/hicolor/*/GhidraIcon.png
|
2020-03-31 08:06:42 +00:00
|
|
|
|
2022-07-09 22:14:04 +00:00
|
|
|
%files apidocs
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%license LICENSE
|
|
|
|
%dir %{_docdir}/%{name}
|
|
|
|
%{_docdir}/%{name}/api
|
|
|
|
|
2023-07-06 12:03:09 +00:00
|
|
|
%files javadocs
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%license LICENSE
|
|
|
|
%dir %{_docdir}/%{name}
|
|
|
|
%{_docdir}/%{name}/javadoc
|
|
|
|
|
|
|
|
%files doc
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%license LICENSE
|
|
|
|
%dir %{_docdir}/ghidra
|
|
|
|
%exclude %{_docdir}/ghidra/DISCLAIMER.md
|
|
|
|
%exclude %{_docdir}/ghidra/NOTICE
|
|
|
|
%exclude %{_docdir}/ghidra/README.md
|
|
|
|
%exclude %{_docdir}/ghidra/api
|
|
|
|
%exclude %{_docdir}/ghidra/javadoc
|
|
|
|
%{_docdir}/ghidra/*
|
|
|
|
|
2020-03-31 08:06:42 +00:00
|
|
|
%changelog
|