Some minor cleanups after the autotools removal

This includes removal of the now unused make-gnucash-potfiles.in,
checking for CMakeLists.txt rather than Makefile.am in gnc-vcs-info,
upating the HACKING file,
and generally updating references to autotools.

I have kept "Makefile.*" exclude patterns in our CMakeLists.txt files
because they may still be lingering in the source directory from
previous autogen.sh runs. At some point these should probably be
removed as well still, together with the gitignore references to them.
This commit is contained in:
Geert Janssens 2018-01-26 16:06:29 +01:00
parent 1b02517ea1
commit 85bfbd8e82
21 changed files with 54 additions and 227 deletions

View File

@ -765,8 +765,8 @@ ADD_SUBDIRECTORY(cmake)
SET(PACKAGE_PREFIX "${PACKAGE}-${PACKAGE_VERSION}")
SET(DIST_FILE "${PACKAGE_PREFIX}.tar")
SET(toplvl_DIST_local ${gnucash_DOCS} ChangeLog.2015 ChangeLog.2016
CMakeLists.txt make-gnucash-potfiles.in README)
SET(toplvl_DIST_local ${gnucash_DOCS}
CMakeLists.txt README)
SET_LOCAL_DIST(toplvl_DIST ${toplvl_DIST_local})
@ -809,7 +809,6 @@ ADD_CUSTOM_COMMAND(OUTPUT ${DIST_FILE}.gz ${DIST_FILE}.bz2
-D BUILD_SOURCE_DIR=${BUILD_SOURCE_DIR}
-D BUILDING_FROM_VCS=${BUILDING_FROM_VCS}
-D SHELL=${SHELL}
-D AUTOTOOLS_IN_DIST=${AUTOTOOLS_IN_DIST}
-D WITH_GNUCASH=${WITH_GNUCASH}
-P ${CMAKE_SOURCE_DIR}/common/cmake_modules/MakeDist.cmake

52
HACKING
View File

@ -73,13 +73,24 @@ August 22, 2000
TIPS AND HINTS
==============
Building GnuCash in-tree
------------------------
This is generally discouraged. You should always use a separate build directory,
preferably outside of the source directory. If you really want a build directory
inside your source directory, make it a hidden one (starting with a '.'), to
keep intltool from incorrectly picking up translatable strings from the build directory.
Starting GnuCash from the build tree
------------------------------------
This is known to not work very well. Instead, `--prefix` your build into /opt/gnc/svn/ (or some such).
This should mostly work, but there may be corner cases where it behaves differently from
running gnucash from the target installation directory. You can tell cmake which
install directory to use via the command line switch '-DCMAKE_INSTALL_PREFIX='
Don't use '/usr' or '/usr/local' unless you're a package maintainer for a distro.
Instead choose /opt/gnc/git/ or even $HOME/gnc/git (or something similar).
Getting Trace Messages From GnuCash
-----------------------------------
See the doxygen comments in src/engine/qoflog.h (and .c)
See the doxygen comments in libgnucash/engine/qoflog.h (and .c)
Starting GnuCash in GDB
-----------------------
@ -87,10 +98,6 @@ To run gdb on an installed version of gnucash (installed in /opt/gnc/unstable:)
% gdb /opt/gnc/unstable/bin/gnucash
OS X/Quartz developers can't run gnucash in gdb this way. They should instead use:
% /opt/gnc/unstable/bin/gnucash-gdb
You'll also probably want to know about these:
gdb> catch fork
@ -116,15 +123,17 @@ jsled does not need the above with emacs-22, thankfully. It was getting quite t
Using Electric Fence with GnuCash
---------------------------------
% configure --enable-efence
(except this doesn't actually enable efence :-( need to hack
configure.in and add $LIBS = -lefence and re-run ./autogen.sh)
There are currently no rules in our build system to build and run gnucash
or unit tests with Electric Fence.
Don't know why, efence does not currently work with gnucash:
I get a bunch of errors:
warning: Cannot initialize thread debugging library: unknown thread_db error '22'
I should probably be relatively straightforward to add this as all it
needs is to link with libefence.so (-lefence).
If you know how to fix this, please update these instructions.
Fedora 27 ships an ElectricFence package containing that libary and also
an exectuable 'ef' to run an arbitrary program with Electric Fence
guarding enabled. I have given it a quick spin on gnucash but it immediatly
crashes. I haven't investigated whether this is because I should first have
linked gnucash with -lefence or because a real problem in GnuCash code.
Using Valgrind with GnuCash
@ -157,6 +166,7 @@ These commands may be useful to find out the library that actually
exported a particular symbol, and to check which import symbol one
particular library depends upon and where they are imported
from. Run these from the top-level of the build tree.
Note "lib64" below should be "lib" for a 32-bit build.
# Create a table of all exported symbols and where they come from
nm -A `find . -name '*.so'` | grep ' T ' | \
@ -164,26 +174,26 @@ nm -A `find . -name '*.so'` | grep ' T ' | \
# For a particular library, check symbol import requirements,
# listing all symbols (needs the file from above)
A=src/gnc-module/.libs/libgw-gnc-module.so && echo "$A requirements:" \
A=lib64/libgnc-module.so && echo "$A requirements:" \
&& nm $A | grep ' U ' | sed 's/^.* \([^ ]*\)$/\1/' | \
grep -wFf- exportedsymbols
# For a particular library, check import requirements,
# summarized by library
A=src/gnc-module/.libs/libgw-gnc-module.so && echo "$A requirements:" \
A=lib64/libgnc-module.so && echo "$A requirements:" \
&& nm $A | grep ' U ' | sed 's/^.* \([^ ]*\)$/\1/' | \
grep -wFf- exportedsymbols | cut -d: -f1 | sort | uniq
# For a particular library, check import requirements,
# summarized by library, formatted for Makefile.am
A=src/gnc-module/.libs/libgw-gnc-module.so && echo "$A requirements:" \
# summarized by library, formatted for a cmake TARGET_LINK_LIBRARIES command
A=lib64/libgnc-gnome.so && echo "$A target link libraries:" \
&& nm $A | grep ' U ' | sed 's/^.* \([^ ]*\)$/\1/' | \
grep -wFf- exportedsymbols | cut -d: -f1 | sort | uniq | \
sed 's!.libs/!!' | sed 's/.so$/.la \\/' | sed 's!^.! \${top_builddir}!'
sed 's!.*/lib! !' | sed 's/.so$//'
# List all import requirements summarized by library for a full
# recursive directory tree
for A in `find src/business/business-core -name '*.so'`; do \
for A in `find lib64 -name '*.so'`; do \
echo -e "\n##$A requirements:" && nm $A | grep ' U ' | \
sed 's/^.* \([^ ]*\)$/\1/' | grep -wFf- exportedsymbols | \
cut -d: -f1 | sort | uniq; done
@ -196,6 +206,10 @@ source tree. This project can be used with XCode on a Macintosh to debug
GnuCash. It is not set up to build GnuCash, but only to debug it. Building must
be done using the normal command line tools.
Note this XCode project has not been updated since the big directory restructuring
preceding the 2.7.1 release. So it will currently not find source files where
it's expecting them.
This project is designed to be used with the X Window version of GnuCash, not
the native Quartz version. To use it you must build and install GnuCash into
directories "build" and "install" parallel to the source directory. Furthermore

2
README
View File

@ -207,8 +207,6 @@ http://wiki.gnucash.org/wiki/Locale_Settings
Building & Installing
---------------------
(For additional build system details, see doc/README.build-system.)
GnuCash uses CMake to handle the build process. Details are available
in cmake/README_CMAKE.txt (If you are building directly from Git, read
the README.git file for more instructions.)

View File

@ -13,7 +13,7 @@ Some advantages of using CMake:
* The build time on Windows drops from around an hour to just a few
minutes.
* CMake supports the generation of build files for several IDEs
such as Xcode, Eclipse, KDevelop and others. The open source Qt
Creator and the commercial CLion C/C++ IDE from JetBrains can use
@ -25,7 +25,7 @@ Some advantages of using CMake:
This setup also uses the http://www.ninja-build.org[Ninja] build
system to enable fast and parallel builds on Windows. (On POSIX
systems [OS X, Linux, FreeBSD, etc.] Ninja does not seem significantly
faster that using the default Makefile generator to me.)
faster than using the default Makefile generator to me.)
== Scope
@ -62,8 +62,7 @@ Limitations include:
The CMake setup does not support building and installing dependencies
(although it probably could some day). So you need to have the
dependencies available, most likely by having run the existing
Autotools build at least once. Various resources on the GnuCash wiki
dependencies available. Various resources on the GnuCash wiki
will have advice on how to do this.
You will need to have CMake and optionally Ninja installed, either

View File

@ -50,7 +50,6 @@ FUNCTION(RUN_DIST_CHECK PACKAGE_PREFIX EXT)
-D CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-D CMAKE_INSTALL_PREFIX=../${INSTALL_DIR}
-D AUTOTOOLS_IN_DIST=${AUTOTOOLS_IN_DIST}
../${PACKAGE_PREFIX}
WORKING_DIRECTORY ${BUILD_DIR}
ERROR_MSG "CMake configure command failed."

View File

@ -41,7 +41,6 @@ ENDFUNCTION()
SET(COPY_FROM_BUILD
ChangeLog
doc/gnucash.1
libgnucash/app-utils/migratable-prefs.xml
libgnucash/app-utils/swig-app-utils-guile.c
libgnucash/app-utils/swig-app-utils-python.c
libgnucash/backend/xml/test/test-real-data.sh

View File

@ -18,7 +18,7 @@ SET(doc_DATA
SET(doc_noinst_DATA
build-aix.txt build-solaris.txt CMakeLists.txt gnc-fq-dump.1 gnc-fq-helper.1 gnucash.1.in gtkrc-2.0.gnucash
misc-notes.txt README.build-system README.HBCI README.OFX README.translator.txt tip_of_the_day.list.in
misc-notes.txt README.HBCI README.OFX README.translator.txt tip_of_the_day.list.in
TRANSLATION_HOWTO)
INSTALL(FILES ${doc_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/gnucash)

View File

@ -1,83 +0,0 @@
-*-text-*-
===========================================================================
Automake
GnuCash uses automake to handle the build process. Make sure you
understand what automake provides/requires before you add anything
particularly fancy to the Makefile.am files.
Most of the time, a "make" or "make install" will automatically DTRT
and regenerate Makefiles or Makefile.ins, re-run configure, regenerate
configure from configure.in, etc. whenever needed. However, it is
possible, if you make a mistake when working on the Makefile.am's to
leave yourself in a situation where automake won't work because a
Makefile is broken. To fix this, just run:
./autogen.sh
./configure <your usual options>
That should sledgehammer the problem bit back into place.
===========================================================================
Adding files to AC_OUTPUT in configure.in.
Please do not add any non-makefiles to AC_OUTPUT unless you're
*absolutely* sure that it's safe and necessary to do so. If you're
not sure, then please use the "generation with sed by hand approach"
that we use for other non-makefiles like src/scm/bootstrap.scm. See
src/scm/bootstrap.scm.in and src/scm/Makefile.in for details.
The reasoning behind this is that there are often variables that
autoconf uses and replaces via the @@ mechanism that are recursively
defined in terms of other variables. For example, @datadir@ might
expand into $prefix/share, which itself contains an unexpanded
variable. Unless the @datadir@ replacement is performed on a file
that will eventually be processed by make, there's no guarantee that
the variable will *ever* be fully expanded and then your code will
break.
To get around this, we handle all non-makefiles (with a few notable
exceptions) manually with sed. For example, we have
src/scm/bootstrap.scm.in which is processed in src/scm/Makefile.in
according to the following rule:
bootstrap.scm: bootstrap.scm.in
rm -f $@.tmp
sed < $@.in > $@.tmp \
-e 's:[@]VERSION[@]:${VERSION}:g' \
-e 's:[@]GNC_CONFIGDIR[@]:${GNC_SHAREDIR}:g' \
-e 's:[@]GNC_SHAREDIR[@]:${GNC_CONFIGDIR}:g'
chmod +x $@.tmp
mv $@.tmp $@
This approach guarantees that the variables referred to will be
properly expanded at the right times.
Note that on OSX, you MUST have the GNU version of sed installed
via fink - the BSD version installed by default will not work with
some of the substitution operators used in the gnucash build.
The only non-Makefiles files that must be handled directly by
AC_OUTPUT are files that refer to variables that, when expanded, may
have makefile-hostile characters like '#' in them like
INCLUDE_LOCALE_H. These may need to be replaced directly in the
relevant file via AC_OUTPUT since going through a makefile would break
the makefile when it interprets the '#' as the beginning of a comment.
You'd have something like this:
FOO = "#include <locale.h>"
If you end up in a situation where you need to refer to both these
makefile-hostile variables and non-makefile hostile variables in the
same file, please restructure things (breaking the file up if
necessary) so that only the makefile hostile variables are in the
files being handled by AC_OUTPUT directly.
===========================================================================
It is not safe to use $prefix in configure.in for anything other than
an unexpanded reference. If the user doesn't specify a --prefix, then
it'll be set to NONE until the end of the configure process.
===========================================================================

View File

@ -21,8 +21,6 @@
\********************************************************************/
/* This is a template test program. Copy it to the test sudirectory and rename it test_modulename.c. (Use the same modulename that you gave Makefile.am in the same directory.
Write and link other test files */
#include <glib.h>
#include <config.h>
#include <qof.h>

View File

@ -5,7 +5,7 @@ GNC_ADD_TEST(test-link-module-report-locale-specific-us test-link-module.c
LOCALE_SPECIFIC_US_TEST_INCLUDE_DIRS LOCALE_SPECIFIC_US_TEST_LIBS
)
# This test not run in the autotools build.
# FIXME why is this not run/running?
#SET(GUILE_DEPENDS
# gncmod-app-utils
# gnc-core-utils

View File

@ -14,7 +14,7 @@ SET(scm_test_report_system_SOURCES
test-collectors.scm
test-list-extras.scm
test-report-utilities.scm
# test-test-extras.scm ;;Not run in autotools
# test-test-extras.scm ;;FIXME why is this not run
)
GNC_ADD_SCHEME_TESTS(${scm_test_report_system_SOURCES})

View File

@ -147,8 +147,6 @@ SET(MIGRATABLE_PREFS_XML ${DATADIR_BUILD}/gnucash/migratable-prefs.xml)
FILE(COPY make-prefs-migration-script.xsl DESTINATION ${DATADIR_BUILD}/gnucash)
CONFIGURE_FILE(migratable-prefs.xml.in ${MIGRATABLE_PREFS_XML})
# This configure_file is to generate the file for autotools
CONFIGURE_FILE(migratable-prefs.xml.in migratable-prefs.xml)
INSTALL(FILES ${MIGRATABLE_PREFS_XML} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash)
INSTALL(FILES make-prefs-migration-script.xsl DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash)

View File

@ -20,7 +20,7 @@ ENDMACRO()
ADD_APP_UTILS_TEST(test-exp-parser test-exp-parser.c)
GNC_ADD_TEST_WITH_GUILE(test-link-module-app-utils test-link-module APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
ADD_APP_UTILS_TEST(test-print-parse-amount test-print-parse-amount.cpp)
# This test not run in autotools build.
# FIXME Why is this test not run ?
#GNC_ADD_TEST_WITH_GUILE(test-print-queries test-print-queries.cpp APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
GNC_ADD_TEST_WITH_GUILE(test-scm-query-string test-scm-query-string.cpp
APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS

View File

@ -50,7 +50,7 @@
(export gnc:debug)
(export gnc:safe-strcmp) ;; only used by aging.scm atm...
;; Get the Makefile.am/configure.in generated variables.
;; Get the cmake generated variables.
(load-from-path "build-config")
;; Do this stuff very early -- but other than that, don't add any

View File

@ -5,7 +5,7 @@ GNC_ADD_TEST(test-link-module-tax-us test-link-module.c
TAX_US_TEST_INCLUDE_DIRS TAX_US_TEST_LIBS
)
# This test not run in autotools build.
# FIXME why is this test not run ?
#SET(GUILE_DEPENDS
# gnc-core-utils
# gnc-module

View File

@ -1,83 +0,0 @@
#!@PERL@ -w
# -*- perl -*-
#
# This perl script is used to make po/POTFILES.in, the list
# of files to be searched for translatable strings.
#
# It will exclude any files listed in po/POTFILES.skip, po/POTFILES.ignore
# or that match the regexp patterns listed in @ignorepatterns.
#
# Author: Dave Peticolas <dave@krondo.com>
use strict;
use File::Basename;
# Note: These are perl regexp patterns, *not* normal shell wildcards!
my @ignorepatterns = ('gw-', 'test', 'experimental', 'python-bindings', 'swig-.*\.c');
my (@skipped_files, @ignored_files);
open(IN, "< @SRCDIR@/po/POTFILES.skip");
while (<IN>) {
push @skipped_files, $_ unless $_ =~ /^\#/;
}
close IN;
open(IN, "< @SRCDIR@/po/POTFILES.ignore");
while (<IN>) {
push @ignored_files, $_ unless $_ =~ /^\#/;
}
close IN;
# Sort filenames in POTFILES.in in a consistent way
# This reduces the amount of clutter in our version manangement system
# The files will be sorted
# * per directory
# * case-insensitive
# * ignoring punctuation (-,_,.)
#
# This sort function has been extracted into a separate file (util/elegant-sort.pl)
# in order to use the same algorithm in both cmake and autools based builds
my @possible_files = `cd @SRCDIR@ && \\
find bindings borrowed common libgnucash gnucash -name '*.c' \\
-o -name '*.cpp' -o -name '*.glade' \\
-o -name '*.desktop.in' -o -name '*.keys.in' \\
-o -name '*.gschema.xml.in.in' -o -name '*.scm' \\
| util/elegant-sort.pl`;
## For perl files add the following:
# -o -name '*.pl'
print "# This is a list of files which contain translatable strings.\n";
print "# This file was generated by ../make-gnucash-potfiles.\n";
my %ignores;
foreach my $file (@possible_files) {
chomp($file);
my ($name, $path) = fileparse($file);
$path =~ s/^\.\///;
foreach my $pat (@ignorepatterns, @skipped_files, @ignored_files) {
chomp($pat);
next unless $pat;
if ($file =~ m/$pat/ || $name =~ m/$pat/ || $path =~ m/$pat/) {
$ignores{$path . $name} = 1;
}
}
next if $ignores{$path . $name};
# Ignore unreadable files, e.g. dangling symlinks
next unless (-r "@SRCDIR@/" . $path . $name);
# Force parse type for gsettings files
my $type = "";
if ($file =~ m/.gschema.xml.in.in/ ){
$type = "[type: gettext/gsettings]";
}
print $type . $path . $name . "\n";
}
# These are manually added, because they're not picked up by the generation script
print "gnucash/gnome/gnucash.appdata.xml.in\n";
print "gnucash/gnome/gnucash.desktop.in.in\n";
print "libgnucash/engine/qofbookslots.h\n";
print "doc/tip_of_the_day.list.in\n";

View File

@ -101,9 +101,9 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
ENDFOREACH()
# CMake sorting different from UNIX sorting. Sort the files
# here so it is easier for me to compare to the autotools
# generated POTFILES.in
# CMake sorting is different from UNIX sorting. Use perl to
# sort POTFILES.in universally. This may no longer be needed
# now we have dropped autotools support.
STRING(REPLACE ";" "\n" SORT_IN "${FILES}")
SET(SORT_IN "${SORT_IN}\n")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in.in "${SORT_IN}")
@ -118,7 +118,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
# intltool-update insists that this file be in the source directory. :-(
SET(POTFILES_IN_PATH ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in)
FILE(WRITE ${POTFILES_IN_PATH} "# This is a list of files which contain translatable strings.
# This file was generated by ../make-gnucash-potfiles.
# This file was autogenerated by cmake.
")
FOREACH(path ${POTFILES})

View File

@ -1,5 +1,5 @@
# This is a list of files which contain translatable strings.
# This file was generated by ../make-gnucash-potfiles.
# This file was autogenerated by cmake.
borrowed/goffice/go-charmap-sel.c
borrowed/goffice/go-glib-extras.c
borrowed/goffice/go-optionmenu.c

View File

@ -5,17 +5,6 @@ if [[ "$BUILDTYPE" == "cmake-make" ]] || [[ "$BUILDTYPE" == "cmake-ninja" ]]; th
echo "##### LastTest.log #####";
echo "########################";
cat /build/Testing/Temporary/LastTest.log;
elif [[ "$BUILDTYPE" == "autotools" ]]; then
find . -name 'test*.log' -print0 |
while IFS= read -r -d '' logfile; do
SIZE=$((${#logfile} + 12));
HRULE=$(head -c "$SIZE" < /dev/zero | tr '\0' '#');
echo $HRULE;
echo "##### ${logfile} #####";
echo $HRULE;
cat -- "$logfile";
echo $'\n'$'\n';
done;
else
echo "Unknown BUILDTYPE: \"$BUILDTYPE\", cannot create failure information.";
fi

View File

@ -9,9 +9,9 @@
# Python is python 3, but gnucash doesn't work with python 3. There
# doesn't seem to be a way to tell automake to use /usr/bin/python2,
# so we'll mock this up
mkdir autotools_bin
ln -s /usr/bin/python2 autotools_bin/python
export PATH=/autotools_bin:"$PATH"
mkdir ourpython_bin
ln -s /usr/bin/python2 ourpython_bin/python
export PATH=/ourpython_bin:"$PATH"
echo path is "$PATH"
echo python version is "$(python --version)"

View File

@ -64,9 +64,9 @@ srcdir=$2
# Find the real srcdir.
# This handles the case of a symlink (lndir) tree
# $real_srcdir will hold the actual source dir
if test -h "$srcdir"/Makefile.am
if test -h "$srcdir"/CMakeLists.txt
then
tmp_srcdir=`readlink "$srcdir"/Makefile.am`
tmp_srcdir=`readlink "$srcdir"/CMakeLists.txt`
real_srcdir="$srcdir/`dirname ${tmp_srcdir}`"
else
real_srcdir="$srcdir"