geary/configure
Jim Nelson 826e9d5f3a Memory leak and lost reference tracking: Refs #5306
This patch solves the following memory/resource leak problems:

(a) Gee.TreeSet doesn't drop references when destroyed.  Fixed by
using a subclass that clears the set when destroyed (exactly same
as patch made to Gee, however that won't be in distribution for
awhile.)

(b) Imap.ClientSession was holding refs to CommandResponses after
they'd been completed.  They're now dropped.

(c) Imap.ClientSessionManager now has an open/close_async() (called
by Imap.Account.open/close_async()) that drops all ClientSessions.

(d) All classes in Engine (and some in the client) use Geary.BaseObject,
which uses a static map to track outstanding held references to
it.  The table is dumped when Geary exits.  Must be enabled with a
./configure flag.

Two outstanding memory leaks persist (one for Imap.ResponseCodes and
another when messages are selected/deselected), so this doesn't close
the ticket, but testing and use has shown these changes to make a huge
improvement on memory usage and reducing crashes.
2013-03-07 18:08:50 -08:00

139 lines
3.5 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Copyright 2012 Yorba Foundation
#
# This software is licensed under the GNU LGPL (version 2.1 or later).
# See the COPYING file in this distribution.
DEFAULT_PREFIX="/usr/local"
PREFIX=$DEFAULT_PREFIX
configure_help() {
printf "Usage:\n"
printf "\t./configure [OPTIONS]...\n"
printf "\n"
printf "Options:\n"
printf "\t-h, --help\t\tPrint this help and exit.\n"
printf "\t--prefix=PREFIX\t\tPrepend PREFIX to program installation paths.\n"
printf "\t\t\t\t[%s]\n" $DEFAULT_PREFIX
printf "\t--debug\n"
printf "\t\t\t\tBuild for debugging.\n"
printf "\t--enable-ref-tracking\n"
printf "\t\t\t\tEnable reference tracking which is dumped to stdout when the program exits.\n"
printf "\t--disable-schemas-compile\n"
printf "\t\t\t\tDisable compiling the GSettings schema.\n"
printf "\t--disable-desktop-update\n"
printf "\t\t\t\tDisable desktop database update.\n"
printf "\t--disable-icon-update\n"
printf "\t\t\t\tDisable icon cache update.\n"
printf "\n"
}
abort() {
printf "%s: Invalid argument %s\n" $0 $1
configure_help
exit 1
}
while [ $# != 0 ]
do
option=`echo $1 | sed 's/=.*//'`
if [ `echo $1 | grep '='` ]
then
value=`echo $1 | sed 's/.*=//'`
fi
case $option in
-h | --help) configure_help
exit 0
;;
--prefix) if [ ! $value ]
then
abort $1
fi
CMDLINE="${CMDLINE} -DCMAKE_INSTALL_PREFIX=${value}"
;;
--debug)
CMDLINE="${CMDLINE} -DDEBUG=ON"
;;
--enable-ref-tracking)
CMDLINE="${CMDLINE} -DREF_TRACKING=ON"
;;
--disable-schemas-compile)
CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE=OFF"
CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE_IN_PLACE=OFF"
;;
--disable-icon-update)
CMDLINE="${CMDLINE} -DICON_UPDATE=OFF"
;;
--disable-desktop-update)
CMDLINE="${CMDLINE} -DDESKTOP_UPDATE=OFF"
;;
*) abort $option
;;
esac
shift
done
# Verify cmake is installed
# TODO: Check for minimum version number
if ! cmake --version
then
printf "cmake must be installed to configure and build.\n"
exit 1
fi
# Simple check to verify this script is running in the root of the source tree
if ! [ -e Makefile.in ]
then
printf "configure script must be executed in source directory (Makefile.in not found).\n"
exit 1
fi
# Remove existing Makefile so it's not left around if configure fails
rm -f Makefile
# Remove the build folder to force Cmake to update its cache.
rm -fr build
if ! mkdir -p build
then
printf "Unable to create build directory.\n"
exit 1
fi
cd build
if ! cmake $CMDLINE ..
then
printf "Unable to prepare build directory.\n"
exit 1
fi
cd ..
if ! cp -f Makefile.in Makefile
then
printf "Unable to prepare Makefile.\n"
exit 1
fi
printf "Configured. Type 'make' to build, 'make install' to install.\n"