commit b5e45ba28097aac34eef5ebcd52a29b5fcef1caa parent e2c271d21f1b39945c79fc7509b1de923891ce17 Author: parazyd <parazyd@dyne.org> Date: Sat, 7 Mar 2020 23:41:40 +0100 dev-util/ghidra: Add 9.1.2 Diffstat:
A | dev-util/ghidra/Manifest | | | 8 | ++++++++ |
A | dev-util/ghidra/files/repos.gradle | | | 13 | +++++++++++++ |
A | dev-util/ghidra/ghidra-9.1.2.ebuild | | | 104 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dev-util/ghidra/metadata.xml | | | 7 | +++++++ |
4 files changed, 132 insertions(+), 0 deletions(-)
diff --git a/dev-util/ghidra/Manifest b/dev-util/ghidra/Manifest @@ -0,0 +1,8 @@ +DIST AXMLPrinter2.jar 24552 BLAKE2B 3ff09da948c2962919927ad35f8d38a13391c763a83962f8fdce90ec4720430b00be891f68fc149f62180ddf5f5e818af4e6b6a153d1a55e871f181e930d2b7b SHA512 c1168ec913f1fbb0675915d4fd865ec9a8e8573f6c8aedcb6e68166f61f11aeaececc7548d54d78134843c0102c57d6350973f6d3027d0ffdae52a5c57a7f601 +DIST Ghidra_9.1.2_build.tar.gz 59623429 BLAKE2B 43fca3f8a10efdecd6c86920920f611c8d90d5a1b4729a17eb3ae5f4ef2fea93798532b05c4213c69c54dc7d2bc3aeebe84f735021fde4aa476e158ca921b792 SHA512 48e200e11b87dc07e8381af3a8b50df509991e49bba0cf73d6494d9f606d2b61850c2ebe051092567da5098b2e298332fb01923325135037e1f2fd097ff2b22d +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-20191226.tar.gz 54723274 BLAKE2B 91cf086c4737093aecf579b264b792b30fa4465dba8753e99dbbc43be9d1e883ae728b9c42984a7c14fe42147baf92e2f5ece53021967708bc45cffd24c45231 SHA512 3d82d440b5f71b48d248c03c9bf123a3eb31e02f69fee602abb99e585a0b8b3805c9fbc762bbb3818c91ba5a40d3f875208c4609a6923a813ef15f1908d68c9e +DIST hfsexplorer-0_21-bin.zip 1473278 BLAKE2B e9d2a3fae4da8046a17ce5e6828b4d1ff27da6384aac4be3864fe2c16f83bb95cb728eaeec9a42c3e1febaef98ba9357bfc3744b4950deb4b783d36e723d6cc0 SHA512 b85b4316115695acc78cc7c675c673058c05a238451562be0c6a48b2d11a28e5645a42cb62cdf063be015369df26201dfab6cf2e60f39e6468d1d53b23f94415 +DIST yajsw-stable-12.12.zip 25051676 BLAKE2B b0deae56e2dbde49271f1a31188edba74001193071b1d12d6c000db7883489faab290f2b2dcb47a10d6fa9a447a93d319ea4a3edd864095834dba280e44eaec6 SHA512 0ff5a228ae1c5251c8ba59f9bcd9b4a199b0caaf688f6eccba42c3d227784d8f56f9164b2fad73fc173ec314340c036144123ce152fe911013df5598bd708944 diff --git a/dev-util/ghidra/files/repos.gradle 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-9.1.2.ebuild b/dev-util/ghidra/ghidra-9.1.2.ebuild @@ -0,0 +1,104 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +GRADLE_DEP_VER="20191226" + +DESCRIPTION="A software reverse engineering framework" +HOMEPAGE="https://www.nsa.gov/ghidra" +SRC_URI="https://github.com/NationalSecurityAgency/${PN}/archive/Ghidra_${PV}_build.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-12.12.zip + http://www.eclipse.org/downloads/download.php?r=1&protocol=https&file=/tools/cdt/releases/8.6/cdt-8.6.0.zip + mirror://sourceforge/project/pydev/pydev/PyDev%206.3.1/PyDev%206.3.1.zip -> PyDev-6.3.1.zip + https://dev.pentoo.ch/~blshkv/distfiles/${PN}-dependencies-${GRADLE_DEP_VER}.tar.gz" +# run: pentoo/scripts/gradle_dependencies.py from "${S}" directory to generate dependencies + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" +IUSE="" + +RDEPEND=">=virtual/jre-1.8:*" +DEPEND="${RDEPEND} + >=virtual/jdk-11:* + dev-java/gradle-bin:5.2.1 + sys-devel/bison + dev-java/jflex + app-arch/unzip" + +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" + + 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() { + sed -i 's|gradle.gradleVersion != "5.0"|gradle.gradleVersion <= "5.0"|g' build.gradle || die "(9) sed failed" + mkdir -p ".gradle/init.d" || die "(10) mkdir failed" + cp "${FILESDIR}"/repos.gradle .gradle/init.d || die "(11) cp failed" + sed -i "s|S_DIR|${S}|g" .gradle/init.d/repos.gradle || die "(12) sed failed" + #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" + + if [[ -z "$(eselect java-vm show system | grep '11')" ]]; then + eerror "JDK 11 is not installed or not selected. Please run the following:" + eerror "eselect java-vm set system <jdk-11>" + die + fi + + #9.1 workaround + ln -s ./.gradle/flatRepo ./flatRepo + + eapply_user +} + +src_compile() { + export _JAVA_OPTIONS="$_JAVA_OPTIONS -Duser.home=$HOME" + + GRADLE="gradle-5.2.1 --gradle-user-home .gradle --console rich --no-daemon" + GRADLE="${GRADLE} --offline" + + unset TERM + ${GRADLE} prepDev -x check -x test || die + ${GRADLE} buildGhidra -x check -x test || die +#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() { + #it is easier to unpack existing archive + dodir /usr/share + unzip build/dist/ghidra_9.1_DEV_linux64.zip -d "${ED}"/usr/share/ || die "unable to unpack dist zip" + mv "${ED}"/usr/share/ghidra_9.1_DEV "${ED}"/usr/share/ghidra || die "mv failed" + + #fixme: add doc flag + rm -r "${ED}"/usr/share/ghidra/docs/ || die "rm failed" + dosym "${EPREFIX}"/usr/share/ghidra/ghidraRun /usr/bin/ghidra +} diff --git a/dev-util/ghidra/metadata.xml b/dev-util/ghidra/metadata.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="person"> +<email>parazyd@dyne.org</email> +</maintainer> +</pkgmetadata>