- haskell-platform
- elm-lang BuildFromSource.hs script
Recent versions of OpenBSD enforce W^X. elm-lang is one of many programs that will not run unless executed from a mount point that explicitly allows code to violate W^X. /usr/local typically has the mount privilige wxallowed. This means building elm-lang from your home directory or /usr/ports will also fail since those mount points don't have wxallowed set. There are a couple strategies for working around this problem.
- Set wxallowed on /home
- Build in /usr/local
- Build on mount point that has wxallowed set and move the resulting binaries to /usr/local/bin
The following instructions document the first approach.
Get the BuildFromSource.hs script and read
$ mkdir -p $HOME/dev/elm-lang
$ cd $HOME/dev/elm-lang
$ curl -LO https://raw.githubusercontent.com/elm-lang/elm-platform/master/installers/BuildFromSource.hs
$ less BuildFromSource.hs
$ export PATH=$PATH:$HOME/dev/elm-lang/Elm-Platform/0.18/.cabal-sandbox/bin
By default Cabal builds all objects in /tmp. Many of the packages elm-lang depends on need to execute code, which also requires wxallowed. For this to work you must add wxallowed to /tmp:
$ doas mount -uo wxallowed /tmp
If you don't want to add wxallowed to /tmp you can specify the temp dir in the environment. Ensure it has wxallowed set:
# Use WORKOBJDIR which is usually set to /usr/obj (see /etc/mk.conf)2
$ doas mount -uo wxallowed /usr/obj
$ # Build with /tmp
$ runhaskell BuildFromSource.hs 0.18
$
$ # Build with a different temp dir
$ TMPDIR=/usr/obj runhaskell BuildFromSource.hs 0.18
$ # $HOME/dev/elm-lang/Elm-Platform/0.18/.cabal-sandbox/bin
$ doas -uo wxallowed /home
- Configure your favorite editor
- Install elm-oracle for in-editor helps
- Read the elm-lang tutorial