CMake and library properties

When writing libraries with CMake, you need to set a couple of properties, especially the VERSION and SOVERSION properties. For library libbar, it could look like:

set_property(TARGET bar PROPERTY VERSION “0.0.0″)
set_property(TARGET bar PROPERTY SOVERSION 0 )

This will give you a libbar.so => libbar.so.0 => libbar.so.0.0.0 symlink chain with a SONAME of libbar.so.0 encoded into the library.

The SOVERSION target property controls the number in the middle part of the symlink chain as well as the numeric part of the SONAME encoded into the library. The VERSION target property controls the last part of the last element of the symlink chain

This also means that the first part of VERSION should match what you put in SOVERSION to avoid surprises for others and for the future you.

Both these properties control “Technical parts” and should be looked at from a technical perspective. They should not be used for the ‘version of the software’, but purely for the technical versioning of the library.

In the kdeexamples git repository, it is handled like this:

set(BAR_VERSION_MAJOR 1)
set(BAR_VERSION_MINOR 2)
set(BAR_VERSION_PATCH 3)
set(BAR_VERSION ${BAR_VERSION_MAJOR}.${BAR_VERSION_MINOR}.${BAR_VERSION_PATCH} )

And a bit later:

set_target_properties(bar PROPERTIES VERSION ${BAR_VERSION}
SOVERSION ${BAR_VERSION_MAJOR} )

which is a fine way to ensure that things actually matches.

Oh. And these components is not something that should be inherited from other external projects.

So people, please be careful to use these correct.

Posted in debian, english, kde

Bringing KDE forward

The almost-yearly large KDE-sprint in Randa, Switzerland is doing a fundraiser to get this year’s event running. See http://www.kde.org/fundraisers/randameetings2014/

This year, it is besides the recurring multimedia topics, a lot about improving the new KDE Frameworks, the related documentation and the development experience with IDE’s and such.

It is also a good way to come full circle, since it was back in 2011 when I was at the Randa Meetings that the KDE Frameworks initiative was started.

So once again: http://www.kde.org/fundraisers/randameetings2014/

Posted in english, kde

Diploma thesis about media choice and usage in Free Software communities: I need your help

My hard-working KDE friend Mario asked me to help him to get Debian people to help him with his thesis. Here is what he writes:

Dear Free Software contributor*

I’m currently in the process of writing my diploma thesis. I’ve worked hard during the last few weeks and months on a questionnaire which shall collect some data for my thesis. Furthermore the data of this survey will be interesting for the Free Software communities as well.

So please take some time or add it to your todo list or, even better, go directly to my questionnaire and help me make a great diploma thesis and improve the Free Software community in some ways.

The questionnaire takes some 20 to 30 minutes. At the end of the questionnaire you’ll find a way to participate in a draw where you can even win something nice.

In a first round I got the feedback that the length of the questionnaire and that some questions (mostly the ones at the beginning of the questionnaire about the 12 different tasks) are quite abstract and difficult. But please try it, try your best and take the time and brain power. The remaining part of the questionnaire [1] (after these two pages with the tasks questions) is quite
easy and quickly done. And you have the possibility to come back to where you
have left filling in the questionnaire after a shorter or longer break.

And if there are any questions, feedback or you need help don’t hesitate a moment to write me an email or ping me on IRC (freenode.net and oftc.net) as unormal.

This survey will be open till Sunday, the 9th of March 2014, 23.59 UTC.

Thanks to all for reading and helping and towards the summer of 2014 you can read here what all the data you gave me showed us and where we can learn and improve.

Thanks in advance and best regards
Mario Fux

* By contributor I mean not just developers but translators, artist, usability
people, documentation writers and many more. Everybody who contributes in one
way or the other to Free Software.

Posted in debian, english, kde

9.0 Zurg

I welcome Debian 9.0 Zurg!

Thanks to Phoronix and to Wikipedia editor at 213.81.201.123 and 149.255.97.132 for their high quality fact checking.

Posted in debian, english, kde

CMake skeleton for small Qt projects

For small Qt-projects, I have for a long time been using qmake, mostly because qmake -project gives me a working build in most cases, but once the project grows a bit, I have switched to cmake because there is just things there I like better.

So, I thought how to start with cmake instead, and ended up writing a small script. I guess I should share it:

#! /bin/sh

# Simple script that generates a cmake project file for a Qt project

#
# Copyright (c) 2013 Sune Vuorela
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the “Software”), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#

CPPFILES=”$(ls *.cpp 2>/dev/null)”

UIFILES=”$(ls *.ui 2>/dev/null)”

QRCFILES=”$(ls *.qrc 2>/dev/null)”

NAME=”$(basename $(pwd))”

error() {
echo ERROR: “$@”
exit 1
}

debug() {
[ -z "${DEBUG}" ] && return
echo DEBUG: “$@” 1>&2
}

# sanity checks

if [ -e "CMakeLists.txt" ]
then
error CMakeLists.txt found. Doing nothing.
fi

if [ -z "${CPPFILES}" ]
then
error “No cpp files found”
fi

debug NAME ${NAME}
debug CPPFILES ${CPPFILES}
debug UIFILES ${UIFILES}
debug QRCFILES ${QRCFILES}

# First part of cmake files
cat >> CMakeLists.txt << __EOHEADER__
project(${NAME})

cmake_minimum_required(VERSION 2.8.11)

find_package(Qt5 CONFIG REQUIRED Widgets)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

__EOHEADER__

# Handle ui files if any
if [ -n "${UIFILES}" ]
then
cat >> CMakeLists.txt << __EOUI__
set(${NAME}_ui ${UIFILES})
qt5_wrap_ui(${NAME}_wrapped_ui \${${NAME}_ui})

__EOUI__

UIWRAPPED="\${${NAME}_wrapped_ui}"
debug prepared UIWRAPPED ${UIWRAPPED}
fi

# Handle qrc files if any
if [ -n "${QRCFILES}" ]
then

cat >> CMakeLists.txt << __EOQRC__
set(${NAME}_qrc ${QRCFILES})
qt5_add_resources(${NAME}_wrapped_qrc \${${NAME}_qrc})

__EOQRC__

QRCWRAPPED="\${${NAME}_wrapped_qrc}"
debug prepared QRCWRAPPED ${QRCWRAPPED}
fi

# Build the actual library
cat >> CMakeLists.txt << __EOCPP__
set(${NAME}_src ${CPPFILES})

add_executable(${NAME} \${${NAME}_src} ${UIWRAPPED} ${QRCWRAPPED} )

target_link_libraries(${NAME} Qt5::Widgets )
__EOCPP__

I’ve saved it locally as cmake-qtproject – and it works with at least cmake 2.8.11.

I hope wordpress doesn’t make too much mess of it. Have fun.

Posted in debian, english, kde

Announcing Rawatar – Qt5 libravatar client library

So. following up on my previous post about implementing a libravatar server, this will be an announcement of a quick Qt5 based client library for libravatar – so that everyone can put avatars everywhere!

Get it while it is hot on
git.kde.org

There isn’t much screenshots to show off, given it is effectively just converting a string with an email into a URL for a image.

And thanks to Martin Sandsmark for coming up with such a great name. Now I expect him to show off what it can be used for. Another thanks goes to Andreas Hartmetz for going thru the code & api.

Posted in english, kde, Pocket projects

Simple Libravatar service

So, since recently bugs.debian.org has started using libravatar avatars. Not yet the federated service, but that’s supposedly in the works. But for that, one of course need to run each own service. Which I wanted to do. In a simple way.

So I did it.

_avatars._tcp.pusling.com. 43200 IN SRV 10 10 80 static.pusling.com.

and in my root dir for that one I have source/ and avatar/

$ ls
avatar source

In source, I have default.png which I’m serving and a series of avatars for various email addresses

$ ls source/
debian@pusling.com default.png

and then I have a simple script to generate the right file names:

#! /bin/sh

(cd avatar;
ls | while read file ; do [ -L $file ] && rm $file ; done
)
for i in source/*@* ; do ln -s ../$i avatar/$(echo -n $(basename $i) | sha256sum | sed ‘s/-//’) ; done
for i in source/*@* ; do ln -s ../$i avatar/$(echo -n $(basename $i) | md5sum | sed ‘s/-//’) ; done

and the last piece of magic to get everything to work:

$ cat avatar/.htaccess
ErrorDocument 404 “/source/default.png”
ForceType image/png

<Files “index.html”>
ForceType text/html
</Files>

and a set of index.html files created with ‘touch’.

So there you go. A simple libravatar service, ignoring some pieces of the spec, but it should be good enough for most people. I might save my rants about the libravatar spec for another day. But it involves implementing a complete redirecting service and scaling of images.

When will debian.org and kde.org start providing avatar services?

Posted in debian, english, kde, opensourcedays, Pocket projects

Nogen fra NemId?

Er der nogen fra NemId der læser med her? Jeg kan ikke få jeres supportformular til at virke. Og jeg kan ikke få jeres applet til at virke når jeg skal logge ind på skat.dk.

Tilgengæld har jeg noget i .xsession-errors der sikkert vil glæde jer.

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:131)
at java.util.jar.JarFile.(JarFile.java:150)
at java.util.jar.JarFile.(JarFile.java:101)
at net.sourceforge.jnlp.tools.JarSigner.verifyJar(JarSigner.java:287)
at net.sourceforge.jnlp.tools.JarSigner.verifyJars(JarSigner.java:247)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.verifyJars(JNLPClassLoader.java:902)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:390)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.(JNLPClassLoader.java:168)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:249)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:575)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:548)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:729)
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:131)
at java.util.jar.JarFile.(JarFile.java:150)
at java.util.jar.JarFile.(JarFile.java:101)
at net.sourceforge.jnlp.tools.JarSigner.verifyJar(JarSigner.java:287)
at net.sourceforge.jnlp.tools.JarSigner.verifyJars(JarSigner.java:247)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.verifyJars(JNLPClassLoader.java:902)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:390)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.(JNLPClassLoader.java:168)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:249)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:575)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:548)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:729)
net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize applet.
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:604)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:548)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:729)
Caused by: net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: A fatal error occurred while trying to verify jars.
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:396)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.(JNLPClassLoader.java:168)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:249)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:575)
... 2 more
Caused by:
net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: A fatal error occurred while trying to verify jars.
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:396)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.(JNLPClassLoader.java:168)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:249)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:575)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:548)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:729)
java.lang.NullPointerException
at net.sourceforge.jnlp.NetxPanel.runLoader(NetxPanel.java:99)
at sun.applet.AppletPanel.run(AppletPanel.java:380)
at java.lang.Thread.run(Thread.java:636)
java.lang.NullPointerException
at sun.applet.AppletPanel.run(AppletPanel.java:430)
at java.lang.Thread.run(Thread.java:636)
java.lang.Exception: Applet initialization timeout
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:637)
at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:270)
at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)
java.lang.RuntimeException: Failed to handle message: handle 71305979 for instance 1
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:660)
at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:270)
at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)
Caused by: java.lang.Exception: Applet initialization timeout
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:637)
... 2 more

Gad vide hvad der foregår?

ps.: NemId virker fint når jeg skal i banken.

Posted in danish

Fake Akrobat browser plugin

So. for some reason, the danish tax authorities (Skat) has started requiring Adobe Acrobat for being able to see pdf files to work around a bug with handling of temporary files on Windows8 and shared computers and such.

Luckily there is a couple of easy workarounds. Like modifying the Javascript to check things at runtime using some browser specific addons. Or just do it like I did and write a actual browserplugin. I cheated and used QtBrowserPlugin. Then my actual code was a couple of lines. Want to check it out? Look here: http://quickgit.kde.org/?p=scratch%2Fsune%2Ffakeacrobat.git. It just does enough to ensure the test succeeds. Work in: iceweasel and arora. For some reason, it doesn’t work in konqueror/webkit nor in konqueror/khtml.

Posted in english, kde, Pocket projects

Kontact / PIM sprinting

So, a couple of days ago, I came home tired after a intense weekend of learning Akonadi and hacking on KDEPIM.

At each meal, we attended 12 people, but it wasn’t the same people every time. And a couple of people participated remotely.

Several people, including me, got their feet wet in kdepim & akonadi code. Talks about the future with Qt 6 and Qt 7 and Akonadi 3 were also held in the corners.

Hopefully, others will tell more closely about what they did, including fixing kmail memory usage to not grow until all headers of all emails was in memory and improving the address completion job to help filling in to/cc/bcc fields.

Personally, I started off several times with the same issue. Not doing several synchronous calls from KMail to Akonadi during message writing and sending. On my way, I cleaned up some code and started over a couple of times. And the code is still a work in progress on my laptop. But the most important synchronous call is in that WIP patch now actually asynchronous \o/. There is still work to do on that area though and I hope to get around polishing it and finishing it this month somehow. I currently have function names like ‘second_half_of_generateCryptoMessages‘ and ‘this_function_should_be_renamed‘.

And next up will Andras Mantia hopefully blog about his accomplishments. And poke some other person for a blog post.

Oh. and if you like developers taking a weekend or so out of their busy schedule to meet up for hacking, please consider supporting KDE by Joining the game

Posted in english, kde