capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.61k stars 1.56k forks source link

[Draft] Apt debian packages #2541

Closed AndrewQuijano closed 1 week ago

AndrewQuijano commented 1 week ago

Your checklist for this pull request

Detailed description

Based on the original PR #2521, I created a Debian package that created everything needed to run capstone. However, it would be nice to be able to update the Debian package repositories too. So I will be working on the steps to create the updated libcapstone5, libcapstone6, and libcapstone-dev packages to be relatively identical to the current outdated versions in Ubuntu. ...

Test plan

Based on a prior PR, I am essentially using these same tests to confirm the packages that would be sent to Debian/Ubuntu work as intended.

...

Closing issues

closes #2537 ...

AndrewQuijano commented 1 week ago

At the moment, I get /usr/local/lib/libcapstone.so.6.0. My question is, where is the .so.6.0 being populated? Should a fix be made to have the files only be in a format like libcapstone.so.5, libcapstone.so.6, etc?

With that said, I will have to assume the version based as an argument is correct in populating the control file

AndrewQuijano commented 1 week ago

I suspect I also need to update capstone.pc to point from /usr/local to /usr? Once again, the main question is how would the plan be to update these new packages to Ubuntu/Debian.

Rot127 commented 1 week ago

Should a fix be made to have the files only be in a format like libcapstone.so.5, libcapstone.so.6, etc?

You can check the Debian package naming conventions for details. The revision version must be part of the name apparently (docs, dpkg-name and more details).

I suspect I also need to update capstone.pc to point from /usr/local to /usr?

As I see it, it should install directly into /usr/lib (see: https://www.debian.org/doc/debian-policy/ch-sharedlibs.html). So the current implementation (installing into /usr/local) is wrong. Can you please open another PR to fix it?

Rot127 commented 1 week ago

@AndrewQuijano I looked into your questions in detail and found actually more than one problem. I am sorry that I did not review more thoroughly before. I also never worked with deb packages until now, was in a rush due to other things and oversaw quite some problems. Thank you for asking about these problems, otherwise I would have missed them.

The issues I found are the following:

I tried fixing some of them, but quickly recognized that it gets out of hand quickly. And for Capstone we need a more complete approach.

As it looks like, the original script, you used as a basis, was never meant to generate a deb package for the official Debian/Ubuntu repositories. This would also explain why it was lacking so many things.

Unfortunately, we cannot provide a package which is this much incomplete for the release. In https://github.com/capstone-engine/capstone/pull/2543 I removed it from the release CI, but kept your work in packages/deb/. Also you can trigger the package build by dispatching the new Build Debian Package workflow.

Because your initial idea was to ease the install in PANDA, I would see two solutions for this:

  1. Fork the Capstone repository for PANDA and redo the package generation there. You can easily do a release in this fork and download the package for PANDA from it.
  2. If you want to have a deb package in the official Ubuntu/Debian repositories, I would ask you to do the implementation from scratch. This time though by using CPack. And with CPack we can also generate packages for other distros. Also we have a certain guarantee that the built packages are correct. If you do so, please first submit the package to the Debian packages and wait for approval. Then we can merge it here.

I am sorry again I didn't properly reviewed the first PR, due to my lag of knowledge about Debian packages.