Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#28668 - [x264] Building x264 from git instead of snapshots

Attached to Project: Arch Linux
Opened by Krzysztof Grygiencz (kfgz) - Sunday, 26 February 2012, 21:52 GMT
Last edited by Ionut Biru (wonder) - Wednesday, 06 February 2013, 20:11 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Ionut Biru (wonder)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No



Some application (i.e. hybrid-encoder in AUR) requires version check of x264. x264 built from snapshot has only x at the end of version string.

Snapshot version
x264 0.120.x

Git version
x264 0.120.2164 da19765

Currently x264 is built from snapshots but Arch policy (bleeding edge) allows "git snapshots" so maybe it will be good idea to built x264 from git.

This task depends upon

Closed by  Ionut Biru (wonder)
Wednesday, 06 February 2013, 20:11 GMT
Reason for closing:  Implemented
Additional comments about closing:  x264 20130206
Comment by Ionut Biru (wonder) - Monday, 27 February 2012, 10:24 GMT
imo is a bug in hybrid-encoder and they should use pkg-config to check the existance of x264
Comment by Krzysztof Grygiencz (kfgz) - Monday, 27 February 2012, 15:05 GMT
Presence of x264 in system is done correctly in hybrid encoder. It's the revision check that fails (0.120.x vs 0.120.2164). Alternative solution is to patch x264 and repace "x" with revison number (file x264_config.h after ./configure).

Possible fix

./configure --enable-shared
sed -i "s|0.120.x|0.120.REV_NUM|g" x264_config.h
Comment by Ionut Biru (wonder) - Monday, 27 February 2012, 15:33 GMT
submit that to x264 devs. I won't add that sed workaround because every time soname changes I have to change the sed as well.
Comment by Greg (dolby) - Friday, 24 August 2012, 11:30 GMT
Any news?
Comment by Krzysztof Grygiencz (kfgz) - Friday, 24 August 2012, 15:37 GMT
Thanks for reminding this bug report. I was too lazy ;) to report this upstream so I figure out a workaround. It's fully automatic ;)
   PKGBUILD (1.3 KiB)
Comment by Gustavo Alvarez (sl1pkn07) - Thursday, 17 January 2013, 00:51 GMT
  • Field changed: Percent Complete (100% → 0%)
The upstream has a method to get the version of the x264 since beginning of the project (the method is the same, only changes the VCS used).

This method is:

when configure is executed (with or withour arguments) it calls the script, to see the total number of commits that the repository has.

[1], Exactly [2]...

If the whole script is read, with this total number of commits (and some equations) determines the build.

The Zip has no folder .git to generate the version, but if the git repository is used, it will fix the problem, because the x264 repository has the master and stable heads.
Master is under development, but stable freezes when the whole code has been tested.

No need for sed workground, just (the real problem) to stablish the variable pkgver= with the info generated by, but this only works if the repository is cloned
and extracting the info from the x264_config.h file before launching build() function in the pkgbuild.

I've not found the method to get all the info from the repository like git rev-list in the local repository. Only if a painful hack is built:

Download from [3] with curl -sL (pg=0 is a variable that determines the number of pages that the log has; this number increments if you add more commits to the repository.
Today, the log has 22 pages; tomorrow, or in a month, it might have 30... or 50...), extract the hash from the commits, run the command uniq to eliminate the repeated commits,
and make your own algorithm (like in the to get the version.

I'm working on it. For now, only this works:

_getver() {
msg "Connecting to server to get version"
rm -fr .temp
git clone "${_gitroot}" .temp > /dev/null 2>&1
cd .temp
./configure > /dev/null 2>&1
echo "$(< x264_config.h)" | grep X264_VERSION | cut -d ' ' -f4 | cut -b2-
cd ..
rm -fr .temp


and running a clonation for the second time in the function build()

if anyone have any idea to complete this (without cloning the repository twice and with compatibility with pkgbuild), you'd make me a wooden son.