[Haskell-cafe] announcing franchise 0.0
droundy at darcs.net
Fri Apr 18 11:37:06 EDT 2008
I'm pleased to announce the existence (not release, properly) of
franchise, a new configuration/build system for Haskell programs and
Franchise is a configuration and build system for Haskell projects. The
configure system employed in franchise is designed to be easily forward and
backward compatible, meaning that you shouldn't need to change your
Setup.hs file in order to compile with a new version of ghc, and if you
*do* need to make a change in your Setup.hs file, it shouldn't force users
who have an older version of franchise and/or ghc to upgrade either their
compiler or their copy of franchise. The latter goal is really only going
to be realized if and when a stable version of franchise is released... as
it is currently is something of a pre-alpha state (but useable, for
instance, for compiling darcs).
One goal of franchise is to not require developers to provide redundant
information. For instance, you've already listed all the modules you use,
and ghc already knows which modules are present in which packages, so
there's in general no need for you to list the packages that you require,
much less their versions. This enhances both forwards and backwards
compatibility, and just plain makes your life easier. If a particular
module is provided by more than one package, you may need to disambiguate,
but that's not the common case.
Perhaps also worth mentioning is that franchise supports parallel builds
similar to make -j. Currently the number of simultaneous builds is fixed
at four. Franchise does not, however, compute an optimized parallel build
order, with the result that on the darcs repository a franchise build is a
few percent slower than make -j4.
Franchise is currently ghc-specific and won't run on Windows, but patches
to extend either of these limitations would be welcome. It also currently
won't work when any flags contain space characters (e.g. with
--prefix="/home/user/My stuff"), but the fix for lack of space support is
the same as the fix for Windows support, so far as I can tell.
The package name "franchise" stands for "Fun, relaxing and calming Haskell
into Saturday evening." It is also something of an antonym of "cabal,"
since "franchise" means the right to vote. Which also fits in with the
concept of allowing the code to decide on its own dependencies. Franchise
is made up of some pretty ugly code, with a small amount of pretty
beautiful code. But it was all code that was fun and relaxing to write.
It you want to have argumentative, stressful conversations, please don't do
so on the subject of fun, relaxing and calming code.
Note: franchise is almost entirely undocumented. It does only export a
couple of dozen functions, but still might be hard to learn to use. This
is because writing documentation is not as fun, relaxing or calming as
writing Haskell. Also, franchise is not yet at the stage where it's likely
to be useful to you without any features added, unless you've got a very
simple project, in which case you should be able to pretty easily copy and
modify an existing franchise Setup.hs file.
To get franchise, run
darcs get http://darcs.net/repos/franchise
(note that this will require darcs 2.0.0)
To build and install franchise, simply execute
runghc Setup.hs install --user --prefix=$HOME
if you don't want to actually install it, just run
runghc Setup.hs build
I think that's all (and obviously, in no particular order). I hope you
enjoy franchise, or if you don't enjoy franchise, I hope you don't tell me
P.S. A franchise build file for darcs is included below. This is a
work-in-progress. It doesn't build the documentation, doesn't allow the
user to configure on the command-line which packages they want to use
(e.g. bytestring/curl/libwww) and doesn't build the Workaround.hs module
which codes replacements for missing or broken library functions. But it
*is* able to build darcs, and if these features are added, it will be able
to replace darcs' configure and build system without loss of features or
configure = do findPackagesFor "src/darcs.lhs"
addEnv "GHC_FLAGS" "-DPACKAGE_VERSION=\"2.0.0\""
addEnv "GHC_FLAGS" "-O2 -Wall -Werror"
addEnv "CFLAGS" "-DPACKAGE_VERSION=\"2.0.0\""
-- look for libz
checkLib "z" "zlib.h" "gzopen(\"temp\",\"w\")"
-- look for libwww
do systemOut "libwww-config" ["--cflags"] >>= addEnv "CFLAGS"
systemOut "libwww-config" ["--libs"] >>= addEnv "LDFLAGS"
addEnv "GHC_FLAGS" "-DHAVE_LIBWWW"
putStrLn "Found libwww"
`catch` \_ -> putStrLn "Libwww isn't present!"
-- look for libcurl
do systemOut "curl-config" ["--cflags"] >>= addEnv "GHC_FLAGS"
systemOut "curl-config" ["--cflags"] >>= addEnv "CFLAGS"
systemOut "curl-config" ["--libs"] >>= addEnv "LDFLAGS"
addEnv "GHC_FLAGS" "-DHAVE_CURL"
putStrLn "Found libcurl"
`catch` \_ -> putStrLn "Libcurl isn't present!"
-- look for libcurses
do checkLib "curses" "term.h" "tgetnum(\"hello world\")"
checkLib "curses" "curses.h" ""
addEnv "GHC_FLAGS" "-DHAVE_CURSES"
`catch` \_ -> putStrLn "Couldn't find libcurses."
-- look for http packages
do requireModule "Network.HTTP ()"
addEnv "GHC_FLAGS" "-DHAVE_HTTP"
`catch` \_ -> putStrLn "Couldn't find http package."
main = build configure $
executable "darcs" "src/darcs.lhs" ["src/c_compat.c",
Department of Physics
Oregon State University
More information about the Haskell-Cafe