[Vm-dev] Passing additional parameters for a particular plugin

Bert Freudenberg bert at freudenbergs.de
Thu May 17 11:41:41 UTC 2012


On 17.05.2012, at 01:11, Igor Stasenko wrote:

> On 16 May 2012 16:53, Damien Cassou <damien.cassou at gmail.com> wrote:
>> 
>> Hi,
>> 
>> I try to build DBusPlugin (www.squeaksource.com/dbus). Unfortunately,
>> compiling the generated C file requires passing "$(pkg-config dbus-1
>> --cflags)" as additional compiler argument. How can I specify that?

In the official sources, there is no such call. It builds DBusPlugin using CMake, and all that's needed is 

	PLUGIN_REQUIRE_PACKAGE (DBUS1 dbus-1)

which is in 

	http://squeakvm.org/svn/squeak/trunk/platforms/unix/plugins/DBusPlugin/config.cmake

After installing libdbus-1-dev (or whatever the dbus devel pkg on your distro is), building DBusPlugin works just fine.

That said, if you just want to build the DBusPlugin independently, then adding `pkg-config dbus-1 --cflags` to your command line should work fine. Pkg-config is just a program that outputs the needed compiler and linker options:

bert at ubuntu12-VirtualBox:~/squeak-svn/bld/DBusPlugin$ pkg-config dbus-1 --cflags
-I/usr/include/dbus-1.0 -I/usr/lib/i386-linux-gnu/dbus-1.0/include

bert at ubuntu12-VirtualBox:~/squeak-svn/bld/DBusPlugin$ pkg-config dbus-1 --libs
-ldbus-1 -lpthread -lrt  

On 17.05.2012, at 01:11, Igor Stasenko wrote:

> But I am not sure what
> $(pkg-config dbus-1 --cflags)
> expression means.
> Looks like stuff between () is invoked by shell and output of it is
> used instead.
> [...]
> 
> But i don't like that it takes flags from another package build flags (dbus).
> This means that such plugin will work only on your machine and nobody
> else(s), once your build
> flags is different to others.

In Linux, by definition, you are only compiling for your own machine.

Packages for use by others are built by the distro's package maintainers, and they will make sure that the version that comes with your system works.

> On your place, i would take this command output and put it literally
> into extra definitions.
> Like that, a plugin configuration will be not dependent from some
> 3rd-party stuff , and won't change randomly depending on system where
> it built.

Unless you use the CMake built-in stuff, pkg-config is precisely the right thing to use (in particular for D-Bus, which is a freedesktop standard, just like pkg-config). It will make sure that this compiles and links correctly on your machine. By hard-coding its output you make it a lot harder for others to use the same source, because they will have to manually change the flags.

- Bert -



More information about the Vm-dev mailing list