Tips to create a plugin with specific platform dependant stuff

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Tips to create a plugin with specific platform dependant stuff

Guillermo Polito
Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And that's the problem :), It uses gnome2 stuff to access the system configuration (because gnome handles it's own configuration... :/).

Now, I made it work doing something like this in vmmaker:

CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
    "extra rules for InternetConfigPlugin"
   
    super configureInternetConfigPlugin: maker.
    maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
    maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
    maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').

And adding it in the list of internal plugins for Unix.

But this should only compile and work on a system with gconf and stuff installed :).

So, how does or should vmmaker and vm building process handle something like this?

Guille

_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: Tips to create a plugin with specific platform dependant stuff

Igor Stasenko
On 7 April 2012 17:55, Guillermo Polito <[hidden email]> wrote:

> Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And
> that's the problem :), It uses gnome2 stuff to access the system
> configuration (because gnome handles it's own configuration... :/).
>
> Now, I made it work doing something like this in vmmaker:
>
> CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
>     "extra rules for InternetConfigPlugin"
>
>     super configureInternetConfigPlugin: maker.
>     maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
>     maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
>     maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').
>
> And adding it in the list of internal plugins for Unix.
>
> But this should only compile and work on a system with gconf and stuff
> installed :).
>
Then don't make this plugin internal, but external instead. Because if
library is missing,
VM will refuse to start. In contrast, if your plugin will be in
external module, then module will refuse to load
if lib is missing.

> So, how does or should vmmaker and vm building process handle something like
> this?
>

The philosophy of CMake configurations is to be concrete and without
conditionals. I.E. they should
not contain "if this, do this, if that do that" , instead if you have
such choice, one should make another configuration.

There is no way to predict how different is platform on which you
building VM  from platform where it used (especially in case of unix
systems and their numerous flavors). So, what is working on your OS,
could not work on another. That's why i don't see a point to put
conditionals in build process.

In contrast, if you have a concrete configuration, which says: if you
want to build me, you should have this, this and this, and if you want
to use the built artifact you should have this, this and this
installed, then it makes things much more predictable and
straightforward.


> Guille
>
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
Best regards,
Igor Stasenko.
_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: Tips to create a plugin with specific platform dependant stuff

Guillermo Polito
Haha! :)

You won me :).  I was about to reply this:

"Ok, so I talked with Esteban today :).  And thanks to him I reached the conclussion that this plugin should be external."

I'll spend some hours tomorrow to finish it.

Now, as I think it happens with the ssl plugin... Where should we put the code and what should I in order to get it easily integrated in the ci buildings? :)

Thanks!
Guille

On Sun, Apr 8, 2012 at 9:46 PM, Igor Stasenko <[hidden email]> wrote:
On 7 April 2012 17:55, Guillermo Polito <[hidden email]> wrote:
> Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And
> that's the problem :), It uses gnome2 stuff to access the system
> configuration (because gnome handles it's own configuration... :/).
>
> Now, I made it work doing something like this in vmmaker:
>
> CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
>     "extra rules for InternetConfigPlugin"
>
>     super configureInternetConfigPlugin: maker.
>     maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
>     maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
>     maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').
>
> And adding it in the list of internal plugins for Unix.
>
> But this should only compile and work on a system with gconf and stuff
> installed :).
>
Then don't make this plugin internal, but external instead. Because if
library is missing,
VM will refuse to start. In contrast, if your plugin will be in
external module, then module will refuse to load
if lib is missing.

> So, how does or should vmmaker and vm building process handle something like
> this?
>

The philosophy of CMake configurations is to be concrete and without
conditionals. I.E. they should
not contain "if this, do this, if that do that" , instead if you have
such choice, one should make another configuration.

There is no way to predict how different is platform on which you
building VM  from platform where it used (especially in case of unix
systems and their numerous flavors). So, what is working on your OS,
could not work on another. That's why i don't see a point to put
conditionals in build process.

In contrast, if you have a concrete configuration, which says: if you
want to build me, you should have this, this and this, and if you want
to use the built artifact you should have this, this and this
installed, then it makes things much more predictable and
straightforward.


> Guille
>
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
Best regards,
Igor Stasenko.


_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: Tips to create a plugin with specific platform dependant stuff

Guillermo Polito
ok,

I did this:
- configured the plugin as external
- created

CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
    super configureInternetConfigPlugin: maker.
    maker addPlatformSources: #( 'sqUnixInternetConfiguration')

and put the file attached in /platforms/unix/plugins/InternetConfigPlugin.
I finally used dlopen to load gconf dinamically and check if it is available, and if it's not, I check the env vars with getenv().

If someone can do a little review, it would be nice :).

Guille

On Sun, Apr 8, 2012 at 9:55 PM, Guillermo Polito <[hidden email]> wrote:
Haha! :)

You won me :).  I was about to reply this:

"Ok, so I talked with Esteban today :).  And thanks to him I reached the conclussion that this plugin should be external."

I'll spend some hours tomorrow to finish it.

Now, as I think it happens with the ssl plugin... Where should we put the code and what should I in order to get it easily integrated in the ci buildings? :)

Thanks!
Guille


On Sun, Apr 8, 2012 at 9:46 PM, Igor Stasenko <[hidden email]> wrote:
On 7 April 2012 17:55, Guillermo Polito <[hidden email]> wrote:
> Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And
> that's the problem :), It uses gnome2 stuff to access the system
> configuration (because gnome handles it's own configuration... :/).
>
> Now, I made it work doing something like this in vmmaker:
>
> CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
>     "extra rules for InternetConfigPlugin"
>
>     super configureInternetConfigPlugin: maker.
>     maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
>     maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
>     maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').
>
> And adding it in the list of internal plugins for Unix.
>
> But this should only compile and work on a system with gconf and stuff
> installed :).
>
Then don't make this plugin internal, but external instead. Because if
library is missing,
VM will refuse to start. In contrast, if your plugin will be in
external module, then module will refuse to load
if lib is missing.

> So, how does or should vmmaker and vm building process handle something like
> this?
>

The philosophy of CMake configurations is to be concrete and without
conditionals. I.E. they should
not contain "if this, do this, if that do that" , instead if you have
such choice, one should make another configuration.

There is no way to predict how different is platform on which you
building VM  from platform where it used (especially in case of unix
systems and their numerous flavors). So, what is working on your OS,
could not work on another. That's why i don't see a point to put
conditionals in build process.

In contrast, if you have a concrete configuration, which says: if you
want to build me, you should have this, this and this, and if you want
to use the built artifact you should have this, this and this
installed, then it makes things much more predictable and
straightforward.


> Guille
>
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
Best regards,
Igor Stasenko.



_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners

sqUnixInternetConfiguration.c (7K) Download Attachment