Bug 280378 - devel/ghidra: update to 11.1.2
Summary: devel/ghidra: update to 11.1.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-19 21:36 UTC by gatekeeper
Modified: 2024-07-26 20:44 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (sghctoma)


Attachments
git path (380.83 KB, patch)
2024-07-19 21:36 UTC, gatekeeper
no flags Details | Diff
git patch (380.86 KB, patch)
2024-07-20 01:11 UTC, gatekeeper
no flags Details | Diff
git patch (366.32 KB, patch)
2024-07-20 01:58 UTC, gatekeeper
no flags Details | Diff
git patch (365.95 KB, patch)
2024-07-25 22:12 UTC, gatekeeper
no flags Details | Diff
devel/ghidra as tgz (29 bytes, application/gzip)
2024-07-25 22:14 UTC, gatekeeper
no flags Details
devel_ghidra.tar.xz (28.09 KB, application/x-xz)
2024-07-26 17:48 UTC, gatekeeper
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description gatekeeper 2024-07-19 21:36:32 UTC
Created attachment 252180 [details]
git path

Hi. ghidra is currently fallout; the last version in the ports tree is 9.1, which is now 3 years old and, because version 9.1 contains an RCE, it is marked also as FORBIDDEN (for about 5 months now...)

I have contributed some code directly upstream to make ghidra work in FreeBSD (unfortunately currently the debugger option is broken, but the decompilation is working wel) - the fixes are available now since 11.1.1.
Now, I have updated the port the newest version (which to date is 11.1.2) and include a patch in attachment to do this update. In this patch, I switched to the official PUBLIC release of ghidra.

Some reports (e.g #275383) ask the maintainer to update the port to a newer version. If the current maintainer is OK, I can take maintainership of this port. (NOTE: I did not change this in the proposed patch). :-)
Comment 1 gatekeeper 2024-07-20 01:11:33 UTC
Created attachment 252186 [details]
git patch

improvements to the Makefile...
Comment 2 gatekeeper 2024-07-20 01:58:07 UTC
Created attachment 252187 [details]
git patch

+ minor improvements
+ make sure to compile the demangler
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-25 14:47:27 UTC
SHEBANG_FILES=	${WRKSRC}/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.sh
Why not:
SHEBANG_FILES=	Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.sh
?
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-25 14:49:39 UTC
USE_GCC=	13
Can't build with clang from base?
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-25 14:56:06 UTC
This is incorrect:
@${LN} -sf ${PREFIX}/bin/g++13 ${WRKDIR}/.bin/g++
@${LN} -sf ${PREFIX}/bin/gcc   ${WRKDIR}/.bin/gcc

${PREFIX} => ${LOCALBASE}
$ pkg which /usr/local/bin/gcc*
/usr/local/bin/gcc was installed by package gcc-13_5
$ pkg which /usr/local/bin/g++13
/usr/local/bin/g++13 was installed by package gcc13-13.2.0_4

gcc-13_5 is "Meta-port for the default version of the GNU Compiler Collection" - it installed symlinks only:
gcc@ -> gcc13
g++@ -> g++13
gfortran@ -> gfortran13

But after all - why do you need these symlinks?
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-25 15:16:22 UTC
@${CP} -r ${WRKSRC} ${STAGEDIR}${DATADIR}
Use ${COPYTREE_SHARE} instead of ${CP}.
You can find examples in other ports.
Maybe:
cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}


${RM} -r ${STAGEDIR}${DATADIR}/Ghidra/Ghidra/.gradle
Remove this from ${WRKSRC} before copy to ${STAGEDIR}.
Also you can use .for loop instead of 8 lines, something like this:
.for F in Ghidra/Ghidra/.gradle Ghidra/Features/Decompiler/build/objs \
       Ghidra/Features/Decompiler/build/tmp <...cut...>
       ${RM} -r ${WRKSRC}/${F}
.endfor
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-25 15:17:54 UTC
EXTRACT_DEPENDS=	${UNZIP_CMD}:archivers/unzip
Try USES+=zip instead.
Comment 8 gatekeeper 2024-07-25 22:12:53 UTC
Created attachment 252290 [details]
git patch

Changes:
  - removed ${WRKSRC} from SHEBANG_FILES
  - removed dependency on gcc and switched to clang compilation
  - rewrote the do-install target, using for-loops
  - removed EXTRACT_DEPENDS
  - portlint / portfmt / portclippy
  - reduce openjdk required version to 17+
Comment 9 gatekeeper 2024-07-25 22:14:09 UTC
Created attachment 252291 [details]
devel/ghidra as tgz

Add the files in devel/ghidra as a TGZ archive also.
NOTE: no changes compared to the git patch.
Comment 10 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-26 17:03:07 UTC
Comment on attachment 252291 [details]
devel/ghidra as tgz

This is 1024 bytes with chars 0 comressed with gzip…
Comment 11 gatekeeper 2024-07-26 17:48:16 UTC
Created attachment 252305 [details]
devel_ghidra.tar.xz

(In reply to Vladimir Druzenko from comment #10)

OK, sorry, I guess there was a problem with my browser before.
I am now re-uploading the file.
No changes compared to the git patch.

Forgotten to mention before:
With this patch, I am also proposing to take maintainership of devel/ghidra.
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-07-26 20:41:18 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e2b8d2a6176627276e35eb607d81bf3e474e41f4

commit e2b8d2a6176627276e35eb607d81bf3e474e41f4
Author:     gatekeeper <tiago.gasiba@gmail.com>
AuthorDate: 2024-07-26 20:31:11 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-07-26 20:39:31 +0000

    devel/ghidra: update 9.1 → 11.1.2, take maintainership

    Port was FORBIDDEN, updated last time in 2019, maintainer is innactive.
    Tamas Szakaly <sghctoma@gmail.com>, thanks for you work, hope you come
    back to FreeBSD porters team!

    Install share/ghidra/support/launch.properties as a @sample file.

    Changelogs:
    https://htmlpreview.github.io/?https://raw.githubusercontent.com/NationalSecurityAgency/ghidra/Ghidra_11.1.2_build/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html

    PR:     280378 275383 244345
    MFH:    2024Q3

 devel/ghidra/Makefile                              |  133 +-
 devel/ghidra/distinfo                              |   16 +-
 .../files/patch-GPL_CabExtract_build.gradle (gone) |   18 -
 .../patch-GPL_DemanglerGnu_build.gradle (gone)     |   31 -
 ...tch-GPL_GnuDisassembler_buildGdis.gradle (gone) |   32 -
 devel/ghidra/files/patch-GPL_gpl.gradle (gone)     |   23 -
 .../files/patch-GPL_nativeBuildProperties.gradle   |   31 +-
 ...draBuild_Skeleton_certification.manifest (gone) |   10 -
 ...raBuild_Skeleton_os_freebsd64_README.txt (gone) |    6 -
 ...-Ghidra_Features_Decompiler_build.gradle (gone) |   28 -
 ...es_Decompiler_src_decompile_cpp_Makefile (gone) |   13 -
 ...iler_src_decompile_cpp_loadimage__bfd.hh (gone) |   12 -
 ...res_Decompiler_src_decompile_cpp_types.h (gone) |   39 -
 ...-Ghidra_Features_FunctionID_build.gradle (gone) |   33 -
 ...main_java_ghidra_framework_Platform.java (gone) |   36 -
 ...va_ghidra_framework_OperatingSystem.java (gone) |   10 -
 ...a_RuntimeScripts_Linux_support_launch.sh (gone) |   10 -
 ...patch-Ghidra_RuntimeScripts_build.gradle (gone) |   11 -
 devel/ghidra/files/patch-README.txt (gone)         |    6 -
 devel/ghidra/files/patch-build.gradle (gone)       |   74 -
 .../patch-gradle_root_distribution.gradle (gone)   |   10 -
 .../files/patch-gradle_support_ip.gradle (gone)    |   11 -
 devel/ghidra/pkg-plist (new)                       | 4666 ++++++++++++++++++++
 23 files changed, 4731 insertions(+), 528 deletions(-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2024-07-26 20:44:24 UTC
A commit in branch 2024Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a345c2f858e04f01d7c5d6c7c42af76a9898197a

commit a345c2f858e04f01d7c5d6c7c42af76a9898197a
Author:     gatekeeper <tiago.gasiba@gmail.com>
AuthorDate: 2024-07-26 20:31:11 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-07-26 20:43:34 +0000

    devel/ghidra: update 9.1 → 11.1.2, take maintainership

    Port was FORBIDDEN, updated last time in 2019, maintainer is innactive.
    Tamas Szakaly <sghctoma@gmail.com>, thanks for you work, hope you come
    back to FreeBSD porters team!

    Install share/ghidra/support/launch.properties as a @sample file.

    Changelogs:
    https://htmlpreview.github.io/?https://raw.githubusercontent.com/NationalSecurityAgency/ghidra/Ghidra_11.1.2_build/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html

    PR:     280378 275383 244345
    MFH:    2024Q3
    (cherry picked from commit e2b8d2a6176627276e35eb607d81bf3e474e41f4)

 devel/ghidra/Makefile                              |  133 +-
 devel/ghidra/distinfo                              |   16 +-
 .../files/patch-GPL_CabExtract_build.gradle (gone) |   18 -
 .../patch-GPL_DemanglerGnu_build.gradle (gone)     |   31 -
 ...tch-GPL_GnuDisassembler_buildGdis.gradle (gone) |   32 -
 devel/ghidra/files/patch-GPL_gpl.gradle (gone)     |   23 -
 .../files/patch-GPL_nativeBuildProperties.gradle   |   31 +-
 ...draBuild_Skeleton_certification.manifest (gone) |   10 -
 ...raBuild_Skeleton_os_freebsd64_README.txt (gone) |    6 -
 ...-Ghidra_Features_Decompiler_build.gradle (gone) |   28 -
 ...es_Decompiler_src_decompile_cpp_Makefile (gone) |   13 -
 ...iler_src_decompile_cpp_loadimage__bfd.hh (gone) |   12 -
 ...res_Decompiler_src_decompile_cpp_types.h (gone) |   39 -
 ...-Ghidra_Features_FunctionID_build.gradle (gone) |   33 -
 ...main_java_ghidra_framework_Platform.java (gone) |   36 -
 ...va_ghidra_framework_OperatingSystem.java (gone) |   10 -
 ...a_RuntimeScripts_Linux_support_launch.sh (gone) |   10 -
 ...patch-Ghidra_RuntimeScripts_build.gradle (gone) |   11 -
 devel/ghidra/files/patch-README.txt (gone)         |    6 -
 devel/ghidra/files/patch-build.gradle (gone)       |   74 -
 .../patch-gradle_root_distribution.gradle (gone)   |   10 -
 .../files/patch-gradle_support_ip.gradle (gone)    |   11 -
 devel/ghidra/pkg-plist (new)                       | 4666 ++++++++++++++++++++
 23 files changed, 4731 insertions(+), 528 deletions(-)
Comment 14 Vladimir Druzenko freebsd_committer freebsd_triage 2024-07-26 20:44:55 UTC
Thanks!