On Sat, Sep 25, 2010 at 09:47:11PM +0200, Matthias Kilian wrote:
> Use cabal and build the library on archs with ghc (i386 and amd64),
> because jasper@ wants the cpphs library.
> Put the library into a separate subpackage (hs-cpphs).
> Shorten DESCR-main (formerly DESCR).
>
> It would be nice if someone could chwck wether this still builds
> and packages correctly on an arch with nhc (my armish is currently
> busy with other stuff).
>
> Any objections?
>
> BTW: is there a reason why ports with MULTI_PACKAGES don't have
> DISTNAME in SUBST_VARS by default?
>
> Ciao,
> Kili
This builds fine with nhc98 on my landisk. OK with me.
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/cpphs/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile 17 Jul 2010 13:54:30 -0000 1.15
> +++ Makefile 25 Sep 2010 19:43:51 -0000
> @@ -1,9 +1,12 @@
> # $OpenBSD: Makefile,v 1.15 2010/07/17 13:54:30 kili Exp $
>
> -COMMENT = liberalised reimplementation of cpp in Haskell
> +COMMENT-main = liberalised reimplementation of cpp in Haskell
> +COMMENT-lib = cpphs library
>
> DISTNAME = cpphs-1.11
> -REVISION = 2
> +PKGNAME-main = ${DISTNAME}
> +PKGNAME-lib = hs-${DISTNAME}
> +REVISION-main = 3
> CATEGORIES = devel
> MAINTAINER = Matthias Kilian <[email protected]>
> HOMEPAGE = http://haskell.org/cpphs/
> @@ -15,28 +18,36 @@ PERMIT_PACKAGE_FTP = Yes
> PERMIT_DISTFILES_CDROM =Yes
> PERMIT_DISTFILES_FTP = Yes
>
> -WANTLIB += c m pthread
> +MULTI_PACKAGES = -main
> +WANTLIB-main = ${WANTLIB} c m pthread
> +
> +SUBST_VARS += DISTNAME
>
> -# Pure Haskell 98. Could also interpret via Hugs
> .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
> -WANTLIB += gmp util
> -MODULES = lang/ghc converters/libiconv
> -MODGHC_BUILD = nort
> -LIB_DEPENDS = ::devel/gmp
> -HC = ghc
> -HC_OPTS = -O -o cpphs --make
> +# GHC: use cabal to build both the executable and the library.
> +MULTI_PACKAGES += -lib
> +WANTLIB-main += gmp util
> +MODULES = lang/ghc converters/libiconv
> +MODGHC_BUILD = cabal haddock register
> +LIB_DEPENDS-main = ${LIB_DEPENDS} ::devel/gmp
> +RUN_DEPENDS-main =
> +LIB_DEPENDS-lib =
> .else
> -BUILD_DEPENDS+= ::devel/hmake \
> - ::lang/nhc98
> -HC= hmake
> -HC_OPTS= -nhc98 -package base
> -.endif
> +# NHC: use the good old makefile for now (though it *should* be possible
> +# to build with cabal, too).
> +BUILD_DEPENDS += ::devel/hmake \
> + ::lang/nhc98
> +HC = hmake
> +HC_OPTS = -nhc98 -package base
>
> do-build:
> cd ${WRKSRC} && ${HC} ${HC_OPTS} cpphs
>
> do-install:
> ${INSTALL_PROGRAM} ${WRKSRC}/cpphs ${PREFIX}/bin
> +.endif
> +
> +post-install:
> ${INSTALL_MAN} ${WRKSRC}/docs/cpphs.1 ${PREFIX}/man/man1
>
> do-regress:
> Index: pkg/DESCR
> ===================================================================
> RCS file: pkg/DESCR
> diff -N pkg/DESCR
> --- pkg/DESCR 29 Jun 2007 10:59:07 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,22 +0,0 @@
> -Rightly or wrongly, the C pre-processor is widely used in Haskell
> -source code. It enables conditional compilation for different
> -compilers, different versions of the same compiler, and different OS
> -platforms. It is also occasionally used for its macro language, which
> -can enable certain forms of platform-specific detail-filling, such as
> -the tedious boilerplate generation of instance definitions and FFI
> -declarations. However, there are two problems with cpp, aside from the
> -obvious aesthetic ones:
> -
> - * For some Haskell systems, notably Hugs on Windows, a true cpp is
> - not available by default.
> - * Even for the other Haskell systems, the common cpp provided by the
> - gcc 3.x and 4.x series has changed subtly in ways that are
> - incompatible with Haskell's syntax. There have always been
> - problems with, for instance, string gaps, and prime characters
> - in identifiers. These problems are only going to get worse.
> -
> -So, it seemed right to provide an alternative to cpp, both more
> -compatible with Haskell, and itself written in Haskell so that it
> -can be distributed with compilers. This version of the C pre-processor
> -is pretty-much feature-complete, and compatible with the -traditional
> -style.
> Index: pkg/DESCR-lib
> ===================================================================
> RCS file: pkg/DESCR-lib
> diff -N pkg/DESCR-lib
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/DESCR-lib 25 Sep 2010 19:43:51 -0000
> @@ -0,0 +1 @@
> +This library provides the functioninality of cpphs to other programs.
> Index: pkg/DESCR-main
> ===================================================================
> RCS file: pkg/DESCR-main
> diff -N pkg/DESCR-main
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/DESCR-main 25 Sep 2010 19:43:51 -0000
> @@ -0,0 +1,7 @@
> +Cpphs is a re-implementation of the C pre-processor that is both
> +more compatible with Haskell, and itself written in Haskell so that
> +it can be distributed with compilers.
> +This version of the C pre-processor is pretty-much feature-complete
> +and compatible with traditional (K&R) pre-processors. Additional
> +features include: a plain-text mode; an option to unlit literate
> +code files; and an option to turn off macro-expansion.
> Index: pkg/PLIST
> ===================================================================
> RCS file: pkg/PLIST
> diff -N pkg/PLIST
> --- pkg/PLIST 22 Apr 2010 21:51:54 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,3 +0,0 @@
> -...@comment $OpenBSD: PLIST,v 1.2 2010/04/22 21:51:54 kili Exp $
> -...@bin bin/cpphs
> -...@man man/man1/cpphs.1
> Index: pkg/PLIST-lib
> ===================================================================
> RCS file: pkg/PLIST-lib
> diff -N pkg/PLIST-lib
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/PLIST-lib 25 Sep 2010 19:43:51 -0000
> @@ -0,0 +1,43 @@
> +...@comment $OpenBSD$
> +lib/${DISTNAME}/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/HS${DISTNAME}.o
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/CppIfdef.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/HashDefine.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/MacroPass.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/Options.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/Position.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/ReadFirst.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/RunCpphs.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/SymTab.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Cpphs/Tokenise.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Language/Preprocessor/Unlit.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Text/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Text/ParserCombinators/
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/Text/ParserCombinators/HuttonMeijer.hi
> +lib/${DISTNAME}/ghc-${MODGHC_VER}/libHS${DISTNAME}.a
> +lib/${DISTNAME}/register.sh
> +...@exec /usr/bin/env HOME=/nonexistent %D/lib/${DISTNAME}/register.sh -v0
> +...@unexec /usr/bin/env HOME=/nonexistent %D/lib/${DISTNAME}/unregister.sh
> -v0 --force
> +lib/${DISTNAME}/unregister.sh
> +share/doc/${DISTNAME}/
> +share/doc/${DISTNAME}/LICENCE-LGPL
> +share/doc/${DISTNAME}/html/
> +share/doc/${DISTNAME}/html/Language-Preprocessor-Cpphs.html
> +share/doc/${DISTNAME}/html/Language-Preprocessor-Unlit.html
> +share/doc/${DISTNAME}/html/cpphs.haddock
> +share/doc/${DISTNAME}/html/doc-index.html
> +share/doc/${DISTNAME}/html/frames.html
> +share/doc/${DISTNAME}/html/haddock-util.js
> +share/doc/${DISTNAME}/html/haddock.css
> +share/doc/${DISTNAME}/html/haskell_icon.gif
> +share/doc/${DISTNAME}/html/index-frames.html
> +share/doc/${DISTNAME}/html/index.html
> +share/doc/${DISTNAME}/html/mini_Language-Preprocessor-Cpphs.html
> +share/doc/${DISTNAME}/html/mini_Language-Preprocessor-Unlit.html
> +share/doc/${DISTNAME}/html/minus.gif
> +share/doc/${DISTNAME}/html/plus.gif
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: pkg/PLIST-main
> diff -N pkg/PLIST-main
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/PLIST-main 25 Sep 2010 19:43:51 -0000
> @@ -0,0 +1,4 @@
> +...@comment $OpenBSD$
> +...@pkgpath devel/cpphs
> +...@bin bin/cpphs
> +...@man man/man1/cpphs.1
>
--
Cheers,
Jasper
Stay Hungry. Stay Foolish.