-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RFC: Build libstlink shared library, add debian packaging #444
Conversation
Looking good, is the |
I have already cleaned up and extended the |
Yeah, I've seen that one, it's mostly about those fancy 'snap' packages and I completely agree that they are evil (and should die along with those who propose them). On the contrary I don't think that giving people a simple way to run dpkg-buildpackage and getting a deb for their system will hurt in any way related to maintaining a package. In our case debian/ubuntu maintainers will just have one less patch in their batch. The pros are that things will get simpler for devs when it comes to providing nightly debian builds for testing and/or deploying the package to your own hardware. The problem maintaining software like stlink IMO is that it's hardware related and it is intended for developers. And if ST releases, say, stlink v3 a lot of people with new hardware will forget all the maintainers' work and compile from source anyway.
Okay, should I wait for texane/stlink -deprecate_autotools branch to be merged into master, or just rebase this patchset on that branch? P.S. I think I can help out a little bit with CI ( Like I do it here: https://jenkins.ncrmnt.org/job/GithubCI/job/aura/ ) and automatic packaging. I've mostly set up an infrastructure that builds and manages a debian repository from within jenkins and provides debs in batch for armel/armhf/amd64/i386/aarch64 and publishes them in a repository. I still need to polish a few bits and pieces, but it should be live soon. |
@nekromant I really appreciate you work on CI packaging and improving but I also had enabled AppVeyor for windows (mingw builds) and had some discussion with @texane about the forward progress here #437, and here PR 434 - discussion. And I put my major effort currently in similar project |
I don't think AppVeyor really hurts, since my jenkins instance has no windows nodes and right now I don't have the resources to add any. But I think I can help out with packaging once I have all set up. Right now I can't keep actual hardware connected since I have only 2 USB ports that have individual power control and both are busy for CI-testing my RPC library called aura. In the upcoming months I hope to get the PCBs for my homebrew USB hub that will have 6 ports with individual power control, so I can add some hardware (I have 2 different discovery boards with v1 and v2 stlink). Since I plan to add RPC transport over stlink (that's why I've started this PR after all) I'll have at least one of those boards rigged to my jenkins all the time anyway. |
P.S. Here you go: https://jenkins.ncrmnt.org/job/GithubCI/job/stlink/ |
Okay, I've tested all that I could and added a standalone application example. You are free to merge whenever you want. P.S. I also rigged clang-analyze to do some static analysis and it uncovered some bugs: https://jenkins.ncrmnt.org/job/GithubCI/job/stlink/2/clangScanBuildBugs/ |
@nekromant looks good, if you want a "real CI" we must have the following steps:
|
@nekromant I'm already aware of those static analyzer found bugs. I have run stlink code also on our own jenkins CI platform which I saw them pop up in the graphs. As you can see, the gdb server stubs are in a very bad shape. |
@@ -0,0 +1,5 @@ | |||
#!/bin/bash |
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'm not a fan putting auxiliary scripts in the root, you better off to place them in a scripts folder and add a small note what it does. You can also feed cmake a different compiler from a top-level Makefile.
I have not yet tested this, but as texane probably disabled travis builds for OSX on his personal account we can not verify it has not been killed. And you should forget autotools, as most beard-wearing people also switching to CMake which care about true mac and windows builds. |
Okay. Let me know if anything else in this PR needs fixing.
|
|
Unity for C89 is damn monster! Thanks for telling me about it ;). I've worked a little bit with ctest (this ctest: https://github.com/bvdberg/ctest ), but for my purposes I ended up writing tests as simple applications with no testing framework, since they can also serve as ready to use examples. I haven't been developing things that big that will require such testing frameworks. Using that stuff for stlink... Well, for me it looks like using a nuke to squash a roach ;) |
I understand, but if you create more complex unit tests which need to produce good code coverage using a common framework is suggested. As C language has no "testable example" as in Golang, you could add a examples folder and compile and run it with CMake CTest. |
Hi @nekromant I have merged PR #434 could you rebase your work on master and squash all the work into one commit. Then we can review and merge this also to master. Thank you for your contribution! |
@xor-gate Got it, will get to it in a day or two. |
I will wait until you are in sync with master. When you are finished I will prepare for release of version 2.0.0. |
Okay, I think I've done it. I've added some additional PROJECT_VERSION handling to properly set it (and soversion) from STLINK_PACKAGE_VERSION. You may want to tripple check the logic. I think I got it right. I've also bumped debian changelog to version 2.0.0. |
Looks good but I have some comments:
|
Adding debian/ stuff has the following rationale:
I completely agree that we can't package it for every linux distro out there, but adding support for some widely used distros could save some time. Whether to include this one or not is completely up to you. As for the rest, I'll try to fix it this week |
I agree on your points, I'm also not sure how to create multiple packages from one source-tree with CMake/CPack as I have never did this. And the approach you did seems the less worse 👍 . When you have resolved those comments we are ready to go (don't forget to rebase-squash into a single commit). |
10bf12e
to
2a8a196
Compare
@xor-gate Sorry for the delay, I've finally got time to fix the PR and ran into some tricky points, namely:
fixed
The version stuff is tricky, since version detection here relies on variables set by project() directive, but as of cmake policy CMP0048 we're expected to set all the version variables from project(). Oops. As of now I've resorted to using STLINK_PACKAGE_VERSION_* variables for everything. soversion should also now be set properly for windows builds.
done
Adding it as a subproject makes it link against system-installed stlink, if any. And I don't want to bloat the example's CMakeLists.txt with any logic - just keep it bare minimum. Note, I haven't tried building it under mingw/msys for I can't test it right now.
Fixed.
|
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${STLINK_PACKAGE_VERSION_MAJOR} | ||
VERSION ${STLINK_SHARED_VERSION}) | ||
|
||
add_library(${PROJECT_NAME}static STATIC |
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.
Please separate ${PROJECT_NAME}static
with a -
. Maybe better would be to have a variable like STLINK_LIB_STATIC
, STLINK_LIB_SHARED
for the target names.
I've fixed the remaining things in both CMakeLists.txt. See if everything's okay now. If it is, I'll squash everything in a single commit so that you can finally merge. |
PROJECT(st-hello) | ||
SET(PROJECT_VERSION 0.1) | ||
SET(SRCS main.c) | ||
cmake_minimum_required(VERSION 2.8) |
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.
cmake_minimum_required
should always be the first line for CMakeLists.txt
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.
cmake_minimum_required should always be the first line for CMakeLists.txt
It is there on the first line, diff just looks a bit weird due to adding sidenotes.
You should replace all occurences of
and should be set once in the main CMakeLists.txt:
|
ping @nekromant |
Signed-off-by: Andrew Andrianov <[email protected]>
@xor-gate Sorry, I've been out of the city, just got back to fix it. I've merged all my work in a single commit so that it would be easier to review what's left of it. |
Hi @nekromant I was a weekend AFK and I will review the whole bunch next week completely. Thank you for your work! |
In upcoming time I will refactor some things and prepare a new release. Do you mind if I add your build (jenkins) badge also to the readme? Maybe you could poll |
No problem, I've just set up jenkins to use texane/stlink for building. Can you set up the github to ping my jenkins instance when something is pushed? P.S. I will rig a real stlink-v1 board to jenkins in the upcoming months. Just have to find some time and lay out a proper usb hub with per-port power management. |
Hi Jerry, are there side effects in doing so ? If not, please do it. 2016-09-07 21:11 GMT+02:00 Jerry Jacobs [email protected]:
|
Hi all, no I can not send a webhook when something is pushed. As I use this also at my works this way, without the need to have hooks configured. If you need help with jenkins. I have proffesional experience. Hooking up a board and have some code coverage displayed would be really really awesome. We need to see how this fits as I dont want any CI-related scripts in the main repo. Probably we should have a seperate repository somewhere else which is used to run on real hardware. I prefer a custom jenkins with e.g Debian because we indeed can hook up some real hardware. |
Thanks, I've got quite some experience with jenkins as well, had to even dive into plugin development a few times. No problem here ;) If you want, I can set up the instance to build branches using Jenkinsfile, this way you can keep all the CI stuff in the repo and not rely on me to fix a thing or two (Just, please, don't do rm -Rfv / or mine bitcoins;) ) |
Wow, thats getting your hands dirty. A Jenkinsfile is nice. Mining bitcoins will not happen as this takes way to long LOL. And rm -Rfv is also not a good idea. Having the seperate Jenkinsfile is a good idea. Maybe you could draft one (where clang-analyzer also works). I have tried to setup a pipelined build with a jenkins build and was not able to use all job features. |
Jenkins DSL is somewhat new and new features are coming with every release, so you might've missed them the day you tried. I'll give it a spin, but can't make any promises. I'm just back to work from the vacation and things are quite hellish right now. Will post to a new issue. |
I have created a issue where we can discus further in #461. Locking this PR so this wont get polluted 👍 |
This PR is now finally closed. |
PLEASE DO NOT MERGE YET!
Well, basically sometimes one may need to use stlink in his own app. This patchset does the following:
As of debian packaging, I've split the package into three:
libstlink - the shared library
libstlink-dev - pkg-config file, static library and headers
stlink-tools - all the binaries
Please don't yet merge, since there are a few things I haven't yet tested out/firgured.