Packaging:Globus

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Draft Globus Packaging Guidelines - initial version)
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Draft}}
 
 
 
This document describes the guidelines and conventions for packaging components from the Globus Toolkit in Fedora. The following guidelines applies to the components of the Globus Toolkit written in C. A future version of the guidelines may address the packaging of components written in java as well.
 
This document describes the guidelines and conventions for packaging components from the Globus Toolkit in Fedora. The following guidelines applies to the components of the Globus Toolkit written in C. A future version of the guidelines may address the packaging of components written in java as well.
  
Line 9: Line 7:
 
== Obtaining sources ==
 
== Obtaining sources ==
  
The sources for the Globus Toolkit are distributed as one big installer tarball that contain the sources for more than 300 packages. Since including this huge tarball in every Globus source RPM and use less than 1% of it to compile a single Globus package would be extremely wasteful in terms of diskspace and bandwidth, the relevant subdirectory from the installer tarball must be extracted and repackaged for each package. This must be documented using comments in the spec file according to the [[Packaging:SourceURL]] guidelines so that the source tarball can be reproduced, as in the following example:
+
The sources for the Globus Toolkit are distributed as one big installer tarball that contain the sources for more than 300 packages. Since including this huge tarball in every Globus source RPM and use less than 1% of it to compile a single Globus package would be extremely wasteful in terms of diskspace and bandwidth, the relevant subdirectory from the installer tarball must be extracted and repackaged for each package. The GLOBUS_LICENSE file must also be copied into the extracted source tree since it is part of the upstream installer. This must be documented using comments in the spec file according to the [[Packaging:SourceURL]] guidelines so that the source tarball can be reproduced, as in the following example:
  
 
<pre>
 
<pre>
#               Source is extracted from the globus toolkit installer:
+
# Source is extracted from the globus toolkit installer:
#               wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
+
# wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#               tar -jxf gt4.2.1-all-source-installer.tar.bz2
+
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
#               mv gt4.2.1-all-source-installer/source-trees/core/source globus_core-5.15
+
# mv gt4.2.1-all-source-installer/source-trees/common/source globus_common-10.2
#               tar -zcf globus_core-5.15.tar.gz globus_core-5.15
+
# cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_common-10.2
Source:         %{_name}-%{version}.tar.gz
+
# tar -zcf globus_common-10.2.tar.gz globus_common-10.2
 +
Source: %{_name}-%{version}.tar.gz
 
</pre>
 
</pre>
  
Line 25: Line 24:
  
 
<pre>
 
<pre>
Source:         http://www-unix.globus.org/ftppub/gt4/4.2.1/updates/src/%{_name}-%{version}.tar.gz
+
Source: http://www-unix.globus.org/ftppub/gt4/4.2.1/updates/src/%{_name}-%{version}.tar.gz
 
</pre>
 
</pre>
  
Line 57: Line 56:
 
For a globus package that provides libraries the mapping between GPT and RPM packages is as follows:
 
For a globus package that provides libraries the mapping between GPT and RPM packages is as follows:
  
* %{flavor}_rtl.gpt → main package
+
*%{flavor}_rtl.gpt → main package
* %{flavor}_dev.gpt → -devel package
+
*%{flavor}_dev.gpt → -devel package
* noflavor_doc.gpt → -doc package
+
*noflavor_doc.gpt → -doc package
  
 
And if the package provides programs as well as libraries:
 
And if the package provides programs as well as libraries:
  
* %{flavor}_pgm.gpt → -progs package
+
*%{flavor}_pgm.gpt → -progs package
  
 
For a globus package that provides only programs the mapping is as follows:
 
For a globus package that provides only programs the mapping is as follows:
  
* %{flavor}_pgm.gpt → main package
+
*%{flavor}_pgm.gpt → main package
  
 
== GPT metadata files ==
 
== GPT metadata files ==
Line 103: Line 102:
 
== Autogenerating specfiles (informational) ==
 
== Autogenerating specfiles (informational) ==
  
It is possible to autogenerate an initial version of the specfile from the information in the GPT source package description file by running the [http://www.grid.tsl.uu.se/repos/globus/scripts/globus-spec.pl globus-spec.pl] script. Using this script is optional, but provides increased maintainability of the package and reduces the risk of cut and paste errors. The following examples shows the autogenerated specfiles generated by the script in a few cases.
+
It is possible to autogenerate an initial version of the specfile from the information in the GPT source package description file by running the <code>globus-spec-creator</code> script, which is installed as part of the '''globus-core''' package. Using this script is optional, but provides increased maintainability of the package and reduces the risk of cut and paste errors. The following examples shows the autogenerated specfiles generated by the script in a few cases.
  
 
=== Globus package that provides a library ===
 
=== Globus package that provides a library ===
  
 
<code>
 
<code>
./globus-spec.pl -g globus_gsi_openssl_error-0.14/pkgdata/pkg_data_src.gpt.in -d gsi/openssl_error/source
+
globus-spec-creator -g globus_gsi_openssl_error-0.14/pkgdata/pkg_data_src.gpt.in -d gsi/openssl_error/source
 
</code>
 
</code>
  
 
* The <code>-g</code> option specifies the GPT source package description file
 
* The <code>-g</code> option specifies the GPT source package description file
* The <code>-d</code> option specifies the directory in the installer from where the code was extracted.
+
* The <code>-d</code> option specifies the directory in the installer from where the code was extracted
 
* The <code>-e</code> option can be used to specify the packager's e-mail address (defaults to username@host)
 
* The <code>-e</code> option can be used to specify the packager's e-mail address (defaults to username@host)
  
Line 135: Line 134:
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# mv gt4.2.1-all-source-installer/source-trees/gsi/openssl_error/source globus_gsi_openssl_error-0.14
 
# mv gt4.2.1-all-source-installer/source-trees/gsi/openssl_error/source globus_gsi_openssl_error-0.14
 +
# cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_gsi_openssl_error-0.14
 
# tar -zcf globus_gsi_openssl_error-0.14.tar.gz globus_gsi_openssl_error-0.14
 
# tar -zcf globus_gsi_openssl_error-0.14.tar.gz globus_gsi_openssl_error-0.14
Source: %{_name}-%{version}.tar.gz
+
Source: %{_name}-%{version}.tar.gz
Source8: epstopdf-2.9.5gw
+
# This is a workaround for the broken epstopdf script in RHEL5
 +
# See: https://bugzilla.redhat.com/show_bug.cgi?id=450388
 +
Source9: epstopdf-2.9.5gw
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  
Line 146: Line 148:
 
BuildRequires: globus-core >= 4
 
BuildRequires: globus-core >= 4
 
BuildRequires: doxygen
 
BuildRequires: doxygen
%if %{?fedora}%{!?fedora:0} >= 3
 
BuildRequires: graphviz
 
BuildRequires: ghostscript
 
%else
 
%if %{?rhel}%{!?rhel:0} >= 5
 
 
BuildRequires: graphviz
 
BuildRequires: graphviz
 
BuildRequires: ghostscript
 
BuildRequires: ghostscript
 
%if "%{?rhel}" == "5"
 
%if "%{?rhel}" == "5"
 
BuildRequires: graphviz-gd
 
BuildRequires: graphviz-gd
%endif
 
%endif
 
 
%endif
 
%endif
 
%if %{?fedora}%{!?fedora:0} >= 9
 
%if %{?fedora}%{!?fedora:0} >= 9
Line 211: Line 206:
 
%setup -q -n %{_name}-%{version}
 
%setup -q -n %{_name}-%{version}
  
# This is a workaround for the broken epstopdf script in RHEL5
 
# See: https://bugzilla.redhat.com/show_bug.cgi?id=450388
 
 
%if "%{rhel}" == "5"
 
%if "%{rhel}" == "5"
 
mkdir bin
 
mkdir bin
install %{SOURCE8} bin/epstopdf
+
install %{SOURCE9} bin/epstopdf
 
%endif
 
%endif
  
Line 223: Line 216:
 
%endif
 
%endif
  
 +
# Remove files that should be replaced during bootstrap
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Makefile.am
 
rm -f doxygen/Makefile.am
Line 251: Line 245:
 
rm -rf $RPM_BUILD_ROOT
 
rm -rf $RPM_BUILD_ROOT
 
make install DESTDIR=$RPM_BUILD_ROOT
 
make install DESTDIR=$RPM_BUILD_ROOT
 +
 +
GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages
  
 
# Remove libtool archives (.la files)
 
# Remove libtool archives (.la files)
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la' -exec rm -v '{}' \;
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la' -exec rm -v '{}' \;
sed '/lib.*\.la$/d' \
+
sed '/lib.*\.la$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist
  -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_rtl.filelist
+
  
 
# Remove static libraries (.a files)
 
# Remove static libraries (.a files)
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
sed '/lib.*\.a$/d' \
+
sed '/lib.*\.a$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist
  -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_dev.filelist
+
  
 
# Generate pkg-config file from GPT metadata
 
# Generate pkg-config file from GPT metadata
Line 271: Line 265:
 
   $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 
   $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 
sed s!doc/%{_name}!doc/%{name}-%{version}! \
 
sed s!doc/%{_name}!doc/%{name}-%{version}! \
   -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/noflavor_doc.filelist
+
   -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist
  
# Remove unwanted documentation
+
# Remove unwanted documentation (needed for RHEL4)
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/deprecated.3
+
 
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*_%{_name}-%{version}_*.3
 
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*_%{_name}-%{version}_*.3
sed -e '/deprecated\.3/d' \
+
sed -e '/_%{_name}-%{version}_.*\.3/d' \
    -e '/_%{_name}-%{version}_.*\.3/d' \
+
   -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist
   -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/noflavor_doc.filelist
+
 
 +
# Install license file
 +
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 +
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
  
 
# Generate package filelists
 
# Generate package filelists
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_rtl.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist \
 
   | sed s!^!%{_prefix}! > package.filelist
 
   | sed s!^!%{_prefix}! > package.filelist
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_dev.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist \
 
   | sed s!^!%{_prefix}! > package-devel.filelist
 
   | sed s!^!%{_prefix}! > package-devel.filelist
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/noflavor_doc.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist \
 
   | sed -e 's!/man/.*!&*!' -e 's!^!%doc %{_prefix}!' > package-doc.filelist
 
   | sed -e 's!/man/.*!&*!' -e 's!^!%doc %{_prefix}!' > package-doc.filelist
  
Line 296: Line 292:
  
 
%files -f package.filelist
 
%files -f package.filelist
%defattr(-,root,root,-)
 
 
%dir %{_datadir}/globus/packages/%{_name}
 
%dir %{_datadir}/globus/packages/%{_name}
 +
%dir %{_docdir}/%{name}-%{version}
 +
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE
  
 
%files -f package-devel.filelist devel
 
%files -f package-devel.filelist devel
%defattr(-,root,root,-)
 
 
%{_libdir}/pkgconfig/%{name}.pc
 
%{_libdir}/pkgconfig/%{name}.pc
  
 
%files -f package-doc.filelist doc
 
%files -f package-doc.filelist doc
%defattr(-,root,root,-)
 
%dir %{_docdir}/%{name}-%{version}
 
 
%dir %{_docdir}/%{name}-%{version}/html
 
%dir %{_docdir}/%{name}-%{version}/html
  
 
%changelog
 
%changelog
* Wed Apr 15 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 0.14-1
+
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 0.14-1
 
- Autogenerated
 
- Autogenerated
 
</pre>
 
</pre>
Line 316: Line 310:
  
 
<code>
 
<code>
./globus-spec.pl -g globus_proxy_utils-2.5/pkgdata/pkg_data_src.gpt.in -d gsi/proxy/proxy_utils/source %{name}-ldflag-overwrt.patch
+
globus-spec-creator -g globus_proxy_utils-2.5/pkgdata/pkg_data_src.gpt.in -d gsi/proxy/proxy_utils/source
 
</code>
 
</code>
 
This example also illustrates that the names of patches can be listed as arguments to the script. For each patch listed on the command line the autogenerated specfile will contain a stub comment saying "INSERT PATCH DESCRIPTION HERE" and an incomplete reference to the upstream bugzilla where the bug number should be entered.
 
  
 
<pre>
 
<pre>
Line 341: Line 333:
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# mv gt4.2.1-all-source-installer/source-trees/gsi/proxy/proxy_utils/source globus_proxy_utils-2.5
 
# mv gt4.2.1-all-source-installer/source-trees/gsi/proxy/proxy_utils/source globus_proxy_utils-2.5
 +
# cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_proxy_utils-2.5
 
# tar -zcf globus_proxy_utils-2.5.tar.gz globus_proxy_utils-2.5
 
# tar -zcf globus_proxy_utils-2.5.tar.gz globus_proxy_utils-2.5
Source: %{_name}-%{version}.tar.gz
+
Source: %{_name}-%{version}.tar.gz
# ### INSERT PATCH DESCRIPTION HERE ###:
+
# http://bugzilla.globus.org/bugzilla/show_bug.cgi?id=###BUG NUMBER###
+
Patch0: %{name}-ldflag-overwrt.patch
+
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  
Line 374: Line 364:
 
%prep
 
%prep
 
%setup -q -n %{_name}-%{version}
 
%setup -q -n %{_name}-%{version}
%patch0 -p1
 
  
 
%build
 
%build
 +
# Remove files that should be replaced during bootstrap
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Makefile.am
 
rm -f doxygen/Makefile.am
Line 392: Line 382:
 
rm -rf $RPM_BUILD_ROOT
 
rm -rf $RPM_BUILD_ROOT
 
make install DESTDIR=$RPM_BUILD_ROOT
 
make install DESTDIR=$RPM_BUILD_ROOT
 +
 +
GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages
 +
 +
# Install license file
 +
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 +
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
  
 
# Generate package filelists
 
# Generate package filelists
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_pgm.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_pgm.filelist \
 
   | sed s!^!%{_prefix}! > package.filelist
 
   | sed s!^!%{_prefix}! > package.filelist
  
Line 401: Line 397:
  
 
%files -f package.filelist
 
%files -f package.filelist
%defattr(-,root,root,-)
 
 
%dir %{_datadir}/globus/packages/%{_name}
 
%dir %{_datadir}/globus/packages/%{_name}
 +
%dir %{_docdir}/%{name}-%{version}
 +
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE
  
 
%changelog
 
%changelog
* Thu Apr 16 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 2.5-1
+
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 2.5-1
 
- Autogenerated
 
- Autogenerated
 
</pre>
 
</pre>
Line 412: Line 409:
  
 
<code>
 
<code>
./globus-spec.pl -g globus_xio_popen_driver-0.2/pkgdata/pkg_data_src.gpt.in -d xio/drivers/popen/source -n %{name}-wrong-dep.patch
+
globus-spec-creator -g globus_xio_popen_driver-0.2/pkgdata/pkg_data_src.gpt.in -d xio/drivers/popen/source -r 2 -n %{name}-wrong-dep.patch %{name}-wrong-desc.patch
 
</code>
 
</code>
  
In this case the autogenerated specfile will instead of the commands for deleting the .la files contain a comment explaining why the .la files can not be removed. This example also shows the use of the <code>-n</code> option to disable the generation of a doc package for Globus packages that don't have any doxygen markup in the sources.
+
* The <code>-r</code> option is used to set the release version of the specfile to 2 (default is 1, as in the previous examples)
 +
* The <code>-n</code> option can be used to disable the generation of a doc package for Globus packages that don't have any doxygen markup in the sources.
 +
 
 +
In this case the autogenerated specfile will instead of the commands for deleting the .la files contain a comment explaining why the .la files can not be removed.
 +
 
 +
This example also illustrates that the names of patches can be listed as arguments to the script. For each patch listed on the command line the autogenerated specfile will contain a stub comment saying "INSERT PATCH DESCRIPTION HERE" and an incomplete reference to the upstream bugzilla where the bug number should be entered.
  
 
<pre>
 
<pre>
Line 427: Line 429:
 
%global _name %(tr - _ <<< %{name})
 
%global _name %(tr - _ <<< %{name})
 
Version: 0.2
 
Version: 0.2
Release: 1%{?dist}
+
Release: 2%{?dist}
Summary: Globus Toolkit - Globus XIO BW Limit Driver
+
Summary: Globus Toolkit - Globus XIO Pipe Open Driver
  
 
Group: System Environment/Libraries
 
Group: System Environment/Libraries
Line 437: Line 439:
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# mv gt4.2.1-all-source-installer/source-trees/xio/drivers/popen/source globus_xio_popen_driver-0.2
 
# mv gt4.2.1-all-source-installer/source-trees/xio/drivers/popen/source globus_xio_popen_driver-0.2
 +
# cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_xio_popen_driver-0.2
 
# tar -zcf globus_xio_popen_driver-0.2.tar.gz globus_xio_popen_driver-0.2
 
# tar -zcf globus_xio_popen_driver-0.2.tar.gz globus_xio_popen_driver-0.2
Source: %{_name}-%{version}.tar.gz
+
Source: %{_name}-%{version}.tar.gz
 
# ### INSERT PATCH DESCRIPTION HERE ###:
 
# ### INSERT PATCH DESCRIPTION HERE ###:
 
# http://bugzilla.globus.org/bugzilla/show_bug.cgi?id=###BUG NUMBER###
 
# http://bugzilla.globus.org/bugzilla/show_bug.cgi?id=###BUG NUMBER###
Patch0: %{name}-wrong-dep.patch
+
Patch0: %{name}-wrong-dep.patch
 +
# ### INSERT PATCH DESCRIPTION HERE ###:
 +
# http://bugzilla.globus.org/bugzilla/show_bug.cgi?id=###BUG NUMBER###
 +
Patch1: %{name}-wrong-desc.patch
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  
 +
Requires: globus-common
 
BuildRequires: grid-packaging-tools
 
BuildRequires: grid-packaging-tools
 
BuildRequires: globus-xio-devel
 
BuildRequires: globus-xio-devel
  
 
%package devel
 
%package devel
Summary: Globus Toolkit - Globus XIO BW Limit Driver Development Files
+
Summary: Globus Toolkit - Globus XIO Pipe Open Driver Development Files
 
Group: Development/Libraries
 
Group: Development/Libraries
 
Requires: %{name} = %{version}-%{release}
 
Requires: %{name} = %{version}-%{release}
Line 460: Line 467:
  
 
The %{name} package contains:
 
The %{name} package contains:
Globus XIO BW Limit Driver
+
Globus XIO Pipe Open Driver
  
 
%description devel
 
%description devel
Line 469: Line 476:
  
 
The %{name}-devel package contains:
 
The %{name}-devel package contains:
Globus XIO BW Limit Driver Development Files
+
Globus XIO Pipe Open Driver Development Files
  
 
%prep
 
%prep
 
%setup -q -n %{_name}-%{version}
 
%setup -q -n %{_name}-%{version}
 
%patch0 -p1
 
%patch0 -p1
 +
%patch1 -p1
  
 
%build
 
%build
 +
# Remove files that should be replaced during bootstrap
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Makefile.am
 
rm -f doxygen/Makefile.am
Line 500: Line 509:
 
rm -rf $RPM_BUILD_ROOT
 
rm -rf $RPM_BUILD_ROOT
 
make install DESTDIR=$RPM_BUILD_ROOT
 
make install DESTDIR=$RPM_BUILD_ROOT
 +
 +
GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages
  
 
# This library is opened using lt_dlopenext, so the libtool archives
 
# This library is opened using lt_dlopenext, so the libtool archives
Line 509: Line 520:
 
# Remove static libraries (.a files)
 
# Remove static libraries (.a files)
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
sed '/lib.*\.a$/d' \
+
sed '/lib.*\.a$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist
  -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_dev.filelist
+
  
 
# Generate pkg-config file from GPT metadata
 
# Generate pkg-config file from GPT metadata
Line 516: Line 526:
 
%{_datadir}/globus/globus-gpt2pkg-config pkgdata/pkg_data_%{flavor}_dev.gpt > \
 
%{_datadir}/globus/globus-gpt2pkg-config pkgdata/pkg_data_%{flavor}_dev.gpt > \
 
   $RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}.pc
 
   $RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}.pc
 +
 +
# Install license file
 +
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 +
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
  
 
# Generate package filelists
 
# Generate package filelists
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_rtl.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist \
 
   | sed s!^!%{_prefix}! > package.filelist
 
   | sed s!^!%{_prefix}! > package.filelist
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_dev.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist \
 
   | sed s!^!%{_prefix}! > package-devel.filelist
 
   | sed s!^!%{_prefix}! > package-devel.filelist
  
Line 531: Line 545:
  
 
%files -f package.filelist
 
%files -f package.filelist
%defattr(-,root,root,-)
 
 
%dir %{_datadir}/globus/packages/%{_name}
 
%dir %{_datadir}/globus/packages/%{_name}
 +
%dir %{_docdir}/%{name}-%{version}
 +
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE
  
 
%files -f package-devel.filelist devel
 
%files -f package-devel.filelist devel
%defattr(-,root,root,-)
 
 
%{_libdir}/pkgconfig/%{name}.pc
 
%{_libdir}/pkgconfig/%{name}.pc
  
 
%changelog
 
%changelog
* Thu Apr 16 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 0.2-1
+
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 0.2-2
 
- Autogenerated
 
- Autogenerated
 
</pre>
 
</pre>
Line 546: Line 560:
  
 
<code>
 
<code>
./globus-spec.pl -g globus_common-10.2/pkgdata/pkg_data_src.gpt.in -s globus_common_setup-2.6/pkgdata/pkg_data_src.gpt.in -r 2 -d common/source
+
globus-spec-creator -g globus_common-10.2/pkgdata/pkg_data_src.gpt.in -s globus_common_setup-2.6/pkgdata/pkg_data_src.gpt.in -r 3 -d common/source
 
</code>
 
</code>
  
 
* The <code>-s</code> option is used to indicate the GPT source package description file for the setup package
 
* The <code>-s</code> option is used to indicate the GPT source package description file for the setup package
* The <code>-r</code> option is used to set the release version of the specfile to 2 (default is 1, as in the previous examples)
 
  
The patches have been excluded from this example to keep it short. For this package some additional editing is needed. Compare the autogenerated file below with the [http://cvs.fedoraproject.org/viewvc/devel/globus-common/globus-common.spec?view=markup specfile on the actual package] to see the differences.
+
The patches have been excluded from this example to keep it short. For this package some additional editing is needed. Compare the autogenerated file below with the [http://cvs.fedoraproject.org/viewvc/devel/globus-common/globus-common.spec?view=markup specfile in the actual package] to see the differences.
  
 
<pre>
 
<pre>
Line 565: Line 578:
 
Version: 10.2
 
Version: 10.2
 
%global setupversion 2.6
 
%global setupversion 2.6
Release: 2%{?dist}
+
Release: 3%{?dist}
 
Summary: Globus Toolkit - Common Library
 
Summary: Globus Toolkit - Common Library
  
Line 575: Line 588:
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# mv gt4.2.1-all-source-installer/source-trees/common/source globus_common-10.2
 
# mv gt4.2.1-all-source-installer/source-trees/common/source globus_common-10.2
 +
# cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_common-10.2
 
# tar -zcf globus_common-10.2.tar.gz globus_common-10.2
 
# tar -zcf globus_common-10.2.tar.gz globus_common-10.2
Source: %{_name}-%{version}.tar.gz
+
Source: %{_name}-%{version}.tar.gz
 
# Source1 is extracted from the globus toolkit installer:
 
# Source1 is extracted from the globus toolkit installer:
 
# wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
 
# wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# tar -jxf gt4.2.1-all-source-installer.tar.bz2
 
# mv gt4.2.1-all-source-installer/source-trees/common/setup globus_common_setup-2.6
 
# mv gt4.2.1-all-source-installer/source-trees/common/setup globus_common_setup-2.6
 +
# cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_common_setup-2.6
 
# tar -zcf globus_common_setup-2.6.tar.gz globus_common_setup-2.6
 
# tar -zcf globus_common_setup-2.6.tar.gz globus_common_setup-2.6
 
Source1: %{_name}_setup-%{setupversion}.tar.gz
 
Source1: %{_name}_setup-%{setupversion}.tar.gz
Source8: epstopdf-2.9.5gw
+
# This is a workaround for the broken epstopdf script in RHEL5
 +
# See: https://bugzilla.redhat.com/show_bug.cgi?id=450388
 +
Source9: epstopdf-2.9.5gw
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  
Line 591: Line 608:
 
BuildRequires: globus-core >= 4
 
BuildRequires: globus-core >= 4
 
BuildRequires: doxygen
 
BuildRequires: doxygen
%if %{?fedora}%{!?fedora:0} >= 3
 
BuildRequires: graphviz
 
BuildRequires: ghostscript
 
%else
 
%if %{?rhel}%{!?rhel:0} >= 5
 
 
BuildRequires: graphviz
 
BuildRequires: graphviz
 
BuildRequires: ghostscript
 
BuildRequires: ghostscript
 
%if "%{?rhel}" == "5"
 
%if "%{?rhel}" == "5"
 
BuildRequires: graphviz-gd
 
BuildRequires: graphviz-gd
%endif
 
%endif
 
 
%endif
 
%endif
 
%if %{?fedora}%{!?fedora:0} >= 9
 
%if %{?fedora}%{!?fedora:0} >= 9
Line 675: Line 685:
 
%setup -D -T -q -n %{_name}-%{version} -a 1
 
%setup -D -T -q -n %{_name}-%{version} -a 1
  
# This is a workaround for the broken epstopdf script in RHEL5
 
# See: https://bugzilla.redhat.com/show_bug.cgi?id=450388
 
 
%if "%{rhel}" == "5"
 
%if "%{rhel}" == "5"
 
mkdir bin
 
mkdir bin
install %{SOURCE8} bin/epstopdf
+
install %{SOURCE9} bin/epstopdf
 
%endif
 
%endif
  
Line 687: Line 695:
 
%endif
 
%endif
  
 +
# Remove files that should be replaced during bootstrap
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Makefile.am
 
rm -f doxygen/Makefile.am
Line 711: Line 720:
 
cd %{_name}_setup-%{setupversion}
 
cd %{_name}_setup-%{setupversion}
  
 +
# Remove files that should be replaced during bootstrap
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Doxyfile*
 
rm -f doxygen/Makefile.am
 
rm -f doxygen/Makefile.am
Line 748: Line 758:
  
 
### INSERT RELEVANT PARTS OF setup-globus-common HERE ###
 
### INSERT RELEVANT PARTS OF setup-globus-common HERE ###
 +
 +
GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages
  
 
# Remove libtool archives (.la files)
 
# Remove libtool archives (.la files)
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la' -exec rm -v '{}' \;
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la' -exec rm -v '{}' \;
sed '/lib.*\.la$/d' \
+
sed '/lib.*\.la$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist
  -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_rtl.filelist
+
  
 
# Remove static libraries (.a files)
 
# Remove static libraries (.a files)
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
 
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
sed '/lib.*\.a$/d' \
+
sed '/lib.*\.a$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist
  -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_dev.filelist
+
  
 
# Generate pkg-config file from GPT metadata
 
# Generate pkg-config file from GPT metadata
Line 768: Line 778:
 
   $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 
   $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 
sed s!doc/%{_name}!doc/%{name}-%{version}! \
 
sed s!doc/%{_name}!doc/%{name}-%{version}! \
   -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/noflavor_doc.filelist
+
   -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist
  
# Remove unwanted documentation
+
# Remove unwanted documentation (needed for RHEL4)
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/deprecated.3
+
 
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*_%{_name}-%{version}_*.3
 
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*_%{_name}-%{version}_*.3
sed -e '/deprecated\.3/d' \
+
sed -e '/_%{_name}-%{version}_.*\.3/d' \
    -e '/_%{_name}-%{version}_.*\.3/d' \
+
   -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist
   -i $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/noflavor_doc.filelist
+
 
 +
# Install license file
 +
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 +
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
  
 
# Generate package filelists
 
# Generate package filelists
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_rtl.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist \
 
   | sed s!^!%{_prefix}! > package.filelist
 
   | sed s!^!%{_prefix}! > package.filelist
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_pgm.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_pgm.filelist \
     $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}_setup/noflavor_pgm.filelist \
+
     $GLOBUSPACKAGEDIR/%{_name}_setup/noflavor_pgm.filelist \
 
   | sed s!^!%{_prefix}! > package-progs.filelist
 
   | sed s!^!%{_prefix}! > package-progs.filelist
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/%{flavor}_dev.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist \
 
   | sed s!^!%{_prefix}! > package-devel.filelist
 
   | sed s!^!%{_prefix}! > package-devel.filelist
cat $RPM_BUILD_ROOT%{_datadir}/globus/packages/%{_name}/noflavor_doc.filelist \
+
cat $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist \
 
   | sed -e 's!/man/.*!&*!' -e 's!^!%doc %{_prefix}!' > package-doc.filelist
 
   | sed -e 's!/man/.*!&*!' -e 's!^!%doc %{_prefix}!' > package-doc.filelist
  
Line 796: Line 808:
  
 
%files -f package.filelist
 
%files -f package.filelist
%defattr(-,root,root,-)
 
 
%dir %{_datadir}/globus/packages/%{_name}
 
%dir %{_datadir}/globus/packages/%{_name}
 +
%dir %{_docdir}/%{name}-%{version}
 +
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE
  
 
%files -f package-progs.filelist progs
 
%files -f package-progs.filelist progs
%defattr(-,root,root,-)
 
 
%dir %{_datadir}/globus/packages/%{_name}_setup
 
%dir %{_datadir}/globus/packages/%{_name}_setup
 
%{_datadir}/globus/packages/setup
 
%{_datadir}/globus/packages/setup
Line 806: Line 818:
  
 
%files -f package-devel.filelist devel
 
%files -f package-devel.filelist devel
%defattr(-,root,root,-)
 
 
%{_libdir}/pkgconfig/%{name}.pc
 
%{_libdir}/pkgconfig/%{name}.pc
  
 
%files -f package-doc.filelist doc
 
%files -f package-doc.filelist doc
%defattr(-,root,root,-)
 
%dir %{_docdir}/%{name}-%{version}
 
 
%dir %{_docdir}/%{name}-%{version}/html
 
%dir %{_docdir}/%{name}-%{version}/html
  
 
%changelog
 
%changelog
* Thu Apr 16 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 10.2-2
+
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 10.2-3
 
- Autogenerated
 
- Autogenerated
 
</pre>
 
</pre>
 +
 +
[[Category:Packaging guidelines]]

Latest revision as of 15:31, 28 April 2011

This document describes the guidelines and conventions for packaging components from the Globus Toolkit in Fedora. The following guidelines applies to the components of the Globus Toolkit written in C. A future version of the guidelines may address the packaging of components written in java as well.

Contents

[edit] What is the Globus Toolkit?

The Globus Toolkit is a set of libraries and tools used as building blocks for grid computing applications. The toolkit is developed and maintained by the Globus Alliance.

[edit] Obtaining sources

The sources for the Globus Toolkit are distributed as one big installer tarball that contain the sources for more than 300 packages. Since including this huge tarball in every Globus source RPM and use less than 1% of it to compile a single Globus package would be extremely wasteful in terms of diskspace and bandwidth, the relevant subdirectory from the installer tarball must be extracted and repackaged for each package. The GLOBUS_LICENSE file must also be copied into the extracted source tree since it is part of the upstream installer. This must be documented using comments in the spec file according to the Packaging:SourceURL guidelines so that the source tarball can be reproduced, as in the following example:

#		Source is extracted from the globus toolkit installer:
#		wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#		tar -jxf gt4.2.1-all-source-installer.tar.bz2
#		mv gt4.2.1-all-source-installer/source-trees/common/source globus_common-10.2
#		cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_common-10.2
#		tar -zcf globus_common-10.2.tar.gz globus_common-10.2
Source: 	%{_name}-%{version}.tar.gz

[edit] Off-release upstream updates

Occasionally the Globus Alliance publishes an off-release update of a package. For these updates each updated package is available as a separate tarball, and the repackaging discribed above should not be done:

Source: 	http://www-unix.globus.org/ftppub/gt4/4.2.1/updates/src/%{_name}-%{version}.tar.gz

In order to keep the packaging consistent, the naming of the tarfiles extracted from the installer should use the same naming convention as upstream uses for the tarfiles for these updates, i.e. the upstream package name and version.

[edit] Grid packaging tools

The Globus Toolkit uses its own build system called the grid packaging tools (GPT). This is available in Fedora in the grid-packaging-tools package.

[edit] globus-core

The globus-core package is a development package that provides common build instructions for all globus packages. The globus-core package is not required at runtime and must not be listed as a Requires other than for -devel packages.

[edit] Creating the specfile for a Globus package

All metadata about a Globus package needed to create the specfile is available in the package's GPT source package description file, usually obtainable as pkgdata/pkg_data_src.gpt.in in the package's sources. This is an XML file that contains the package's

  • Name
  • Version
  • Description
  • Build dependencies
  • Link dependencies
  • Runtime dependencies

The underscores in the upstream package name are changed to dashes in order to comply with the Packaging/NamingGuidelines#Separators guidelines.

[edit] GPT packages vs. RPM packages

GPT has its own packaging mechanism, and automatically distributes the installed files generated from the GPT source package into several GPT binary packages. By taking advantage of this feature the split of the installed files into several binary RPMs can be automatised.

For a globus package that provides libraries the mapping between GPT and RPM packages is as follows:

  • %{flavor}_rtl.gpt → main package
  • %{flavor}_dev.gpt → -devel package
  • noflavor_doc.gpt → -doc package

And if the package provides programs as well as libraries:

  • %{flavor}_pgm.gpt → -progs package

For a globus package that provides only programs the mapping is as follows:

  • %{flavor}_pgm.gpt → main package

[edit] GPT metadata files

The grid-packaging-tools install GPT metadata about the binary packages they create. Each GPT binary package has two metadata files in /usr/share/globus/<source_package_name>. These files should be packaged in the binary RPMs since they are needed by GPT to resolve build dependencies and by GPT user tools, such as gpt-query.

Some of the GPT metadata files contain information about architecture specific files. However, the metadata itself is architecture independant and therefore belong in /usr/share rather than /usr/lib. GPT uses different filenames for metadata files containing architecture dependent information, so there are no filename clashes in a multi-architecture installation.

These GPT metadata files are also used to generate the RPM filelists. The main difference between the GPT and RPM filelist format is that the prefix (/usr) is missing in the GPT filelist. The translation can be done using a simple sed replacement.

[edit] Doc packages

The globus library APIs are documented using doxygen comments. These are used to generate the documentation in the GPT doc packages. For some globus packages these packages are very large, while for others they are quite small. In order to provide consistent and user predictable packaging for all globus packages, the GPT doc packages should be packaged as separate doc RPMs for all globus packages regardless of their size.

[edit] Setup packages

Some globus packages has a corresponding setup package. These two packages usually requires each other and it doesn't make sense to create separate RPMs for them. The source RPM should therefore contain the sources for both packages.

A setup package normally contains a postinstall script. Since the install location of the RPM package is known it is on most occasions possible to convert the commands in this postinstall script to commands in the install section of the specfile instead, and not use a postinstall scriptlet. It is usually not a good idea to run the postinstall script provided in the sources as a postinstall scriptlet in the RPM since it often depends on the grid-packaging-tools, which is a development package and should not be Required by a non-devel package.

[edit] Plugins

Most globus libraries are simply libraries. However, globus occasionally uses a plugin mechanism based on the libtool dynamic loader library (libltdl). Libraries used as plugins in this way can be recognized by that they have an empty pkg_libs tag in the Build_Environment in the GPT source description file. Since the libtool dynamic loader library requires the libtool archive (.la) files at runtime for proper functionality, these packages as an exception should contain these files.

[edit] Library flavor tags

In a default Globus installation a flavor tag, encoding the name of the compiler and the architecture, is added to the name of the libraries in order to allow libraries for multiple architectures to be installed in the same directory. This is not needed in Fedora since in a multi-architecture installation, Fedora installs libraries for different architectures in different directories. Also encoding this information in the library names violates the packaging guidelines.

By adding a ColocateLibraries="no" attribute to the With_Flavors tag in the GPT source package description file, GPT can be told to generate Makefile rules without the flavor tag in the library names.

[edit] GPT glue packages

Some of the GPT packages in the huge Globus Toolkit installer tarball contain copies of sources of external libraries the Globus packages depend on. Such code should not be packaged in Fedora, since these libraries are already available in the distribution. However, since building the Globus packages uses GPT, the build process expects that the GPT metadata for these packages exists. In this case, a GPT glue package should be created containing only GPT metadata files. These files should refer to the Fedora version of the library as an external dependency. The version of this package should be the same as the version of the globus package it replaces.

[edit] Autogenerating specfiles (informational)

It is possible to autogenerate an initial version of the specfile from the information in the GPT source package description file by running the globus-spec-creator script, which is installed as part of the globus-core package. Using this script is optional, but provides increased maintainability of the package and reduces the risk of cut and paste errors. The following examples shows the autogenerated specfiles generated by the script in a few cases.

[edit] Globus package that provides a library

globus-spec-creator -g globus_gsi_openssl_error-0.14/pkgdata/pkg_data_src.gpt.in -d gsi/openssl_error/source

  • The -g option specifies the GPT source package description file
  • The -d option specifies the directory in the installer from where the code was extracted
  • The -e option can be used to specify the packager's e-mail address (defaults to username@host)
%ifarch alpha ia64 ppc64 s390x sparc64 x86_64
%global flavor gcc64pthr
%else
%global flavor gcc32pthr
%endif

Name:		globus-gsi-openssl-error
%global _name %(tr - _ <<< %{name})
Version:	0.14
Release:	1%{?dist}
Summary:	Globus Toolkit - Globus OpenSSL Error Handling

Group:		System Environment/Libraries
License:	ASL 2.0
URL:		http://www.globus.org/
#		Source is extracted from the globus toolkit installer:
#		wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#		tar -jxf gt4.2.1-all-source-installer.tar.bz2
#		mv gt4.2.1-all-source-installer/source-trees/gsi/openssl_error/source globus_gsi_openssl_error-0.14
#		cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_gsi_openssl_error-0.14
#		tar -zcf globus_gsi_openssl_error-0.14.tar.gz globus_gsi_openssl_error-0.14
Source: 	%{_name}-%{version}.tar.gz
#		This is a workaround for the broken epstopdf script in RHEL5
#		See: https://bugzilla.redhat.com/show_bug.cgi?id=450388
Source9:	epstopdf-2.9.5gw
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires:	globus-openssl >= 1
BuildRequires:	grid-packaging-tools
BuildRequires:	globus-common-devel >= 3
BuildRequires:	globus-openssl-devel >= 1
BuildRequires:	globus-core >= 4
BuildRequires:	doxygen
BuildRequires:	graphviz
BuildRequires:	ghostscript
%if "%{?rhel}" == "5"
BuildRequires:	graphviz-gd
%endif
%if %{?fedora}%{!?fedora:0} >= 9
BuildRequires:	tex(latex)
%else
%if %{?rhel}%{!?rhel:0} >= 6
BuildRequires:	tex(latex)
%else
BuildRequires:	tetex-latex
%endif
%endif

%package devel
Summary:	Globus Toolkit - Globus OpenSSL Error Handling Development Files
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	globus-common-devel >= 3
Requires:	globus-openssl-devel >= 1
Requires:	globus-core >= 4

%package doc
Summary:	Globus Toolkit - Globus OpenSSL Error Handling Documentation Files
Group:		Documentation
Requires:	%{name} = %{version}-%{release}

%description
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name} package contains:
Globus OpenSSL Error Handling

%description devel
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name}-devel package contains:
Globus OpenSSL Error Handling Development Files

%description doc
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name}-doc package contains:
Globus OpenSSL Error Handling Documentation Files

%prep
%setup -q -n %{_name}-%{version}

%if "%{rhel}" == "5"
mkdir bin
install %{SOURCE9} bin/epstopdf
%endif

%build
%if "%{rhel}" == "5"
export PATH=$PWD/bin:$PATH
%endif

# Remove files that should be replaced during bootstrap
rm -f doxygen/Doxyfile*
rm -f doxygen/Makefile.am
rm -f pkgdata/Makefile.am
rm -f globus_automake*
rm -rf autom4te.cache

# Remove flavor tags
for f in `find . -name Makefile.am` ; do
  sed -e 's!^flavorinclude_HEADERS!include_HEADERS!' \
      -e 's!\(lib[a-zA-Z_]*\)_$(GLOBUS_FLAVOR_NAME)\.la!\1.la!g' \
      -e 's!^\(lib[a-zA-Z_]*\)___GLOBUS_FLAVOR_NAME__la_!\1_la_!' -i $f
done
sed -e "s!<With_Flavors!<With_Flavors ColocateLibraries=\"no\"!" \
  -i pkgdata/pkg_data_src.gpt.in

%{_datadir}/globus/globus-bootstrap.sh

%configure --with-flavor=%{flavor} --enable-doxygen

make %{?_smp_mflags}

%install
%if "%{rhel}" == "5"
export PATH=$PWD/bin:$PATH
%endif

rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages

# Remove libtool archives (.la files)
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la' -exec rm -v '{}' \;
sed '/lib.*\.la$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist

# Remove static libraries (.a files)
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
sed '/lib.*\.a$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist

# Generate pkg-config file from GPT metadata
mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%{_datadir}/globus/globus-gpt2pkg-config pkgdata/pkg_data_%{flavor}_dev.gpt > \
  $RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}.pc

# Move documentation to default RPM location
mv $RPM_BUILD_ROOT%{_docdir}/%{_name} \
  $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
sed s!doc/%{_name}!doc/%{name}-%{version}! \
  -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist

# Remove unwanted documentation (needed for RHEL4)
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*_%{_name}-%{version}_*.3
sed -e '/_%{_name}-%{version}_.*\.3/d' \
  -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist

# Install license file
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

# Generate package filelists
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist \
  | sed s!^!%{_prefix}! > package.filelist
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist \
  | sed s!^!%{_prefix}! > package-devel.filelist
cat $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist \
  | sed -e 's!/man/.*!&*!' -e 's!^!%doc %{_prefix}!' > package-doc.filelist

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f package.filelist
%dir %{_datadir}/globus/packages/%{_name}
%dir %{_docdir}/%{name}-%{version}
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE

%files -f package-devel.filelist devel
%{_libdir}/pkgconfig/%{name}.pc

%files -f package-doc.filelist doc
%dir %{_docdir}/%{name}-%{version}/html

%changelog
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 0.14-1
- Autogenerated

[edit] Globus package that only provides programs

globus-spec-creator -g globus_proxy_utils-2.5/pkgdata/pkg_data_src.gpt.in -d gsi/proxy/proxy_utils/source

%ifarch alpha ia64 ppc64 s390x sparc64 x86_64
%global flavor gcc64pthr
%else
%global flavor gcc32pthr
%endif

Name:		globus-proxy-utils
%global _name %(tr - _ <<< %{name})
Version:	2.5
Release:	1%{?dist}
Summary:	Globus Toolkit - Globus GSI Proxy Utility Programs

Group:		Applications/Internet
License:	ASL 2.0
URL:		http://www.globus.org/
#		Source is extracted from the globus toolkit installer:
#		wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#		tar -jxf gt4.2.1-all-source-installer.tar.bz2
#		mv gt4.2.1-all-source-installer/source-trees/gsi/proxy/proxy_utils/source globus_proxy_utils-2.5
#		cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_proxy_utils-2.5
#		tar -zcf globus_proxy_utils-2.5.tar.gz globus_proxy_utils-2.5
Source: 	%{_name}-%{version}.tar.gz
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires:	globus-openssl >= 1
BuildRequires:	grid-packaging-tools
BuildRequires:	globus-gsi-proxy-ssl-devel >= 1
BuildRequires:	globus-gsi-credential-devel >= 1
BuildRequires:	globus-gsi-callback-devel
BuildRequires:	globus-openssl-module-devel
BuildRequires:	globus-gss-assist-devel >= 3
BuildRequires:	globus-gsi-openssl-error-devel
BuildRequires:	globus-openssl-devel >= 1
BuildRequires:	globus-gsi-proxy-core-devel >= 1
BuildRequires:	globus-core >= 4
BuildRequires:	globus-gsi-cert-utils-devel >= 1
BuildRequires:	globus-common-devel >= 3
BuildRequires:	globus-gsi-sysconfig-devel >= 1

%description
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name} package contains:
Globus GSI Proxy Utility Programs

%prep
%setup -q -n %{_name}-%{version}

%build
# Remove files that should be replaced during bootstrap
rm -f doxygen/Doxyfile*
rm -f doxygen/Makefile.am
rm -f pkgdata/Makefile.am
rm -f globus_automake*
rm -rf autom4te.cache

%{_datadir}/globus/globus-bootstrap.sh

%configure --with-flavor=%{flavor}

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages

# Install license file
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

# Generate package filelists
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_pgm.filelist \
  | sed s!^!%{_prefix}! > package.filelist

%clean
rm -rf $RPM_BUILD_ROOT

%files -f package.filelist
%dir %{_datadir}/globus/packages/%{_name}
%dir %{_docdir}/%{name}-%{version}
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE

%changelog
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 2.5-1
- Autogenerated

[edit] Globus package containing a plugin

globus-spec-creator -g globus_xio_popen_driver-0.2/pkgdata/pkg_data_src.gpt.in -d xio/drivers/popen/source -r 2 -n %{name}-wrong-dep.patch %{name}-wrong-desc.patch

  • The -r option is used to set the release version of the specfile to 2 (default is 1, as in the previous examples)
  • The -n option can be used to disable the generation of a doc package for Globus packages that don't have any doxygen markup in the sources.

In this case the autogenerated specfile will instead of the commands for deleting the .la files contain a comment explaining why the .la files can not be removed.

This example also illustrates that the names of patches can be listed as arguments to the script. For each patch listed on the command line the autogenerated specfile will contain a stub comment saying "INSERT PATCH DESCRIPTION HERE" and an incomplete reference to the upstream bugzilla where the bug number should be entered.

%ifarch alpha ia64 ppc64 s390x sparc64 x86_64
%global flavor gcc64pthr
%else
%global flavor gcc32pthr
%endif

Name:		globus-xio-popen-driver
%global _name %(tr - _ <<< %{name})
Version:	0.2
Release:	2%{?dist}
Summary:	Globus Toolkit - Globus XIO Pipe Open Driver

Group:		System Environment/Libraries
License:	ASL 2.0
URL:		http://www.globus.org/
#		Source is extracted from the globus toolkit installer:
#		wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#		tar -jxf gt4.2.1-all-source-installer.tar.bz2
#		mv gt4.2.1-all-source-installer/source-trees/xio/drivers/popen/source globus_xio_popen_driver-0.2
#		cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_xio_popen_driver-0.2
#		tar -zcf globus_xio_popen_driver-0.2.tar.gz globus_xio_popen_driver-0.2
Source: 	%{_name}-%{version}.tar.gz
#		### INSERT PATCH DESCRIPTION HERE ###:
#		http://bugzilla.globus.org/bugzilla/show_bug.cgi?id=###BUG NUMBER###
Patch0: 	%{name}-wrong-dep.patch
#		### INSERT PATCH DESCRIPTION HERE ###:
#		http://bugzilla.globus.org/bugzilla/show_bug.cgi?id=###BUG NUMBER###
Patch1: 	%{name}-wrong-desc.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires:	globus-common
BuildRequires:	grid-packaging-tools
BuildRequires:	globus-xio-devel

%package devel
Summary:	Globus Toolkit - Globus XIO Pipe Open Driver Development Files
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	globus-xio-devel

%description
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name} package contains:
Globus XIO Pipe Open Driver

%description devel
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name}-devel package contains:
Globus XIO Pipe Open Driver Development Files

%prep
%setup -q -n %{_name}-%{version}
%patch0 -p1
%patch1 -p1

%build
# Remove files that should be replaced during bootstrap
rm -f doxygen/Doxyfile*
rm -f doxygen/Makefile.am
rm -f pkgdata/Makefile.am
rm -f globus_automake*
rm -rf autom4te.cache

# Remove flavor tags
for f in `find . -name Makefile.am` ; do
  sed -e 's!^flavorinclude_HEADERS!include_HEADERS!' \
      -e 's!\(lib[a-zA-Z_]*\)_$(GLOBUS_FLAVOR_NAME)\.la!\1.la!g' \
      -e 's!^\(lib[a-zA-Z_]*\)___GLOBUS_FLAVOR_NAME__la_!\1_la_!' -i $f
done
sed -e "s!<With_Flavors!<With_Flavors ColocateLibraries=\"no\"!" \
  -i pkgdata/pkg_data_src.gpt.in

%{_datadir}/globus/globus-bootstrap.sh

%configure --with-flavor=%{flavor}

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages

# This library is opened using lt_dlopenext, so the libtool archives
# (.la files) can not be removed - fix the libdir...
for lib in `find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la'` ; do
  sed "s!^libdir=.*!libdir=\'%{_libdir}\'!" -i $lib
done

# Remove static libraries (.a files)
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
sed '/lib.*\.a$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist

# Generate pkg-config file from GPT metadata
mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%{_datadir}/globus/globus-gpt2pkg-config pkgdata/pkg_data_%{flavor}_dev.gpt > \
  $RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}.pc

# Install license file
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

# Generate package filelists
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist \
  | sed s!^!%{_prefix}! > package.filelist
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist \
  | sed s!^!%{_prefix}! > package-devel.filelist

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f package.filelist
%dir %{_datadir}/globus/packages/%{_name}
%dir %{_docdir}/%{name}-%{version}
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE

%files -f package-devel.filelist devel
%{_libdir}/pkgconfig/%{name}.pc

%changelog
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 0.2-2
- Autogenerated

[edit] Globus package that provides both a library and programs and that has a corresponding setup package

globus-spec-creator -g globus_common-10.2/pkgdata/pkg_data_src.gpt.in -s globus_common_setup-2.6/pkgdata/pkg_data_src.gpt.in -r 3 -d common/source

  • The -s option is used to indicate the GPT source package description file for the setup package

The patches have been excluded from this example to keep it short. For this package some additional editing is needed. Compare the autogenerated file below with the specfile in the actual package to see the differences.

%ifarch alpha ia64 ppc64 s390x sparc64 x86_64
%global flavor gcc64pthr
%else
%global flavor gcc32pthr
%endif

Name:		globus-common
%global _name %(tr - _ <<< %{name})
Version:	10.2
%global setupversion 2.6
Release:	3%{?dist}
Summary:	Globus Toolkit - Common Library

Group:		System Environment/Libraries
License:	ASL 2.0
URL:		http://www.globus.org/
#		Source is extracted from the globus toolkit installer:
#		wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#		tar -jxf gt4.2.1-all-source-installer.tar.bz2
#		mv gt4.2.1-all-source-installer/source-trees/common/source globus_common-10.2
#		cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_common-10.2
#		tar -zcf globus_common-10.2.tar.gz globus_common-10.2
Source: 	%{_name}-%{version}.tar.gz
#		Source1 is extracted from the globus toolkit installer:
#		wget -N http://www-unix.globus.org/ftppub/gt4/4.2.1/installers/src/gt4.2.1-all-source-installer.tar.bz2
#		tar -jxf gt4.2.1-all-source-installer.tar.bz2
#		mv gt4.2.1-all-source-installer/source-trees/common/setup globus_common_setup-2.6
#		cp -p gt4.2.1-all-source-installer/source-trees/core/source/GLOBUS_LICENSE globus_common_setup-2.6
#		tar -zcf globus_common_setup-2.6.tar.gz globus_common_setup-2.6
Source1:	%{_name}_setup-%{setupversion}.tar.gz
#		This is a workaround for the broken epstopdf script in RHEL5
#		See: https://bugzilla.redhat.com/show_bug.cgi?id=450388
Source9:	epstopdf-2.9.5gw
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires:	globus-libtool >= 1
BuildRequires:	grid-packaging-tools
BuildRequires:	globus-libtool-devel >= 1
BuildRequires:	globus-core >= 4
BuildRequires:	doxygen
BuildRequires:	graphviz
BuildRequires:	ghostscript
%if "%{?rhel}" == "5"
BuildRequires:	graphviz-gd
%endif
%if %{?fedora}%{!?fedora:0} >= 9
BuildRequires:	tex(latex)
%else
%if %{?rhel}%{!?rhel:0} >= 6
BuildRequires:	tex(latex)
%else
BuildRequires:	tetex-latex
%endif
%endif

%package progs
Summary:	Globus Toolkit - Common Library Programs
Group:		Applications/Internet
Provides:	%{name}-setup = %{setupversion}
Requires:	%{name} = %{version}-%{release}
Requires:	globus-libtool >= 1
Requires:	globus-common-progs >= 3
Requires:	globus-common-setup >= 2

%package devel
Summary:	Globus Toolkit - Common Library Development Files
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	globus-libtool-devel >= 1
Requires:	globus-core >= 4

%package doc
Summary:	Globus Toolkit - Common Library Documentation Files
Group:		Documentation
Requires:	%{name} = %{version}-%{release}

%description
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name} package contains:
Common Library

%description progs
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name}-progs package contains:
Common Library Programs
Common Setup

%description devel
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name}-devel package contains:
Common Library Development Files

%description doc
The Globus Toolkit is an open source software toolkit used for building Grid
systems and applications. It is being developed by the Globus Alliance and
many others all over the world. A growing number of projects and companies are
using the Globus Toolkit to unlock the potential of grids for their cause.

The %{name}-doc package contains:
Common Library Documentation Files

%prep
%setup -q -n %{_name}-%{version}
%setup -D -T -q -n %{_name}-%{version} -a 1

%if "%{rhel}" == "5"
mkdir bin
install %{SOURCE9} bin/epstopdf
%endif

%build
%if "%{rhel}" == "5"
export PATH=$PWD/bin:$PATH
%endif

# Remove files that should be replaced during bootstrap
rm -f doxygen/Doxyfile*
rm -f doxygen/Makefile.am
rm -f pkgdata/Makefile.am
rm -f globus_automake*
rm -rf autom4te.cache

# Remove flavor tags
for f in `find . -name Makefile.am` ; do
  sed -e 's!^flavorinclude_HEADERS!include_HEADERS!' \
      -e 's!\(lib[a-zA-Z_]*\)_$(GLOBUS_FLAVOR_NAME)\.la!\1.la!g' \
      -e 's!^\(lib[a-zA-Z_]*\)___GLOBUS_FLAVOR_NAME__la_!\1_la_!' -i $f
done
sed -e "s!<With_Flavors!<With_Flavors ColocateLibraries=\"no\"!" \
  -i pkgdata/pkg_data_src.gpt.in

%{_datadir}/globus/globus-bootstrap.sh

%configure --with-flavor=%{flavor} --enable-doxygen

make %{?_smp_mflags}

# setup package
cd %{_name}_setup-%{setupversion}

# Remove files that should be replaced during bootstrap
rm -f doxygen/Doxyfile*
rm -f doxygen/Makefile.am
rm -f pkgdata/Makefile.am
rm -f globus_automake*
rm -rf autom4te.cache

%{_datadir}/globus/globus-bootstrap.sh

%configure --without-flavor

make %{?_smp_mflags}

cd -

%install
%if "%{rhel}" == "5"
export PATH=$PWD/bin:$PATH
%endif

rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

# setup package
cd %{_name}_setup-%{setupversion}
make install DESTDIR=$RPM_BUILD_ROOT
cd -

# Register setup
perl -MGrid::GPT::Setup <<EOF
my \$metadata = new Grid::GPT::Setup(package_name => "%{_name}_setup",
				     globusdir => "$RPM_BUILD_ROOT%{_prefix}");
\$metadata->finish();
EOF

# Create setup files

### INSERT RELEVANT PARTS OF setup-globus-common HERE ###

GLOBUSPACKAGEDIR=$RPM_BUILD_ROOT%{_datadir}/globus/packages

# Remove libtool archives (.la files)
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.la' -exec rm -v '{}' \;
sed '/lib.*\.la$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist

# Remove static libraries (.a files)
find $RPM_BUILD_ROOT%{_libdir} -name 'lib*.a' -exec rm -v '{}' \;
sed '/lib.*\.a$/d' -i $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist

# Generate pkg-config file from GPT metadata
mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%{_datadir}/globus/globus-gpt2pkg-config pkgdata/pkg_data_%{flavor}_dev.gpt > \
  $RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}.pc

# Move documentation to default RPM location
mv $RPM_BUILD_ROOT%{_docdir}/%{_name} \
  $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
sed s!doc/%{_name}!doc/%{name}-%{version}! \
  -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist

# Remove unwanted documentation (needed for RHEL4)
rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*_%{_name}-%{version}_*.3
sed -e '/_%{_name}-%{version}_.*\.3/d' \
  -i $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist

# Install license file
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
install -m 644 -p GLOBUS_LICENSE $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

# Generate package filelists
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_rtl.filelist \
  | sed s!^!%{_prefix}! > package.filelist
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_pgm.filelist \
    $GLOBUSPACKAGEDIR/%{_name}_setup/noflavor_pgm.filelist \
  | sed s!^!%{_prefix}! > package-progs.filelist
cat $GLOBUSPACKAGEDIR/%{_name}/%{flavor}_dev.filelist \
  | sed s!^!%{_prefix}! > package-devel.filelist
cat $GLOBUSPACKAGEDIR/%{_name}/noflavor_doc.filelist \
  | sed -e 's!/man/.*!&*!' -e 's!^!%doc %{_prefix}!' > package-doc.filelist

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f package.filelist
%dir %{_datadir}/globus/packages/%{_name}
%dir %{_docdir}/%{name}-%{version}
%doc %{_docdir}/%{name}-%{version}/GLOBUS_LICENSE

%files -f package-progs.filelist progs
%dir %{_datadir}/globus/packages/%{_name}_setup
%{_datadir}/globus/packages/setup
%dir %{_datadir}/globus/setup

%files -f package-devel.filelist devel
%{_libdir}/pkgconfig/%{name}.pc

%files -f package-doc.filelist doc
%dir %{_docdir}/%{name}-%{version}/html

%changelog
* Tue May  5 2009 Mattias Ellert <mattias.ellert@fysast.uu.se> - 10.2-3
- Autogenerated