Generic specs (was:Building RPM from CVS)



This is the generic spec template I use for most of the gnome packages.
It may produce empty '-devel' rpms but these can be ignored.
 Adapt it to your pleasure.
# Note that this is NOT a relocatable package
# Note that this is a VERY GENERIC spec file
%define name     XXXX
%define ver      0.01
%define rel      SNAP
%define prefix   /usr
%define conflags --prefix=%{prefix}
%define makeinstall install

Summary: %{name} 
Name: %{name}
Version: %{ver}
Release: %{rel}
Copyright: LGPL
Group: X11/Libraries
Source: %{name}-%{ver}.tar.gz
BuildRoot: /tmp/%{name}-root
Packager: Yournamehere <your@email.address.ok>
URL: http://www.gnome.org
Prereq: /sbin/install-info
Docdir: %{prefix}/doc

%description
Put %{name} description here

%package devel
Summary: %{name} core libraries, includes, etc
Group: X11/Libraries

%description devel
%{name} libraries and header files.


# This is the generic part 

%prep
%setup

%build

# echo Select configure methord 
if [  -f configure ]; then
  CFLAGS="$RPM_OPT_FLAGS" ./configure %{conflags}
elif [ -f autogen.sh ]; then
  cp -f /usr/share/libtool/config.* . ; 
  cp -f /usr/share/libtool/ltconfig . ; 
  cp -f /usr/share/libtool/ltmain.sh . ;
  CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh %{conflags}
elif [ -f Makefile.PL ]; then
  CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL %{conflags}
fi

# echo Trying parallel make if available
if [ "$SMP" != "" ]; then
  (make "MAKE=make -k -j $SMP"; exit 0)
  make
else
  make
fi

%install

# echo Clean and create buildroot directory
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT%{prefix}/lib
mkdir -p $RPM_BUILD_ROOT%{prefix}/share/gnome

# echo fix for perl Makemaker 
if [ -f Makefile.PL ]; then
  mkdir -p $RPM_BUILD_ROOT`perl -MConfig -e 'print $Config{installarchlib}'`
fi

# echo make install
make PREFIX=$RPM_BUILD_ROOT%{prefix} \
     prefix=$RPM_BUILD_ROOT%{prefix} \
     exec_prefix=$RPM_BUILD_ROOT%{prefix} %{makeinstall}

# echo compressing any info files
( for x in  `find $RPM_BUILD_ROOT -type f -path '*info/*.inf*[o1-9]' -print` ; \
   do { gzip -9n $x } ; done )

# echo finding installed development files
( cd $RPM_BUILD_ROOT ; find * ! -type d \( \
 -path '*info/*.info*' -o \
 -path '*man[23]*/*' -o \
 -path '*bin/*-config' -o \
 -path '*include/*' -o \
 -path '*lib/*lib*.a' -o \
 -path '*lib/*lib*.la' -o \
 \( -path '*lib/*lib*.so' -type l \) -o \
 -path '*share/aclocal/*' -o \
 -path '*.idl' -o \
 -path '*lib/*.sh' \) -print ) | sed 's+^+%attr(-, root, root) /+' \
 | tee RPM-MANIFEST-DEVEL.lst 

# echo finding installed non-development files
( cd $RPM_BUILD_ROOT ; find * ! -type d ! \( \
 -path '*info/dir' -o \
 -path '*info/*.info*' -o \
 -path '*man[23]*/*' -o \
 -path '*bin/*-config' -o \
 -path '*include/*' -o \
 -path '*lib/*lib*.a' -o \
 -path '*lib/*lib*.la' -o \
 \( -path '*lib/*lib*.so' -type l \) -o \
 -path '*share/aclocal/*' -o \
 -path '*.idl' -o \
 -path '*lib/*.sh' \) -print ) \
 | sed 's+^+%attr(-, root, root) /+ ; /\/etc\// s+^+%config + ; /\/share\/.*rc$/ s+^+%config +' \
 | tee RPM-MANIFEST.lst

# echo finding doc files
( find . ! -type d \( \
 -path AUTHORS -o \
 -path 'COPYING*' -o \
 -path 'ChangeLog*' -o \
 -path 'NEWS*' -o \
 -path 'README*' -o \
 -path 'TODO*' -o \
 -path BUGS -o \
 -path LICENCE -o \
 -path 'RELNOTES*' -o \
 -path THANKS -o \
 -path '*.txt' \) ) | sed 's+^./+%doc +' | tee -a RPM-MANIFEST.lst 

# echo found files

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f RPM-MANIFEST.lst

%files devel -f RPM-MANIFEST-DEVEL.lst


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]