Selden,

the VERSION variable that Andrew added to celestia.pro serves to label the distro name, celestia1.7.0.tar.gz,  that is generated from the 'make dist' target that the qmake-generated Makefile includes. The 'make dist' target most probably requires further additions. But I guess we are not in a hurry here ;-)

Updating the version in qtappwin.cpp should be sufficient. It leads to a correct version number in 'Help->About Celestia'. I have updated it in SVN provisionally to 1.7.0 as well. Automatic syncing the VERSION variable in celestia.pro with the version in qtappwin.cpp seems hard. But perhaps one of us has a clever idea in this respect.

I found that all other occurences of 1.6.0 refer to versions that will not be supported anymore at the 1.7.0 level. (Win32, Linux-KDE, Linux-gtk, Linux-gnome, MAC).

Fridger

On 04/02/2012 12:21 PM, Selden E Ball Jr wrote:
Celestia's version number also needs to be changed in 
src/celestia/qt/qtappwin.cpp

It's also present in other files, but most of them seem to be
comments or the equivalent.

Is there some way for the version value specified in celestia.pro 
to be evaluated in source files like qtappwin.cpp ?

s.


Hello,
Sorry I haven't got round to testing this before now.
The way that automake is doing it is with defining CONFIG_DATA_DIR during
compilation. I also prefer the use of the sh script to generated the
.desktop file as it provides some level of protection against people
deciding to change PREFIX.
The attached diff file incorporates the following:
   - Target name set to "celestia" rather than "celestia-qt4"
   - Version number set to 1.7.0 - this and the previous change cause make
   dist to output celestia1.7.0.tar.gz rather than celestia-qt40.0.0.tar.gz. I
   haven't yet checked whether the make dist output is correct though.
   - Put object files into the obj subdirectory
   - On Linux, if config.h doesn't exist then create it (do we need this on
   other platforms?)
   - Use pkg-config to find Lua on Linux (based on discussions in the other
   thread)
   - Define CONFIG_DATA_DIR on Linux, note that the quote escaping will not
   work with qmake < 4.2, if we need to support this there are workarounds at
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392902#22
   - Fridger's install code with modification to use sh to generate the
   .desktop file.
The celestia.desktop.sh file goes in src/celestia/qt/data. I've been
building this using your change to qtappwin.cpp.
Andrew
On 28 March 2012 17:55, Fridger Schrempp <fridger.schrempp@desy.de> wrote:
Andrew,

after our long qmake versus cmake dispute, I took up the challenge and
wrote
a prototype LINUX install target for celestia.pro and qmake. It works well
and fast and the code is compact and self-explanatory due to qmake's
object-based syntax. Let me add here already that many more
install-related
features are announced by Nokia for Qt 3.0.

The coding only took about 30 minutes and this half page is all there is.
Note that the following code is just added at the end of a /standard/
celestia.pro from SVN

unix {

    #VARIABLES

    isEmpty(PREFIX) { PREFIX = /usr/local}

    BINDIR = $$PREFIX/bin
    DATADIR =$$PREFIX/share
    WORKDIR =$$DATADIR/$${TARGET}

    #MAKE INSTALL

    target.path =$$BINDIR

    data.path   = $$WORKDIR/data
    data.files  = $$CATALOG_SOURCE/*
    flares.path     = $$WORKDIR/textures
    flares.files   += ../textures/*.jpg ../textures/*.png
    textures.path   = $$WORKDIR/textures/medres
    textures.files += $$TEXTURE_SOURCE/*.jpg $$TEXTURE_SOURCE/*.png
    lores_textures.path  =  $$WORKDIR/textures/lores
    lores_textures.files += $$LORES_TEXTURE_SOURCE/*.jpg \
                            $$LORES_TEXTURE_SOURCE/*.png
    hires_textures.path  =  $$WORKDIR/textures/hires
    hires_textures.files =  $$HIRES_TEXTURE_SOURCE/*.jpg
    models.path    = $$WORKDIR/models
    models.files  += $$MODEL_SOURCE/*.cmod $$MODEL_SOURCE/*.png
    shaders.path   = $$WORKDIR/shaders
    shaders.files += $$SHADER_SOURCE/*.vp $$SHADER_SOURCE/*.fp
    fonts.path     = $$WORKDIR/fonts
    fonts.files    = $$FONT_SOURCE/*.txf
    scripts.path   = $$WORKDIR/scripts
    scripts.files  = ../scripts/*.celx
    configuration.path = $$WORKDIR
    configuration.files += $$CONFIGURATION_FILES \
                           $$CONFIGURATION_SOURCE/guide.cel \
                           $$CONFIGURATION_SOURCE/demo.cel \
                           $$CONFIGURATION_SOURCE/controls.txt \
                           $$CONFIGURATION_SOURCE/COPYING \
                           $$CONFIGURATION_SOURCE/README \
                           $$CONFIGURATION_SOURCE/ChangeLog \
                           $$CONFIGURATION_SOURCE/AUTHORS

    locale.path = $$WORKDIR/locale
    locale.files = ../locale/*

    extras.path = $$WORKDIR/extras
    extras.files = ../extras/*
    extras-standard.path = $$WORKDIR/extras-standard
    extras-standard.files = ../extras-standard/*

    desktop.path = /usr/share/applications
    desktop.files += ../src/$${TARGET}.desktop

    icon128.path = /usr/share/icons/hicolor/128x128/apps
    icon128.files += ../src/celestia/qt/data/celestia.png

    INSTALLS += target data textures lores_textures hires_textures \
    flares models shaders fonts locale extras extras-standard
configuration
\
    desktop icon128

   }



The complete celestia.pro is attached. To avoid misunderstandings, here
are
the required steps in short:

1) use a fresh celestia checkout from SVN and cd to celestia's root dir.
Replace the celestia.pro file in src/.     Create a dir named 'build' and
cd
to build/. There, type

2) > qmake -config release ../src/celestia.pro

Using my new install code, qmake now generates a 'make install' target in
the resulting Makefile. Next type

3)  > make
     > sudo make install

I have not chosen a particular Linux distro here, but I rather wanted to
remain /generic/ for now. So I took as BINDIR for the celestia-qt4
executable /usr/local/bin and correspondingly as working directory
/usr/local/share/$${TARGET}. Note: the target name of celestia-qt4
prevents
accidental overwriting ;-).
Note also that the *.desktop file name and content is different from
yours.
Also the icons directory is chosen as
/usr/share/icons/hicolor/128x128/apps.
All these assignments can be trivially modified in celestia.pro.

The working directory, requires some further explanations.

By default, in Qt,

working directory = ./    (i.e $PWD)

Hence it takes an environment variable CELESTIA_DATA_DIR to point to
another
one, e.g. /usr/local/share/$${TARGET}. In src/celestia/qt/qtappwin.cpp
there
was a respective bug. While CELESTIA_DATA_DIR is indeed queried from the
environment, the code in qtappwin.cpp throws an  error message unless
CELESTIA_DATA_DIR is the empty string!

If it is the empty string, then it is replaced by $PWD (=> "./"). This
corresponds to the above default assignment. However, if
CELESTIA_DATA_DIR
is to be NON-empty, an error is thrown! Hence the whole env mechanism
didn't
work. I have attached a simple patch that should be included for  testing.

If celestia is started in a terminal or Qt Creator, the working directory
actually read by the code is always printed upon startup. This cout<<
debug
statement will of course be deleted later. Before starting the installed
celestia-qt4, you need to type (once) in the terminal (or lateron into the
profile...)

export CELESTIA_DATA_DIR=/usr/local/share/celestia-qt4
Then start celestia-qt4. You may also type 'export CELESTIA_DATA_DIR='
whence an error occurs at startup since the executable ceases to find the
data directory now.

Perhaps anyone knows another method to communicate the data directory.
Please let me know.

Finally, concerning the uninstall target:

Andrew, you complained that upon uninstalling some system dir was not
removed since it (fortunately) happened to be non-empty. Well as you know
there are two UNIX ways of removing directories:

1) rm -r <dir>
2) rmdir <dir>

The first one always removes <dir>, while rmdir that is used in qmake
NEVER
removes non-empty dirs.
So there is no danger whatsoever.  Perhaps we come across a better way
these
days, but after many careful tests, I am convinced that 'sudo make
uninstall' is perfectly safe!

In summary, there are a few aspects left for polishing, but things appear
to
work and the required coding is very simple and transparent. As announced
by
Nokia, there is more to come with Qt 3.x.

Fridger