Jamfiles & the Locale Kit

I´m currently working on a patch for the Medo video editor to use the Locale Kit for translating the UI to different languages. Medo uses Jam as build system, which I´m not really familiar with as I use the makefile engine for my own projects.

My questions are

  • what definitions does the Jamfile need to be able to handle the translations (creating catkeys files, linking them with the app)?
  • which jam commands do I have to use for creating the catkeys files? Does Jam have an equivalent to “make bindcatalogs” or does it link the catalogs automatically?

I have looked at the Jamfiles for the apps that are bundled with Haiku but most of the definitions in these Jamfiles don´t seem to work outside Haiku´s source tree.

1 Like

jam itself is about as basic as make and has no specific knowledge of catalog files. And yes, the definitions in Haiku are not meant to be used outside of our source tree.

So you’ll be a bit on your own for writing the needed rules.

The commands to use are:

  • collectcatkeys, to parse the .cpp/.h files and extract a .catkeys file with the english strings
  • linkcatkeys, to take a .catkey file (translated in another language than english) and compile it into a .catalog file (or directly into an application resource)

Both of these come with a --help switch that should give a bit more info on its usage.

You can see how it’s done in the Makefile engine:
https://git.haiku-os.org/haiku/tree/data/develop/makefile-engine#n316

And it seems the Jamfile engine includes similar rules as well:
https://git.haiku-os.org/haiku/tree/data/develop/Jamfile-engine#n76

Does Medo use the Jamfile engine? Otherwise you may need to extract these rules and add them in Medo custom Jam rules.

Thanks @PulkoMandy for the help. I’ll take a look at collectcatkeys and linkcatkeys.

I don’t think it uses the Jamfile engine, it looks pretty basic. But I’ll take a look at the Jamfile engine nonetheless, maybe I can convert Medo’s Jamfile to use the engine.

Hi BlueSky.

Medo has a simple Jamfile, with no dependencies. This is so that a person can build Medo without bringing in the entire Haiku source tree (just in order to get the jamrules). So to compile, just type:

jam -j8

And it will create a debug version for you (x64 version). To build a x32 version, I need to find out how to modify the Jamfile so that it references the correct freetype2 header path (interestingly, it’s different on x32 vs x64 builds), and I haven’t spend any time figuring out how to make a dynamically configurable jamfile. These days Medo builds under both x32 and x64 without errors once the freetype2 header path issue is addressed.

The script “create_package” is used to package the final product (it takes care of compiling in Release mode, setting the icon, setting attributes and copying everything into the package file directory, as well as setting up Deskbar link).

I also have a cmake file which does the same thing:

cmake CMakeLists.txt
make -j8

The binary size will be bigger using this method, especially the addons (20Kb vs 450Kb per addon). I didn’t spend any time trying to resolve this issue since I use jam.

QtCreator uses CMakeFiles.txt for dealing with Projects, and works very well when dealing with a pristine folder. However, if you manually type cmake CMakeLists.txt, QtCreator is confused by the output when parsing the CMakeLists.txt. So the habit I got into is to leave the CMakeLists.txt for QtCreator, and just use jam from the terminal to build, this way QtCreator doesn’t get confused with the output of cmake. Another +1 for jam.

Hope that helps, and feel free to email me personally if you want to avoid the forum.

solaja AT gmail DOT com

Take care.

3 Likes

Thanks @Zenja for the detailed explanation. I´ll see if I can integrate the collectcatkey and linkcatkeys commands into the existing Jamfile. Maybe someone else can then do the integration into the cmake build system.

Thanks, will do :slight_smile:

1 Like