how to set an appropriate version for a lib when i'm building it from sources - build-process

As an example of my problem let's use libqb (https://github.com/ClusterLabs/libqb).
To install it from the sources I do the next:
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
The problem is that the version in "/usr/lib/pkgconfig/libqb.pc" is UNDEFINED.
I suspect that I have to pass a parameter to ./configure but I don't know which one.
I do it on Debian.

There are two ways to get sources:
use git ($ git clone)
download sources in an archive
In case of using git, you won't see this problem, because it uses git to get correct version of sources during build.
In case of archive you have to create .tarball-version file in the top dir and put there version you want. For example: $ echo "0.17.0" > .tarball-version.
P.S.: there will be created .version file during build. So, if you did any changes to .tarball-version then you have to remove .version file.

Related

How to install SQLite with Archives extension?

I want to explore the use of SQLite Archive files. I downloaded the amalgamation source code from the downloads page (https://sqlite.org/download.html) and compiled it (gcc shell.c sqlite3.c -lpthread -ldl).
I managed to compile the executable but the Archives option is not there.
Running ./sqlite3 -A shows the error:
./sqlite3: Error: unknown option: -A
Trying to run the .ar command in commandline shows:
Error: unknown command or invalid arguments: "ar". Enter ".help" for help
Running .help also does not show the option for .archive.
How do I install SQLite with the Archives extension?
Compile from source…
$ curl -LO https://www.sqlite.org/src/tarball/sqlite.tar.gz
$ tar xzf sqlite.tar.gz
$ mkdir build
$ cd build
$ ../sqlite/configure
$ make
You will find the executable command line program (sqlite3) in the build directory.
Add compile options by changing the ../sqlite/configure line to something like…
$ ../sqlite/configure CFLAGS='-DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FOREIGN_KEYS=1'
View configure help for more flags like linking additional libraries…
$ ../sqlite/configure --help
Optionally install the headers (sqlite3.h) and libraries (libsqlite3.a, libsqlite3.so, libsqlite3.dylib, etc) by running…
$ make install
Ensure archive support exists…
$ ./sqlite3 -help
...
OPTIONS include:
-A ARGS... run ".archive ARGS" and exit
...
You have to compile it with SQLITE_HAVE_ZLIB defined (And link with -lz).
It's easiest using the autoconf or src source distribution, since the configure script tests for a bunch of things including zlib, and compiles the library and shell with a bunch of useful options that you're not using in your manual compilation of the shell.

Prep line in rpm spec causes duplicate directory inside rpm

I have this spec file for my open source shell scripting sdk https://github.com/icasimpan/shcf/blob/packagebuilds/packagebuilds/rpm/shcf.spec
I build it as follows:
rpmbuild --target noarch -bb shcf.spec
Now, this builds fine, however, the output rpm's content has duplicated path "shcf/shcf", like:
/opt/icasimpan/shcf/shcf/***
This is the prep area
%prep
echo "BUILDROOT = $RPM_BUILD_ROOT"
mkdir -p $RPM_BUILD_ROOT/opt/icasimpan/shcf
cd $RPM_BUILD_ROOT/opt/icasimpan/shcf
git clone --branch 0.3.1 https://github.com/icasimpan/shcf.git
exit
At first sight, it's obviously due to the clone done to "$RPM_BUILD_ROOT/opt/icasimpan/shcf". However, if I modify the clone line to say
git clone --branch 0.3.1 https://github.com/icasimpan/shcf.git .
rpm build will fail due to unpackaged files.
Is there anything I'm missing?
Thanks in advance.

build nginx use autoconf

recently I'm reading nginx source code, but I got confused how to build it's code by autoconf, I have try my best to write a Makefile.am, unfortunate, I'm failed to write a correct Makefile.am file, so I cann't get a configure file, does anybody know how to write a Makefile.am?
I know how to write a Makefile.am, but you have no need to.
As you know, the nginx source package is a GNU autotools
package.
You don't do the autotooling. The people who write nginx do that. When you
download the source package, the configure.ac, the Makefile.am(s) and other
autotools files are already there along with all the source code.
To build the package, all you have to do is run the configure script to
generate correct makefiles for your system, then run make. (This is why the
build system is called autotools.)
Source packages are distributed from http://nginx.org/download/. Assuming
you want nginx 1.10.2 (the stable release at this time), you simply do this
in a suitable working directory:
$ wget http://nginx.org/download/nginx-1.10.2.tar.gz
$ tar zxf nginx-1.10.2.tar.gz
$ cd nginx-1.10.2
$ ./configure
$ make
Then it's built in ./nginx-1.10.2. If you then want to install nginx in your system, continue:
$ sudo make install
Building any autotooled source package is essential the same as this.
For full details and variations, do read NSTALLING NGINX OPEN SOURCE
I have write a email to nginx's author, he said configure file was written by hand

How to execute sqlite test file?

I downloaded the sqlite3 source file (not amalgamation version)
There are test folder and many test files (journal1.test , pager1.test ... etc)
How to execute these test files?
Go to the SQLite's download page and download the Snapshop of the complete (raw) source tree on the Alternative Source Code Formats section.
Unzip it, cd into the folder and run:
sudo apt install tcl-dev zlib1g-dev
./configure
make test
You can run the quick test instead (less than 3 minutes):
make quicktest
Or just the tcl tests (aka veryquick):
make tcltest
On Mac
brew install tcl-tk
./configure --with-tcl=/usr/local/opt/tcl-tk/lib
make test

How to find if file has changed using git2r

Say I have a repository repo:
library(git2r)
repo <- repository(".")
In this repository is a subdirectory R, with files a.txt, b.txt and other files that I'm not interested in. How can I use git2r to work out if there are unstaged changes in these files? I've looked at summary(diff()), but that works on the level of the whole repo.
Essentially, what I'm trying to do is replicate the effects of the git command:
! git diff-index --quiet HEAD -- file
Where if there are changes in the file, then return false. While I could use a system command, there's no guarantee the user has git in their path and so the command would fail.
Is there a way to replicate the git functionality I'm looking for?
This issue is solved in the latest development release of git2r.
There is now an all_unstaged option to status:
> status(repo, all_untracked = TRUE)
Untracked files:
Untracked: untracked/a.txt
Untracked: untracked/b.txt

Resources