# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{11..14} )

# Generated by scripts/gradle-deps.py from one online build's Gradle cache
GRADLE_DEPS="
	biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0:biz.aQute.bnd.annotation-7.1.0.jar
	biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0:biz.aQute.bnd.annotation-7.1.0.pom
	biz.aQute.bnd:biz.aQute.bnd.util:7.0.0:biz.aQute.bnd.util-7.0.0.jar
	biz.aQute.bnd:biz.aQute.bnd.util:7.0.0:biz.aQute.bnd.util-7.0.0.pom
	biz.aQute.bnd:biz.aQute.bndlib:7.0.0:biz.aQute.bndlib-7.0.0.jar
	biz.aQute.bnd:biz.aQute.bndlib:7.0.0:biz.aQute.bndlib-7.0.0.pom
	com.beust:jcommander:1.64:jcommander-1.64.jar
	com.beust:jcommander:1.64:jcommander-1.64.pom
	com.fasterxml:oss-parent:69:oss-parent-69.pom
	com.fasterxml.jackson:jackson-bom:2.19.2:jackson-bom-2.19.2.pom
	com.fasterxml.jackson:jackson-parent:2.19.3:jackson-parent-2.19.3.pom
	com.formdev:flatlaf:3.5.4:flatlaf-3.5.4.jar
	com.formdev:flatlaf:3.5.4:flatlaf-3.5.4.module
	com.formdev:flatlaf:3.5.4:flatlaf-3.5.4.pom
	com.github.rotty3000:phidias:0.3.7:phidias-0.3.7.jar
	com.github.rotty3000:phidias:0.3.7:phidias-0.3.7.pom
	com.github.tomnelson:jungrapht-layout:1.4:jungrapht-layout-1.4.jar
	com.github.tomnelson:jungrapht-layout:1.4:jungrapht-layout-1.4.pom
	com.github.tomnelson:jungrapht-visualization:1.4:jungrapht-visualization-1.4.jar
	com.github.tomnelson:jungrapht-visualization:1.4:jungrapht-visualization-1.4.pom
	com.github.tomnelson:jungrapht-visualization-parent:1.4:jungrapht-visualization-parent-1.4.pom
	com.google:google:5:google-5.pom
	com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar
	com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.pom
	com.google.code.gson:gson:2.13.2:gson-2.13.2.jar
	com.google.code.gson:gson:2.13.2:gson-2.13.2.pom
	com.google.code.gson:gson-parent:2.13.2:gson-parent-2.13.2.pom
	com.google.errorprone:error_prone_annotations:2.2.0:error_prone_annotations-2.2.0.pom
	com.google.errorprone:error_prone_annotations:2.21.1:error_prone_annotations-2.21.1.pom
	com.google.errorprone:error_prone_annotations:2.38.0:error_prone_annotations-2.38.0.pom
	com.google.errorprone:error_prone_annotations:2.41.0:error_prone_annotations-2.41.0.jar
	com.google.errorprone:error_prone_annotations:2.41.0:error_prone_annotations-2.41.0.pom
	com.google.errorprone:error_prone_parent:2.2.0:error_prone_parent-2.2.0.pom
	com.google.errorprone:error_prone_parent:2.21.1:error_prone_parent-2.21.1.pom
	com.google.errorprone:error_prone_parent:2.38.0:error_prone_parent-2.38.0.pom
	com.google.errorprone:error_prone_parent:2.41.0:error_prone_parent-2.41.0.pom
	com.google.guava:failureaccess:1.0.1:failureaccess-1.0.1.jar
	com.google.guava:failureaccess:1.0.1:failureaccess-1.0.1.pom
	com.google.guava:guava:19.0:guava-19.0.pom
	com.google.guava:guava:27.1-android:guava-27.1-android.pom
	com.google.guava:guava:32.1.3-jre:guava-32.1.3-jre.jar
	com.google.guava:guava:32.1.3-jre:guava-32.1.3-jre.module
	com.google.guava:guava:32.1.3-jre:guava-32.1.3-jre.pom
	com.google.guava:guava-parent:19.0:guava-parent-19.0.pom
	com.google.guava:guava-parent:26.0-android:guava-parent-26.0-android.pom
	com.google.guava:guava-parent:27.1-android:guava-parent-27.1-android.pom
	com.google.guava:guava-parent:32.1.3-jre:guava-parent-32.1.3-jre.pom
	com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava:listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
	com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava:listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.pom
	com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.pom
	com.google.j2objc:j2objc-annotations:2.8:j2objc-annotations-2.8.jar
	com.google.j2objc:j2objc-annotations:2.8:j2objc-annotations-2.8.pom
	com.google.protobuf:protobuf-bom:3.25.5:protobuf-bom-3.25.5.pom
	com.google.protobuf:protobuf-bom:3.25.6:protobuf-bom-3.25.6.pom
	com.google.protobuf:protobuf-bom:4.31.0:protobuf-bom-4.31.0.pom
	com.google.protobuf:protobuf-java:3.25.5:protobuf-java-3.25.5.pom
	com.google.protobuf:protobuf-java:3.25.6:protobuf-java-3.25.6.jar
	com.google.protobuf:protobuf-java:3.25.6:protobuf-java-3.25.6.pom
	com.google.protobuf:protobuf-java:4.31.0:protobuf-java-4.31.0.jar
	com.google.protobuf:protobuf-java:4.31.0:protobuf-java-4.31.0.pom
	com.google.protobuf:protobuf-parent:3.25.5:protobuf-parent-3.25.5.pom
	com.google.protobuf:protobuf-parent:3.25.6:protobuf-parent-3.25.6.pom
	com.google.protobuf:protobuf-parent:4.31.0:protobuf-parent-4.31.0.pom
	com.google.protobuf:protoc:4.31.0:protoc-4.31.0-linux-x86_64.exe
	com.google.protobuf:protoc:4.31.0:protoc-4.31.0.pom
	com.h2database:h2:2.2.220:h2-2.2.220.jar
	com.h2database:h2:2.2.220:h2-2.2.220.pom
	com.opencsv:opencsv:5.9:opencsv-5.9.jar
	com.opencsv:opencsv:5.9:opencsv-5.9.pom
	com.oracle.labs.olcut:olcut:5.3.1:olcut-5.3.1.pom
	com.oracle.labs.olcut:olcut-config-protobuf:5.3.1:olcut-config-protobuf-5.3.1.jar
	com.oracle.labs.olcut:olcut-config-protobuf:5.3.1:olcut-config-protobuf-5.3.1.pom
	com.oracle.labs.olcut:olcut-core:5.3.1:olcut-core-5.3.1.jar
	com.oracle.labs.olcut:olcut-core:5.3.1:olcut-core-5.3.1.pom
	commons-beanutils:commons-beanutils:1.9.4:commons-beanutils-1.9.4.jar
	commons-beanutils:commons-beanutils:1.9.4:commons-beanutils-1.9.4.pom
	commons-codec:commons-codec:1.18.0:commons-codec-1.18.0.jar
	commons-codec:commons-codec:1.18.0:commons-codec-1.18.0.pom
	commons-collections:commons-collections:3.2.2:commons-collections-3.2.2.jar
	commons-collections:commons-collections:3.2.2:commons-collections-3.2.2.pom
	commons-io:commons-io:2.19.0:commons-io-2.19.0.jar
	commons-io:commons-io:2.19.0:commons-io-2.19.0.pom
	commons-io:commons-io:2.8.0:commons-io-2.8.0.pom
	commons-logging:commons-logging:1.2:commons-logging-1.2.jar
	commons-logging:commons-logging:1.2:commons-logging-1.2.pom
	de.femtopedia.dex2jar:d2j-base-cmd:2.4.24:d2j-base-cmd-2.4.24.jar
	de.femtopedia.dex2jar:d2j-base-cmd:2.4.24:d2j-base-cmd-2.4.24.module
	de.femtopedia.dex2jar:d2j-base-cmd:2.4.24:d2j-base-cmd-2.4.24.pom
	de.femtopedia.dex2jar:d2j-external:2.4.24:d2j-external-2.4.24.jar
	de.femtopedia.dex2jar:d2j-external:2.4.24:d2j-external-2.4.24.pom
	de.femtopedia.dex2jar:dex-ir:2.4.24:dex-ir-2.4.24.jar
	de.femtopedia.dex2jar:dex-ir:2.4.24:dex-ir-2.4.24.module
	de.femtopedia.dex2jar:dex-ir:2.4.24:dex-ir-2.4.24.pom
	de.femtopedia.dex2jar:dex-reader:2.4.24:dex-reader-2.4.24.jar
	de.femtopedia.dex2jar:dex-reader:2.4.24:dex-reader-2.4.24.module
	de.femtopedia.dex2jar:dex-reader:2.4.24:dex-reader-2.4.24.pom
	de.femtopedia.dex2jar:dex-reader-api:2.4.24:dex-reader-api-2.4.24.jar
	de.femtopedia.dex2jar:dex-reader-api:2.4.24:dex-reader-api-2.4.24.module
	de.femtopedia.dex2jar:dex-reader-api:2.4.24:dex-reader-api-2.4.24.pom
	de.femtopedia.dex2jar:dex-translator:2.4.24:dex-translator-2.4.24.jar
	de.femtopedia.dex2jar:dex-translator:2.4.24:dex-translator-2.4.24.module
	de.femtopedia.dex2jar:dex-translator:2.4.24:dex-translator-2.4.24.pom
	io.github.lisa-analyzer:lisa-analyses:0.1:lisa-analyses-0.1.jar
	io.github.lisa-analyzer:lisa-analyses:0.1:lisa-analyses-0.1.module
	io.github.lisa-analyzer:lisa-analyses:0.1:lisa-analyses-0.1.pom
	io.github.lisa-analyzer:lisa-program:0.1:lisa-program-0.1.jar
	io.github.lisa-analyzer:lisa-program:0.1:lisa-program-0.1.module
	io.github.lisa-analyzer:lisa-program:0.1:lisa-program-0.1.pom
	io.github.lisa-analyzer:lisa-sdk:0.1:lisa-sdk-0.1.jar
	io.github.lisa-analyzer:lisa-sdk:0.1:lisa-sdk-0.1.module
	io.github.lisa-analyzer:lisa-sdk:0.1:lisa-sdk-0.1.pom
	jakarta.platform:jakarta.jakartaee-bom:9.1.0:jakarta.jakartaee-bom-9.1.0.pom
	jakarta.platform:jakartaee-api-parent:9.1.0:jakartaee-api-parent-9.1.0.pom
	javax.help:javahelp:2.0.05:javahelp-2.0.05.jar
	javax.help:javahelp:2.0.05:javahelp-2.0.05.pom
	joda-time:joda-time:2.14.0:joda-time-2.14.0.jar
	joda-time:joda-time:2.14.0:joda-time-2.14.0.pom
	junit:junit:4.13.2:junit-4.13.2.jar
	junit:junit:4.13.2:junit-4.13.2.pom
	msv:isorelax:20050913:isorelax-20050913.jar
	msv:isorelax:20050913:isorelax-20050913.pom
	msv:msv:20050913:msv-20050913.jar
	msv:msv:20050913:msv-20050913.pom
	msv:relaxngDatatype:20050913:relaxngDatatype-20050913.jar
	msv:relaxngDatatype:20050913:relaxngDatatype-20050913.pom
	msv:xsdlib:20050913:xsdlib-20050913.jar
	msv:xsdlib:20050913:xsdlib-20050913.pom
	net.java.dev.javacc:javacc:5.0:javacc-5.0.jar
	net.java.dev.javacc:javacc:5.0:javacc-5.0.pom
	net.java.dev.jna:jna:5.14.0:jna-5.14.0.jar
	net.java.dev.jna:jna:5.14.0:jna-5.14.0.pom
	net.java.dev.jna:jna-platform:5.14.0:jna-platform-5.14.0.jar
	net.java.dev.jna:jna-platform:5.14.0:jna-platform-5.14.0.pom
	net.java.dev.timingframework:timingframework:1.0:timingframework-1.0.jar
	net.java.dev.timingframework:timingframework:1.0:timingframework-1.0.pom
	net.sf.jung:jung-algorithms:2.1.1:jung-algorithms-2.1.1.jar
	net.sf.jung:jung-algorithms:2.1.1:jung-algorithms-2.1.1.pom
	net.sf.jung:jung-api:2.1.1:jung-api-2.1.1.jar
	net.sf.jung:jung-api:2.1.1:jung-api-2.1.1.pom
	net.sf.jung:jung-graph-impl:2.1.1:jung-graph-impl-2.1.1.jar
	net.sf.jung:jung-graph-impl:2.1.1:jung-graph-impl-2.1.1.pom
	net.sf.jung:jung-parent:2.1.1:jung-parent-2.1.1.pom
	net.sf.jung:jung-visualization:2.1.1:jung-visualization-2.1.1.jar
	net.sf.jung:jung-visualization:2.1.1:jung-visualization-2.1.1.pom
	net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01:sevenzipjbinding-16.02-2.01.jar
	net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01:sevenzipjbinding-16.02-2.01.pom
	net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:16.02-2.01:sevenzipjbinding-all-platforms-16.02-2.01.jar
	net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:16.02-2.01:sevenzipjbinding-all-platforms-16.02-2.01.pom
	org.antlr:ST4:4.0.8:ST4-4.0.8.jar
	org.antlr:ST4:4.0.8:ST4-4.0.8.pom
	org.antlr:antlr:3.5.2:antlr-3.5.2.jar
	org.antlr:antlr:3.5.2:antlr-3.5.2.pom
	org.antlr:antlr-master:3.5.2:antlr-master-3.5.2.pom
	org.antlr:antlr-runtime:3.5.2:antlr-runtime-3.5.2.jar
	org.antlr:antlr-runtime:3.5.2:antlr-runtime-3.5.2.pom
	org.apache:apache:13:apache-13.pom
	org.apache:apache:16:apache-16.pom
	org.apache:apache:19:apache-19.pom
	org.apache:apache:21:apache-21.pom
	org.apache:apache:23:apache-23.pom
	org.apache:apache:27:apache-27.pom
	org.apache:apache:30:apache-30.pom
	org.apache:apache:33:apache-33.pom
	org.apache:apache:35:apache-35.pom
	org.apache:apache:39:apache-39.pom
	org.apache.commons:commons-collections4:4.4:commons-collections4-4.4.pom
	org.apache.commons:commons-collections4:4.6.0:commons-collections4-4.6.0.jar
	org.apache.commons:commons-collections4:4.6.0:commons-collections4-4.6.0.pom
	org.apache.commons:commons-compress:1.27.1:commons-compress-1.27.1.jar
	org.apache.commons:commons-compress:1.27.1:commons-compress-1.27.1.pom
	org.apache.commons:commons-dbcp2:2.9.0:commons-dbcp2-2.9.0.jar
	org.apache.commons:commons-dbcp2:2.9.0:commons-dbcp2-2.9.0.pom
	org.apache.commons:commons-lang3:3.12.0:commons-lang3-3.12.0.pom
	org.apache.commons:commons-lang3:3.20.0:commons-lang3-3.20.0.jar
	org.apache.commons:commons-lang3:3.20.0:commons-lang3-3.20.0.pom
	org.apache.commons:commons-lang3:3.9:commons-lang3-3.9.pom
	org.apache.commons:commons-parent:103:commons-parent-103.pom
	org.apache.commons:commons-parent:34:commons-parent-34.pom
	org.apache.commons:commons-parent:39:commons-parent-39.pom
	org.apache.commons:commons-parent:47:commons-parent-47.pom
	org.apache.commons:commons-parent:48:commons-parent-48.pom
	org.apache.commons:commons-parent:52:commons-parent-52.pom
	org.apache.commons:commons-parent:54:commons-parent-54.pom
	org.apache.commons:commons-parent:64:commons-parent-64.pom
	org.apache.commons:commons-parent:72:commons-parent-72.pom
	org.apache.commons:commons-parent:79:commons-parent-79.pom
	org.apache.commons:commons-parent:81:commons-parent-81.pom
	org.apache.commons:commons-parent:92:commons-parent-92.pom
	org.apache.commons:commons-pool2:2.11.1:commons-pool2-2.11.1.jar
	org.apache.commons:commons-pool2:2.11.1:commons-pool2-2.11.1.pom
	org.apache.commons:commons-text:1.10.0:commons-text-1.10.0.jar
	org.apache.commons:commons-text:1.10.0:commons-text-1.10.0.pom
	org.apache.commons:commons-text:1.11.0:commons-text-1.11.0.jar
	org.apache.commons:commons-text:1.11.0:commons-text-1.11.0.pom
	org.apache.commons:commons-text:1.8:commons-text-1.8.pom
	org.apache.felix:felix-parent:6:felix-parent-6.pom
	org.apache.felix:org.apache.felix.framework:7.0.5:org.apache.felix.framework-7.0.5.jar
	org.apache.felix:org.apache.felix.framework:7.0.5:org.apache.felix.framework-7.0.5.pom
	org.apache.groovy:groovy-bom:4.0.27:groovy-bom-4.0.27.module
	org.apache.groovy:groovy-bom:4.0.27:groovy-bom-4.0.27.pom
	org.apache.logging.log4j:log4j:2.26.1:log4j-2.26.1.pom
	org.apache.logging.log4j:log4j-api:2.26.1:log4j-api-2.26.1.jar
	org.apache.logging.log4j:log4j-api:2.26.1:log4j-api-2.26.1.module
	org.apache.logging.log4j:log4j-api:2.26.1:log4j-api-2.26.1.pom
	org.apache.logging.log4j:log4j-bom:2.26.1:log4j-bom-2.26.1.pom
	org.apache.logging.log4j:log4j-core:2.26.1:log4j-core-2.26.1.jar
	org.apache.logging.log4j:log4j-core:2.26.1:log4j-core-2.26.1.module
	org.apache.logging.log4j:log4j-core:2.26.1:log4j-core-2.26.1.pom
	org.bouncycastle:bcpkix-jdk18on:1.84:bcpkix-jdk18on-1.84.jar
	org.bouncycastle:bcpkix-jdk18on:1.84:bcpkix-jdk18on-1.84.pom
	org.bouncycastle:bcprov-jdk18on:1.84:bcprov-jdk18on-1.84.jar
	org.bouncycastle:bcprov-jdk18on:1.84:bcprov-jdk18on-1.84.pom
	org.bouncycastle:bcutil-jdk18on:1.84:bcutil-jdk18on-1.84.jar
	org.bouncycastle:bcutil-jdk18on:1.84:bcutil-jdk18on-1.84.pom
	org.checkerframework:checker-compat-qual:2.5.2:checker-compat-qual-2.5.2.pom
	org.checkerframework:checker-qual:3.37.0:checker-qual-3.37.0.jar
	org.checkerframework:checker-qual:3.37.0:checker-qual-3.37.0.module
	org.checkerframework:checker-qual:3.37.0:checker-qual-3.37.0.pom
	org.checkerframework:checker-qual:3.55.1:checker-qual-3.55.1.jar
	org.checkerframework:checker-qual:3.55.1:checker-qual-3.55.1.module
	org.checkerframework:checker-qual:3.55.1:checker-qual-3.55.1.pom
	org.codehaus:codehaus-parent:3:codehaus-parent-3.pom
	org.codehaus.mojo:animal-sniffer-annotations:1.17:animal-sniffer-annotations-1.17.pom
	org.codehaus.mojo:animal-sniffer-annotations:1.9:animal-sniffer-annotations-1.9.jar
	org.codehaus.mojo:animal-sniffer-annotations:1.9:animal-sniffer-annotations-1.9.pom
	org.codehaus.mojo:animal-sniffer-parent:1.17:animal-sniffer-parent-1.17.pom
	org.codehaus.mojo:animal-sniffer-parent:1.9:animal-sniffer-parent-1.9.pom
	org.codehaus.mojo:mojo-parent:28:mojo-parent-28.pom
	org.codehaus.mojo:mojo-parent:40:mojo-parent-40.pom
	org.commonmark:commonmark:0.23.0:commonmark-0.23.0.jar
	org.commonmark:commonmark:0.23.0:commonmark-0.23.0.pom
	org.commonmark:commonmark-ext-footnotes:0.23.0:commonmark-ext-footnotes-0.23.0.jar
	org.commonmark:commonmark-ext-footnotes:0.23.0:commonmark-ext-footnotes-0.23.0.pom
	org.commonmark:commonmark-ext-gfm-tables:0.23.0:commonmark-ext-gfm-tables-0.23.0.jar
	org.commonmark:commonmark-ext-gfm-tables:0.23.0:commonmark-ext-gfm-tables-0.23.0.pom
	org.commonmark:commonmark-ext-heading-anchor:0.23.0:commonmark-ext-heading-anchor-0.23.0.jar
	org.commonmark:commonmark-ext-heading-anchor:0.23.0:commonmark-ext-heading-anchor-0.23.0.pom
	org.commonmark:commonmark-parent:0.23.0:commonmark-parent-0.23.0.pom
	org.eclipse.ee4j:project:1.0.7:project-1.0.7.pom
	org.fusesource:fusesource-pom:1.12:fusesource-pom-1.12.pom
	org.fusesource.jansi:jansi:2.4.1:jansi-2.4.1.jar
	org.fusesource.jansi:jansi:2.4.1:jansi-2.4.1.pom
	org.hamcrest:hamcrest:2.2:hamcrest-2.2.jar
	org.hamcrest:hamcrest:2.2:hamcrest-2.2.pom
	org.hamcrest:hamcrest-core:1.3:hamcrest-core-1.3.jar
	org.hamcrest:hamcrest-core:1.3:hamcrest-core-1.3.pom
	org.hamcrest:hamcrest-parent:1.3:hamcrest-parent-1.3.pom
	org.jacoco:org.jacoco.agent:0.8.14:org.jacoco.agent-0.8.14.jar
	org.jacoco:org.jacoco.agent:0.8.14:org.jacoco.agent-0.8.14.pom
	org.jacoco:org.jacoco.ant:0.8.14:org.jacoco.ant-0.8.14.jar
	org.jacoco:org.jacoco.ant:0.8.14:org.jacoco.ant-0.8.14.pom
	org.jacoco:org.jacoco.build:0.8.14:org.jacoco.build-0.8.14.pom
	org.jacoco:org.jacoco.core:0.8.14:org.jacoco.core-0.8.14.jar
	org.jacoco:org.jacoco.core:0.8.14:org.jacoco.core-0.8.14.pom
	org.jacoco:org.jacoco.report:0.8.14:org.jacoco.report-0.8.14.jar
	org.jacoco:org.jacoco.report:0.8.14:org.jacoco.report-0.8.14.pom
	org.jdom:jdom2:2.0.6.1:jdom2-2.0.6.1.jar
	org.jdom:jdom2:2.0.6.1:jdom2-2.0.6.1.pom
	org.jgrapht:jgrapht:1.5.1:jgrapht-1.5.1.pom
	org.jgrapht:jgrapht-core:1.5.1:jgrapht-core-1.5.1.jar
	org.jgrapht:jgrapht-core:1.5.1:jgrapht-core-1.5.1.pom
	org.jgrapht:jgrapht-io:1.5.1:jgrapht-io-1.5.1.jar
	org.jgrapht:jgrapht-io:1.5.1:jgrapht-io-1.5.1.pom
	org.jheaps:jheaps:0.13:jheaps-0.13.jar
	org.jheaps:jheaps:0.13:jheaps-0.13.pom
	org.jline:jline-builtins:3.27.1:jline-builtins-3.27.1.jar
	org.jline:jline-builtins:3.27.1:jline-builtins-3.27.1.pom
	org.jline:jline-native:3.27.1:jline-native-3.27.1.jar
	org.jline:jline-native:3.27.1:jline-native-3.27.1.pom
	org.jline:jline-parent:3.27.1:jline-parent-3.27.1.pom
	org.jline:jline-reader:3.27.1:jline-reader-3.27.1.jar
	org.jline:jline-reader:3.27.1:jline-reader-3.27.1.pom
	org.jline:jline-style:3.27.1:jline-style-3.27.1.jar
	org.jline:jline-style:3.27.1:jline-style-3.27.1.pom
	org.jline:jline-terminal:3.27.1:jline-terminal-3.27.1.jar
	org.jline:jline-terminal:3.27.1:jline-terminal-3.27.1.pom
	org.jline:jline-terminal-jansi:3.27.1:jline-terminal-jansi-3.27.1.jar
	org.jline:jline-terminal-jansi:3.27.1:jline-terminal-jansi-3.27.1.pom
	org.jspecify:jspecify:1.0.0:jspecify-1.0.0.jar
	org.jspecify:jspecify:1.0.0:jspecify-1.0.0.module
	org.jspecify:jspecify:1.0.0:jspecify-1.0.0.pom
	org.junit:junit-bom:5.10.0:junit-bom-5.10.0.module
	org.junit:junit-bom:5.10.0:junit-bom-5.10.0.pom
	org.junit:junit-bom:5.11.0-M2:junit-bom-5.11.0-M2.module
	org.junit:junit-bom:5.11.0-M2:junit-bom-5.11.0-M2.pom
	org.junit:junit-bom:5.11.4:junit-bom-5.11.4.module
	org.junit:junit-bom:5.11.4:junit-bom-5.11.4.pom
	org.junit:junit-bom:5.13.4:junit-bom-5.13.4.module
	org.junit:junit-bom:5.13.4:junit-bom-5.13.4.pom
	org.junit:junit-bom:5.14.3:junit-bom-5.14.3.module
	org.junit:junit-bom:5.14.3:junit-bom-5.14.3.pom
	org.junit:junit-bom:5.7.1:junit-bom-5.7.1.module
	org.junit:junit-bom:5.7.1:junit-bom-5.7.1.pom
	org.junit:junit-bom:5.8.0-M1:junit-bom-5.8.0-M1.module
	org.junit:junit-bom:5.8.0-M1:junit-bom-5.8.0-M1.pom
	org.junit:junit-bom:5.9.0:junit-bom-5.9.0.module
	org.junit:junit-bom:5.9.0:junit-bom-5.9.0.pom
	org.junit:junit-bom:5.9.1:junit-bom-5.9.1.module
	org.junit:junit-bom:5.9.1:junit-bom-5.9.1.pom
	org.mockito:mockito-bom:4.11.0:mockito-bom-4.11.0.pom
	org.osgi:org.osgi.annotation.bundle:2.0.0:org.osgi.annotation.bundle-2.0.0.jar
	org.osgi:org.osgi.annotation.bundle:2.0.0:org.osgi.annotation.bundle-2.0.0.pom
	org.osgi:org.osgi.annotation.versioning:1.1.2:org.osgi.annotation.versioning-1.1.2.jar
	org.osgi:org.osgi.annotation.versioning:1.1.2:org.osgi.annotation.versioning-1.1.2.pom
	org.osgi:org.osgi.core:5.0.0:org.osgi.core-5.0.0.jar
	org.osgi:org.osgi.core:5.0.0:org.osgi.core-5.0.0.pom
	org.osgi:org.osgi.resource:1.0.0:org.osgi.resource-1.0.0.jar
	org.osgi:org.osgi.resource:1.0.0:org.osgi.resource-1.0.0.pom
	org.osgi:org.osgi.service.serviceloader:1.0.0:org.osgi.service.serviceloader-1.0.0.jar
	org.osgi:org.osgi.service.serviceloader:1.0.0:org.osgi.service.serviceloader-1.0.0.pom
	org.osgi:org.osgi.util.promise:1.3.0:org.osgi.util.promise-1.3.0.jar
	org.osgi:org.osgi.util.promise:1.3.0:org.osgi.util.promise-1.3.0.pom
	org.ow2:ow2:1.5.1:ow2-1.5.1.pom
	org.ow2.asm:asm:9.7.1:asm-9.7.1.jar
	org.ow2.asm:asm:9.7.1:asm-9.7.1.pom
	org.ow2.asm:asm:9.9:asm-9.9.jar
	org.ow2.asm:asm:9.9:asm-9.9.pom
	org.ow2.asm:asm-analysis:9.7.1:asm-analysis-9.7.1.jar
	org.ow2.asm:asm-analysis:9.7.1:asm-analysis-9.7.1.pom
	org.ow2.asm:asm-bom:9.9:asm-bom-9.9.pom
	org.ow2.asm:asm-commons:9.7.1:asm-commons-9.7.1.jar
	org.ow2.asm:asm-commons:9.7.1:asm-commons-9.7.1.pom
	org.ow2.asm:asm-commons:9.9:asm-commons-9.9.jar
	org.ow2.asm:asm-commons:9.9:asm-commons-9.9.pom
	org.ow2.asm:asm-tree:9.7.1:asm-tree-9.7.1.jar
	org.ow2.asm:asm-tree:9.7.1:asm-tree-9.7.1.pom
	org.ow2.asm:asm-tree:9.9:asm-tree-9.9.jar
	org.ow2.asm:asm-tree:9.9:asm-tree-9.9.pom
	org.ow2.asm:asm-util:9.7.1:asm-util-9.7.1.jar
	org.ow2.asm:asm-util:9.7.1:asm-util-9.7.1.pom
	org.postgresql:postgresql:42.7.13:postgresql-42.7.13.jar
	org.postgresql:postgresql:42.7.13:postgresql-42.7.13.pom
	org.python:jython-standalone:2.7.4:jython-standalone-2.7.4.jar
	org.python:jython-standalone:2.7.4:jython-standalone-2.7.4.pom
	org.slf4j:slf4j-api:1.7.25:slf4j-api-1.7.25.jar
	org.slf4j:slf4j-api:1.7.25:slf4j-api-1.7.25.pom
	org.slf4j:slf4j-nop:1.7.25:slf4j-nop-1.7.25.jar
	org.slf4j:slf4j-nop:1.7.25:slf4j-nop-1.7.25.pom
	org.slf4j:slf4j-parent:1.7.25:slf4j-parent-1.7.25.pom
	org.smali:baksmali:2.5.2:baksmali-2.5.2.jar
	org.smali:baksmali:2.5.2:baksmali-2.5.2.module
	org.smali:baksmali:2.5.2:baksmali-2.5.2.pom
	org.smali:dexlib2:2.5.2:dexlib2-2.5.2.jar
	org.smali:dexlib2:2.5.2:dexlib2-2.5.2.module
	org.smali:dexlib2:2.5.2:dexlib2-2.5.2.pom
	org.smali:util:2.5.2:util-2.5.2.jar
	org.smali:util:2.5.2:util-2.5.2.module
	org.smali:util:2.5.2:util-2.5.2.pom
	org.sonatype.oss:oss-parent:7:oss-parent-7.pom
	org.sonatype.oss:oss-parent:9:oss-parent-9.pom
	org.springframework:spring-framework-bom:5.3.39:spring-framework-bom-5.3.39.module
	org.springframework:spring-framework-bom:5.3.39:spring-framework-bom-5.3.39.pom
	org.tribuo:tribuo:4.3.2:tribuo-4.3.2.pom
	org.tribuo:tribuo-classification:4.3.2:tribuo-classification-4.3.2.pom
	org.tribuo:tribuo-classification-core:4.3.2:tribuo-classification-core-4.3.2.jar
	org.tribuo:tribuo-classification-core:4.3.2:tribuo-classification-core-4.3.2.pom
	org.tribuo:tribuo-classification-tree:4.3.2:tribuo-classification-tree-4.3.2.jar
	org.tribuo:tribuo-classification-tree:4.3.2:tribuo-classification-tree-4.3.2.pom
	org.tribuo:tribuo-common:4.3.2:tribuo-common-4.3.2.pom
	org.tribuo:tribuo-common-tree:4.3.2:tribuo-common-tree-4.3.2.jar
	org.tribuo:tribuo-common-tree:4.3.2:tribuo-common-tree-4.3.2.pom
	org.tribuo:tribuo-core:4.3.2:tribuo-core-4.3.2.jar
	org.tribuo:tribuo-core:4.3.2:tribuo-core-4.3.2.pom
	org.tribuo:tribuo-data:4.3.2:tribuo-data-4.3.2.jar
	org.tribuo:tribuo-data:4.3.2:tribuo-data-4.3.2.pom
	org.tribuo:tribuo-math:4.3.2:tribuo-math-4.3.2.jar
	org.tribuo:tribuo-math:4.3.2:tribuo-math-4.3.2.pom
	org.tribuo:tribuo-util:4.3.2:tribuo-util-4.3.2.pom
	org.tribuo:tribuo-util-onnx:4.3.2:tribuo-util-onnx-4.3.2.jar
	org.tribuo:tribuo-util-onnx:4.3.2:tribuo-util-onnx-4.3.2.pom
	org.tribuo:tribuo-util-tokenization:4.3.2:tribuo-util-tokenization-4.3.2.jar
	org.tribuo:tribuo-util-tokenization:4.3.2:tribuo-util-tokenization-4.3.2.pom
	org.tukaani:xz:1.9:xz-1.9.jar
	org.tukaani:xz:1.9:xz-1.9.pom
"

# Generated by scripts/ghidra-fetchdeps.py from fetchDependencies.gradle
GHIDRA_DEP_URIS="
	https://files.pythonhosted.org/packages/0b/2c/87f3254fd8ffd29e4c02732eee68a83a1d3c346ae39bc6822dcbcb697f2b/wheel-0.45.1-py3-none-any.whl
	https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl
	https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar
		-> ghidra-12.1.4-AXMLPrinter2.jar
	bsim? (
		https://ftp.postgresql.org/pub/source/v15.18/postgresql-15.18.tar.gz
	)
	debugger? (
		https://files.pythonhosted.org/packages/90/c7/6dc0a455d111f68ee43f27793971cf03fe29b6ef972042549db29eec39a2/psutil-5.9.8.tar.gz
		https://files.pythonhosted.org/packages/ee/01/1ed1d482960a5718fd99c82f6d79120181947cfd4667ec3944d448ed44a3/protobuf-6.31.0-py3-none-any.whl
	)
	eclipse? (
		https://archive.eclipse.org/tools/cdt/releases/8.6/cdt-8.6.0.zip
		https://sourceforge.net/projects/pydev/files/pydev/PyDev%209.3.0/PyDev%209.3.0.zip
			-> PyDev-9.3.0.zip
	)
	fidb? (
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2012_x64.fidb
			-> ghidra-12.1.4-vs2012_x64.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2012_x86.fidb
			-> ghidra-12.1.4-vs2012_x86.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2015_x64.fidb
			-> ghidra-12.1.4-vs2015_x64.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2015_x86.fidb
			-> ghidra-12.1.4-vs2015_x86.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2017_x64.fidb
			-> ghidra-12.1.4-vs2017_x64.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2017_x86.fidb
			-> ghidra-12.1.4-vs2017_x86.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2019_x64.fidb
			-> ghidra-12.1.4-vs2019_x64.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vs2019_x86.fidb
			-> ghidra-12.1.4-vs2019_x86.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vsOlder_x64.fidb
			-> ghidra-12.1.4-vsOlder_x64.fidb
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/FunctionID/vsOlder_x86.fidb
			-> ghidra-12.1.4-vsOlder_x86.fidb
	)
	python? (
		https://files.pythonhosted.org/packages/0b/7d/9fdbbc1a574be43f9820735ca8df0caf8b159856201d9b21fd73932342bc/jpype1-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
		https://files.pythonhosted.org/packages/0e/78/95db2eb3c8a7311ee08a2c237cea24828859db6a6cb5e901971d3f5e49da/jpype1-1.5.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
		https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl
		https://files.pythonhosted.org/packages/20/a3/00a265d424f7d47e0dc547df2320225ce0143fec671faf710def41404b8c/jpype1-1.5.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
		https://files.pythonhosted.org/packages/6d/d0/191db2e9ab6ae7029368a488c9d88235966843b185aba7925e54aa0c0013/jpype1-1.5.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
		https://files.pythonhosted.org/packages/74/f3/1cd4332076ed0421e703412f47f15f43af170809435c57ba3162edc80d4b/jpype1-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
		https://files.pythonhosted.org/packages/77/6b/130fb6d0c43976b4e129c6bc19daf0e25c42fc38c5096ed92c4105bfd2c4/jpype1-1.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
		https://files.pythonhosted.org/packages/77/91/f08a719461a390b48d9096b50f1f4a49ee281007ec192e51073090d3d8b7/jpype1-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
		https://files.pythonhosted.org/packages/97/0a/cbe03759331c640aa5862f974028122a862b08935a0b11b8fa6f6e46c26b/jpype1-1.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
		https://files.pythonhosted.org/packages/bd/68/47fa634cbd0418cbca86355e9421425f5892ee994f7338106327e49f9117/jpype1-1.5.2.tar.gz
		https://files.pythonhosted.org/packages/c0/c6/63538d160c17e837f62d29ba4163bc444cef08c29cd3f3b8090691c1869c/jpype1-1.5.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
		https://files.pythonhosted.org/packages/fa/4c/e0200a6e3fed5cda79e926c2a8a610676f04948f89d7e38d93c7d4b21be9/jpype1-1.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
	)
	sarif? (
		https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_12.1.4/lib/java-sarif-2.1-modified.jar
			-> ghidra-12.1.4-java-sarif-2.1-modified.jar
	)
	server? (
		https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-13.18/yajsw-stable-13.18.zip
	)
	z3? (
		https://github.com/Z3Prover/z3/releases/download/z3-4.13.0/z3-4.13.0-x64-glibc-2.31.zip
	)
"

GRADLE_SLOT="9.7.0"

inherit desktop gradle java-pkg-2 python-single-r1 xdg-utils

DESCRIPTION="A software reverse engineering (SRE) framework"
HOMEPAGE="https://ghidra-sre.org/ https://github.com/NationalSecurityAgency/ghidra"

SRC_URI="
	https://github.com/NationalSecurityAgency/ghidra/archive/refs/tags/Ghidra_${PV}_build.tar.gz
		-> ${P}.tar.gz
	${GRADLE_DEP_URIS}
	${GHIDRA_DEP_URIS}
"

S="${WORKDIR}/${PN}-Ghidra_${PV}_build"

LICENSE="Apache-2.0 GPL-2+ GPL-3+"
SLOT="0"
KEYWORDS="~amd64"
IUSE="bsim +debugger doc eclipse +fidb +gui ida +jython lisa machine-learning +python +sarif server +z3"
RESTRICT="test"

REQUIRED_USE="
	python? ( ${PYTHON_REQUIRED_USE} )
	debugger? ( sarif python )
	lisa? ( sarif )
"

BDEPEND="
	app-arch/unzip
	dev-java/gradle-bin:${GRADLE_SLOT}
	dev-java/jflex
	sys-devel/bison
	python? (
		${PYTHON_DEPS}
		$(python_gen_cond_dep '
			dev-python/pip[${PYTHON_USEDEP}]
			dev-python/setuptools[${PYTHON_USEDEP}]
			dev-python/wheel[${PYTHON_USEDEP}]
		')
	)
"

RDEPEND="
	>=virtual/jre-21:*
	python? (
		${PYTHON_DEPS}
		$(python_gen_cond_dep '
			dev-python/jpype[${PYTHON_USEDEP}]
			dev-python/protobuf[${PYTHON_USEDEP}]
			dev-python/psutil[${PYTHON_USEDEP}]
		')
	)
	z3? ( sci-mathematics/z3 )
"

DEPEND="
	${RDEPEND}
	>=virtual/jdk-21:*
"

QA_PREBUILT="
	usr/share/ghidra/GPL/DemanglerGnu/os/*/demangler_gnu_*
	usr/share/ghidra/Ghidra/Features/Decompiler/os/*/decompile
	usr/share/ghidra/Ghidra/Features/Decompiler/os/*/sleigh
	usr/share/ghidra/Ghidra/Features/FileFormats/os/*/lzfse
	usr/share/ghidra/Ghidra/Features/FileFormats/data/sevenzipnativelibs/*/*.so
	usr/share/ghidra/Ghidra/Extensions/SymbolicSummaryZ3/os/*/*.so
"

ghidra_extensions() {
	use bsim && echo BSimElasticPlugin
	use jython && echo Jython
	use lisa && echo Lisa
	use machine-learning && echo MachineLearning
	use z3 && echo SymbolicSummaryZ3
	return 0
}

pkg_postinst() {
	use gui || return
	xdg_desktop_database_update
	xdg_icon_cache_update
}

pkg_postrm() {
	use gui || return
	xdg_desktop_database_update
	xdg_icon_cache_update
}

pkg_setup() {
	java-pkg-2_pkg_setup
	use python && python-single-r1_pkg_setup
}

Z3_P="z3-4.13.0-x64-glibc-2.31"

src_unpack() {
	unpack "${P}.tar.gz"

	use z3 && unpack "${Z3_P}.zip"
}

# <dir under dependencies/> <name in the tree> [distfile]
ghidra_dep() {
	local dir=${1} name=${2} distfile=${3:-${2}}

	mkdir -p "${S}/dependencies/${dir}" || die
	# copied, not linked: Gradle makes what it serves writable
	cp --reflink=auto "${DISTDIR}/${distfile}" "${S}/dependencies/${dir}/${name}" || die
	chmod u+w "${S}/dependencies/${dir}/${name}" || die
}

src_prepare() {
	default

	ghidra_dep flatRepo AXMLPrinter2.jar "${P}-AXMLPrinter2.jar"

	if use sarif; then
		ghidra_dep flatRepo java-sarif-2.1-modified.jar \
			"${P}-java-sarif-2.1-modified.jar"
	fi

	use server && ghidra_dep GhidraServer yajsw-stable-13.18.zip
	use bsim && ghidra_dep BSim postgresql-15.18.tar.gz

	if use eclipse; then
		ghidra_dep GhidraDev cdt-8.6.0.zip
		ghidra_dep GhidraDev "PyDev 9.3.0.zip" PyDev-9.3.0.zip
	fi

	if use fidb; then
		local fid
		for fid in vs20{12,15,17,19}_x{64,86} vsOlder_x{64,86}; do
			ghidra_dep fidb "${fid}.fidb" "${P}-${fid}.fidb"
		done
	fi

	if use debugger; then
		ghidra_dep Debugger-rmi-trace protobuf-6.31.0-py3-none-any.whl
		ghidra_dep Debugger-rmi-trace psutil-5.9.8.tar.gz
		ghidra_dep Debugger-rmi-trace setuptools-80.9.0-py3-none-any.whl
		ghidra_dep Debugger-rmi-trace wheel-0.45.1-py3-none-any.whl
	fi

	if use python; then
		ghidra_dep PyGhidra packaging-25.0-py3-none-any.whl
		ghidra_dep PyGhidra setuptools-80.9.0-py3-none-any.whl
		ghidra_dep PyGhidra wheel-0.45.1-py3-none-any.whl
		ghidra_dep PyGhidra jpype1-1.5.2.tar.gz
		local py
		for py in 39 310 311 312 313; do
			local whl
			for whl in manylinux_2_17_x86_64.manylinux2014_x86_64 \
				manylinux_2_17_aarch64.manylinux2014_aarch64; do
				ghidra_dep PyGhidra \
					"jpype1-1.5.2-cp${py}-cp${py}-${whl}.whl"
			done
		done
	fi

	if use z3; then
		mkdir -p "${S}/dependencies/SymbolicSummaryZ3/os/linux_x86_64" || die
		cp "${WORKDIR}/${Z3_P}"/bin/libz3*.so \
			"${S}/dependencies/SymbolicSummaryZ3/os/linux_x86_64/" || die
		cp "${WORKDIR}/${Z3_P}"/bin/*.jar "${S}/dependencies/flatRepo/" || die
	fi

	# Windows only, and wants a prebuilt type library
	rm -rf Ghidra/Debug/Debugger-agent-dbgeng || die

	# Python configuration
	if use python; then
		sed -i "s/findPython3(true)/\"${EPYTHON}\"/" build.gradle || die
	else
		rm -rf Ghidra/Features/PyGhidra || die
	fi

	# Optional modules controlled by USE flags
	if ! use bsim; then
		rm -rf Ghidra/Features/BSim \
			Ghidra/Features/BSimFeatureVisualizer \
			Ghidra/Features/VersionTrackingBSim \
			Ghidra/Extensions/BSimElasticPlugin || die
	fi

	if ! use debugger; then
		sed -i "/includeProjects('Ghidra\/Debug')/d" settings.gradle || die
	fi

	if ! use eclipse; then
		sed -i "/includeProjects('GhidraBuild\/EclipsePlugins/d" settings.gradle || die
	fi

	if ! use ida; then
		sed -i "/includeProject('IDAPro'/d" settings.gradle || die
	fi

	if ! use jython; then
		rm -rf Ghidra/Extensions/Jython || die
	fi

	if ! use lisa; then
		rm -rf Ghidra/Extensions/Lisa || die
	fi

	if ! use machine-learning; then
		rm -rf Ghidra/Extensions/MachineLearning || die
	fi

	if ! use sarif; then
		rm -rf Ghidra/Features/Sarif || die
	fi

	if ! use server; then
		rm -rf Ghidra/Features/GhidraServer || die
	fi

	if ! use z3; then
		rm -rf Ghidra/Extensions/SymbolicSummaryZ3 || die
	fi
}

src_compile() {
	# the offline repository replaces every flatDir the build declares
	local GRADLE_FLATDIRS="
		${S}/dependencies/flatRepo
		${S}/GPL/DMG/data/lib
	"

	local gradle_args=( -x test -x check -x ip )

	use doc || gradle_args+=( -x createJavadocs -x createJsondocs )
	use python || gradle_args+=( -x createGhidraStubsWheel -x createPythonTypeStubs )

	egradle "${gradle_args[@]}" prepDev
	egradle "${gradle_args[@]}" assembleAll

	# assembleAll leaves Ghidra/Extensions empty
	local ext
	for ext in $(ghidra_extensions); do
		egradle "${gradle_args[@]}" ":${ext}:zipExtensions"
	done
}

src_install() {
	local dist_dirs=( "${S}"/build/dist/ghidra_* )
	local dist_dir="${dist_dirs[0]}"

	[[ -d "${dist_dir}" ]] || die "Build distribution directory not found: ${dist_dir}"

	local ext
	for ext in $(ghidra_extensions); do
		# the archive name carries the build date
		local zips=( "${S}"/build/dist/*_"${ext}".zip )
		[[ -f ${zips[0]} ]] || die "no extension archive built for ${ext}"
		unzip -q -o "${zips[0]}" -d "${dist_dir}/Ghidra/Extensions" || die
	done

	# Remove zip archives not needed for runtime
	find "${dist_dir}" -type f -name '*.zip' -exec rm -f {} +

	if ! use doc; then
		rm -rf "${dist_dir}/docs" || die
	fi

	insinto /usr/share/ghidra
	doins -r "${dist_dir}"/*

	# Fix executable permissions on launchers and native binaries
	fperms +x /usr/share/ghidra/ghidraRun
	fperms +x /usr/share/ghidra/support/launch.sh
	fperms +x /usr/share/ghidra/support/analyzeHeadless

	if use python; then
		[[ -f "${ED}/usr/share/ghidra/support/pyghidraRun" ]] && \
			fperms +x /usr/share/ghidra/support/pyghidraRun
	fi

	# Native executables
	local exe
	while IFS= read -r -d '' exe; do
		fperms +x "${exe#${ED}}"
	done < <(find "${ED}/usr/share/ghidra" -type f \
		\( -name "decompile" -o -name "sleigh" -o -name "demangler_gnu_*" \
			-o -name "lzfse" \) -print0)

	# Debugger scripts
	if use debugger; then
		local dbg_script
		while IFS= read -r -d '' dbg_script; do
			fperms +x "${dbg_script#${ED}}"
		done < <(find "${ED}/usr/share/ghidra/Ghidra/Debug" -type f -name "*.sh" -print0 2>/dev/null)
	fi

	# Symlinks in /usr/bin
	dosym -r /usr/share/ghidra/ghidraRun /usr/bin/ghidra
	dosym -r /usr/share/ghidra/support/analyzeHeadless /usr/bin/ghidra-headless

	# not /usr/bin/pyghidra: that is dev-python/pyghidra's
	if use python && [[ -f "${ED}/usr/share/ghidra/support/pyghidraRun" ]]; then
		dosym -r /usr/share/ghidra/support/pyghidraRun /usr/bin/ghidra-pyghidra
	fi

	if use server && [[ -f "${ED}/usr/share/ghidra/server/svrAdmin" ]]; then
		fperms +x /usr/share/ghidra/server/svrAdmin
		dosym -r /usr/share/ghidra/server/svrAdmin /usr/bin/ghidra-svrAdmin
	fi

	# Desktop integration
	if use gui; then
		local icon_path="${S}/GhidraDocs/GhidraClass/Beginner/Images/GhidraLogo64.png"
		if [[ -f "${icon_path}" ]]; then
			newicon -s 64 "${icon_path}" ghidra.png
		fi
		make_desktop_entry ghidra "Ghidra" ghidra "Development;Utility;"
	fi
}