Update documentation and port build system to CMake#5
Conversation
e589d28 to
3e0166d
Compare
andy-shev
left a comment
There was a problem hiding this comment.
Thanks for your hard work on this! It's almost good, some comments are spread around the commits.
| endif() | ||
|
|
||
| option(STATIC "Build statically-linked iotools?" ON) | ||
| option(INSTALL_LINKS "Generate symlinks during install?" ON) |
There was a problem hiding this comment.
Does it mean the default is on? I would move it OFF in this case (yes I know that initially it was like this, but again, I don't think distros will like this to be the default and I believe many of them will want to simply turn it OFF).
There was a problem hiding this comment.
Yes, that default preserves this project's original view of symlinks as the primary means to access internal commands, because this work is merely a port from pure make to cmake.
I understand that your position is for the benefit of the downstream packager, but now that the packager can easily choose their preference, is it really worth changing the project's default without more concrete evidence of a global preference? If you still want to change the default, that should be done as an explicit commit after the cmake port has landed.
|
|
||
| # Install symlinks á la `iotools --make-links`, but in a cross-build | ||
| # compatible manner. | ||
| if (INSTALL_LINKS) |
There was a problem hiding this comment.
Cool, interesting trick!
The question here is how is it portable? And what if readelf is not available (may this be the case)?
There was a problem hiding this comment.
The LLVM and binutils projects provide readelf implementations that are compatible with my proposal. Those are essential components of their respective build systems, so it should be safe to assume it will be available at build-time.
Make it readily available to the user that iotools supports three
distinct modes of operation and create a clear distinction between
options and commands.
Usage: iotools COMMAND [ARGUMENTS]
or: iotools OPTION
or: COMMAND [ARGUMENTS]
OPTIONS:
--make-links create command symlinks and exit
--list-cmds list available commands and exit
--help print this message and exit
-v, --version print version and exit
COMMANDS:
See output of --list-cmds
Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Users requiring remote installation using SCP/SSH should use the new rinstall BASH script, instead. $ ./rinstall Usage: [RUSER=] RHOST= ./rinstall IOTOOLS_PATH [DESTDIR] Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Add a section (briefly) describing interaction with the binary. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Calling --make-links assumes that iotools can be expected to run on the host architecture, despite the project intending to support native and cross-compilation equally well. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
The DEBUG make variable is replaced by CMAKE_BUILD_TYPE, which defaults to Debug if undefined. The Debug and Release CFLAGS are aligned with the original Makefile, all others use CMake defaults. The project's initial configuration continues to enable static-linking of iotools by default, unless overridden by "cmake -D STATIC=0". A new configurable header, config.h.in, is added to tie VER_MAJOR and VER_MINOR to the implicit PACKAGE_VERSION_MAJOR and PACKAGE_VERSION_MINOR variables. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
From https://cmake.org/cmake/help/latest/policy/CMP0065.html: CMake 3.3 and below, for historical reasons, always linked executables on some platforms with flags like -rdynamic to export symbols from the executables for use by any plugins they may load via dlopen(). CMake 3.4 and above prefer to do this only for executables that are explicitly marked with the ENABLE_EXPORTS target property. The OLD behavior of this policy is to always use the additional link flags when linking executables regardless of the value of the ENABLE_EXPORTS target property. The NEW behavior of this policy is to only use the additional link flags when linking executables if the ENABLE_EXPORTS target property is set to True. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Add an INSTALL_LINKS configuration option to emulate the runtime --make-links option. It leverages a new and automatically-populated .tag field in struct cmd_info for easy lookup using readelf. The CMD_PREFIX define is set from the build script, so that the lookup mechanism has a good chance of staying in sync. Embedding the escaped code directly into CMakeLists allows us to use CMAKE_READELF, which isn't available from external scripts. This mechanism has been tested with readelf and llvm-readelf. Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
Signed-off-by: Aaron Sierra <aaron@bubbl-tek.com>
3e0166d to
a706de3
Compare
andy-shev
left a comment
There was a problem hiding this comment.
I'm going to apply the first part for now and then we can review the second one, there are still unanswered questions as far as I can see.
Ah, I can't do this. Please, split this to two PRs. |
aaron-sierra
left a comment
There was a problem hiding this comment.
These comments have been sitting "Pending" in a review on my side, because I failed to submit them. Sorry for the delay.
|
|
||
| # Install symlinks á la `iotools --make-links`, but in a cross-build | ||
| # compatible manner. | ||
| if (INSTALL_LINKS) |
There was a problem hiding this comment.
The LLVM and binutils projects provide readelf implementations that are compatible with my proposal. Those are essential components of their respective build systems, so it should be safe to assume it will be available at build-time.
| endif() | ||
|
|
||
| option(STATIC "Build statically-linked iotools?" ON) | ||
| option(INSTALL_LINKS "Generate symlinks during install?" ON) |
There was a problem hiding this comment.
Yes, that default preserves this project's original view of symlinks as the primary means to access internal commands, because this work is merely a port from pure make to cmake.
I understand that your position is for the benefit of the downstream packager, but now that the packager can easily choose their preference, is it really worth changing the project's default without more concrete evidence of a global preference? If you still want to change the default, that should be done as an explicit commit after the cmake port has landed.
Interestingly that I can't reply in place there. So here are my answers:
Also a good to have is a variant of bash_completion (and alike to zsh, etc) to help with typing the commands. |
|
I like the idea of shell completion as a future feature. I also think that reorganization of the link install location or other execution refactoring could reasonably occur in the future, too. At this time, I would like to preserve functionality that I (and former coworkers) have relied on for years.
|
Yes, I'm not talking about fulfilling it right now.
Okay.
2014 is 10 years ago. I think we may rely on the feature, but make sure we require minimum CMake version.
Sounds like a plan! |
This is a redo for #7, requested in #7 (comment).
These changes include:
iotools --helpand the project README.iotools --make-linksduring install.Buildroot package reference files
Config.in
iotools.mk