GTK+ development with SunStudio 12

Greetings,

I'm currently in the process of learning GTK+ programming. For this task I wanted to use SunStudio 12 but I found the configuration of the projects for GTK+ development very annoying (adding many include directories and libraries for every configuration).

Therefore I developed a small tool using python which extracts the necessary information from the output of pkg-config and adds it to the configuration of the SunStudio project.

If someone is interested in using this tool he can find it here: http://home.arcor.de/jsiebert/

Feedback is very welcome! Hope you enjoy using the tool!

Best regards,

Jens Siebert

[668 byte] By [jsiebert@arcor.dea] at [2007-11-27 6:46:00]
# 1
Greetings again,I' ve updated my tool so that configuration information for any library which is managed by pkg-config (not only GTK+) can be added to SunStudio 12 projects.As always feedback is very welcome!Best regardsJens Siebert
jsiebert@arcor.dea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
Do you think you could post your program on genunix.org/wiki?I'd love to add it the Sun Studio FAQ there.Or you could send it to me, and I'll post it there. chris.quenelle@sun.com
ChrisQuenellea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

Hi Chris,

you can get the tool from here: http://home.arcor.de/jsiebert/files/ss12-gtk-project.py

It is just a little script that requires python (tested with version 2.5) and the python-lxml module (wrapper for libxml).

Since I don't know where to post it in the genunix.org wiki it would be great if you could post it there. Thanks for that!

Best regards,

Jens Siebert

jsiebert@arcor.dea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4
Good idea.I'll try it out your tool.. :)
JustinClifta at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

Ok, your tool doesn't work for me. :(

Tried it "as is" on my Gentoo Linux system, and it looked like the required xml library isn't installed:

[code]

Traceback (most recent call last):

File "./ss12-gtk-project.py_200706241644", line 6, in ?

from lxml import etree as ElementTree

ImportError: No module named lxml

[/code]

So, as there was a package called "lxml" available, installed that and tried again. Still no luck:

[code]

Traceback (most recent call last):

File "./ss12-gtk-project.py_200706241644", line 7, in ?

from xml.etree.ElementTree import Element

ImportError: No module named etree.ElementTree

[/code]

Looking at http://effbot.org/zone/element-index.htm, it gave some hints, so modified the import declaration at the top of your script to:

[code]

import os

import sys

import getopt

from lxml.etree import Element, ElementTree

[/code]

This seemed to let the script run:

[code]

$ ./ss12-gtk-project.py

Usage: ss12-gtk-project.py -d <SS12-project-directory> -p <project-name> -P <package>

$

[/code]

But after that, I can't get it to recognise the project directory or arguments in a useful way:

[code]

$ ./ss12-gtk-project.py -d /home/jc/SunStudioProjects -p flame-edit -P glib-2.0

Error: Given project-dir or project-name doesn't exist!

$ ls -la /home/jc/SunStudioProjects

total 12

drwxr-xr-x3 jc users 4096 Jun 24 15:53 .

drwx 114 jc users 4096 Jun 24 16:52 ..

drwxr-xr-x 10 jc users 4096 Jun 24 16:24 flame-edit

$ ls -la /home/jc/SunStudioProjects/flame-edit/

total 704

drwxr-xr-x 10 jc users4096 Jun 24 16:24 .

drwxr-xr-x 3 jc users4096 Jun 24 15:53 ..

-rw-r--r-- 1 jc users 78355 Jun 24 16:24 .make.state.Debug

-rw-r--r-- 1 jc users37 Apr 19 2006 AUTHORS

drwxr-xr-x 2 jc users4096 Jun 24 15:56 CVS

-rw-r--r-- 1 jc users 26425 Jul 30 2006 LICENSE.TXT

-rw-r--r-- 1 jc users2269 Jun 24 15:56 Makefile

-rw-r--r-- 1 jc users4310 Feb 25 19:51 NOTES.TXT

-rw-r--r-- 1 jc users 130188 Jun 24 13:03 backend.c

-rw-r--r-- 1 jc users3528 Sep 12 2006 backend.h

drwxr-xr-x 3 jc users4096 Jun 24 16:15 build

-rw-r--r-- 1 jc users 28154 Jun 24 11:06 callbacks.c

-rw-r--r-- 1 jc users3513 Jul 9 2006 callbacks.h

drwxr-xr-x 3 jc users4096 Jun 24 15:53 config

-rw-r--r-- 1 jc users2502 Dec 31 11:19 configure.in

drwxr-xr-x 3 jc users4096 Jun 24 16:22 dist

-rw-r--r-- 1 jc users5188 Jan 5 17:46 externs.h

-rw-r--r-- 1 jc users 69011 Jan 5 19:31 flame-edit.c

-rw-r--r-- 1 jc users9375 Dec 31 11:19 flame-types.h

drwxr-xr-x 4 jc users4096 Jun 24 15:53 fonts

-rw-r--r-- 1 jc users 256963 Jun 24 13:56 gui-functions.c

-rw-r--r-- 1 jc users4714 Jul 4 2006 gui-functions.h

drwxr-xr-x 5 jc users4096 Jun 24 15:53 images

drwxr-xr-x 3 jc users4096 Jun 24 16:53 nbproject

-rw-r--r-- 1 jc users3344 Dec 30 23:03 old_Makefile

-rw-r--r-- 1 jc users766 Jul 30 2006 old_Makefile.config.in

drwxr-xr-x 3 jc users4096 Jun 24 15:53 sounds

$

[/code]

Any ideas?

JustinClifta at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6
(Hey, how brilliant, the "code" tags aren't working. Good site Sun. :( )
JustinClifta at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7

Hi Justin,

> Ok, your tool doesn't work for me. :(

>

Well... Some feedback at least ;-)

[...]

> Looking at http://effbot.org/zone/element-index.htm,

> it gave some hints, so modified the import

> declaration at the top of your script to:

>

> [code]

> import os

> import sys

> import getopt

> from lxml.etree import Element, ElementTree

> [/code]

>

D'oh! Ok, fixed that...

I've uploaded a new version of the script. Could you please test this version with your installation?

>

> But after that, I can't get it to recognise the

> project directory or arguments in a useful way:

>

> [code]

> $ ./ss12-gtk-project.py -d /home/jc/SunStudioProjects

> -p flame-edit -P glib-2.0

> Error: Given project-dir or project-name doesn't

> exist!

Could you check if there is a file named "configurations.xml" in the nbproject sub-directory of the project directory (e.g. /home/jc/SunStudioProjects/flame-edit/nbproject/configurations.xml)?

I suspect that is has been renamed to "configurations.bak" in a previous attempt to run the script.

Just rename configurations.bak to configurations.xml...

Thanks for your feedback and suggestions!

Best regards,

Jens

jsiebert@arcor.dea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 8

Greetings,

in addition to Justins suggestions, I've added a new functionality to the script.

It is now possible to specify a list of configurations to which the pkg-config information should be added.

E.g. the default configurations in a SunStudio 12 project are 'Debug' and 'Release'. If one would like to add the pkg-config information only to the 'Debug' configuration the command looks like this:

ss12-gtk-project.py -d /home/jens/SunStudioProjects -p gtk-test -P gtk+-2.0 Debug

If there is no configuration list specified, the pkg-config information will be added to all configurations available.

You can get the tool from here: http://home.arcor.de/jsiebert/files/ss12-gtk-project.py

As always feedback is welcome!

Best regards,

Jens

jsiebert@arcor.dea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 9

I added an FAQ entry for this.

I also copied the latest version of your script to the wiki, as a backup.

But I recommend people to check the website you gave for

the latest version. Feel free to update the wiki if I have

said something wrong, or if you want to say more about it.

http://www.genunix.org/wiki/index.php/Sun_Studio_FAQs#IDE_-_How_do_I_update_or_ convert_my_Sun_Studio_.27project.27_files.3F

ChrisQuenellea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 10
Hi Chris,thanks for adding this to the FAQ! Maybe I'll add some content within the next few days.Best regards,Jens
jsiebert@arcor.dea at 2007-7-12 18:18:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...