[alex] add fix-bang-pattern.diff patch from Debian to fix build on ppc
Jens Petersen
petersen at fedoraproject.org
Wed Jun 6 07:35:21 UTC 2012
commit 328d9747558c7f81246ffa5b0eb29370879e90af
Author: Jens Petersen <petersen at redhat.com>
Date: Wed Jun 6 16:35:12 2012 +0900
add fix-bang-pattern.diff patch from Debian to fix build on ppc
alex-ghc74-fix-bang-pattern.patch | 53 +++++++++++++++++++++++++++++++++++++
alex.spec | 9 +++++-
2 files changed, 61 insertions(+), 1 deletions(-)
---
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/alex.spec b/alex.spec
index 9607b7a..44bdc09 100644
--- a/alex.spec
+++ b/alex.spec
@@ -1,7 +1,7 @@
Name: alex
# part of haskell-platform
Version: 3.0.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A lexer generator for Haskell
Group: Development/Tools
@@ -13,6 +13,7 @@ BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-rpm-macros
BuildRequires: autoconf docbook-style-xsl libxslt
BuildRequires: ghc-QuickCheck-devel
+Patch1: alex-ghc74-fix-bang-pattern.patch
%description
Alex is a tool for generating lexical analysers in Haskell, given a
@@ -22,6 +23,9 @@ expressions. It is similar to the tool lex or flex for C/C++.
%prep
%setup -q
+%ifarch ppc
+%patch1 -p1 -b .orig
+%endif
%build
@@ -45,6 +49,9 @@ cd ..
%changelog
+* Wed Jun 6 2012 Jens Petersen <petersen at redhat.com> - 3.0.1-2
+- add fix-bang-pattern.diff patch from Debian to fix build on ppc
+
* Tue Mar 20 2012 Jens Petersen <petersen at redhat.com> - 3.0.1-1
- update to 3.0.1
- depends on QuickCheck
More information about the scm-commits
mailing list