[haskell-platform] update to 2012.2.0.0 and subpackage whole of Haskell Platform from this package
Jens Petersen
petersen at fedoraproject.org
Thu Jun 7 12:05:18 UTC 2012
commit 84c2a5f9d816c79018fa7723567fbdbef2b048ac
Author: Jens Petersen <petersen at redhat.com>
Date: Thu Jun 7 21:05:09 2012 +0900
update to 2012.2.0.0 and subpackage whole of Haskell Platform from this package
- update to 2012.2.0.0
- build the whole of haskell-platform now from this package
and subpackage like ghc's libraries
- add alex fix-bang-pattern.diff patch from Debian to fix build on ppc archs
- requires BR alex
- drop common_summary and common_description for subpackaging
- no longer need to unset debug_package
- make sure all the dynamically linked files get stripped
- needs ghc-rpm-macros 0.94 or later to build
.gitignore | 1 +
alex-ghc74-fix-bang-pattern.patch | 53 ++++++
cabal-install.sh | 8 +
ghc-GLUT-extralibs.patch | 8 +
haskell-platform.spec | 352 +++++++++++++++++++++++++++++--------
sources | 2 +-
6 files changed, 345 insertions(+), 79 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index fc66388..b8ccd67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ haskell-platform-2010.2.0.0.tar.gz
/haskell-platform-2011.2.0.0.tar.gz
/haskell-platform-2011.2.0.1.tar.gz
/haskell-platform-2011.4.0.0.tar.gz
+/haskell-platform-2012.2.0.0.tar.gz
diff --git a/alex-ghc74-fix-bang-pattern.patch b/alex-ghc74-fix-bang-pattern.patch
new file mode 100644
index 0000000..cbc5fe4
--- /dev/null
+++ b/alex-ghc74-fix-bang-pattern.patch
@@ -0,0 +1,53 @@
+# Author : Erik de Castro Lopo <erikd at mega-nerd.com>
+# Description : Fix generated haskell code so it doesn't fail with -Werror.
+# Debian Version : 2.3.5
+# Date : Sun, 17 Apr 2011 15:45:41 +1000
+
+--- a/templates/GenericTemplate.hs
++++ b/templates/GenericTemplate.hs
+@@ -9,7 +9,7 @@
+
+ #ifdef ALEX_GHC
+ #define ILIT(n) n#
+-#define FAST_INT_BINDING(n) (n)
++#define FAST_INT_BINDING(n) (!(n))
+ #define IBOX(n) (I# (n))
+ #define FAST_INT Int#
+ #define LT(n,m) (n <# m)
+@@ -57,10 +57,10 @@
+ ALEX_IF_BIGENDIAN
+ narrow16Int# i
+ where
+- i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
+- high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
+- low = int2Word# (ord# (indexCharOffAddr# arr off'))
+- off' = off *# 2#
++ !i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
++ !high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
++ !low = int2Word# (ord# (indexCharOffAddr# arr off'))
++ !off' = off *# 2#
+ ALEX_ELSE
+ indexInt16OffAddr# arr off
+ ALEX_ENDIF
+--- a/src/Scan.x
++++ b/src/Scan.x
+@@ -11,7 +11,7 @@
+ -------------------------------------------------------------------------------
+
+ {
+-{-# OPTIONS_GHC -w #-}
++{-# OPTIONS_GHC -w -XBangPatterns #-}
+
+ module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where
+
+--- a/src/Main.hs
++++ b/src/Main.hs
+@@ -203,7 +203,7 @@
+ hPutStrLn hdl code
+
+ optsToInject :: Target -> [CLIFlags] -> String
+-optsToInject GhcTarget _ = "{-# LANGUAGE CPP,MagicHash #-}\n"
++optsToInject GhcTarget _ = "{-# LANGUAGE CPP,MagicHash,BangPatterns #-}\n"
+ optsToInject _ _ = "{-# LANGUAGE CPP #-}\n"
+
+ importsToInject :: Target -> [CLIFlags] -> String
diff --git a/cabal-install.sh b/cabal-install.sh
new file mode 100644
index 0000000..fdcf006
--- /dev/null
+++ b/cabal-install.sh
@@ -0,0 +1,8 @@
+CABALBIN=${HOME}/.cabal/bin
+
+if ! echo ${PATH} | /bin/grep -q ${CABALBIN} ; then
+ if [ -d ${CABALBIN} ]; then
+ PATH=${PATH}:${CABALBIN}
+ fi
+fi
+unset CABALBIN
diff --git a/ghc-GLUT-extralibs.patch b/ghc-GLUT-extralibs.patch
new file mode 100644
index 0000000..9092408
--- /dev/null
+++ b/ghc-GLUT-extralibs.patch
@@ -0,0 +1,8 @@
+diff -u GLUT-2.1.1.2/GLUT.cabal\~ GLUT-2.1.1.2/GLUT.cabal
+--- GLUT-2.1.1.2/GLUT.cabal~ 2008-06-19 21:39:19.000000000 +1000
++++ GLUT-2.1.1.2/GLUT.cabal 2010-06-10 18:03:20.000000000 +1000
+@@ -58,3 +58,4 @@
+ build-depends: base < 3
+ build-depends: OpenGL >= 2.2
+ extensions: CPP, ForeignFunctionInterface
++ extra-libraries: glut
diff --git a/haskell-platform.spec b/haskell-platform.spec
index a8c4580..57fffd8 100644
--- a/haskell-platform.spec
+++ b/haskell-platform.spec
@@ -1,118 +1,314 @@
-# cabal2spec-0.25.2
+# cabal2spec-0.25
# https://fedoraproject.org/wiki/Packaging:Haskell
# https://fedoraproject.org/wiki/PackagingDrafts/Haskell
-%global pkg_name haskell-platform
-
-%global common_summary Standard Haskell distribution
-
-%global common_description Haskell Platform is a suite of stable and well used Haskell libraries\
-and tools. It provides a good starting environment for Haskell development.
-
-%define without_haddock 1
-%define ghc_without_shared 1
-
-# ghci (ghc library) is not officially part of hackage-platform
-%define platform_progs()\
-%{?1}Requires: ghc-compiler = 7.4.1\
-%{?1}Requires: cabal-install = 0.14.0\
-%{?1}Requires: alex = 3.0.1\
-%{?1}Requires: happy = 1.18.9\
-%{nil}
-
-%define platform_libs()\
-%{?1}Requires: ghc-libraries = 7.4.1\
-%{?1}Requires: ghc-cgi-devel = 3001.1.7.4\
-%{?1}Requires: ghc-fgl-devel = 5.4.2.4\
-%{?1}Requires: ghc-GLUT-devel = 2.1.2.1\
-%{?1}Requires: ghc-haskell-src-devel = 1.0.1.5\
-%{?1}Requires: ghc-html-devel = 1.0.1.2\
-%{?1}Requires: ghc-HTTP-devel = 4000.2.2\
-%{?1}Requires: ghc-HUnit-devel = 1.2.4.2\
-%{?1}Requires: ghc-mtl-devel = 2.0.1.0\
-%{?1}Requires: ghc-network-devel = 2.3.0.11\
-%{?1}Requires: ghc-OpenGL-devel = 2.2.3.1\
-%{?1}Requires: ghc-parallel-devel = 3.2.0.2\
-%{?1}Requires: ghc-parsec-devel = 3.1.2\
-%{?1}Requires: ghc-QuickCheck-devel = 2.4.2\
-%{?1}Requires: ghc-random-devel = 1.0.1.1\
-%{?1}Requires: ghc-regex-base-devel = 0.93.2\
-%{?1}Requires: ghc-regex-compat-devel = 0.95.1\
-%{?1}Requires: ghc-regex-posix-devel = 0.95.1\
-%{?1}Requires: ghc-stm-devel = 2.2.0.1\
-%{?1}Requires: ghc-syb-devel = 0.3.6\
-%{?1}Requires: ghc-text-devel = 0.11.1.13\
-%{?1}Requires: ghc-transformers-devel = 0.2.2.0\
-%{?1}Requires: ghc-xhtml-devel = 3000.2.0.5\
-%{?1}Requires: ghc-zlib-devel = 0.5.3.3\
-%{nil}
-
-%global upstream_version 2011.4.0.0
-%global debug_package %{nil}
-
-Name: %{pkg_name}
-Version: 2011.4.0.741
-Release: 2%{?dist}
+%global ghc_compiler_version 7.4.1
+%global alex_version 3.0.1
+%global cabal_install_version 0.14.0
+%global happy_version 1.18.9
+
+Name: haskell-platform
+Version: 2012.2.0.0
+# Since library subpackages are versioned:
+# - release can only be reset if all library versions get bumped simultaneously
+# (eg for a major release)
+# - minor release numbers should be incremented monotonically
+Release: 15%{?dist}
Summary: Standard Haskell distribution
Group: Development/Tools
License: BSD
# BEGIN cabal2spec
URL: http://hackage.haskell.org/platform
-Source0: http://lambda.haskell.org/platform/download/%{upstream_version}/%{name}-%{upstream_version}.tar.gz
+Source0: http://lambda.haskell.org/platform/download/%{version}/%{name}-%{version}.tar.gz
ExclusiveArch: %{ghc_arches}
BuildRequires: ghc-Cabal-devel
-BuildRequires: ghc-rpm-macros %{!?without_hscolour:hscolour}
+BuildRequires: ghc-rpm-macros >= 0.94, %{!?without_hscolour:hscolour}
# END cabal2spec
-%platform_progs Build
-%platform_libs Build
-%platform_progs
-Requires: ghc-haskell-platform-devel = %{version}
+BuildRequires: ghc-compiler = %{ghc_compiler_version}
+# GLUT
+BuildRequires: freeglut-devel%{?_isa}
+# OpenGL
+BuildRequires: mesa-libGL-devel%{?_isa},mesa-libGLU-devel%{?_isa}
+# QuickCheck
+BuildRequires: ghc-extensible-exceptions-prof
+%ifarch %{ghc_arches_with_ghci}
+BuildRequires: ghc-template-haskell-prof
+%endif
+# haskell-src
+BuildRequires: ghc-haskell98-prof
+# parallel, text
+BuildRequires: ghc-deepseq-prof
+# random
+BuildRequires: ghc-time-devel
+# regex-base, text
+BuildRequires: ghc-bytestring-prof
+# zlib
+BuildRequires: zlib-devel%{?_isa}
+# "ghci" library is not officially part of hackage-platform
+Requires: ghc-compiler = %{ghc_compiler_version}
+Requires: alex = %{alex_version}-%{release}
+Requires: cabal-install = %{cabal_install_version}-%{release}
+Requires: happy = %{happy_version}-%{release}
+Requires: ghc-haskell-platform-devel = %{version}-%{release}
+Patch1: ghc-GLUT-extralibs.patch
+Patch2: alex-ghc74-fix-bang-pattern.patch
%description
-%{common_description}
+Haskell Platform is a suite of stable and well used Haskell libraries
+and tools. It provides a good starting environment for Haskell development.
-%global top_prefix packages/%{name}-%{upstream_version}
+%global BSDHaskellReport BSD%{space}and%{space}HaskellReport
+
+%global haskell_platform_version %{version}
+
+%if %{defined ghclibdir}
+%ghc_lib_subpackage -c freeglut-devel%{?_isa} GLUT 2.1.2.1
+%ghc_lib_subpackage HTTP 4000.2.3
+%ghc_lib_subpackage HUnit 1.2.4.2
+%ghc_lib_subpackage -c mesa-libGL-devel%{?_isa},mesa-libGLU-devel%{?_isa} OpenGL 2.2.3.1
+%ghc_lib_subpackage QuickCheck 2.4.2
+%ghc_lib_subpackage cgi 3001.1.7.4
+%ghc_lib_subpackage fgl 5.4.2.4
+%ghc_lib_subpackage haskell-src 1.0.1.5
+%ghc_lib_subpackage html 1.0.1.2
+%ghc_lib_subpackage mtl 2.1.1
+%ghc_lib_subpackage network 2.3.0.13
+%ghc_lib_subpackage parallel 3.2.0.2
+%ghc_lib_subpackage parsec 3.1.2
+%ghc_lib_subpackage -l %BSDHaskellReport random 1.0.1.1
+%ghc_lib_subpackage regex-base 0.93.2
+%ghc_lib_subpackage regex-compat 0.95.1
+%ghc_lib_subpackage regex-posix 0.95.1
+%ghc_lib_subpackage stm 2.3
+%ghc_lib_subpackage syb 0.3.6.1
+%ghc_lib_subpackage text 0.11.2.0
+%ghc_lib_subpackage transformers 0.3.0.0
+%ghc_lib_subpackage xhtml 3000.2.1
+%ghc_lib_subpackage -c zlib-devel%{?_isa} zlib 0.5.3.3
+%endif
+
+%package -n alex
+Version: %{alex_version}
+Summary: Lexer generator for Haskell
+Group: Development/Tools
+License: BSD
+URL: http://hackage.haskell.org/package/alex
+BuildRequires: autoconf docbook-style-xsl libxslt
+%ifarch ppc ppc64
+# for the BangPatterns patch
+BuildRequires: alex
+%endif
+
+%description -n alex
+Alex is a tool for generating lexical analysers in Haskell from a
+description of the tokens to be recognised in the form of regular
+expressions. It is similar to the tool lex or flex for C/C++.
+
+
+%package -n cabal-install
+Version: %{cabal_install_version}
+Summary: Haskell package tool
+Group: Development/Tools
+License: BSD
+URL: http://hackage.haskell.org/package/%{name}
+Source1: cabal-install.sh
+Requires: ghc-compiler
-%prep
-%setup -q -n %{name}-%{upstream_version}
+%description -n cabal-install
+The 'cabal' command-line program simplifies the process of managing Haskell
+packages by automating fetching, configuration, compilation and
+installation of Haskell libraries and programs from Hackage.
-%build
-#cd %{top_prefix}
-#%%ghc_lib_build
+%package -n happy
+Version: %{happy_version}
+Summary: LALR(1) Parser Generator for Haskell
+License: BSD
+Group: Development/Tools
+URL: http://hackage.haskell.org/package/happy
+BuildRequires: autoconf, docbook-dtds, docbook-style-xsl, libxslt, libxml2
+%description -n happy
+Happy is a parser generator system for Haskell, similar to the tool
+`yacc' for C. Like `yacc', it takes a file containing an annotated BNF
+specification of a grammar and produces a Haskell module containing a
+parser for the grammar.
-%install
-#TOPDIR=$(pwd)
-#cd %{top_prefix}
-#%%ghc_lib_install
+Happy is flexible: you can have several Happy parsers in the same
+program, and several entry points to a single grammar. Happy can work
+in conjunction with a lexical analyser supplied by the user (either
+hand-written or generated by another program).
-#mv ghc-%{name}-devel.files $TOPDIR
-touch ghc-%{name}-devel.files
+
+%global version %{haskell_platform_version}
# devel subpackage
-%ghc_devel_package
-%platform_libs
+%ghc_devel_package haskell-platform %{version}
+%{?ghc_packages_list:Requires: %(echo %{ghc_packages_list} | sed -e "s/\([^ ]*\)-\([^ ]*\)/ghc-\1-devel = \2-%{release},/g")}
+Requires: ghc-libraries = %{ghc_compiler_version}
# added in F17 devel cycle
-Obsoletes: ghc-%{name} < %{version}-%{release}
+Obsoletes: ghc-haskell-platform < %{version}-%{release}
+
+%description -n ghc-haskell-platform-devel
+Haskell Platform is a suite of stable and well used Haskell libraries
+and tools. It provides a good starting environment for Haskell development.
+
-%ghc_devel_description
+%prep
+%setup -q -n %{name}-%{version}
+cd packages/GLUT-*
+%patch1 -p1 -b .orig
-%ghc_devel_post_postun
+%ifarch ppc ppc64
+cd ../alex-%{alex_version}
+%patch2 -p1 -b .orig
+%endif
+
+cd ../..
+
+
+%build
+HOME=$PWD
+PATH=$HOME/.cabal/bin:$PATH
+#%%define cabal_configure_options --global "--package-db=../../packages/package.conf.inplace" "--ghc-pkg-option=--package-conf=../../packages/package.conf.inplace"
+#%%define cabal_configure_options --package-conf=../package.conf.d
+%define cabal_configure_options --user
+
+cd packages
+for i in $(cat platform.packages); do
+name=$(echo $i | sed -e "s/\(.*\)-.*/\1/")
+ver=$(echo $i | sed -e "s/.*-\(.*\)/\1/")
+cd $name-$ver
+case $name in
+alex|cabal-install|happy)
+%ghc_bin_build
+;;
+# ghc-7.4.1 haddock breaks on GLUT
+GLUT)
+%ghc_lib_build_without_haddock $name $ver
+./Setup register --inplace
+;;
+haskell-platform)
+cabal_configure_extra_options="--with-cabal-install=../cabal-install-%{cabal_install_version}/dist/build/cabal/cabal --with-happy=../happy-%{happy_version}/dist/build/happy/happy --with-alex=../alex-%{alex_version}/dist/build/alex/alex"
+%ghc_lib_build_without_haddock $name $ver
+cabal_configure_extra_options=
+;;
+*)
+%ghc_lib_build $name $ver
+./Setup register --inplace
+;;
+esac
+cd ..
+done
+
+# build alex documentation
+for i in alex-%{alex_version} happy-%{happy_version}; do
+cd $i/doc
+autoreconf
+%configure
+make html
+cd ../..
+done
+
+%install
+HOME=$PWD
+PATH=$HOME/.cabal/bin:$PATH
+
+cd packages
+
+for i in $(cat platform.packages); do
+name=$(echo $i | sed -e "s/\(.*\)-.*/\1/")
+ver=$(echo $i | sed -e "s/.*-\(.*\)/\1/")
+cd $name-$ver
+case $name in
+alex|cabal-install|happy)
+%ghc_bin_install $name $ver
+;;
+*)
+%ghc_lib_install $name $ver
+echo "%doc packages/$name-$ver/LICENSE" >> ghc-$name%{?ghc_without_shared:-devel}.files
+;;
+esac
+cd ..
+done
+
+cd cabal-install-%{cabal_install_version}
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
+cp -p bash-completion/cabal $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
+install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
+cd ..
+
+%ghc_strip_dynlinked
+
+# HUnit
+rm %{buildroot}%{_bindir}/*-tests
+rm -r %{buildroot}%{_datadir}/HUnit-*
+
+# haskell-platform
+mv %{buildroot}%{_docdir}/ghc-haskell-platform{,-devel}-%{version}
+
+mv */*.files ..
+cd ..
+
+
+%ghc_devel_post_postun haskell-platform %{version}
%files
-%doc %{top_prefix}/LICENSE
+%doc packages/%{name}-%{version}/LICENSE
+
+
+%files -n alex
+%doc packages/alex-%{alex_version}/ANNOUNCE
+%doc packages/alex-%{alex_version}/LICENSE
+%doc packages/alex-%{alex_version}/README
+%doc packages/alex-%{alex_version}/TODO
+#%doc packages/alex-%{alex_version}/doc/alex
+%doc packages/alex-%{alex_version}/examples
+%{_bindir}/alex
+%{_datadir}/alex-%{alex_version}
-%ghc_files %{top_prefix}/LICENSE
+%files -n cabal-install
+%doc packages/cabal-install-%{cabal_install_version}/LICENSE
+%doc packages/cabal-install-%{cabal_install_version}/README
+%{_bindir}/cabal
+%{_sysconfdir}/bash_completion.d
+%{_sysconfdir}/profile.d/cabal-install.sh
+
+
+%files -n ghc-haskell-platform-devel -f ghc-haskell-platform-devel.files
+%doc packages/haskell-platform-%{version}/LICENSE
+
+
+%files -n happy
+%doc packages/happy-%{happy_version}/ANNOUNCE
+%doc packages/happy-%{happy_version}/CHANGES
+%doc packages/happy-%{happy_version}/LICENSE
+%doc packages/happy-%{happy_version}/README
+%doc packages/happy-%{happy_version}/TODO
+%doc packages/happy-%{happy_version}/doc/happy
+%{_bindir}/happy
+%{_datadir}/happy-%{happy_version}
%changelog
+* Thu Jun 7 2012 Jens Petersen <petersen at redhat.com> - 2012.2.0.0-15
+- update to 2012.2.0.0
+- build the whole of haskell-platform now from this package
+ and subpackage like ghc's libraries
+- add alex fix-bang-pattern.diff patch from Debian to fix build on ppc archs
+ - requires BR alex
+- drop common_summary and common_description for subpackaging
+- no longer need to unset debug_package
+- make sure all the dynamically linked files get stripped
+- needs ghc-rpm-macros 0.94 or later
+
* Wed May 9 2012 Jens Petersen <petersen at redhat.com> - 2011.4.0.741-2
- update cabal-install to 0.14.0
diff --git a/sources b/sources
index 442c86c..f17ba01 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-0880f0943f55bc06962e7827e19ac71f haskell-platform-2011.4.0.0.tar.gz
+db09bc4279c0ef9e0beb5462b793413b haskell-platform-2012.2.0.0.tar.gz
More information about the scm-commits
mailing list