From 9bb4461013dd0a364a92e7992af048697de320f2 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 22 Jun 2011 11:16:09 +0200 Subject: [PATCH] small recoll/kio_recoll build changes: avoid unnecessary recompilations and make them play nicer together --- src/Makefile.in | 10 ++--- src/common/rclversion.h.in | 1 + src/configure | 49 +++++++++++++--------- src/configure.ac | 17 +++++++- src/kde/kioslave/kio_recoll/00README.txt | 12 ++++-- src/kde/kioslave/kio_recoll/CMakeLists.txt | 17 ++++---- src/lib/Makefile | 2 +- src/lib/mkMake | 2 +- 8 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 src/common/rclversion.h.in diff --git a/src/Makefile.in b/src/Makefile.in index c5a4aff6..653ad5a1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -11,7 +11,7 @@ mandir = @mandir@ QMAKE = @QMAKE@ QTGUI = @QTGUI@ -all: mk/sysconf common/rclversion.h +all: mk/sysconf ${MAKE} -C lib ${MAKE} -C index recollindex @NOQTMAKE@(cd $(QTGUI); ${QMAKE} recoll.pro) @@ -21,11 +21,7 @@ all: mk/sysconf common/rclversion.h mk/sysconf: @echo "You need to run configure first" ; exit 1 -versfile=common/rclversion.h -${versfile} : VERSION - echo 'static const char *rclversionstr = "'`cat VERSION`'";'>> ${versfile} - -static: mk/sysconf common/rclversion.h +static: mk/sysconf ${MAKE} -C lib rm -f index/recollindex ${MAKE} -C index BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic \ @@ -46,7 +42,6 @@ clean: ${MAKE} -C utils clean @NOQTMAKE@@-${MAKE} -C $(QTGUI) clean rm -f qtgui/Makefile qtgui/confgui/Makefile qtgui/recoll - rm -f common/rclversion.h rm -f filters/rclexecm.pyc rm -rf qtgui/.moc qtgui/.ui qtgui/confgui/.moc qtgui/confgui/.ui rm -rf qtgui/.obj qtgui/.moc qtgui/.ui @@ -61,6 +56,7 @@ distclean: clean config.log config.status \ recollinstall \ lib/*.dep common/autoconfig.h + rm -f common/rclversion.h rm -f index/alldeps lib/alldeps query/alldeps bincimapmime/alldeps rm -rf autom4te.cache diff --git a/src/common/rclversion.h.in b/src/common/rclversion.h.in new file mode 100644 index 00000000..4b8fe507 --- /dev/null +++ b/src/common/rclversion.h.in @@ -0,0 +1 @@ +static const char *rclversionstr = "@RCLVERSION@"; diff --git a/src/configure b/src/configure index 30e4d95c..6dc34abc 100755 --- a/src/configure +++ b/src/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for Recoll 1.6. +# Generated by GNU Autoconf 2.68 for Recoll 1.16.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -557,8 +557,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Recoll' PACKAGE_TARNAME='recoll' -PACKAGE_VERSION='1.6' -PACKAGE_STRING='Recoll 1.6' +PACKAGE_VERSION='1.16.0' +PACKAGE_STRING='Recoll 1.16.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -601,6 +601,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +RCLVERSION NOPIC NOCMDLINE NOQTMAKE @@ -702,14 +703,9 @@ CPPFLAGS CCC CC CFLAGS -LDFLAGS -LIBS -CPPFLAGS CPP -CPPFLAGS XMKMF -CXXCPP -CPPFLAGS' +CXXCPP' # Initialize some variables set by options. @@ -1252,7 +1248,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Recoll 1.6 to adapt to many kinds of systems. +\`configure' configures Recoll 1.16.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1317,7 +1313,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Recoll 1.6:";; + short | recursive ) echo "Configuration of Recoll 1.16.0:";; esac cat <<\_ACEOF @@ -1440,7 +1436,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Recoll configure 1.6 +Recoll configure 1.16.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1993,7 +1989,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Recoll $as_me 1.6, which was +It was created by Recoll $as_me 1.16.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -4413,8 +4409,8 @@ if test A"$LIBICONV" = A ; then as_fn_error $? "Cannot find iconv_open anywhere. Please install iconv" "$LINENO" 5 exit 1 fi -echo LIBICONV $LIBICONV -echo INCICONV $INCICONV +#echo LIBICONV $LIBICONV +#echo INCICONV $INCICONV CPPFLAGS="$CPPFLAGS $INCICONV" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of inbuf parameter to iconv" >&5 @@ -5545,6 +5541,7 @@ test "X$m_prefix" = "XNONE" && m_prefix=/usr/local m_datadir=${m_prefix}/share QTRECOLL_DATADIR=${m_datadir}/recoll +RCLVERSION='1.16.0' @@ -5564,7 +5561,11 @@ QTRECOLL_DATADIR=${m_datadir}/recoll -ac_config_files="$ac_config_files mk/localdefs" + + +# All object files depend on localdefs which has the cc flags. Avoid +# changing it unless necessary +ac_config_files="$ac_config_files mk/localdefs.new:mk/localdefs.in" ac_config_files="$ac_config_files recollinstall" @@ -5572,6 +5573,8 @@ ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files sampleconf/recoll.conf" +ac_config_files="$ac_config_files common/rclversion.h" + for d in bincimapmime index lib query do @@ -6099,7 +6102,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Recoll $as_me 1.6, which was +This file was extended by Recoll $as_me 1.16.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6161,7 +6164,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Recoll config.status 1.6 +Recoll config.status 1.16.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -6284,10 +6287,11 @@ do case $ac_config_target in "common/autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS common/autoconfig.h" ;; "$QTGUI/recoll.pro") CONFIG_FILES="$CONFIG_FILES $QTGUI/recoll.pro" ;; - "mk/localdefs") CONFIG_FILES="$CONFIG_FILES mk/localdefs" ;; + "mk/localdefs.new") CONFIG_FILES="$CONFIG_FILES mk/localdefs.new:mk/localdefs.in" ;; "recollinstall") CONFIG_FILES="$CONFIG_FILES recollinstall" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "sampleconf/recoll.conf") CONFIG_FILES="$CONFIG_FILES sampleconf/recoll.conf" ;; + "common/rclversion.h") CONFIG_FILES="$CONFIG_FILES common/rclversion.h" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -6869,3 +6873,10 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + +if cmp -s mk/localdefs mk/localdefs.new ; then + rm -f mk/localdefs.new +else + mv -f mk/localdefs.new mk/localdefs +fi + diff --git a/src/configure.ac b/src/configure.ac index c87c9ce1..596304f4 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(Recoll, 1.6) +AC_INIT([Recoll], m4_esyscmd_s(cat VERSION)) AC_CONFIG_HEADERS([common/autoconfig.h]) AC_PREREQ(2.53) AC_CONFIG_SRCDIR(index/recollindex.cpp) @@ -426,6 +426,8 @@ test "X$m_prefix" = "XNONE" && m_prefix=/usr/local m_datadir=${m_prefix}/share QTRECOLL_DATADIR=${m_datadir}/recoll +RCLVERSION='m4_esyscmd_s(cat VERSION)' + AC_SUBST(X_CFLAGS) AC_SUBST(X_PRE_LIBS) AC_SUBST(X_LIBS) @@ -444,11 +446,15 @@ AC_SUBST(HAVE_MKDTEMP) AC_SUBST(NOQTMAKE) AC_SUBST(NOCMDLINE) AC_SUBST(NOPIC) +AC_SUBST(RCLVERSION) -AC_CONFIG_FILES(mk/localdefs) +# All object files depend on localdefs which has the cc flags. Avoid +# changing it unless necessary +AC_CONFIG_FILES(mk/localdefs.new:mk/localdefs.in) AC_CONFIG_FILES(recollinstall) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(sampleconf/recoll.conf) +AC_CONFIG_FILES(common/rclversion.h) for d in bincimapmime index lib query do @@ -459,3 +465,10 @@ done (cd lib;test -f Makefile && chmod +w Makefile;sh mkMake) AC_OUTPUT + +if cmp -s mk/localdefs mk/localdefs.new ; then + rm -f mk/localdefs.new +else + mv -f mk/localdefs.new mk/localdefs +fi + diff --git a/src/kde/kioslave/kio_recoll/00README.txt b/src/kde/kioslave/kio_recoll/00README.txt index bf865839..31980cc7 100644 --- a/src/kde/kioslave/kio_recoll/00README.txt +++ b/src/kde/kioslave/kio_recoll/00README.txt @@ -32,9 +32,7 @@ you should READ THE HELP FILE. Building and installing: ======================= -The directory mode is only available with KDE 4.1 and later. This -began under KDE3 and might still be made to work, but I only built -with KDE4 and cmake recently. +Only tested with KDE 4.1 and later. The main Recoll installation shares its prefix with the KIO slave, which needs to use the KDE one. This means that, if KDE lives in /usr, @@ -42,13 +40,19 @@ Recoll must be configured with --prefix=/usr, not /usr/local. Else you'll have run-time problems, the slave will not be able to find the Recoll configuration. +!!*Notice: You cannot share a build directory between recoll and kio_recoll +because they use different configure options for the main lib, but build it +in the same place. The main lib "configure" is run at "cmake" time for +kio_recoll, the build is done at "make" time. + + Recipe: - Make sure the KDE4 core devel packages and cmake are installed. - Extract the Recoll source. - IF Recoll is not installed yet: configure recoll with - --prefix=/usr --enable-pic (or wherever KDE lives), build and install + --prefix=/usr (or wherever KDE lives), build and install Recoll. - In the Recoll source, go to kde/kioslave/recoll, then build and diff --git a/src/kde/kioslave/kio_recoll/CMakeLists.txt b/src/kde/kioslave/kio_recoll/CMakeLists.txt index 467256bc..8e357ee8 100644 --- a/src/kde/kioslave/kio_recoll/CMakeLists.txt +++ b/src/kde/kioslave/kio_recoll/CMakeLists.txt @@ -14,18 +14,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") set(rcltop ${CMAKE_CURRENT_SOURCE_DIR}/../../../) -# Execute minimum recoll configuration to create autoconfig.h and version.h +# Execute recoll configuration to create autoconfig.h and version.h and +# generate a PIC lib execute_process(COMMAND ${rcltop}/configure --disable-qtgui --disable-x11mon --enable-pic --prefix=${CMAKE_INSTALL_PREFIX} --mandir=${CMAKE_INSTALL_PREFIX}/share/man WORKING_DIRECTORY ${rcltop} ) -execute_process(COMMAND make common/rclversion.h - WORKING_DIRECTORY ${rcltop} -) -execute_process(COMMAND make - WORKING_DIRECTORY ${rcltop}/lib -) -link_directories(${rcltop}/lib) +link_directories(${rcltop}/lib ${CMAKE_INSTALL_PREFIX}/lib) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${rcltop}/aspell @@ -53,6 +48,12 @@ ENDIF(PTHREAD_IN_LIBPTHREAD) kde4_add_plugin(kio_recoll ${kio_recoll_SRCS}) +add_custom_target(rcllib + COMMAND make + WORKING_DIRECTORY ${rcltop}/lib +) +add_dependencies(kio_recoll rcllib) + target_link_libraries(kio_recoll rcl xapian z ${EXTRA_LIBS} ${KDE4_KIO_LIBS}) install(TARGETS kio_recoll DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/src/lib/Makefile b/src/lib/Makefile index 937afd45..21b940f5 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -13,7 +13,7 @@ librcl.a : $(DEPS) $(OBJS) unac.o ar ru librcl.a $(OBJS) unac.o $(RANLIB) librcl.a -unac.o : $(depth)/unac/unac.c $(depth)/unac/unac.h $ +unac.o : $(depth)/unac/unac.c $(depth)/unac/unac.h $(depth)/mk/localdefs $(CC) $(ALL_CXXFLAGS) -c $(depth)/unac/unac.c rclaspell.o : ../aspell/rclaspell.cpp $(depth)/mk/localdefs $(CXX) $(ALL_CXXFLAGS) -c ../aspell/rclaspell.cpp diff --git a/src/lib/mkMake b/src/lib/mkMake index ed548c2f..1ea6d460 100755 --- a/src/lib/mkMake +++ b/src/lib/mkMake @@ -116,7 +116,7 @@ librcl.a : \$(DEPS) \$(OBJS) unac.o ar ru librcl.a \$(OBJS) unac.o \$(RANLIB) librcl.a -unac.o : \$(depth)/unac/unac.c \$(depth)/unac/unac.h $ +unac.o : \$(depth)/unac/unac.c \$(depth)/unac/unac.h $defs \$(CC) \$(ALL_CXXFLAGS) -c \$(depth)/unac/unac.c EOF