Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, November 2007
how do you bundle jambi?


Message 1 in thread

hi all!

have strange question, how do you bundle qt and jambi into your application?
for now, it is problem for me, do you know where to find smaller qt
and jambi distributions or you bundle full 20 megs of libs?
-- 
 [ signature omitted ] 

Message 2 in thread

Paranoid Tiberiumlabs wrote:
> hi all!
> 
> have strange question, how do you bundle qt and jambi into your application?
> for now, it is problem for me, do you know where to find smaller qt
> and jambi distributions or you bundle full 20 megs of libs?

Hi,

If you want to strip down the binary size that you are shipping there 
are a few steps you can take. I don't know what requirements you have so 
I'll list the ones I can think of.

  * Only include the classes and native libs you actually use. For 
instance, if you're not using the OpenGL library exclude the 
com.trolltech.qt.opengl package from qtjambi.jar and don't ship the 
com_trolltech_qt_opengl and QtOpenGL libs. You will always need Core and 
Gui, but the others don't have any cross dependencies and can be 
excluded. Unfortunatly QtGui and QtCore are the largest libs so you can 
only shave off a 5-10 megabytes.

  * More advanced approach, and quite a bit more work... You might not 
need all of QtGui, nor QtCore so you could take out pieces that you 
don't need. Many of Qt's C++ modules come with defines that can be 
defined when configuring Qt. Say for instance that you don't want 
QGraphicsView. You could then configure Qt with the option

 > ./configure -D QT_NO_GRAPHICSVIEW

and this would shave of the parts of QtGui related to QGraphicsView. 
There are similar defines spread around the Qt header files so you could 
potentially save a lot by doing this. The tricky part is that not all 
permutations of defines will work so you may run into compile issues, 
and the you would have to adapt the Qt Jambi typesystem specification to 
your changes. As I said earlier, quite a bit of work, but this is how a 
specialized embedded build would be made, I suspect.

  * Another more advanced approach with more work involved... The JDK 
ships with tons of things you don't need, Swing and AWT are quite a few 
megs, same with XML, graphics, text parsers, etc. It should be possible 
to strip these things out of the runtime .jar and native libs and save 
in the bytes that Qt Jambi costs that way.

On the other hand, 20 megs is hardly noticable on a not-old desktop 
computer, so it depends on your needs.

best regards,
Gunnar



Message 3 in thread

On Monday 26 November 2007, Gunnar Sletta wrote:

>   * Another more advanced approach with more work involved... The JDK
> ships with tons of things you don't need, Swing and AWT are quite a few
> megs, same with XML, graphics, text parsers, etc. It should be possible
> to strip these things out of the runtime .jar and native libs and save
> in the bytes that Qt Jambi costs that way.

One word of caution here, though: The Sun JRE license explicitly states that 
those files for which it grants the right of redistribution may not be 
modified. So you can't take the normal JRE download, strip out files from 
rt.jar and ship the stripped down jar. That would be a violation of Sun's 
license.

An alternative would be to start with the OpenJDK and strip that down. This 
might be safe on the legal side as far as I know.

But if you want to do this, be sure to read your licenses very carefully in 
either case. I'm not a lawyer.

Anyway, thanks for your hints about stripping down Qt Jambi, Gunnar. That 
might come in handy for me, too.

Regards,
Gregor

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 4 in thread

Gregor Mückl wrote:
> On Monday 26 November 2007, Gunnar Sletta wrote:
> 
>>   * Another more advanced approach with more work involved... The JDK
>> ships with tons of things you don't need, Swing and AWT are quite a few
>> megs, same with XML, graphics, text parsers, etc. It should be possible
>> to strip these things out of the runtime .jar and native libs and save
>> in the bytes that Qt Jambi costs that way.
> 
> One word of caution here, though: The Sun JRE license explicitly states that 
> those files for which it grants the right of redistribution may not be 
> modified. So you can't take the normal JRE download, strip out files from 
> rt.jar and ship the stripped down jar. That would be a violation of Sun's 
> license.
> 
> An alternative would be to start with the OpenJDK and strip that down. This 
> might be safe on the legal side as far as I know.


You are quite correct, Gregor. I meant taking the OpenJDK as a basis, as 
you would need to compile out parts of the native libraries to get the 
full benefit. Sorry for not being more clear on that.

-
Gunnar