Hi Bernard,

On 04/15/2012 03:16 PM, Bernard GODARD wrote:
Thank you Fridger,

However there has been some misunderstanding. The patch is not about
the QMAKE project file but about the video capture only. It is an old
patch that I just revived. At the time the patch was written (Sept
2010 svn rev 5053), there was almost nothing in the unix entry of the
project file so I quickly edited it with static "default" paths to
make it compile. I am of course all for using pkgconfig for libraries
that come with pc file (lua already in the current repo, but also for
PNG, GLU and THEORA).
I don't think I misunderstood (, despite being in a hurry at times, yesterday). My comments simply referred to the celestia.pro part of your old patch.

Now concerning the current celestia.pro in the repos, the unix section
does not have explicit mention of zlib and libpng but the windows
section does. Also the generated Makefile (with qmake) does not have
any explicit mention of these libs, but I just realised this Makefile
contains calls to QMAKE and references to some mkspec files and I find
this strange, I thought the Makefile generated by QMAKE was self
contained and didn't call QMAKE itself. 
Why? In the Linux mkspecs files there are many more libs predefined that we don't want to pull out individually, do we? E.g. in linux.conf:
 
QMAKE_LIBS_DYNLOAD    = -ldl
QMAKE_LIBS_X11        = -lXext -lX11 -lm
QMAKE_LIBS_X11SM      = -lSM -lICE
QMAKE_LIBS_NIS        = -lnsl
QMAKE_LIBS_EGL        = -lEGL
QMAKE_LIBS_OPENGL     = -lGL
QMAKE_LIBS_OPENGL_QT  = -lGL
QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
QMAKE_LIBS_OPENVG     = -lOpenVG
QMAKE_LIBS_THREAD     = -lpthread

I see it as a nice aspect that we don't have to bother about all these standard shared libs in Linux.
Unlike Windows many service libs (libpng,....) are part of the default Linux installation and thus could well be handled as such within qmake in my view.

But my executable is
dynamically linked against libpng and I also checked that I can see
PNG textures. Wouldn't it be better to have the PNG and ZLIB libs
mentioned in the unix section of the project file like for MS Windows
(with PKGCONFIG as static paths should be avoided, will have to check
if ZLIB comes with a PKGCONFIG file). I think explicit dependencies
(such as PNG) should be mentioned to avoid confusion (at least in
comments telling which mkspec provides this. If we cannot easily
identify which mkspec provides this then it would look like an
implicit dependency).
I don't think it would be a good idea to start fiddling too much with the default Qt4 settings, notably since the docs & rules about mkspecs stuff are very clear and practical.
Concerning your qmake -unset PREFIX, I was really surprised because it
doesn't work on my system, there is no mention of it on the QT
reference documentation, google doesn't return anything for this and
all I could find on some QT web forums were some hacks to unset
variables and people complaining about this missing functionality. So
I downloaded the QT4 package for you ditribution OpenSuse 12.1 and
read the changelog and it shows that this is a new feature in QT4.8
and I am still on 4.7.

Adding the line you proposed in celestia.pro:
PREFIX = $$[PREFIX]
before the isEmpty call fixed my problem, but shouldn't this be fixed
in the SVN?
Of course, but in Celestia development we have the (proven) habit that any changes are first presented for comments or improvements to the team, before committing them to SVN.

For instance, I am still waiting for further feedback about the question whether my proposed addition of further libs (glu, libpng,...theora,...) to the

PKGCONFIG += glu $$LUAPC libpng

line covers the syntax ambiguities in ALL other (popular) Linux distros. In openSuSE 12.1 it does.
So please, would the Linux-based devs speak up?  Does this line work for you? How about Ubuntu, Andrew?

Fridger
Thank you,


On Sat, Apr 14, 2012 at 7:04 PM, Fridger Schrempp
<fridger.schrempp@desy.de> wrote:
Hi Bernard,

back from dinner, let me now run through a few tests of the few celestia.pro
lines I sent earlier tonight.
Recall:


unix{
    PREFIX = $$[PREFIX]
    isEmpty(PREFIX) { PREFIX=/usr/local }
    message ("PREFIX =" $$PREFIX)
....

I use the latest openSuSE 12.1 Linux with  Qt 4.8.1. Assume that I am in
Celestia/build.
I start with an undefined PREFIX variable:

qmake -unset PREFIX
qmake -query PREFIX
**Unknown**

OK

then:
qmake ../src/celestia.pro
Project MESSAGE: PREFIX = /usr/local

OK.

qmake -set PREFIX /opt
qmake -query PREFIX
/opt

qmake ../src/celestia.pro
Project MESSAGE: PREFIX = /opt

OK!

and in the generated Makefile you see that the install directory is now
indeed
-DCONFIG_DATA_DIR=\"/opt/share/celestia\"

Finally:

qmake -unset PREFIX
qmake -query PREFIX
**Unknown**

OK!

In summary: With these simple assignments in celestia.pro, everything works
properly.

Next a few remarks concerning your previous patch for implementing some
video capture.

Here I think we should implement a somewhat more sophisticated approach in
celestia.pro that accounts for possible syntax differences of libraries in
ALL popular Linux distros. For example, your patch fails for openSuSE, since
there liblua5.1 would not be recognized. That's why we need to use
pkg-config that is nicely supported in qmake.

unix {
    CONFIG += link_pkgconfig

    LUALIST = lua5.1 lua
    for(libpc, LUALIST):system(pkg-config --exists $${libpc}):LUAPC =
$${libpc}
    isEmpty (LUAPC) {error("No shared Lua library found!")}

    PKGCONFIG += glu $$LUAPC libpng
    INCLUDEPATH += /usr/local/cspice/include
    LIBS += -ljpeg /usr/local/cspice/lib/cspice.a

}
As you can see, besides liblua I have similarly included glu.pc and
libpng.pc. In my case it reads
-----------------------------------
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include/libpng14

Name: libpng
Description: Loads and saves PNG files
Version: 1.4.11
Libs: -L${libdir} -lpng14
Libs.private: -lz -lm
Cflags: -I${includedir}
-------------------------------------
and generally, also takes care of the include stuff!

Notably libpng has been recently updated and e.g. SuSE operates libpng12 and
libpng14 in parallel.
Similarly for libGLU and libtheora, of course. Theora is supported via
theora.pc in pkgconfig/.

If you haven't done it yet, please have a look into our extensive respective
earlier discussions.  Some time ago, I have already committed our first
version for eliminating the liblua ambiguities. For other libs the procedure
is entirely analogous.

I'll present a respective update of celestia.pro very soon.

Fridger

PS: Of course Celestia also links against libpng etc. Some standard libs are
predefined already via the mkspecs files in /usr/share/mkspecs.






On 04/14/2012 04:21 PM, Bernard GODARD wrote:

Hi all,

I have added a section on building the QT4 version of celestia on
Linux in http://en.wikibooks.org/w/index.php?title=Celestia/Development/Qt4

I have a few questions about the celestia.pro file:
1) the unix part does not link against libpng and zlib. Why is that?

2) How can I change the INSTALL PREFIX prefix to be /opt instead of
/usr/local without editing celestia.pro but using the QMAKE variable
PREFIX in celestia.pro. I tried the following:

astro@saturn:~/Dev/celestia/src$qmake -set PREFIX /opt
astro@saturn:~/Dev/celestia/src$qmake -query PREFIX
/opt
astro@saturn:~/Dev/celestia/src$cd ~/.config/Trolltech
astro@saturn:~/.config/Trolltech$ more QMake.conf
[2.01a]
PREFIX=/opt
astro@saturn:~/.config/Trolltech$ qmake -query
PREFIX:/opt
QT_INSTALL_PREFIX:/usr
QT_INSTALL_DATA:/usr/share/qt4
QT_INSTALL_DOCS:/usr/share/qt4/doc
QT_INSTALL_HEADERS:/usr/include/qt4
QT_INSTALL_LIBS:/usr/lib/x86_64-linux-gnu
QT_INSTALL_BINS:/usr/bin
QT_INSTALL_PLUGINS:/usr/lib/x86_64-linux-gnu/qt4/plugins
QT_INSTALL_IMPORTS:/usr/lib/qt4/imports
QT_INSTALL_TRANSLATIONS:/usr/share/qt4/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/usr/lib/qt4/examples
QT_INSTALL_DEMOS:/usr/lib/qt4/demos
QMAKE_MKSPECS:/usr/share/qt4/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.7.4
astro@saturn:~/.config/Trolltech$

but when running qmake on celestia.pro it still sees PREFIX as empty
and sets it to /usr/local.
Also I can't even unset the variable PREFIX without manually deleting
the file ~/.config/Trolltech/Qmake.
conf. How do you do that? Is there
nothing like qmake -unset?

Thank you,

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Celestia-developers mailing list
Celestia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/celestia-developers
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Celestia-developers mailing list
Celestia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/celestia-developers