Import C->Haskell (c2hs)

C->Haskell is an interface generator that simplifies the development
of Haskell bindings to C libraries.  The tool processes existing C
header files that determine data layout and function signatures on the
C side, in conjunction with Haskell modules that specify Haskell-side
type signatures and marshaling details. Hooks embedded in the Haskell
code signal access to C structures and functions; they are expanded by
the interfacing tool in conjunction with information in the
corresponding C header file. 

ok pvalchev@
This commit is contained in:
dons 2004-05-08 07:21:03 +00:00
parent b03acb5bea
commit d1011d2804
10 changed files with 166 additions and 0 deletions

35
devel/c2hs/Makefile Normal file
View File

@ -0,0 +1,35 @@
# $OpenBSD: Makefile,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
# $FreeBSD: ports/devel/hs-c2hs/Makefile,v 1.20 2004/03/25 08:29:28 obraun Exp $
COMMENT= "interface generator for Haskell to C bindings"
V= 0.12.0
DISTNAME= c2hs-${V}
CATEGORIES= devel
MAINTAINER= Don Stewart <dons@openbsd.org>
HOMEPAGE= http://www.cse.unsw.edu.au/~chak/haskell/c2hs/
MASTER_SITES= ${HOMEPAGE}
MODULES= ghc
USE_GMAKE= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= --prefix=${PREFIX}
post-build:
@(cd ${WRKSRC}/doc/c2hs && ${MAKE_PROGRAM} man1/c2hs-config.1 man1/c2hs.1)
post-install:
@(cd ${WRKSRC}/doc/c2hs/man1 && \
${INSTALL_MAN} c2hs-config.1 c2hs.1 ${PREFIX}/man/man1)
do-regress:
@(cd ${WRKDIST}/c2hs/tests && ${MAKE_PROGRAM})
# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
.include <bsd.port.mk>

3
devel/c2hs/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (c2hs-0.12.0.tar.gz) = 32327d4c531648bdace8c90d5c52b825
RMD160 (c2hs-0.12.0.tar.gz) = 0d6e3b73de03c4f52356d482ff8234fdc84aa545
SHA1 (c2hs-0.12.0.tar.gz) = 6b4aac0294585a7a0a28dee82d0d1f8d732399dd

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-c2hs_c2hs_conf_in,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
Better package.conf.in. lang => haskell98
--- c2hs/c2hs.conf.in.orig 2002-02-13 15:49:06.000000000 +1100
+++ c2hs/c2hs.conf.in 2004-05-08 14:17:22.000000000 +1000
@@ -1,16 +1,14 @@
-[
Package {
name = "c2hs",
- import_dirs = ["@LIBDIR@/c2hs-@C2HS_VERSION@/@SYS@/import"],
+ import_dirs = ["${PREFIX}/lib/c2hs/imports"],
source_dirs = [],
- library_dirs = ["@LIBDIR@/c2hs-@C2HS_VERSION@/@SYS@"],
+ library_dirs = ["${PREFIX}/lib/c2hs"],
hs_libraries = ["c2hs"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
- package_deps = ["lang"],
+ package_deps = ["haskell98"],
extra_ghc_opts = ["-fglasgow-exts"],
extra_cc_opts = [],
extra_ld_opts = []
}
-]

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-c2hs_c_CAttrs_hs,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
Extra comma
--- c2hs/c/CAttrs.hs.orig 2004-05-06 16:27:44.000000000 +1000
+++ c2hs/c/CAttrs.hs 2004-05-06 16:27:54.000000000 +1000
@@ -144,7 +144,7 @@ leaveRangeC ac = ac {
--
leaveObjRangeC :: AttrC -> AttrC
leaveObjRangeC ac = ac {
- defObjsAC = fst . leaveRange . defObjsAC $ ac,
+ defObjsAC = fst . leaveRange . defObjsAC $ ac
}
-- add another definitions to the object name space (EXPORTED)

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-c2hs_lib_Makefile,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
Fix 'start-of-word' regex. \< looks like a linux-ism
--- c2hs/lib/Makefile.orig 2004-05-06 17:10:10.000000000 +1000
+++ c2hs/lib/Makefile 2004-05-06 17:10:19.000000000 +1000
@@ -77,7 +77,7 @@ depend:
ifeq ($(LEGACY_FFI),no)
$(GREP) -v -e CError -e CForeign -e CString\
-e ForeignPtr -e MarshalAlloc -e MarshalArray\
- -e MarshalError -e MarshalUtils -e "\<Ptr" .depend\
+ -e MarshalError -e MarshalUtils -e "[[:<:]]Ptr" .depend\
>.depend.new
$(MV) .depend.new .depend
# mkdependHS is a bit stupid here and does include files if present even if

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-c2hs_tests_Makefile,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
Broken test, and non-portable test
--- c2hs/tests/Makefile.orig 2003-10-19 20:43:21.000000000 +1000
+++ c2hs/tests/Makefile 2004-05-08 15:26:07.000000000 +1000
@@ -46,7 +46,7 @@ cpp: Cpp.chs cpp.h
.PHONY: tests simple.run calls.build enums.run pointer.run structs.run\
marsh.run cpp.build
-tests: simple.run calls.build enums.run pointer.run structs.run marsh.run\
+tests: simple.run calls.build pointer.run marsh.run\
cpp.build
simple.run: simple

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-mk_config_mk_in,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
Canonical install directory
--- mk/config.mk.in.orig 2004-05-08 13:27:43.000000000 +1000
+++ mk/config.mk.in 2004-05-08 13:28:09.000000000 +1000
@@ -72,10 +72,10 @@ DESTDIR =
# the $(PACKAGE) variable is set by the toplevel Makefile in each compiler
# package
#
-pkgdatadir = $(datadir)/$(PACKAGE)-$(PCKVERSION)
-pkgdocdir = $(docdir)/$(PACKAGE)-$(PCKVERSION)
-pkglibdir = $(libdir)/$(PACKAGE)-$(PCKVERSION)/$(SYS)
-pkgimportdir = $(pkglibdir)/import
+pkgdatadir = $(datadir)/$(PACKAGE)
+pkgdocdir = $(docdir)/$(PACKAGE)
+pkglibdir = $(libdir)/$(PACKAGE)
+pkgimportdir = $(pkglibdir)/imports
# Haskell compiler: for details in the supported systems check

9
devel/c2hs/pkg/DESCR Normal file
View File

@ -0,0 +1,9 @@
C->Haskell is an interface generator that simplifies the development
of Haskell bindings to C libraries. The tool processes existing C
header files that determine data layout and function signatures on the
C side, in conjunction with Haskell modules that specify Haskell-side
type signatures and marshaling details. Hooks embedded in the Haskell
code signal access to C structures and functions; they are expanded by
the interfacing tool in conjunction with information in the
corresponding C header file. A noteworthy property is the lightweight
nature of the approach.

7
devel/c2hs/pkg/MESSAGE Normal file
View File

@ -0,0 +1,7 @@
------------------------------------------------------------------------
To link against the c2hs library components, add:
-package c2hs
to the GHC command line
------------------------------------------------------------------------

20
devel/c2hs/pkg/PLIST Normal file
View File

@ -0,0 +1,20 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2004/05/08 07:21:03 dons Exp $
bin/c2hs
bin/c2hs-config
lib/c2hs/c2hs.conf
lib/c2hs/imports/C2HS.hi
lib/c2hs/imports/C2HSBase.hi
lib/c2hs/imports/C2HSDeprecated.hi
lib/c2hs/imports/C2HSMarsh.hi
lib/c2hs/imports/NewStablePtr.hi
lib/c2hs/imports/NewStorable.hi
lib/c2hs/libc2hs.a
man/man1/c2hs-config.1
man/man1/c2hs.1
@dirrm lib/c2hs/imports
@dirrm lib/c2hs
@comment call ghc-pkg to register/unregister this library with ghc
@exec cat %D/lib/c2hs/c2hs.conf | /usr/bin/env PREFIX=%D %D/bin/ghc-pkg -u
@exec /bin/rm -f %D/lib/ghc-6.2.1/package.conf.old
@unexec %D/bin/ghc-pkg -r c2hs
@unexec /bin/rm -f %D/lib/ghc-6.2.1/package.conf.old