forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev-haskell/gtk2hs-buildtools: add support for '__builtin_offsetof (s…
…truct sigcontext, sc_gr[0])', bug #498638 Bug: https://bugs.gentoo.org/498638 Package-Manager: portage-2.2.20
- Loading branch information
Sergei Trofimovich
committed
Sep 25, 2015
1 parent
375b157
commit 62c9551
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
dev-haskell/gtk2hs-buildtools/files/gtk2hs-buildtools-0.13.0.4-ia64.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
ia64 is is a special showflake. | ||
|
||
Technically does nothing bad, | ||
but it alone uses '__builtin_offsetof (struct sigcontext' | ||
in system headers. c2hs does not handle that. | ||
|
||
https://bugs.gentoo.org/498638 | ||
diff --git a/c2hs/c/C.hs b/c2hs/c/C.hs | ||
index f79b6d9..aa1b5e4 100644 | ||
--- a/c2hs/c/C.hs | ||
+++ b/c2hs/c/C.hs | ||
@@ -1 +1,2 @@ | ||
+{-# LANGUAGE CPP, PatternGuards #-} | ||
-- C->Haskell Compiler: interface to C processing routines | ||
@@ -94,2 +95,20 @@ isuffix = ".i" | ||
|
||
+-- This stanza workarounds very specific limitation | ||
+-- of c2hs of not being able to expang __builtin_offsetof | ||
+-- used by all glib/gtk headers at least on ia64. | ||
+raw_mangle :: String -> String | ||
+raw_mangle s = case s of | ||
+ [] -> [] | ||
+#ifdef ia64_HOST_ARCH | ||
+ _ | Just (h, rest) <- chop_head "__builtin_offsetof (struct sigcontext, sc_gr[0])" | ||
+ "200" -- ia64/linux/glibc, sigh | ||
+ -> h ++ raw_mangle rest | ||
+#endif /* ia64_HOST_ARCH */ | ||
+ (h:t) -> h : raw_mangle t | ||
+ where chop_head prefix new_prefix = | ||
+ case splitAt p_len s of | ||
+ (h, t) | h == prefix -> Just (new_prefix, t) | ||
+ _ -> Nothing | ||
+ where p_len = length prefix | ||
+ | ||
-- given a file name (with suffix), parse that file as a C header and do the | ||
@@ -106,3 +124,3 @@ loadAttrC fname = do | ||
traceInfoRead fname | ||
- contents <- readFileCIO fname | ||
+ contents <- raw_mangle `fmap` readFileCIO fname | ||
|
||
@@ -126,4 +144,4 @@ loadAttrC fname = do | ||
errmsgs <- showErrors | ||
- fatal ("C header contains \ | ||
- \errors:\n\n" ++ errmsgs) -- fatal error | ||
+ fatal ("C header contains " ++ | ||
+ "errors:\n\n" ++ errmsgs) -- fatal error | ||
else do |
38 changes: 38 additions & 0 deletions
38
dev-haskell/gtk2hs-buildtools/gtk2hs-buildtools-0.13.0.4-r3.ebuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 1999-2015 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
# $Id$ | ||
|
||
EAPI=5 | ||
|
||
# ebuild generated by hackport 0.4.5.9999 | ||
|
||
CABAL_FEATURES="bin" | ||
inherit haskell-cabal | ||
|
||
DESCRIPTION="Tools to build the Gtk2Hs suite of User Interface libraries" | ||
HOMEPAGE="http://projects.haskell.org/gtk2hs/" | ||
SRC_URI="mirror://hackage/packages/archive/${PN}/${PV}/${P}.tar.gz" | ||
|
||
LICENSE="GPL-2" | ||
SLOT="0" | ||
KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86" | ||
IUSE="+closuresignals" | ||
|
||
RDEPEND="dev-haskell/random:= | ||
>=dev-lang/ghc-7.4.1:= | ||
|| ( ( >=dev-lang/ghc-7.7:= dev-haskell/hashtables:= ) <dev-lang/ghc-7.7:= ) | ||
" | ||
DEPEND="${RDEPEND} | ||
dev-haskell/alex | ||
>=dev-haskell/cabal-1.8 | ||
dev-haskell/happy | ||
" | ||
|
||
src_prepare() { | ||
epatch "${FILESDIR}"/${P}-ia64.patch | ||
} | ||
|
||
src_configure() { | ||
haskell-cabal_src_configure \ | ||
$(cabal_flag closuresignals closuresignals) | ||
} |