[GNC] GnuCash 3.2 Released

David Cousens davidcousens at bigpond.com
Thu Jul 5 01:04:21 EDT 2018


On Wed, 2018-07-04 at 14:54 +0200, Geert Janssens wrote:
> Op dinsdag 3 juli 2018 00:59:51 CEST schreef DaveC49:
> > 
> > Geert,
> > 
> > I had realised the same thing about needing to uninstall before
> > building and
> > shifted the section on uninstalling to before the section on
> > Building on
> > the Wiki page and specifically mentioned using the previous
> > version's build
> > directory. I might make the note clearer about retaining the build
> > directory for uninstalling.
> > 
> Thanks for documenting all this.

No problem my pleasure
> 
> > 
> > From the tarball the source directory installs with the version
> > number
> > attached (from github it is a generic gnucash). It has become my
> > practice to
> > put the build directory inside the source directory (I have had no
> > problems
> > with that) so it is clearly identified which version it is for, or
> > alternatively one could tag the build directory with the version
> > number as
> > there is no real need to keep the source directory once the build
> > is done.
> This is a subtlety I'm not so sure about.
> I think in order for "make/ninja-build uninstall" to work properly
> you need to 
> keep both the source directory and the build directory. In addition
> the source 
> directory should reflect the version of gnucash you wish to
> uninstall.
> 
> Here's a quick experiment to illustrate this:
> I have a build directory outside my source tree and I have
> successfully run
> ninja-build install

Geert,
You are correct here. I tried the experiment and build.ninja looks for
the CMakeLists.txt in the top level of the source directory and fails
when it is not there. It also goes into the source tree. I copied
CMakeLists.txt back and then it failed when files further down the
source tree were not present
> 
>  This also means cmake will check dependencies
> before trying to run "make uninstall". The uninstall command depends
> on "install_manifest.txt".
> That file seems to be a file generated and tracked by the cmake build
> system itself. Our CMakeLists.txt files don't manipulate it
> explicitly. And clearly cmake attempts track dependencies on this
> file (namely each file that got installed).
The install_manifest.txt file is written by cmake_install.cmake which
is in turn called by the uninstall target in build.ninja which reside
in the top level of the build directory
> 
> > 
> > I'm not pushed for space so I don't bother to delete the source
> > files until
> > I've installed another version and I'm happy with it but others
> > won't
> > necessarily have that luxury.
> > 
> > At the moment the uninstall from a ninja build I did is a kludge. I
> > will see
> > if I can find how/where cmake generates the install secion when
> > creating
> > build.ninja and populate the uninstall target. If I succeed, i'll
> > generate
> > a patch.
> Are you referring to the fact that uninstall doesn't remove empty
> directories
> Maybe that can be improved indeed. I don't know. Keep in mind the
> intended final install destination is typically into a set of 
> directories that already contain applications and libraries. 
> So we can't unconditionally delete all directories. We should at
> least verify whether they are empty or not.
> And we probably don't want to delete any common top-level directory 
> like bin or lib when dealing with standard install locations.
>  

No. The uninstall target in build.ninja as written by cmake was just an
empty stub. It was originally:

#############################################
# Utility command for uninstall

build uninstall: phony CMakeFiles/uninstall

#############################################

 I copied the code from the install target:

#############################################
# Utility command for install

build CMakeFiles/install.util: CUSTOM_COMMAND all
  COMMAND = cd /home/david/Applications/gnucash-3.2/build-ninja &&
/usr/bin/cmake -P cmake_install.cmake
  DESC = Install the project...
  pool = console
  restat = 1
build install: phony CMakeFiles/install.util

#############################################

, substituted "uninstall" for "install" so it became:

#############################################
# Utility command for uninstall
build CMakeFiles/uninstall.util: CUSTOM_COMMAND all
  COMMAND = cd /home/david/Applications/gnucash-3.2/build-ninja &&
/usr/bin/cmake -P cmake_uninstall.cmake
  DESC = Uninstall the project...
  pool = console
  restat = 1
build uninstall: phony CMakeFiles/uninstall

#############################################

and then ninja uninstall works in a shell open in the build directory.

cmake_uninstall.cmake existed and had been created by cmake when it
configured the build, but it could not be executed from build.ninja.
Somewhere in the CMakeLists.txt files in the source something is
missing which writes the code into build.ninja to run
cmake_uninstall.cmake. 

I think it would be nice to tidy up the uninstall of the directories as
well. John has pointed out elsewhere that it isn't absolutely necessary
to prevent any interference between installs and that this was
primarily for developers but with cmake now the primary build
configuration, those of us who like to keep ahead of the distro version
are likely to be building from source using cmak and ninja. 

With a /usr/local prefix, GnuCash does a nice install where the files
are all copied into directories named as gnucash:
/usr/local/lib/gnucash/...
/usr/local/share/gnucash/...
/usr/local/etc/gnucash/...
/usr/local/include/gnucash/...

and the directories I referred to were subdirectories of the respective
gnucash directories listed above. At present install_manifest.txt has
no explicit record of the existence of them as they are created on the
fly when files are installed in them by cmake_install.cmake (top level
of build directory) rather than being created explicitly with a mkdir.

Removing the above directories with "rm -r <prefix>/lib/gnucash " and
similar commands for the others should do it with the appropriate
checking as you mentioned above.

There is a separate target in build.ninja for install/local (but not an
uninstall/local) for installing under a user home directory.

Do you know if Rob Gowin is continuing to work on the cmake scripts or
not? I don't mind going in and trying to patch it, but if it is still a
work in progress then I don't want to get in his way, and I'm happy to
leave it to Rob if he is still developing them.

Regards

David



More information about the gnucash-user mailing list