I have a set of Debian packaging scripts and I would like the version number of the package to be incremented each time it is built. (i.e. debian_revision as specified in the Debian Policy Manual) That is, the first build should be PACKAGE-1.0-0, then PACKAGE-1.0-0, and so on (where 1.0 is the upstream_version). Is there an easy way to specify this "extra" version number without having to create a new entry in the changelog?
I'm looking to have this automatically done by the Makefile for the project whenever a particular target (i.e. deb is built)
dh_* scripts read debian/changelog to build a changes file and set the versions, among other things. You should not change the version without editing the changelog, but if your problem is changes made manually you can make a script that invokes
dch -i
or if your problem is changes made at the debian/changelog, you can make a bash script to change the version automatically.
Related
I have a simple CMake project with CTest and CPack. It uses the Lua C API to load and execute an script file called script.lua.
This script will be in different location when built vs when installed/packed, it's location would be:
[build] : ${CMAKE_CURRENT_SOURCE_DIR}/src/scripts
[install]: ../scripts (relative to app which is in bin directory)
What I'm trying to achieve here is to have install step regenerate configure_file then rebuild using new configure_file and only then proceed to do the normal install step and of course revert the configure_file back to it's original state afterwards.
Any help regarding this issue is appreciated.
My understanding is that CMake's configure_file command has its full effect during the execution of the cmake program. It has no representation in generated makefiles, or whatever other build system components cmake generates. Thus, if you want to configure a file differently for installation than for pre-installation testing,
You would need to perform completely separate builds (starting with executing cmake) for the two cases, and
You would need to use some attribute of the cmake command line or execution environment to convey the wanted information, such as using a -D option to define a CMake variable on the command line.
I advise you not to pursue this route. Aside from being overcomplicated, it's also poor form to install a different build of the software than is tested.
You have a variety of alternatives that could serve better. Among those are
Give the program itself the ability to accept a custom location for the Lua script. That is, make it recognize a command-line argument or environment variable that serves this purpose. Make use of that during pre-installation testing.
If indeed the program is using a relative path to locate the script at runtime, then just (have CMake) put a copy of the script at the appropriate location in the build tree, so that the program will find it normally during testing.
I'm new to c development, but I have some experience in other modern languages .so the first thing that I found hard is dependencies and deployment, while we got Gradle, maven, NuGet and pipy and... but in c I find it a bit difficult to manage this process.
for example, I have an app that should use mongo-c-library, log4c,libarchive so basically, in my development environment, I download and unzip all of the tar files of the above libraries and then followed their instruction(usually some make stuff) and installed them in order to include them in code make the code work.
I have studied a bit about CMake but I couldn't get a clear picture of how that could actually solve the problem.
at this moment my best solution is to create an install bash script and zip all dependencies unzipped folder with that install script and then send it to the production server to deploy it.
1.The first question is : is it possible to just copy and past all of .so .h and etc files in /path/of/installed/dependencies/include
and /path/of/installed/dependencies/lib in the destination server libary path.
2.if not what is the faster way?
while I was surfing the CMake source file I found that its developers just use this package source code directly.
cmxxx contains the xxx sources and headers files.
3.how can apt-get and Linux package manager help in the deployment process?
2 first question was more about dependencies. imagine we have a simple c app and we want to install(build and make a useable executable file) quickly. how it can be related to .deb packages.
1.The first question is : is it possible to just copy and past all of .so .h and etc files in /path/of/installed/dependencies/include and /path/of/installed/dependencies/lib in the destination server libary path.
Yes, technically it's possible. That's essentially what package managers do under the hood. However, doing that is a colossal mistake and screams bad practices. If that's what you want then in the very least you should look into package managers to build up your own installer, which handles this sort of stuff already for you.
2.if not what is the faster way?
You're actually asking an entirely different question, which is: how should I distribute my code, and how do I expect users to use/deploy it?
If you want users to access your source code and build it locally, as you've mentioned cmake then you just to set up your project right as cmake already supports that usecase.
If instead you just want to distribute binaries for a platform then you'll need to build and package that code. Again, cmake can also help you on that one, as cmake's cpack supports generating some types of packages like DEB packages used by Debian and Ubuntu, and which are handled by apt.
3.how can apt-get and Linux package manager help in the deployment process?
apt is designed to download and install packages from a repository.
Under the hood, apt uses DEB packages, which can be installed with dpkg.
If you're targeting a system that uses apt/deb, you can build DEB packages whenever you release a version to allow people to install their software.
You can also go a step beyond and release your DEB packages in a Personal Package Archive.
You would typically NOT download and install source packages. Instead you should generally rely on the libraries and development packages of the distribution. When building your own package you would typically just reference the packages or files that your package is dependent on. Then you build your own package and you're done. Upon installation of your package, all dependencies will automatically be resolved in an appropriate order.
What exactly needs to be done is dependent on the package management system, but generally the above statements apply. Be advised, package management apparently is pretty hard, because so many 3rd party developers screw it up.
This question has been asked before (there are questions that are 5 or 10 years old) but without any real answer, usually a different approach has been used.
I'm working on a project where a different approach is simply not possible. We are using a third-party post-build step that needs some arguments (version) as part of the input. The version is set inside the C code using #define as some settings are set based on different parts of the version.
After some major changes, we have to recompile the code with different versions so I rather keep the version in a single location (in main.h preferably). Is there any way to do it in eclipse or do I have to bear the pain and just change it at multiple locations manually?
I'm using Eclipse Neon.3 Release (4.6.3), since I'm using system workbench and that's their default version.
You have some tool that does:
Your build
This post build step
Extract the version #define from your C project (in 1) and store it instead in a build system variable. Then pass it as a -D parameter to the necessary files (in 1), and as a parameter in whatever way it's expected by step 2.
Using -D parameter (in project properties > C/C++ Build > settings > Tool Settings > Preprocessor) did not do the job for me as the macros or the build variables defined based on them were not expanding in the post-build step.
My workaround was to write a shell script to read the version from the header file and then pass it to the post-build. So I'm calling the other script inside my script that extracts the version. This way I can change the versions inside the code rather than the labyrinth of the eclipse settings.
This line extracts the version:
fw_version=$(cat "$projectdir/../Inc/main.h" | grep "FW_VERSION" | cut -d ' ' -f 3-)
I am still new to C programming, but I think that I can handle all major parts of it as pointers, functions, arrays... . Now I am looking forward for GUI programming. I want something that can handle crossplatform. So I decided to go for GTK+. I found this on their website:
First, make sure that your system meets the requirements as mentioned above, then download and run the installation script (gtk-osx-build-setup.sh). If your application already has a module, everything you need to build your application is handled by jhbuild. The build page has detailed instructions.
So my system meets the requirements. I have downloaded the file.I opened up my terminal and wrote:
sh gtk-osx-build-setup.sh
My terminal returned:
Checking out jhbuild (7c8d34736c3804) from git...
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Deleted branch stable (was 7c8d347).
Already up-to-date.
Switched to a new branch 'stable'
Installing jhbuild...
-n WARNING: aclocal not available (usually part of package 'autoconf')
-n WARNING: automake not available (usually part of package 'automake')
-n WARNING: autopoint not available (usually part of package 'gettext')
-n WARNING: pkg-config not available (usually part of package 'pkgconfig')
-n WARNING: yelp-tools not available (usually part of package 'yelp-tools')
-n Configuring jhbuild without autotools
-n Now type `make' to compile jhbuild
Installing jhbuild configuration...
Installing gtk-osx moduleset files...
PATH does not contain /Users/myname/.local/bin, it is recommended that you add that.
Done.
What should I do know guys? Please help!
I was also trying to do all in one bundle... So i went to the directory wich i downloaded. And than run make install. I should type something more than make install or it is everything?
I am pretty new to buildroot and I wish to add more than 1 post-build scripts, as the documentation says:
3.3.1. Customizing the generated target filesystem
In the Buildroot configuration, you can specify the paths to one or more post-build scripts. These scripts are called in the given order, after Buildroot builds all the selected software, but before the rootfs images are assembled. The BR2_ROOTFS_POST_BUILD_SCRIPT allows you to specify the location of your post-build scripts
http://buildroot.uclibc.org/downloads/manual/manual.html#rootfs-custom
How can I specify more than one value in a buildroot setting?
See: buildroot Makefile, especially lines 782-784.
The string is passed to a shell's for loop. So a space separator should be used. Each script gets a TARGET_DIR parameter.
In fact, I am running Armadeus 5.2 which only includes Buildroot 2012.02, which does not allow more than 1 post build script. Buildroot 2013.02 does.
Current docs have made it clearer now:
To enable this feature, specify a space-separated list of post-build scripts in config option BR2_ROOTFS_POST_BUILD_SCRIPT
So space separated as Artless deduced from the source.