-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement CPack for Debian/RPM #2590
base: next
Are you sure you want to change the base?
Conversation
@Rot127 While I will need help with the Mac stuff, I can try to poke around how capstone made RPM packages before, but your feedback would be helpful to have! I did poke around and find this, it seems the RPM packaging standard is a lot more of a mess than I thought as it seems anyone can package as they see fit. https://rpmfind.net/linux/rpm2html/search.php?query=libcapstone-devel I do want to ask, if the goal is to automate placing Debian packages in APT, this would require creating both a libcapstone package with the shared objects only and another debian with the static library/headers. I could use cmake twice and leverage CPack to make two packages. To avoid the headers being made twice, would I need to delete these lines of code? https://github.com/capstone-engine/capstone/blob/next/CMakeLists.txt#L799-L801 |
Sorry for the late answer. I will review this one after new year. But to answer your questions meanwhile:
Yes, this would be nice to have. Though, I can't put any priority on it. And before v6 Beta, it is not necessary. I think for v6 Gold it is though.
I have no idea. They were made before my time here. You have to contact the package maintainers and/or follow the docs. |
419750b
to
12879d4
Compare
I poked around a bit more about making the RPM the best I can, so a few things I'll likely need help on,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks a lot for getting started with it.
Some general notes:
- Let's exclude OSX for now, please. It gets too much otherwise and they can be part of another PR.
- The
packages/rpm/capstone.spec
file shouldn't be necessary. I think it can be removed. CPack should generate it. - Once we have tested the package build locally, we can add the process to the release workflow.
Regarding #2590 (comment)
This looks a little hacky. Let's not worry about the bindings for now. Because they need some refactoring before (see: #2291).
And maybe there are way better ways to create such packages. In the case of the Python bindings, they are already uploaded to pypi.
@Rot127 Just updated the CPack file per your suggestions (Note both Debian and RPM package content looks identical now), three questions remain:
https://github.com/AndrewQuijano/capstone/releases/tag/6.0.2-Alpha3 |
d2bb8b5
to
c77d6ff
Compare
I just ran a
Not yet. I waited for you to add the workflow job, so I don't have to set up to much. Will do review this one again tomorrow.
Yeah, sure. Less duplicates are always better.
This would be awesome! @kabeor Do you know if we could get the release before lunar new year? |
0e85387
to
e31a1e9
Compare
@Rot127 What are the cstool commands you used? I think I can add this to RPM spec file? I just removed the duplicate with Docker and created the PR for v5. I should note, it seems I broke labeler when switching to v5, I'm trying to fix this, but it is turning out to be a bit more complicated than I thought https://github.com/actions/labeler https://github.com/capstone-engine/capstone/actions/runs/12645601156/job/35235004550?pr=2590 |
No worries. Going to fix it.
Just some basic disassembly. It just needs to prove it loads the share library properly and correctly disassembles an instruction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the review on this one. Since they the comments are basically the same for the v5
version.
Btw, I am sorry if I sometimes make multiple suggestions on the same line of code. I learn how the CPack packaging works while reviewing your code. So sometimes I see things only on a second look.
Hope this is not discouraging. I very much appreciate your effort!
023a04f
to
f82b52a
Compare
@Rot127 Just updated the PR, and just curious would you look into how to update labeler to v5? Also, figure I should ask, you don't mind I use your ISSUE_TEMPLATE folder and labeler stuff for any other open-source work right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
But the build fails for me: https://github.com/Rot127/capstone/actions/runs/12734529842/job/35492198289
...
Enabling CAPSTONE_WASM_SUPPORT
Enabling CAPSTONE_BPF_SUPPORT
Enabling CAPSTONE_RISCV_SUPPORT
Enabling CAPSTONE_SH_SUPPORT
Enabling CAPSTONE_TRICORE_SUPPORT
Enabling CAPSTONE_ALPHA_SUPPORT
Enabling CAPSTONE_HPPA_SUPPORT
Enabling CAPSTONE_LOONGARCH_SUPPORT
Enabling CAPSTONE_XTENSA_SUPPORT
CMake Error at /usr/local/share/cmake-3.31/Modules/WriteBasicConfigVersionFile.cmake:43 (message):
No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
Call Stack (most recent call first):
/usr/local/share/cmake-3.31/Modules/CMakePackageConfigHelpers.cmake:402 (write_basic_config_version_file)
CMakeLists.txt:897 (write_basic_package_version_file)
-- Configuring incomplete, errors occurred!
cd build | ||
cpack -G DEB | ||
cpack -G RPM | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing I thought it would be nice to upload the produced packages also as artifacts.
So we don't need a release each time we want to download them.
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./build/*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rot127 Would I add this to the release workflow? It just seems like this would mean the artifact would only be made on release unless I put it on another workflow?
Please add the commit so I can add it to this PR
CPackConfig.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build possibly fails due to this name.
CPackConfig.cmake
is a reserved name IIRC. Try to rename it to CPackGeneratorSetup.txt
or something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me know if the regex should be stricter to remove/ignore all numbers before the X.Y.Z?
string(REGEX MATCH "^[vV]?([0-9]+\\.[0-9]+\\.[0-9]+)" _ ${PROJECT_VERSION})
set(PROJECT_VERSION_BASE ${CMAKE_MATCH_1})
It isn't a priority currently for me. Too much other stuff to do unfortunately. If you want to work on it feel free to do so! If you are faster then @kabeor reviewing, we can replace my downgrading PR with yours.
Not at all. It is open-source in the end :D |
Your checklist for this pull request
Detailed description
I created a CPackConfig.txt that can create both Debian and RPM packages. The Debian package matches what we have now. I can look further about making a proper RPM package.
Debian Screenshots
This is identical to #2579
RPM
Here is the generated spec file
libcapstone-dev.spec.txt
I do want to get help with macOS package creation and testing using CPack
I updated how to do this in the Building.md file
...
Test plan
We can probably use something like check_capstone.sh? Although for now, we can merge it as another way to create the Debian Package? My hope is, from here, work can be done to get a Mac OSX package built. I can help with RPM, the work is done, but any last necessary touches I can take care of it.
...
Closing issues
...