rpms/ghc/devel cabal-lib-template.spec, NONE, 1.1 cabal2spec, NONE, 1.1 Makefile, 1.5, 1.6 ghc-rpm-macros.ghc, 1.8, 1.9 ghc.spec, 1.60, 1.61

Jens Petersen petersen at fedoraproject.org
Tue Nov 25 02:52:40 UTC 2008


Author: petersen

Update of /cvs/extras/rpms/ghc/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12786

Modified Files:
	Makefile ghc-rpm-macros.ghc ghc.spec 
Added Files:
	cabal-lib-template.spec cabal2spec 
Log Message:
- add cabal2spec and cabal-lib-template.spec for easy Cabal library packaging
- simplify script macros: make ghc_preinst_script and ghc_postun_script no-ops
  and ghc_preun_script only unregister for uninstall




--- NEW FILE cabal-lib-template.spec ---
%define pkg_name @PACKAGE@
%define ghc_version @GHC_VERSION@

%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{pkg_name}-%{version}
%define pkg_docdir %{_docdir}/ghc/libraries/%{pkg_name}

%define build_prof 1
%define build_doc 1

# ghc does not emit debug information
%define debug_package %{nil}

Name:		ghc-%{pkg_name}
Version:	@VERSION@
Release:	1%{?dist}
Summary:	Haskell %{pkg_name} library *FIXME*

Group:		Development/Libraries
License:	BSD
URL:		http://hackage.haskell.org/cgi-bin/hackage-scripts/package/%{pkg_name}
Source0:	http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz
Provides:	%{name}-devel = %{version}-%{release}
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# ghc has only been bootstrapped on the following archs:
ExclusiveArch:	i386 x86_64 ppc
BuildRequires:	ghc = %{ghc_version}
%if %{build_prof}
BuildRequires:	ghc-prof = %{ghc_version}
%endif
Requires:	ghc = %{ghc_version}
Requires(post):	ghc = %{ghc_version}
Requires(preun): ghc = %{ghc_version}
Requires(postun): ghc = %{ghc_version}

%description
Haskell %{pkg_name} library for ghc-%{ghc_version}. *FIXME*


%if %{build_prof}
%package prof
Summary: Profiling libraries for %{name}
Group: Development/Libraries
Requires: ghc-prof = %{ghc_version}

%description prof
This package contains profiling libraries for ghc %{ghc_version}.
%endif


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


%build
%cabal_configure --ghc \
%if %{build_prof}
  -p
%else
%{nil}
%endif
%cabal_build
%if %{build_doc}
%cabal_haddock
%endif
%ghc_gen_scripts


%install
rm -rf $RPM_BUILD_ROOT
%cabal_install
%ghc_install_scripts
%ghc_gen_filelists %{name}


%clean
rm -rf $RPM_BUILD_ROOT


%post 
%ghc_postinst_script
%if %{build_doc}
%ghc_reindex_haddock
%endif


%preun 
%ghc_preun_script


%postun
if [ "$1" -eq 0 ] ; then
%if %{build_doc}
  %ghc_reindex_haddock
%endif
fi


%files -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE README
%if %{build_doc}
%{pkg_docdir}
%endif


%if %{build_prof}
%files prof -f %{name}-prof.files
%defattr(-,root,root,-)
%doc LICENSE
%endif


%changelog
* @DATE@ @PACKAGER@ <@EMAIL@> - @VERSION at -1
- initial packaging for Fedora


--- NEW FILE cabal2spec ---
#!/bin/sh

[ $# -ne 1 ] && echo "Usage: $0 lib-ver[.tar.gz]" && exit 1

INPUT=$1

case $INPUT in
    */*) INPUT=$(basename $INPUT) ;;
esac

INPUT=$(echo $INPUT | sed -e "s/.tar.gz//")

VERSION=$(echo $INPUT | sed -e "s/[A-Za-z-]*-//")

NAME=$(echo $INPUT | sed -e "s/-$VERSION//")

[ -r ghc-$NAME.spec ] && echo "ghc-$NAME.spec already exists!" && exit 1

cp /usr/share/ghc/cabal-lib-template.spec ghc-$NAME.spec

echo "created ghc-$NAME.spec"

sed -i -e "s/@PACKAGE@/$NAME/" -e "s/@GHC_VERSION@/$(ghc --numeric-version)/" -e "s/@VERSION@/$VERSION/" -e "s/@DATE@/`date +\"%a %b %e %Y\"`/" ghc-$NAME.spec


Index: Makefile
===================================================================
RCS file: /cvs/extras/rpms/ghc/devel/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Makefile	27 Sep 2006 12:34:59 -0000	1.5
+++ Makefile	25 Nov 2008 02:52:09 -0000	1.6
@@ -1,7 +1,7 @@
 # Makefile for source rpm: ghc
 # $Id$
 NAME := ghc
-SPECFILE = $(firstword $(wildcard *.spec))
+SPECFILE = $(NAME).spec
 
 define find-makefile-common
 for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done


Index: ghc-rpm-macros.ghc
===================================================================
RCS file: /cvs/extras/rpms/ghc/devel/ghc-rpm-macros.ghc,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ghc-rpm-macros.ghc	23 Oct 2008 08:31:20 -0000	1.8
+++ ghc-rpm-macros.ghc	25 Nov 2008 02:52:10 -0000	1.9
@@ -40,7 +40,6 @@
 %{nil}
 
 %ghc_preinst_script \
-[ "$1" = 2 ] && %{pkg_libdir}/unregister.sh >&/dev/null || : \
 %{nil}
 
 %ghc_postinst_script \
@@ -48,11 +47,10 @@
 %{nil}
 
 %ghc_preun_script \
-%{pkg_libdir}/unregister.sh >&/dev/null \
+[ "$1" = 0 ] && %{pkg_libdir}/unregister.sh >&/dev/null \
 %{nil}
 
 %ghc_postun_script \
-[ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || : \
 %{nil}
 
 %ghc_reindex_haddock \


Index: ghc.spec
===================================================================
RCS file: /cvs/extras/rpms/ghc/devel/ghc.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- ghc.spec	11 Nov 2008 03:48:10 -0000	1.60
+++ ghc.spec	25 Nov 2008 02:52:10 -0000	1.61
@@ -16,7 +16,7 @@
 
 Name:		ghc
 Version:	6.10.1
-Release:	4%{?dist}
+Release:	5%{?dist}
 Summary:	Glasgow Haskell Compilation system
 # See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239713
 ExcludeArch:	alpha ppc64
@@ -25,6 +25,8 @@
 Source0:	http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz2
 Source1:	http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs.tar.bz2
 Source2:	ghc-rpm-macros.ghc
+Source3:	cabal-lib-template.spec
+Source4:	cabal2spec
 URL:		http://haskell.org/ghc/
 Requires:	gcc, gmp-devel, libedit-devel
 Requires(post): policycoreutils
@@ -67,7 +69,7 @@
 Group:		Development/Languages
 Requires:	%{name} = %{version}-%{release}
 # for haddock
-Requires(post): %{name} = %{version}-%{release}
+Requires(posttrans): %{name} = %{version}-%{release}
 
 %description doc
 Preformatted documentation for the Glorious Glasgow Haskell
@@ -126,7 +128,14 @@
 # install rpm macros
 mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
 cp -p %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
-			
+
+# spec templating
+# cabal-lib-template.spec
+mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/ghc
+cp -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_datadir}/ghc/
+# cabal2spec
+install -m 0755 -p %{SOURCE4} ${RPM_BUILD_ROOT}/%{_bindir}
+
 SRC_TOP=$PWD
 rm -f rpm-*-filelist rpm-*.files
 ( cd $RPM_BUILD_ROOT
@@ -192,6 +201,7 @@
 %{_bindir}/*
 %{_sysconfdir}/rpm/macros.ghc
 %config(noreplace) %{_libdir}/ghc-%{version}/package.conf
+%{_datadir}/ghc
 
 %if %{build_prof}
 %files prof -f rpm-prof-filelist
@@ -217,6 +227,11 @@
 %endif
 
 %changelog
+* Tue Nov 25 2008 Jens Petersen <petersen at redhat.com> - 6.10.1-5
+- add cabal2spec and cabal-lib-template.spec for easy Cabal library packaging
+- simplify script macros: make ghc_preinst_script and ghc_postun_script no-ops
+  and ghc_preun_script only unregister for uninstall
+
 * Tue Nov 11 2008 Jens Petersen <petersen at redhat.com> - 6.10.1-4
 - fix broken urls to haddock docs created by gen_contents_index script
 - avoid haddock errors when upgrading by making doc post script posttrans




More information about the scm-commits mailing list