Reputation: 53906
This my setup.cabal file :
-- Initial SparkSetup.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: SparkSetup
version: 0.1.0.0
-- synopsis:
-- description:
-- license:
license-file: LICENSE
author: user
maintainer: user
-- copyright:
-- category:
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
executable SparkSetup
-- main-is:
-- other-modules:
-- other-extensions:
build-depends: base >=4.7 && <4.8
-- hs-source-dirs:
default-language: Haskell2010
When run cabal build
this generates a SparkSetup.exe file in dist folder which can be executed directly. Is there something similar of Linux ? Can a .sh file be generated which will package the Haskell code to be executed on Linux ?
Update : I'm on Windows and want to cross compile for Linux / Unix
Upvotes: 1
Views: 143
Reputation: 12700
If you want to distribute something binary that works with minimum hassle almost everywhere and is super-easy to install, you can always use Docker. Also, check stack, they seem to provide quite good support for this type of things.
Upvotes: 0
Reputation: 25782
Building a single binary file that works across all common distributions is a challenging task at best. People like Joey Hess managed to pull that through, but it is generally not recommended.
One option is to upload your code to hackage, instruct your users to install the Haskell Platform (which, if you stay compatible with older releases of GHC, is as easy as running apt-get install haskell-platform
on Debian-based distributions) and then run cabal install SparkSetup
.
In order to make sure your package builds with a variety of compilers, you can use Herbert’s excellent travis setup, at least as long as your code is on GitHub.
Upvotes: 2