[bt-devel] Current spec file for bibletime.

Brook Humphrey bt-devel@crosswire.org
Wed, 23 May 2001 14:02:33 -0700


Here is my current spec file for bibletime, and before you ask, yes 
compileing a static rpm is a hoary deal not for the faint at heart. No there 
is not a way around moving some of the libs out of the way. If you use kde 
this makes your system unusable for about a half hour untill the spec file 
puts the libs back were they belong.

I've tried to cover the largest number of users possible and comment things 
to make it easy but most will probably not attempt to build the static 
version. I will probably build it agian right now with the new naming (It's 
already in the spec) and get it uploaded to sourceforge so people can start 
testing it out for bugs. It's not little the bibletime program itself is 10.5 
megs. The rpm is 4.2 megs.

%define         name 		bibletime
%define         version 	1.0.beta

# This should not be changed but set this to static or dynamic.
# Sword should always be set to static for these builds.
%define		swordlibs 	static

# This should be set to static or dynamic.
# Most systems may not have all the libs to compile this staticly.
%define		kdelibs 	static
%define		releaseinfo 	cvs.20010523.2mdk

# This should be set to your os Mandrake, Red Hat, Turbolinux, Caldera, Suse, 
Etc.
%define		ostype 		Mandrake

# This should be set to the version # of your os 6.0, 6.1, 6.2, 7.0, 7.1, 
7.2, 8.0, etc.
%define		osversion 	8.0

# This is your cpu i486, i586, i686, ppc, sparc, alfa, etc.
%define		buildarch 	i586

# This the RPM group on your system that this will installed into.
# Graphical desktop/KDE, X11/apps, etc.
%define		rpmgroup 	Graphical desktop/KDE

# this is were the sword modules will be installed on your system.
# /usr/local/sword, /usr/share/sword, /opt/local/sword, etc.
%define         SwordPath 	/usr/share/sword
%define		ModsPath 	%{SwordPath}/mods.d

# This for Mandrake menus if you have another system do not edit this line it 
is for.
# compatability wit hthose systems.
%define		_menudir 	/usr/lib/menu
# Nothing else should need to be changed.
# Please do not edit below this line unless you know what you are doing.
if [ %{kdelibs} = "static" ] ; then
%define         release 	static.%{releaseinfo}
else 
%define		release 	%{releaseinfo}
fi

Summary:        BibleTime %{version} is an easy to use Bible study tool for 
KDE2.
Name:		%{name}
Version:        %{version}
Release:        %{release}
Icon:		bibletime.xpm
Copyright:      GPL
Vendor:         The team of BibleTime <info@bibletime.de>
Url:            http://www.bibletime.de
Packager:       Brook Humphrey <bah@webmedic.net>, Joachim Ansorg 
<jansorg@gmx.de>
Group:          %{rpmgroup}
BuildArch:      %{buildarch}
Source0:        %{name}-%{version}.tar.bz2

# For use with mandrake menu system. 
Source1:        bibletime_icons.tar.bz2

# This is to make a static KDE/QT version
Patch:          %{name}-1.0.patch.tar.bz2

BuildRoot:      %{_tmppath}/%{name}-%{version}--rootbibletime
Provides:       sword-base
Prefix:         %{_prefix}



%description
BibleTime %{version}-%{release} is a free and easy to use bible study tool 
for UNIX systems.

BibleTime provides easy handling of digitalized texts (Bibles, commentaries 
and lexicons) and powerful features to work with these texts (search in 
texts, write own notes, save, print etc.). Bibletime is a frontend for the  
SWORD Bible Framework.

This is  a relocatable package, you can install it on different target with
rpm -Uvh bibletime-xxx.rpm --prefix /usr/local/opt/apps/noncommercial
default is %{_prefix}

The SWORD Project is an effort to create an ever expanding software package 
for research and study of God and His Word.  The SWORD Bible Framework allows 
easy manipulation of Bible texts, commentaries, lexicons, dictionaries, etc.  
Many frontends are build using this framework.  An installed module set may 
be shared between any frontend using the framework.

This rpm was compiled on a %{ostype}  %{osversion} system for %{buildarch} 
class cpu's.

This RPM has these compiled options Sword is compiled %{swordlibs} and KDE/QT 
is compiled %{kdelibs}.

Although this binary no longer requires sword to run the source.rpm will not 
build correctly
 without the sword-devel package installed.

%prep
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%{name}-%{version}

# For use with mandrake menu system
mkdir -p $RPM_BUILD_ROOT%{_menudir}

mkdir -p $RPM_BUILD_ROOT/usr/share/config

# generate directories for sword if building static
if [ %{swordlibs} = "static" ] ; then
mkdir -p $RPM_BUILD_ROOT%{SwordPath}
mkdir -p $RPM_BUILD_ROOT%{ModsPath}
# move the shared libs out of the way to make it static
# this one is for the sword libs if only the sword-devel package is installed
# this will not be necessary. But it is ok to leave it in.
if [ -f /usr/lib/libsword.so ] ; then mv /usr/lib/libsword.so 
/usr/lib/libsword.bak ; fi
fi


%setup -q
#Icons for Mandrake menu system
if [ %{ostype} = "Mandrake" ] ; then
tar jxvf %{SOURCE1}
fi

echo Using $KDEDIR as KDE2 directory
echo Using $QTDIR as QT 2.2.x directory.
echo If the directories are not correct please set them using\
 "export KDEDIR=<KDE2 directory> QTDIR=<QT2.2 directory>"
sleep 5
echo "I'll start now"
make -f Makefile.cvs

if [ %{kdelibs} = "static" ] ; then
./configure --with-qt-libraries=/usr/lib/qt2/lib
else
./configure
fi

# patch to bibletime make file to compile static
if [ %{kdelibs} = "static" ] ; then
%patch -p1
mv /usr/lib/qt2/lib /usr/lib/qt2/bak
mkdir -p /usr/lib/qt2/lib
cp /usr/lib/qt2/bak/*.a /usr/lib/qt2/lib/
cp /usr/lib/qt2/bak/libqxt.* /usr/lib/qt2/lib/
fi


make -j4

%install
make prefix=$RPM_BUILD_ROOT%{prefix} install

# Create Sword globals.conf for using bibletime without sword installed.
cat << EOF >$RPM_BUILD_ROOT%{ModsPath}/globals.conf
 [Globals]
EOF

# For use with mandrake menu system 
cat << EOF > $RPM_BUILD_ROOT%{_menudir}/%{name}
?package(bibletime):command="/usr/bin/bibletime" icon="bibletime.xpm" \
                needs="X11" section="Applications/Bible Study/" 
title="Bibletime" \
                longtitle="An easy to use Bible study tool."
EOF

# For use with mandrake menu system 
# icons: this is for the mandrake menu system
if [ %{ostype} = "Mandrake" ] ; then
mkdir -p $RPM_BUILD_ROOT%{_liconsdir}
mkdir -p $RPM_BUILD_ROOT%{_iconsdir}
mkdir -p $RPM_BUILD_ROOT%{_miconsdir}
cd $RPM_BUILD_DIR/%{name}-%{version}
install -m 644 %{name}_16.xpm $RPM_BUILD_ROOT%{_miconsdir}/%{name}.xpm
install -m 644 %{name}_32.xpm $RPM_BUILD_ROOT%{_iconsdir}/%{name}.xpm
install -m 644 %{name}_48.xpm $RPM_BUILD_ROOT%{_liconsdir}/%{name}.xpm
fi

%post
# this is for creation of the sword.conf for systems that are using bibletime 
withour sword installed.
if [ -f /etc/sword.conf ] ; then
         echo "sword.conf already exists skiping sword.conf creation." ;
else
cat << EOF >/etc/sword.conf
[Install]
DataPath=%{SwordPath}
EOF
fi

/sbin/ldconfig

# For use with mandrake menu system
if [ %{ostype} = "Mandrake" ] ; then
%{update_menus}
fi

%postun
#if [ $1 = 0 ]; then
#     /bin/rm -f /etc/sword.conf
#fi

# For use with mandrake menu system
if [ %{ostype} = "Mandrake" ] ; then
%{clean_menus}
fi

/sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

if [ %{swordlibs} = "static" ] ; then
# move the shared libs back to where they belong
if [ -f /usr/lib/libsword.bak ] ; then mv /usr/lib/libsword.bak 
/usr/lib/libsword.so ; fi
fi

if [ %{kdelibs} = "static" ] ; then
cp /usr/lib/qt2/bak/* /usr/lib/qt2/lib/
rm -rf /usr/lib/qt2/bak
fi

%files
%defattr(-,root,root)
%doc %{prefix}/share/doc/HTML/de/bibletime/*
%doc %{prefix}/share/doc/HTML/en/bibletime/*
%config %{ModsPath}/globals.conf
%config %{prefix}/share/config/bt-printing
%{prefix}/bin/bibletime
%{prefix}/share/applnk/Applications/*
%{prefix}/share/apps/bibletime/*
%{prefix}/share/icons/*
%{prefix}/share/locale/*/LC_MESSAGES/bibletime.mo
# For use with mandrake menu system
%{_menudir}/%{name}


%changelog
* Wed May 23 2001 Brook Humphrey <bah@webmedic.net>

- Yet another try at static qt.

- Qt static works now

* Mon May 21 2001 Brook Humphrey <bah@webmedic.net>

- Static is working for kde and a few other libs but not qt yet

- Testing another patch today to try to get qt compiled static.

* Sun May 20 2001 Brook Humphrey <bah@webmedic.net>

- Cleaned up spec some more(stupid spelling error's)

- static compile not working today so added option to compile kde and sword 
as static seperately

* Sat May 19 2001 Brook Humphrey <bah@webmedic.net>

- Cleaned up spec some more and added a few more comments

- Changed spec to automaticly do parts concerning static and Mandrake menus

- All info can be set in defines at top of spec file no other changes should 
need to be made

- Fixed patch to compile static should now compile static with kde libs 

- Test to compile with qt as static also

* Sun May 13 2001 Brook Humphrey <bah@webmedic.net>

- cleaned up spec file and added more comments for easier reading.

- changed sword.conf instelation to check for previous versions of sword.conf

- If found a new sword.conf is not created

- Made a patch to hopefully compile kde and other libs as atatic

- static compile didn't work for today.

* Tue May 8 2001 Brook Humphrey <bah@webmedic.net>

- Updated package to be relocatable

- added sword directories and sword.conf to install

* Mon Apr 30 2001 Brook Humphrey <bah@webmedic.net>

- Changed to build staticly

- added more mandrake macros to spec file

* Mon Apr 23 2001 Brook Humphrey <bah@webmedic.net>

- made changes to enable compile of cvs tree

* Wed Mar 14 2001 Brook Humphrey <bah@webmedic.net>

- updated to use mandrake menu sysem

-- 

-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-
                                Brook Humphrey		
          Mobile PC Medic, 420 1st, Cheney, WA 99004, 509-235-9107        
     http://www.webmedic.net, bah@webmedic.net, bah@linux-mandrake.com   
-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-~`'~-
  My posting or sending this is NOT an invitation for spammers to say that
                  I've asked to be put on a mailing list.
           You are not permitted to send unsolicited bulk email 
                     (commonly referred to as spam) 
        to this address, or to sell this address to people who do. 
                By extracting the address from this page, 
      you agree to pay a fee of $10,000.00 per UBE message you send 
           and $100,000.00 per instance you sold this address.
 
                    _______________-~-_______________
                          Holliness unto the Lord
                  He must increase but I must decrease.
                  *****************-~-*****************