diff options
author | Florian Schmaus <flow@gentoo.org> | 2023-01-06 14:31:15 +0100 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2023-01-06 14:32:04 +0100 |
commit | f322207f9cd59fb003842a2cd3417327c69493d2 (patch) | |
tree | 95536a212dac85485d32ca247b46201e3aa0e925 | |
parent | gradle.eclass: update (diff) | |
download | java-f322207f9cd59fb003842a2cd3417327c69493d2.tar.gz java-f322207f9cd59fb003842a2cd3417327c69493d2.tar.bz2 java-f322207f9cd59fb003842a2cd3417327c69493d2.zip |
dev-util/ghidra: import from ::pentoo, modified to use gradle.eclass
Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r-- | dev-util/ghidra/Manifest | 8 | ||||
-rw-r--r-- | dev-util/ghidra/files/repos.gradle | 13 | ||||
-rw-r--r-- | dev-util/ghidra/ghidra-10.2.2-r2.ebuild | 116 | ||||
-rw-r--r-- | dev-util/ghidra/metadata.xml | 8 |
4 files changed, 145 insertions, 0 deletions
diff --git a/dev-util/ghidra/Manifest b/dev-util/ghidra/Manifest new file mode 100644 index 00000000..17f5c145 --- /dev/null +++ b/dev-util/ghidra/Manifest @@ -0,0 +1,8 @@ +DIST AXMLPrinter2.jar 24552 BLAKE2B 3ff09da948c2962919927ad35f8d38a13391c763a83962f8fdce90ec4720430b00be891f68fc149f62180ddf5f5e818af4e6b6a153d1a55e871f181e930d2b7b SHA512 c1168ec913f1fbb0675915d4fd865ec9a8e8573f6c8aedcb6e68166f61f11aeaececc7548d54d78134843c0102c57d6350973f6d3027d0ffdae52a5c57a7f601 +DIST Ghidra_10.2.2_build.tar.gz 65081499 BLAKE2B 77c95f4df445dc7ff4ba2409173cd27f50629f5367a22ffd4033a2531c689a4727a847459f8a2043ef87ef844a58eb0cc84fa96012c163a7ce7c506a752c22b5 SHA512 443cc6a3b5883c612d81883399dc32147245a4a7b501d4ddd1a559874e22d6ff074530d011f1994892a9f2c05eed02304f2accc61b017d7f01d1bf75c57aea0a +DIST PyDev-6.3.1.zip 24756333 BLAKE2B e9a942e0ff90b9eafbd1fa0df5429f2ff227ed140b7352a1003be04ffbc043e17bf19bd622d7fe9b958286a75ff4897c03088c1627ee62ea7b6e832752cb427e SHA512 411ed78d1057f5e9780e44169935fb8a0da17e97ce26e9a7a9fa9a251d4d3c1118e9b47dd9f7af03bde1f47180bde0d456039b65687f600026a148055311ecfa +DIST cdt-8.6.0.zip 76639241 BLAKE2B 32c724b1f6ff43132f09c544bac8b35ed3f4f5866c844810abba3a52f82a3585ae7a57430fcf5603afecbeec1f46461a831339e442ca628b77f78c319bd9fc26 SHA512 2b8bb498146aa29995e807c5b4e9d5dab0f6afe89a5ce256978b7b2c478677a0cb5a0f15913a32bd99cb7b4bb31230521f70b9c26cdef1cb983dfcea599737c0 +DIST dex-tools-2.0.zip 2362460 BLAKE2B 464f2a143f1c8720eddd4d1c7db5a6f681db1091518d915b0d7807c12d021c8a734d8980bccfd417bc60297647b33ed0b7cc1e004716804bb9e25ee99f29f8ad SHA512 c4a6c72ea09b58a44fcb8918cfada600467f10f99a02b53d2436ac68295e73c8daf9ba0a8bc7160ba1e28e87f032ee034435ebe40af35b6e2fe9fa4607581358 +DIST ghidra-dependencies-20221104.tar.gz 85678075 BLAKE2B a298b3a52137c8077f90b5d7cddba43a6437ef7906aae130158691c032c31c57be55f9f072d6a44b351b47f8fe04f397dabb24c1bd976593294a68b5d2a4fece SHA512 7dcbc5bdba0fce2e0ae0a6f41d1fbd88cb6080a97e5404f5bfce393e07165f15f0549d3254b446f5ab5352484dd32bdf54ea92f50f96e572520b10672519aeb9 +DIST hfsexplorer-0_21-bin.zip 1473278 BLAKE2B e9d2a3fae4da8046a17ce5e6828b4d1ff27da6384aac4be3864fe2c16f83bb95cb728eaeec9a42c3e1febaef98ba9357bfc3744b4950deb4b783d36e723d6cc0 SHA512 b85b4316115695acc78cc7c675c673058c05a238451562be0c6a48b2d11a28e5645a42cb62cdf063be015369df26201dfab6cf2e60f39e6468d1d53b23f94415 +DIST yajsw-stable-13.05.zip 27823454 BLAKE2B e43e6a97e356be40e776568deafeeb19e3e8b462a20e53a7456f3ce61364d3c4fe08d48f7710e6f570641618a6c75b75d98427d04d25133cdf7aa3c9f0aeee8b SHA512 ba6421fcc9d5fd5edf0b5f299914a54a8e3d8cbe79b83cf9b1a4a1828eb26f32f8d04299235233581a848e274665c6d2da9b8394be1d7a824e443efd2508413c diff --git a/dev-util/ghidra/files/repos.gradle b/dev-util/ghidra/files/repos.gradle new file mode 100644 index 00000000..1b13aae4 --- /dev/null +++ b/dev-util/ghidra/files/repos.gradle @@ -0,0 +1,13 @@ +allprojects { + repositories { + flatDir name:'flat', dirs:["S_DIR/.gradle/flatRepo"] + if ('allow' == System.properties['build.network_access']) { + mavenCentral() + jcenter() + } else { + maven { + url "S_DIR/dependencies" + } + } + } +} diff --git a/dev-util/ghidra/ghidra-10.2.2-r2.ebuild b/dev-util/ghidra/ghidra-10.2.2-r2.ebuild new file mode 100644 index 00000000..64aee54f --- /dev/null +++ b/dev-util/ghidra/ghidra-10.2.2-r2.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit gradle java-pkg-2 desktop + +GRADLE_DEP_VER="20221104" + +DESCRIPTION="A software reverse engineering framework" +HOMEPAGE="https://ghidra-sre.org/" +SRC_URI="https://github.com/NationalSecurityAgency/${PN}/archive/Ghidra_${PV}_build.tar.gz + https://dev.pentoo.ch/~blshkv/distfiles/${PN}-dependencies-${GRADLE_DEP_VER}.tar.gz + https://github.com/pxb1988/dex2jar/releases/download/2.0/dex-tools-2.0.zip + https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar + https://sourceforge.net/projects/catacombae/files/HFSExplorer/0.21/hfsexplorer-0_21-bin.zip + mirror://sourceforge/yajsw/yajsw/yajsw-stable-13.05.zip + https://dev.pentoo.ch/~blshkv/distfiles/cdt-8.6.0.zip + mirror://sourceforge/project/pydev/pydev/PyDev%206.3.1/PyDev%206.3.1.zip -> PyDev-6.3.1.zip" +# run: "pentoo/scripts/gradle_dependencies.py buildGhidra" from "${S}" directory to generate dependencies +# https://www.eclipse.org/downloads/download.php?r=1&protocol=https&file=/tools/cdt/releases/8.6/cdt-8.6.0.zip + +# https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-13.05/yajsw-stable-13.05.zip/download + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64" + +#FIXME: +# * QA Notice: Files built without respecting LDFLAGS have been detected +# * Please include the following list of files in your report: +# * /usr/share/ghidra/GPL/DemanglerGnu/os/linux_x86_64/demangler_gnu_v2_24 +# * /usr/share/ghidra/GPL/DemanglerGnu/os/linux_x86_64/demangler_gnu_v2_33_1 +# * /usr/share/ghidra/Ghidra/Features/Decompiler/os/linux_x86_64/decompile +# * /usr/share/ghidra/Ghidra/Features/Decompiler/os/linux_x86_64/sleigh + +#java-pkg-2 sets java based on RDEPEND so the java slot in rdepend is used to build +RDEPEND="virtual/jre:17" +DEPEND=" + virtual/jdk:17 + sys-devel/bison + dev-java/jflex + app-arch/unzip +" +BDEPEND=">=dev-java/gradle-bin-7.3:*" + +EGRADLE_MIN="7.3" + +S="${WORKDIR}/ghidra-Ghidra_${PV}_build" + +src_unpack() { + # https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md + unpack ${A} + mkdir -p "${S}/.gradle/flatRepo" || die "(1) mkdir failed" + cd "${S}/.gradle" + + unpack dex-tools-2.0.zip + cp dex2jar-2.0/lib/dex-*.jar ./flatRepo || die "(3) cp failed" + + cp "${DISTDIR}/AXMLPrinter2.jar" ./flatRepo || die "(4) cp failed" + + unpack hfsexplorer-0_21-bin.zip + cp lib/*.jar ./flatRepo || die "(5) cp failed" + + mkdir -p "${WORKDIR}"/ghidra.bin/Ghidra/Features/GhidraServer/ || die "(6) mkdir failed" +# cp "${DISTDIR}"/yajsw-stable-12.12.zip "${WORKDIR}"/ghidra.bin/Ghidra/Features/GhidraServer/ || die "(7) cp failed" + cp "${DISTDIR}"/yajsw-stable-13.05.zip "${WORKDIR}"/ghidra.bin/Ghidra/Features/GhidraServer/ || die "(7) cp failed" + + mkdir -p "${WORKDIR}"/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/ || die "(8) mkdir failed" + cp "${DISTDIR}"/PyDev-6.3.1.zip "${WORKDIR}/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/PyDev 6.3.1.zip" || die "(9) cp failed" + cp "${DISTDIR}"/cdt-8.6.0.zip "${WORKDIR}"/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/ || die "(10) cp failed" + + cd "${S}" + mv ../dependencies . +} + +src_prepare() { + default + local repos_gradle="${EGRADLE_USER_HOME}/init.d/repos.gradle" + install -D "${FILESDIR}"/repos.gradle "${repos_gradle}" || die + sed -i "s|S_DIR|${S}|g" "${repos_gradle}" || die + + #remove build date so we can unpack dist.zip later + sed -i "s|_\${rootProject.BUILD_DATE_SHORT}||g" gradle/root/distribution.gradle || die "(13) sed failed" + + #10.0 workaround + ln -s ../.gradle/flatRepo ./dependencies/flatRepo +} + +src_compile() { + egradle prepDev -x check -x test + egradle buildGhidra -x check -x test --parallel + +#build without eclipse plugin +# ${GRADLE} yajswDevUnpack -x check -x test || die +# ${GRADLE} buildNatives_linux64 -x check -x test || die +# ${GRADLE} sleighCompile -x check -x test || die +} + +src_install() { + #FIXME: it is easier to unpack existing archive for now + dodir /usr/share + unzip build/dist/ghidra_"${PV}"_DEV_linux_x86_64.zip -d "${ED}"/usr/share/ || die "unable to unpack dist zip" + mv "${ED}"/usr/share/ghidra_"${PV}"_DEV "${ED}"/usr/share/ghidra || die "mv failed" + # remove zip files which aren't needed at runtime + find "${ED}"/usr/share/ghidra -type f -name '*.zip' -exec rm -f {} + + + #fixme: add doc flag + rm -r "${ED}"/usr/share/ghidra/docs/ || die "rm failed" + dosym "${EPREFIX}"/usr/share/ghidra/ghidraRun usr/bin/ghidra + + # icon + doicon GhidraDocs/GhidraClass/Beginner/Images/GhidraLogo64.png + # desktop entry + make_desktop_entry ${PN} "Ghidra" /usr/share/pixmaps/GhidraLogo64.png "Utility" +} diff --git a/dev-util/ghidra/metadata.xml b/dev-util/ghidra/metadata.xml new file mode 100644 index 00000000..87a759d4 --- /dev/null +++ b/dev-util/ghidra/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <name>Florian Schmaus</name> + <email>flow@gentoo.org</email> + </maintainer> +</pkgmetadata> |