patch: rpm stuff


Subject: patch: rpm stuff
From: Tomas Frydrych (tomas@frydrych.uklinux.net)
Date: Fri Mar 02 2001 - 10:54:27 CST


The following patch was sent to me by Tzafrir Cohen; as I know
nothing about making rpm's, I would appreciate if the rpm gurus
could look at it ...

-----original message----
Anyway, while building them I added a patch to put all the auxilary
sources (wx, unixfonts, expat, etc.) under a different directory than
$(ABI_ROOT)/.. . This helps building the RPMs.

I attach the modifications needed (A small patch. There are other
modifications, but it was more compact to describe them as a
short perl script. See the third attachment, which is part of the rpm
spec file)

I attach the rpm spec file (it also contains another patch that
mandrake added and I haven't removed, because it seemed to be
working), the small patch itself, and the portion of the spec that
describes the modifications needed for that change.

One problem I encountered was in the build of the expat library.
Hence the 'ln -s' command in the %prep section of the rpm spec.

Tzafrir Cohen

diff -u -r ../../BUILD/abi-0.7.13/Makefile ./Makefile
--- ../../BUILD/abi-0.7.13/Makefile Sat Feb 3 18:16:37 2001
+++ ./Makefile Mon Feb 26 22:22:11 2001
@@ -22,6 +22,7 @@
 ABI_ROOT :=$(shell pwd)
 prefix :=/usr/local
 
+LIBS_DIR=$(ABI_ROOT)../
 ##################################################################
 ## Useful options:
 ##
diff -u -r ../../BUILD/abi-0.7.13/src/config/abi_rules.mk ./src/config/abi_rules.mk
--- ../../BUILD/abi-0.7.13/src/config/abi_rules.mk Sun Jan 21 11:34:48 2001
+++ ./src/config/abi_rules.mk Tue Feb 27 01:05:09 2001
@@ -36,6 +36,7 @@
 ##################################################################
 ##################################################################
 
+LIBS_DIR=$(ABI_ROOT)/../
 
 ifdef LIBRARY_NAME
 ifeq ($(OS_NAME), WIN32)

# '$(ABI_ROOT)/..' -> '$(LIBS_DIR)'
grep -rl '$(ABI_ROOT)/\.\.' . | \
  xargs perl -p -i -e 's/\$\(ABI_ROOT\)\/\.\./\$\(LIBS_DIR\)/g'
# '$(MAKE)' -> '$(MAKE) LIBS_DIR=$(LIBS_DIR)' (except in some calls to
# external libs
grep -rl '$(MAKE)' . | grep -v src/lib/requires | \
  xargs perl -p -i -e 's/\$\(MAKE\)/\$\(MAKE\) LIBS_DIR=\$\(LIBS_DIR\)/g'
%patch5 -p1 -b .libs_dir

%define name abisuite
%define version 0.7.13
%define release 2bidi
%define ABIPREFIX /usr/share/abisuite
%define MAKEOPT UNIX_CAN_BUILD_STATIC=0 ABI_BUILD_VERSION=%{version}

%define snapshot_ver 010228
# for nightly builds:
%define package_suffix nightly

Name: %{name}
Summary: Lean and fast full-featured word processor
Version: %{version}
Release: %{release}

# currently using a nightly build instead of the source
#Source: http://download.abisource.com/releases/%{version}/src/lf/abi-%{version}.tar.bz2
Source: abi-%{version}-%{snapshot_ver}.tar.bz2
Source1: http://download.abisource.com/releases/%{version}/src/lf/abidistfiles-%{version}.tar.bz2
Source2: http://download.abisource.com/releases/%{version}/src/lf/expat-%{version}.tar.bz2
Source3: http://download.abisource.com/releases/%{version}/src/lf/unixfonts-%{version}.tar.bz2
Source4: http://download.abisource.com/releases/%{version}/src/lf/wv-%{version}.tar.bz2
Source5: abiword-48.xpm.bz2
Source6: abiword-32.xpm.bz2
Source7: http://download.abisource.com/releases/%{version}/src/lf/libiconv-%{version}.tar.bz2
Source8: abiword-16.xpm.bz2
Source9: http://download.abisource.com/releases/%{version}/src/lf/psiconv-%{version}.tar.bz2

Group: Office
URL: http://www.abisource.com/
Requires: gtk+ >= 1.2, glib
BuildRoot: %{_tmppath}/%{name}-buildroot
Copyright: GPL
#Patch0: abi-remove-menus.patch.bz2
Patch1: abi-toolbars.patch.bz2
#Patch2: abi-menus-fr.patch.bz2
Patch3: wv.patch.bz2
Patch4: wv-support.patch.bz2
Patch5: abi-libs-dir.patch
BuildRequires: libwmf glib-devel gtk+-devel freetype-devel xpm-devel zlib-devel libpng-devel

%description
AbiWord is a lean and fast full-featured word processor. It works on Microsoft
Windows and most Unix Systems. Features include:

   * Basic character formatting (bold, underline, italics, etc.)
   * Paragraph alignment
   * Spell-check
   * Import of Word97 and RTF documents
   * Export to RTF, Text, HTML, and LaTeX formats
   * Interactive rulers and tabs
   * Styles
   * Unlimited undo/redo
   * Multiple column control
   * Widow/orphan control
   * Find/Replace
   * Images

This spesific package is using a snapshot of the CVS code of %{snapshot_ver}
and is compiled with the options ABI_OPT_BIDI_ENABLED=1 and
ABI_OPT_BIDI_RTL_DOMINANT=1

%prep
rm -rf $RPM_BUILD_ROOT

#%setup -q -n abi-%{version} -b 1 -b 2 -b 3 -b 4 -b 7 -b 9
%setup -q -n abi-%{package_suffix} -a 1 -a 2 -a 3 -a 4 -a 7 -a 9
# (Fred) from Helix
#%patch0 -p1 -b .remove_menu
# (Renaud)
%patch1 -p1 -b .remove_tools
#%patch2 -p1 -b .menus_fr

############################
# getting extra libraries to $RPM_BUILD_ROOT/libs instead of
# $RPM_BUILD_ROOT/../
# TODO: clean this up

# and instead of modifying every seperate file:

# '$(ABI_ROOT)/..' -> '$(LIBS_DIR)'
grep -rl '$(ABI_ROOT)/\.\.' . | \
  xargs perl -p -i -e 's/\$\(ABI_ROOT\)\/\.\./\$\(LIBS_DIR\)/g'
# '$(MAKE)' -> '$(MAKE) LIBS_DIR=$(LIBS_DIR)' (except in some calls to
# external libs
grep -rl '$(MAKE)' . | grep -v src/lib/requires | \
  xargs perl -p -i -e 's/\$\(MAKE\)/\$\(MAKE\) LIBS_DIR=\$\(LIBS_DIR\)/g'
%patch5 -p1 -b .libs_dir

# a work around some compile problems
ln -s ../../../../libs/expat/lib/expat.h src/af/util/xp/expat.h

mkdir libs
mv abidistfiles expat libiconv psiconv unixfonts wv libs/
cd libs/
#cd $RPM_BUILD_DIR
##########################

# wv.h from abisuite/wv and wmfapi.h clash on some declarations...
#bzcat %{PATCH3} > $RPM_BUILD_DIR/wv.patch
bzcat %{PATCH3} > wv.patch
#bzcat %{PATCH4} > $RPM_BUILD_DIR/wv-support.patch
bzcat %{PATCH4} > wv-support.patch
patch wv/wv.h wv.patch
patch wv/support.c wv-support.patch
cd ..
# back in $RPM_BUILD_DIR

%build
# note the BIDI options!
make %{MAKEOPT} LIBS_DIR=`pwd`/libs prefix=/usr \
     ABI_OPT_BIDI_ENABLED=1 ABI_OPT_BIDI_RTL_DOMINANT=1 ABI_OPT_DEBUG=1
make %{MAKEOPT} canonical prefix=/usr LIBS_DIR=`pwd`/libs \
     ABI_OPT_BIDI_ENABLED=1 ABI_OPT_BIDI_RTL_DOMINANT=1 ABI_OPT_DEBUG=1

%install
make %{MAKEOPT} install LIBS_DIR=`pwd`/libs \
     prefix=$RPM_BUILD_ROOT/usr/share/abisuite
mkdir -p $RPM_BUILD_ROOT/usr/bin
mv $RPM_BUILD_ROOT/usr/share/abisuite/AbiSuite/bin/* $RPM_BUILD_ROOT/usr/bin
( cd $RPM_BUILD_ROOT/usr/bin; ln -s AbiWord abiword )
perl -pi -e "s,$RPM_BUILD_ROOT,," $RPM_BUILD_ROOT/usr/bin/AbiWord
perl -pi -e "s,/usr/share/abisuite/AbiSuite/bin,/usr/bin," $RPM_BUILD_ROOT/usr/bin/AbiWord
rm -rf $RPM_BUILD_ROOT/usr/share/abisuite/bin/
rm -rf $RPM_BUILD_ROOT/usr/share/abisuite/AbiSuite/bin/
rm -f $RPM_BUILD_ROOT/usr/share/abisuite/AbiSuite/COPYING $RPM_BUILD_ROOT/usr/share/abisuite/AbiSuite/readme.txt

# (fg) Icons
mkdir -p $RPM_BUILD_ROOT%{_liconsdir}
mkdir -p $RPM_BUILD_ROOT%{_iconsdir}
mkdir -p $RPM_BUILD_ROOT%{_miconsdir}
bzcat %{SOURCE5} > $RPM_BUILD_ROOT%{_liconsdir}/abiword.xpm
bzcat %{SOURCE6} > $RPM_BUILD_ROOT%{_iconsdir}/abiword.xpm
bzcat %{SOURCE8} > $RPM_BUILD_ROOT%{_miconsdir}/abiword.xpm

# (fg) Menu entry
mkdir -p $RPM_BUILD_ROOT/usr/lib/menu
cat >$RPM_BUILD_ROOT/usr/lib/menu/%{name} <<EOF
?package(abisuite): command="abiword" section="Office" \
icon="abiword.xpm" needs="x11" title="AbiWord" \
longtitle="RTF and Microsoft Word (up to 97) document editor"
EOF

# (vince) user cann't read the fonts without this
chmod 644 $RPM_BUILD_ROOT/usr/share/abisuite/AbiSuite/fonts/*

%clean
rm -fr $RPM_BUILD_ROOT

%files
%defattr(-,root,root,755)
%doc user/wp/readme.txt COPYING
%{_datadir}/abisuite
%{_bindir}/*
%{_iconsdir}/abiword.xpm
%{_miconsdir}/abiword.xpm
%{_liconsdir}/abiword.xpm
%{_menudir}/%{name}

%post
%{update_menus}

%postun
%{clean_menus}

%changelog
* Wed Feb 28 2001 Tzafrir Cohen <tzafrir@technion.ac.il> 0.7.13-2bidi
- upgraded to CVS build of %{snapshot_ver}
- added BIDI and debug compile-time flags
- moved all libraries to under libs/

* Wed Oct 4 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.7.11-4mdk
- Add ABI_BUILD_VERSION so version numbers work (from Tristan Henderson)

* Tue Oct 3 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.7.11-3mdk
- patch to avoid a clash between wv.h provided by abiword/wv module and
  wmfapi.h (which it tries to include when wmf lib is correctly detected)

* Tue Oct 3 2000 Frederic Lepied <flepied@mandrakesoft.com> 0.7.11-2mdk
- added build requires on libwmf gtk+-devel glib-devel freetype-devel xpm-devel zlib-devel libpng-devel.

* Mon Sep 18 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.7.11-1mdk
- new version
- updated menus patch
- added toolbars patch

* Thu Sep 7 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.7.10-2mdk
- macroszification
- added liconsdir

* Wed Jul 19 2000 Frederic Crozat <fcrozat@mandrakesoft.com> 0.7.10-1mdk
- Update to 0.7.10 (from Helix)
- change menu update
- move doc to standard location
- BM

* Sun May 21 2000 David BAUDENS <baudens@mandrakesoft.com> 0.7.9-1mdk
- Fix descriptions (RPM & menu)

* Tue May 2 2000 Vincent Saugey <vince@mandrakesoft.com> 0.7.9-1mdk
- Update to 0.7.9
- Nothing sucks :)

* Sat Apr 15 2000 Guillaume Cottenceau <gc@mandrakesoft.com> 0.7.8-7mdk
- fg sucks - menu entry really really added this time :-)
- fixed sources location

* Fri Apr 14 2000 David BAUDENS <baudens@mandrakesoft.com> 0.7.8-6mdk
- Real description

* Tue Apr 11 2000 Francis Galiegue <fg@mandrakesoft.com> 0.7.8-5mdk
- Titi sucks - menu entry really added this time
- Titi sucks - %post and %postun were incorrect
- Titi sucks - there were no icons, now there are
- Removed SMP cruft

* Wed Apr 05 2000 Jerome Martin <jerome@mandrakesoft.com> 0.7.8-4mdk
- Fixing distribution tag

* Thu Mar 30 2000 Thierry Vignaud <tvignaud@mandrakesoft.com> 0.7.8-3mdk
- add menu entry

* Thu Mar 30 2000 Thierry Vignaud <tvignaud@mandrakesoft.com> 0.7.8-2mdk
- clean spec: remove last garbages of file lists
- now compliant to the new naming scheme
- fix /usr/share/abisuite/bin/abiword incorectely linked on
  /var/tmp/abisuite-buildroot/usr/share/abisuite/AbiSuite/bin/AbiWord
  This bug is present at least since 0.7.7-3mdk!!

* Sun Mar 19 2000 John Buswell <johnb@mandrakesoft.com> 0.7.8-1mdk
- 0.7.8
- PPC Support

* Tue Jan 25 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 0.7.7-2mdk
- Fix alpha/sparc compilation.

* Thu Jan 13 2000 Saugey Vincent <vince@mandrakesoft.com>
- update to 0.7.7

* Thu Oct 21 1999 Thierry Vignaud <tvignaud@mandrakesoft.com>
- update to 0.7.6

* Thu Sep 23 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- Build for cooker.

* Fri Sep 10 1999 Daouda LO <daouda@mandrakesoft.com>
- Mandrake adaptations
- bzipped the sources
- Make the package relocatable

* Sun Sep 05 1999 Vu Hung Quan <binaire@videotron.ca>
- update to 0.7.5 ; redhat adaptation

* Sat Jun 26 1999 Bernhard Rosenkraenzer <bero@mandrakesoft.com>
- create (more or less) generic spec file...



This archive was generated by hypermail 2b25 : Fri Mar 02 2001 - 10:54:12 CST