Sailfish Community News, 13th January, Tasks

Subscribe to future posts here :bell:

Sailfish OS update from Jolla

It’s 2022 and at Jolla we have big plans for the year. If you were keeping track of Sailfish OS news in 2021 you’ll already have heard about some of these plans. Things to look forward to include.

  1. Sailfish X extending to support the Xperia 10 III.
  2. Jolla entering new markets beyond Europe.
  3. VoLTE support for the Xperia 10 II.
  4. More secure alphanumeric encryption.
  5. Updated browser engine.

None of this is new information, but it’s worth reiterating as we’re still on track to deliver these in the coming year.

We have other plans as well, including our usual cadence of Sailfish OS releases, each of which will introduce new features and fixes, both user-facing and behind-the-scenes improvements. We look forward to revealing more of these plans as the work on them progresses.

Just in the last week Jolla has been at CES in Las Vegas, promoting AppSupport for integration with embedded Linux, and especially In-Vehicle-Infotainment systems. We’ll talk a little more about this in the News from farther afield section below.

But first, in the spirit of the new year we thought we’d spend a bit of time looking at how the Sailfish developer tools can potentially be used to organise your development tasks better and streamline your development workflow.

Developer Tasks

January tends to be a rather task-oriented month for me. My annual new year’s resolution ritual involves me writing down all of the things I planned but failed to complete last year. It’s a long list, I can tell you. Half of the tasks stay on my to-do list, the other half end up on my new year’s resolutions list. Then they’re all forgotten about until the ritual is repeated again in a year.

Despite this, I’m still a big fan of a task-based approach. Clearly scoped, well-structured and achievable goals are a great help when it comes to actually getting stuff done. Some of the features introduced recently into the Sailfish developer tools are specifically aimed at supporting task-based workflows which span multiple projects, and we wanted to take a look at them in more detail.

One of the common situations where you may need to work across multiple projects simultaneously is when you’re developing functionality that relies on new code in a dependency library. If the library is in a separate repository, then you’ll somehow need to get the consuming code to pick up the new functionality in the library.

This isn’t really a problem for apps, since Harbour doesn’t allow the use of third-party libraries that aren’t already part of Sailfish OS. However, if you want to do platform development (i.e. making changes to the Sailfish OS code itself) then you’re likely to eventually hit this problem.

The sfdk tool used for building Sailfish OS binaries has some nice functionality built in to help with this, in the form of the output-dir configuration option. This allows you to specify where the final .rpm files created by your build script end up. The really neat part is that it also magically picks up any rpms output to the folder when checking for dependencies.

The easiest way to understand the issue, and how this solution works, is to consider an example. In all of our examples below we assume the SDK is configured with an appropriate target. If not, set it now with something like this (the actual target name will depend on which targets you have installed).

sfdk config --global --push target SailfishOS-4.3.0.12EA-aarch64

Now check out this super-simple library project. It has one source file containing one function news_print() that prints a string.

void news_print() {
  std::cout << "This is the news";
}

Everything else in the repository is the boiler-plate library project structure. The most important other pieces are the .pro file and the .spec files which determine how the library object is built and wrapped up into an rpm respectively.

You can clone and build this with the following few commands.

git clone git@github.com:llewelld/newslib.git
cd newslib/
sfdk build

Unless you’ve changed your sfdk configuration, this will build the library and development rpms in a folder called RPMS inside the project folder itself.

So far so good. But what if we now have some code that wants to make use of the library? As luck would have it, there is such an app in this super-simple application project. All this app does is print some words on the command line and then call our news_print() library function (which prints a little bit more). You can see this happening in the source code for the app:

#include <iostream>
#include <newslib.h>

int main(int, char *[]) {
  std::cout << "News application";
  news_print();
  return 0;
}

Also worth noting are the build requirement lines in the rpm/harbour-newsapp.spec file:

BuildRequires: newslib-devel
Requires: newslib

This dependency is then made use of In the harbour-newsapp.pro file where we see the following for making use of our libnews library.

PKGCONFIG += news

Notice how we also #include the newslib.h file in our main C++ file. So it looks like everything is in place. However, if we now clone the repository and try to build the project, we’ll run into trouble.

cd ..
git clone git@github.com:llewelld/harbour-newsapp.git
cd harbour-newsapp/
sfdk build

We get an error “Failed build dependencies…” as shown below.

The problem here is that even though we’ve built a copy of the newslib library and its development package, the build tools are only searching inside the Sailfish SDK target for packages to resolve its dependencies.

The way to solve this is to install the library development packages inside our target. We could in fact do this manually, and as long as we install it inside the snapshot rather than the original target, this is relatively safe. However, if we’re making changes to the library alongside the code that consumes it, this becomes cumbersome. A much neater solution is to have both projects use the same output directory.

The sfdk tool makes this process really straightforward. We can create a folder ~/RPMS where our built rpm files end up, and which will also get searched for dependences, like this:

mkdir ~/RPMS
sfdk config --session --push output-dir ~/RPMS

A few things to note about this configuration command. First, we use the --session flag so that it only applies for the current session. If you want it to stick indefinitely, you can use the --global flag instead. Second, we specify ~/RPMS as an absolute directory path. The command won’t work correctly if you try to set it as a relative path. Third, the directory must exist for the configuration command to work, which is why we create it first.

If you want to see the current configuration, you can use the sfdk config command. I’ve done this in all of the screenshots so you can see what the current configuration looks like in my environment.

We must now rebuild the library in order to get the rpm files into this output directory, but having done so, the application project will now automatically install the library in our target snapshot when we try to build it, and the dependencies will be resolved correctly.

cd ../newslib/
sfdk build
cd ../harbour-newsapp/
sfdk build

Nice!

You’ll see some warnings about the packages not being signed, but these won’t prevent the application from being built*. So if we now look inside the ~/RPMS folder, we’ll see our harbour-newsapp application successfully built there. If you like you can now copy the library and application rpms over to your phone, install them and run the application (but I wouldn’t bother; it’s not a very exciting app!).

We can now take this a step further by partitioning our output directory in terms of tasks. Tasks add an extra subdirectory layer to the output based on a task name, which we’ll set up to use the name of the current git branch for the project. As long as you use the same branch name for all of the projects that relate to the task, they’ll all end up in the right place.

Let’s suppose we’ve been given the task of adding another function to our library that prints another line of arbitrary text, and which needs to be called from our application. We’ll call this the newfunc task.

First we need to set up our build system to use tasks, rather than a flat output directory. First, we remove our previous configuration:

sfdk config --session --drop output-dir

Now we set up our session using the output-prefix option, to replace the output-dir we were using before, and ensure we have tasks activated to use the git branch name.

sfdk config --session --push output-prefix ~/RPMS
sfdk config --session --push task git:.*

Here we’re using git: followed by a regex to use the entire branch name. We could refine this with a different regex if we have some clever naming technique we want to use for our branches. But we won’t go into that further today. Now let’s create a new branch in our newslib project:

cd ../newslib/
git checkout -b newfunc

And now edit the src/newslib.cpp file to add our new news_footer() function:

void news_footer() {
  std::cout << "That was the news" << std::endl;
}

and also add it to the src/newslib.h file:

void news_footer();

The full set of changes can be seen in this diff. So that’s the library updated and configuration set. Now build the project using sfdk build, and note how the rpms are output into the ~/RPMS/newfunc/<target> directory.

Now we can update our application to use the new function.

cd ../harbour-newsapp/
git checkout -b newfunc

Add the new call into the main() function.

int main(int, char *[]) {
  std::cout << "News application" << std::endl;
  news_print();
  news_footer();
  return 0;
}

The full set of changes can be seen in this diff. Finally we build the application to use our new library function.

sfdk build

You’ll see the new library development package being installed into the snapshot, so that the application can be built against it. If you like you can now install the new rpms onto your phone to test them out. Make sure you install both the application and the library to avoid runtime linker errors, and if you’ve configured your device with the SDK, you can easily do this using:

sfdk deploy --sdk --all +newslib
sfdk deploy --sdk

If you want to use this task-based approach all the time, you can set a permanent configuration using the --global flag.

sfdk config --global --push output-prefix ~/RPMS
sfdk config --global --push task git:.*

This simple technique is a little hidden, since it’s not available directly from the IDE, but I think it’s worth knowing about. If you spend some time doing platform development, or development of libraries used by other applications, then setting up this configuration can save a lot of time and energy.


* If this bothers you, you can suppress the warnings with the following: sfdk config --session --push search-output-dir quiet

Energy from the Community

As always, we have a nice selection of new and updated apps to bring us in to 2022. There was clearly a lot of development work happening over Christmas; thank you to all the developers out there for your work building great software for Sailfish OS. Let’s take a look at some of the results.

Aenigma

We’ve featured a number of different puzzle apps in the newsletter before, including Picross 2 back in May, Patience Deck in June and Mah Solitaire in November. Aenigma is an entirely new app on Sailfish OS released right at the tail end of 2021 by Samuel Kron (black_sheep_dev), and which follows in a similar tradition by providing a very thorough Sudoku implementation.

The app is very slick and provides a very streamlined way of playing Sudoku. The app generates boards from one of four different difficulty levels (easy, medium, hard and insane), and which in my experience live up to their names. You then fill out the board by selecting one of the numbers from 1-9 and then clicking on empty cells to insert the number in to it. It seems like a natural approach, given that it’s not uncommon to focus on particular numbers, fill out as many as possible, and then move to a different number to continue.

On top of this nice interface the app provides a huge variety of game aids. You can undo moves, add notes to cells, highlight any cells that are clearly incorrect (e.g. because the number appears twice in a column). Selecting a number for placement highlights all other instances of the number on the board, and you can also configure them to highlight all of the columns, rows and blocks they appear in too (to indicate that you shouldn’t place a second instance in any of them).

It’s all very helpful stuff. But if you’re a purist you can turn all this off and play as if using just pencil and paper.

At the end of the game, the app tells you the time and number of moves recorded for the board.

If you like playing Sudoku, you should definitely try this app. The latest version adds Hungarian and Dutch translations as well as persistent storage of the board across restarts so you can easily continue the same board over an extended period of time. However, development has been so rapid over the last fortnight (at least one new version every day) that by the time you read this it may well have improved even further.

Aenigma is available from the Jolla Store and OpenRepos.

Audioworks

Audioworks is another of Tobias Planitzer’s apps that’s recently been rehabilitated under the able stewardship of Mark Washeim (poetaster). Audioworks isn’t a music or sound producer, but instead is a tool for manipulating and cleaning up existing audio samples. An “audio workbench” as the app’s description puts it.

As you might guess, it’s a companion app to ImageWorks and VideoWorks, both of which are impressively capable apps for editing images and videos as featured back in September and December respectively.

Audioworks shares a similar interface, with the audio file waveform shown at the top of the screen where the image or video appeared in the other two apps. By displaying it in two lines at two different zoom levels, you can easily jump to the right place in the sample and careful select the region to apply an edit to. Below the sample is a tab-like toolbar with six icons: trim, volume control, speed control, copy/paste, filter and file. Selecting one of the tabs fills out the control area below it with potential options.

Although the options here are more limited than their image or video counterparts, there’s still a lot of scope for manipulating sound files. The ability to trim and remove sections is already useful in itself, but there’s also high and low pass filters, automatic silence removal, echo, the ability to speed up the audio without changing the pitch, and quite a few other possibilities. All of them are easy to apply and can be undone with a single tap.

One unfortunate bump on the path to installing the app is that, as explained in the description, you must first install ffmpeg-tools at the command line. It’s a one-time configuration step, but means there’s a requirement for your device to be in developer mode. It’s not ideal, and hopefully something that can be addressed in the future.

This is another superb piece of software. The latest version, which improves the code structure rather than adding features or fixing bugs, is available from the Jolla Store.

Worldclock

Worldclock from Arno Dekker (ade) is a helpful app for anyone who has to deal with multiple timezones, due to travel in either the physical or virtual worlds. Much as you might expect from an app of this name, you can select different cities and the app will present them neatly in a list on the main page of the app. Not only that, but it will also present the same list very neatly on the cover, so you can check the time across the world at a glance without even opening the app.

Apart from the ability to display the time and date for multiple countries simultaneously, the app also has a number of other nice features. I especially liked the fact that selecting one of the cities opens a page with much more detailed information. Not just the timezones, local time and daylight saving transitions, but also the international dialling code, TLD and currency. Handy stuff.

The list of cities you can choose from contains the standard set of capitals covering all of the timzones, but you don’t have to stick to just those. You can also create your own by duplicating one of the entries and giving it an alternative name.

There are options for sorting the list in various ways, or switching language in the app from one of the fifteen it supports, meaning you can change language without having to restart your phone (a restart of the app is required though).

The latest version adds sandboxing support, as well as adding Chinese translations, improved icons and improved support for light ambiences. Worldclock is available from the Jolla Store as well as OpenRepos.

avaRisk - Avalanche Bulletins

The avaRisk app is a great companion app for avid skiers and winter sportspeople. It will give you up-to-date information about the risk of avalanche activity in your area, pulling in Avalanche Bulletins from across Europe.

The app has an interesting history, created by Friedrich Mütschele (fridl) as part of an internship with an avalanche warning service secured as a result of him contacting them in order to make use of their API for the app. A few months after, they contacted him back to ask if he’d be willing to help develop their software platform together.

History aside, the app is nicely designed with rather elegant graphics and watermarking throughout. It provides information categorised into several hundred different regions, selected by drilling down from country to area and then region.

Having selected it, you’re presented with avalanche information relevant to that region. This includes the danger level, elevation information, icons representing the avalanche problem types, complete descriptions (in English or the local language) of any dangers, the snowpack, the weather and the tendency. In addition, the period of validity is also clearly specified. The information seems to come from various services, depending on the location you choose. It’s all presented clearly and in an easily accessible way. This location-specific information is also nicely summarised on the app cover.

In addition to this current information based on location, the app also has a nice “Know-How” section which covers more general information needed in order to understand the bulletins properly. This has been provided by avalanche.report.

The latest version updates the Know-How section and improves the GPS location (although this is still beta functionality according to the author). The avaRisk app is available from the Jolla Store, and OpenRepo.

News from farther afield

Jolla was attending CES in Las Vegas last week, especially promoting the use of Android AppSupport in automotive settings. Check out the section of the Jolla website devoted to AppSupport for the background. You can also have a read of Jolla’s Press Release for CES on the topic.

Since multiple car manufacturers are choosing embedded Linux to build their In-Vehicle Infortainment systems, this is a great opportunity for car manufacturers to integrate support for Android apps on top of their own platforms, as well as a great opportunity for Jolla to harness and improve the incredible technical investment it’s already made in the technology.

Sharp-eyed community member d.d noticed a host of news sites picking up Jolla’s announcement, including Triggered Reviews (English), mobiili.fi (Finnish), smartworld (Italian). Tecnogazzetta (Italian) and Ugeek (French). It was also picked up by Italy 24 News (English), mobilissimo.ro (Romanian), autoevolution (English), HDmotori.it (Italian), informaticien.be (French), and Services Mobiles (French), amongst others.

It’s always nice to get positive news coverage of course, but more relevant to denizens of this forum is that AppSupport running in cars means more investment in the technology, resulting in a better experience for Sailfish OS users, while at the same time improving the experience for car owners who get to benefit from this unique technology too. We will, no doubt, be talking more about this topic in future newsletters.

Please feed us your news

This is a community update, and frankly we can’t always keep up with all the exciting stuff happening in the Sailfish community. Plus, the less of this we have to actually write ourselves the better. So please help us out by posting your Sailfish news updates to the forum as a reply to this post. We’ll collate as much of it as possible into one easily digestable post for the next update.

Don’t forget to join us at our community meetings. They’re held every other Thursday on IRC. The next meeting will be on the 20th January.

18 Likes

Thanks for the detailed how-to and the news! We are going to have to collect all of the how-tos in the wiki!

1 Like

That probably means, that the other (existing) devices won’t get VoLTE support. :face_with_raised_eyebrow:

Not necessarily. If the source can be released then the porting community will pick up …

2 Likes

That’d be very sad, but quite probable looking how Jolla tends to sideline older ports.
It;d be quite difficult for me as I can’t see any proper replacement for F5321 (X Compact), all those phones are awfully huge these days.

1 Like

I know the question of which devices will be supported has been raised, so I wanted to be as clear as possible based on the info I have. But I would caution against inferring anything about other devices from this. I would have loved to give you more info about other devices, but I don’t have that info to share I’m afraid.

4 Likes

Wow.

If only someone had told me about that dependency stuff half a year ago!

This makes things so much simpler :smiley:

1 Like

Thanks for mentioning avaRisk this week! I hope some winter sports enthusiast enjoy the app. There are more regions to come, and if someone wants to help with translations feel free to contact me. It should be possible to fetch a number of reports in other languages as well, e. g. in Norway there is Norwegian available for the report obviously, but the app is not localized to Norwegian at the moment. Also a lot of reports are available in Italian (whole Swiss for example, the “Euregio” region around Tirol etc.). So if someone would be interested in the reports in that language and a localized version, I would only need some help with the translations. :wink:
And thanks, as always, for the Newsletter. It is, as always, a very interesting read!

2 Likes

Note that this (naturally) only seems to work with this workspace directory you’ve configured while installing the SDK.
“~” is the default for this, but if you have changed that (like I did), build commands will abort with a strange Fatal: '/home/username/RPMS' is not a directory although you have created that directory just before.

1 Like

That (strange error message) is a known issue. In our next SDK version it will be replaced with a more clear message Invalid argument '/home/username/RPMS/': Path not located under Sailfish SDK workspace directory (/home/username/SDKWorkspace)

4 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.