gtk 3.8 and glib 3.6


mcobit

Advanced Member
Joined
Jul 28, 2008
Messages
6,909
Hello. After some days of compiling and fighting with dependencies I managed to compile the latest gtk framework.


As this includes a lot of stuff like cairo pango pixbuf etc. it would be pretty big if I wanted to include it into every pnd.


Can anyone give me some pointers on how to make a pnd that provides those on request? Like the mono or java pnd?
 
Last edited by a moderator:
For MonoRT (or wxPython), it's not 100% transparent. The RunTime is mounted by the PND that want to use it. But I think that ok for gtk too.

Once you have defined a name for the pnd (like gtk3 ?), you "just" create a normal PND with a sh file that will setup the essential environnement (like LD_LIBRARY_PATH).

For mono, the pnd is named monort (it's important to autofind the PND location), and the setup script is called monort.sh. You will also need a real shortcut for the PND (or it will not be findable).

The monort is:

#!/bin/bash

pwdmono=$(pwd)

if [ ! -z "$1" ];then
 pwdmono="$1"
fi

export PS1='\w\$ '
umask 022

export PATH="$pwdmono/bin:${PATH:-"/usr/bin:/bin:/usr/local/bin"}"

export LD_LIBRARY_PATH="$pwdmono/lib:${LD_LIBRARY_PATH:-"/usr/lib:/lib"}"

export PKG_CONFIG_PATH="$pwdmono/lib/pkgconfig":$PKG_CONFIG_PATH

export XDG_DATA_DIRS="$pwdmono/share":$XDG_DATA_DIRS


export LC_ALL=en_US.UTF-8

if [ -z "$1" ];then
 echo "Welcome to mono command line"
 echo .
 echo "you can compile C# program with xbuild"
 echo "or use MonoDevelop GUI with monodevelop"
 echo .
 echo "type exit to close this window"
 echo .
fi
and than, in your calling PND, you do that to find and call the runtime PND:

#!/bin/bash

pwd=$(pwd)

if [ ! -d home ];then
 mkdir home
fi

# search and mount monort config...
pnd_cb="monort-ptitseb"
pnd_folder="monort"
#check if it exist
if [ ! -e /usr/share/applications/$pnd_cb*.desktop ];then
zenity --error --title "Pinta" --text="Error, cannot find monort PND.
You need to install the Mono RunTime PND first!"
exit
fi
#grab where is the pnd
pnd_path=$(sed -n 's/.*X-Pandora-Object-Path *= *\([^ ]*.*\)/\1/p' < /usr/share/applications/$pnd_cb*.desktop)
pnd_name=$(sed -n 's/.*X-Pandora-Object-Filename *= *\([^ ]*.*\)/\1/p' < /usr/share/applications/$pnd_cb*.desktop)
path_to_pnd=$pnd_path/$pnd_name
 
#automount it
/usr/pandora/scripts/pnd_run.sh -p $path_to_pnd -b $pnd_folder -m
 
#check version of PND
if [ -e /mnt/utmp/$pnd_folder/build ];then
 monort_build=`cat /mnt/utmp/monort/build`
else
 monort_build=0
fi

echo monort pnd build $monort_build

if [ $monort_build -lt 1 ];then
 zenity --error --title "Pinta" --text="Error, your Mono RunTime PND is too old.
Please update it!"
 /usr/pandora/scripts/pnd_run.sh -p $path_to_pnd -b $pnd_folder -u &
 exit
fi

#ok, now run monort init script
#but first, preserve ol lc_all
if [ -z "$LC_ALL" ];then
 OLD_LC="en_US.UTF-8"
else
 OLD_LC="$LC_ALL"
fi

cd /mnt/utmp/$pnd_folder
. monort.sh
cd $pwd
The LC_ALL thing is because I cannot compile if LC_ALL is different than en_US.UTF-8, but I can execute software in other language...

Also, don't forget to unmount at the end...

/usr/pandora/scripts/pnd_run.sh -p $path_to_pnd -b $pnd_folder -u &

And congrat's for the compile of gtk3+newer glib, that a huge work!!!
 
Last edited by a moderator:
Thanks. Will see if that works. So I need to mount the pnd and set up the Library and path dirs, then start the actual app...
 
You might want to consider a helper .sh file that you install into /usr/bin.  basically you could have that do something like:

/usr/bin/mcobit-libs.sh

/usr/pandora/scripts/pnd_run.sh -p /media/PANDORAMAIN/pandora/menu/mcobit-libs.pnd -b "mcobit-libs" -m

export LD_LIBRARY_PATH=/mnt/utmp/mcobit-libs:${LD_LIBRARY_PATH}

Presumably in the mcobit-libs.sh you'd also want to do validation that the .pnd can be found and such... but happy path first right?

Then the only requirement you'd have to get your libraries to work ahead of time for another app would be to do something like:

if [ -e /usr/bin/mcobit-libs.sh ]; then

    . /usr/bin/mcobit-libs.sh

else

    echo "mcobit-libs.sh is not installed"

    exit

fi

Or some such.
 
Also, don't forget to unmount at the end...

/usr/pandora/scripts/pnd_run.sh -p $path_to_pnd -b $pnd_folder -u &
And congrat's for the compile of gtk3+newer glib, that a huge work!!!
Having played around with this concept a bit... the danger here is that if you unmount the pnd at the end of all applications, if you have 2+ applications running using your libraries you may be pulling the carpet out from underneath them.

I had done some research into some kind of a lock counter or other way to determine how many apps are using the libraries/applications contained within, but this seems like a harder way to do it since it likely means some level of bash overhead, trust that nothing crashes, etc.  

I've considered a few options around the issue.

1)  Only allow one app at a time to use your libraries.  It may be better to just drop a lock file someplace to at least signify that the libraries are in use by one app, and not let other apps use the libraries until the first app is done.

2) Just mount it and forget about unmounting.  There are 8 loopback devices (I believe)... so as long as a user isn't consuming a lot of them then locking one up until next reboot may not be such a problem

3) Let the user control when to mount/unmount your libraries... though I see this as something that only benefits more advanced users.  People that don't understand what is going on under the hood are going to hit strange/mysterious problems.

4) Oh, install the libraries onto SD and figure out how to 'permanently' add them to the path... this doesn't consume a loopback, but it will cause issues if somebody removes the SD card...

I'm sure that there is a good solution out there for this problem... I just haven't stumbled upon it yet :p
 
Also, don't forget to unmount at the end...

/usr/pandora/scripts/pnd_run.sh -p $path_to_pnd -b $pnd_folder -u &
And congrat's for the compile of gtk3+newer glib, that a huge work!!!
Having played around with this concept a bit... the danger here is that if you unmount the pnd at the end of all applications, if you have 2+ applications running using your libraries you may be pulling the carpet out from underneath them.

I had done some research into some kind of a lock counter or other way to determine how many apps are using the libraries/applications contained within, but this seems like a harder way to do it since it likely means some level of bash overhead, trust that nothing crashes, etc.  

I've considered a few options around the issue.

1)  Only allow one app at a time to use your libraries.  It may be better to just drop a lock file someplace to at least signify that the libraries are in use by one app, and not let other apps use the libraries until the first app is done.

2) Just mount it and forget about unmounting.  There are 8 loopback devices (I believe)... so as long as a user isn't consuming a lot of them then locking one up until next reboot may not be such a problem

3) Let the user control when to mount/unmount your libraries... though I see this as something that only benefits more advanced users.  People that don't understand what is going on under the hood are going to hit strange/mysterious problems.

4) Oh, install the libraries onto SD and figure out how to 'permanently' add them to the path... this doesn't consume a loopback, but it will cause issues if somebody removes the SD card...

I'm sure that there is a good solution out there for this problem... I just haven't stumbled upon it yet :p
At the beggining, I was thinking of some kind of "lock token", in the /tmp folder, to check if an app was still using the PND. But in fact, for MonoRT and wxPyton (and with WineRT when I'll eventually do it), the PND is used for the libraries / program. If it was mounted by another software, it will use some of the libs/programs/folder/whatever, making the unmount not possible.

The unmount script will try a bit, than stop trying and let the PND mounted.

So in fact, I don't think it will be an issue (at least not for that kind of PND).
 
Ah... Maybe I misunderstood the problem I was having... But it had seemed that I was getting the PND unmounted while it was still trying to access commands from the cli. Perhaps I can come up with an alternative solution to my problem.
 
Sorry that I didn't do anything on this front. I also noticed, that different glib versions don't really play nice together as there are more files than just the libs that need to be taken into account. This is not a problem if you install it into a separate directory in the codeblocks overlay but if you want to have them in one system you will have some more problems. I think petitseb had similar problems with including newer glib into his pnd.


I don't have the time to figure it out, but if you want to build that stuff with codeblocks you need to do it in this order with the latest versions:


(From memory, so don't hold me responsible ;) )


- Cairo


- gdkpixbuf


- pango


- libiconv


- glib (use gnu libiconv)


- gtk3


There are some dependencies you need for them, but I cannot remember them all.


I was able to build a working version of gwaei and some other gtk3 apps with this.
 
Last edited by a moderator:
Back
Top