Enhanced spec file for GnuCash 1.6.6

Glen Ditchfield gjditchfield@acm.org
Sat, 20 Apr 2002 22:16:17 -0500


--Boundary_(ID_msjtwtxPBW4OL/3i23wVVg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT

I had some trouble compiling GnuCash 1.6.6 from the source RPM for "vanilla"
Red Hat 7.2,
http://www.gnucash.org/pub/gnucash/redhat-7.x/SRPMS/gnucash-1.6.6-1.src.rpm.
It requires a bunch of *-devel RPMs, such as g-wrap-devel, that aren't
necessarily installed by a normal Red Hat installation.  That caused the
"configure" step to fail for lack of one file or another.  Tracing through
config.log to figure out what was missing and what RPM to install was a bit
tedious.

Here's a new gnucash.spec with added "Buildrequires" directives that say what
packages are needed to build from source.  If you build GnuCash from a source
RPM with this spec, rpm will tell you right up front what packages you are
missing.  You should be able to install gnucash-1.6.6-1.src.rpm, replace
gnucash.spec, and use rpmbuild to build the package.

The other thing that this .spec does is use rpm's (badly documented) "--with"
option to decide whether to build the Postgres back end.  If you run the
command
    rpmbuild --with postgres -bb gnucash.spec
the result will be a file named gnucash-postgres-1.6.6-2.i386.rpm, containing
a GnuCash with Postgres support.  Running either of
    rpmbuild -bb gnucash.spec
    rpmbuild --without postgres -bb gnucash.spec
creates gnucash-1.6.6-2.i386.rpm and leaves Postgres out.  I set up the spec
file to require Posgres version 7.1.3 because that's what came with Red Hat
7.2 -- I suppose earlier versions would work, but I don't know how low to go.

I haven't tried this on any other of the Red Hat variants, or any other
RPM-based distributions.  If you try it, let me know how it goes.

Finally, I have a .src.rpm and two .i386.rpm files build from this spec.  Can
I contribute them?

--Boundary_(ID_msjtwtxPBW4OL/3i23wVVg)
Content-type: text/plain; charset=iso-8859-1; name=gnucash.spec
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=gnucash.spec

# Check whether GnuCash should be build with or without the Postgres backend.
# When building GnuCash, pass "--with postgres" or "--without postgres"
# options, as in
#    rpmbuild --with postgres -bb gnucash.spec
%if "%{_without_postgres}" == "--without-postgres"
  %if "%{_with_postgres}" == "--with-postgres"
  %{error:--with postgres and --without postgres conflict!}
  %endif
  %define _with_postgres 0
%endif

%if "%{_with_postgres}" == "--with-postgres"
  %define _build_name_fmt  %%{ARCH}/%%{NAME}-postgres-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
  %define sql_config --enable-sql
%else
  %define _with_postgres 0
  %define sql_config --disable-sql
%endif

Name:      	gnucash
Summary:   	GnuCash is an application to keep track of your finances.
Version:   	1.6.6
Release:  	2
Copyright: 	Free Software Foundation
Group:     	Applications/Finance
Source:    	http://www.gnucash.org/pub/gnucash/sources/stable/gnucash-%{PACKAGE_VERSION}.tar.gz
BuildRoot: 	/var/tmp/gnucash-%version
Requires:  	gnome-libs >= 1.2.0
Buildrequires:	gnome-libs-devel >= 1.2.0
Requires:	gdk-pixbuf >= 0.2.5
Buildrequires:	gdk-pixbuf-devel >= 0.2.5
Requires:	gnome-print >= 0.21
Buildrequires:  gnome-print-devel >= 0.21
Requires:	guile >= 1.3.4
Buildrequires:  guile-devel >= 1.3.4
Requires:	gtkhtml >= 0.8
Buildrequires:  gtkhtml-devel >= 0.8
Requires:	Guppi >= 0.35.3
Buildrequires:  Guppi-devel >= 0.35.3
Requires:	g-wrap >= 1.1.5
Buildrequires:  g-wrap-devel >= 1.1.5
Requires:	umb-scheme >= 3.2
Requires:	gal >= 0.8
Buildrequires:  gal-devel >= 0.8
Buildrequires:	libglade-devel >= 0.16

%if "%{_with_postgres}" == "--with-postgres"
Requires:	postgresql-libs >= 7.1.3
Buildrequires:	postgresql-devel >= 7.1.3
%endif

%description
GnuCash is a personal finance manager. A check-book like
register GUI allows you to enter and track bank accounts,
stocks, income and even currency trades. The interface is
designed to be simple and easy to use, but is backed with
double-entry accounting principles to ensure balanced books.
%if "%{_with_postgres}" == "--with-postgres"
This package supports the use of Postgres to store account data.
See %{_docdir}/%{name}-%{version}/README.postgres for more information.
%endif

%prep
%setup -q


%build
./configure %{sql_config} --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} \
--infodir=%{_infodir} --mandir=%{_mandir}
make
cp -p src/engine/sql/README README.postgres

%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT/%{_prefix} sysconfdir=$RPM_BUILD_ROOT/%{_sysconfdir} \
infodir=$RPM_BUILD_ROOT/%{_infodir} mandir=$RPM_BUILD_ROOT/%{_mandir} install
%find_lang %name

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(444,root,root,755)
%attr(555,root,root) %{_bindir}/*
%attr(555,root,root) %{_datadir}/gnucash/finance-quote-helper
%{_mandir}/man1/*
%{_infodir}/*.gz
%{_libdir}/*
%dir %{_datadir}/gnucash
%{_datadir}/gnucash/accounts
%{_datadir}/gnucash/doc
%{_datadir}/gnucash/guile-modules
%{_datadir}/gnucash/html
%{_datadir}/gnucash/scm
%{_datadir}/gnome/help/gnucash
%{_datadir}/gnome/apps/Applications/*
%{_datadir}/pixmaps/gnucash
%{_datadir}/mime-info/gnucash.*
%config %{_sysconfdir}/gnucash
%doc AUTHORS COPYING ChangeLog ChangeLog.1 HACKING NEWS README README.patches
%doc doc/README.german doc/README.francais doc/guile-hackers.txt
%if "%{_with_postgres}" == "--with-postgres"
  %doc README.postgres
%endif

--Boundary_(ID_msjtwtxPBW4OL/3i23wVVg)--