diff --git a/ats-setup.cabal b/ats-setup.cabal
--- a/ats-setup.cabal
+++ b/ats-setup.cabal
@@ -1,5 +1,5 @@
 name:                ats-setup
-version:             0.2.0.1
+version:             0.3.0.0
 synopsis:            ATS scripts for Cabal builds
 description:         This package contains various scripts that go in a package's @Setup.hs@ to make building libraries with ATS dependencies easier.
 license:             BSD3
@@ -21,6 +21,7 @@
 library
   hs-source-dirs:      src
   exposed-modules:     Distribution.ATS
+  other-modules:       Distribution.ATS.Compiler
   build-depends:       base >= 4.8 && < 5
                      , Cabal >= 2.0
                      , directory
@@ -29,6 +30,12 @@
                      , tar
                      , http-client
                      , parallel-io
+                     , process
+                     , bytestring
+                     , directory
+                     , filemanip
+                     , dependency
+                     , unix
   default-language:    Haskell2010
   if flag(development)
     ghc-options:       -Werror
diff --git a/src/Distribution/ATS.hs b/src/Distribution/ATS.hs
--- a/src/Distribution/ATS.hs
+++ b/src/Distribution/ATS.hs
@@ -11,6 +11,10 @@
                         , intinf
                         , atsPrelude
                         , atsContrib
+                        -- * Functions involving the compiler
+                        , fetchCompiler
+                        , setupCompiler
+                        , packageCompiler
                         ) where
 
 import qualified Codec.Archive.Tar                    as Tar
@@ -19,6 +23,7 @@
 import           Control.Monad
 import           Data.Bool
 import           Data.List                            (intercalate)
+import           Distribution.ATS.Compiler
 import           Distribution.PackageDescription
 import           Distribution.Simple
 import           Distribution.Simple.LocalBuildInfo
diff --git a/src/Distribution/ATS/Compiler.hs b/src/Distribution/ATS/Compiler.hs
new file mode 100644
--- /dev/null
+++ b/src/Distribution/ATS/Compiler.hs
@@ -0,0 +1,70 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+-- | This module contains scripts to fetch the compiler.
+module Distribution.ATS.Compiler
+    ( packageCompiler
+    , fetchCompiler
+    , setupCompiler
+    ) where
+
+import qualified Codec.Archive.Tar       as Tar
+import           Codec.Compression.GZip  (compress, decompress)
+import           Control.Monad           (void, when)
+import qualified Data.ByteString.Lazy    as BS
+import           Data.Dependency
+import           Data.Maybe              (fromMaybe)
+import           Network.HTTP.Client     hiding (decompress)
+import           Network.HTTP.Client.TLS (tlsManagerSettings)
+import           System.Directory
+import           System.Environment      (getEnv)
+import           System.FilePath.Find    (find)
+import           System.Posix.Files
+import           System.Process
+
+compilerDir :: Maybe FilePath -> Version -> IO FilePath
+compilerDir mp v = fromMaybe <$> def <*> pure mp
+    where def = (++ ("/.atspkg/" ++ show v)) <$> getEnv "HOME"
+
+packageCompiler :: FilePath -> IO ()
+packageCompiler directory = do
+    files <- find (pure True) (pure True) directory
+    bytes <- fmap Tar.write . Tar.pack directory $ fmap (drop $ length (directory :: String) + 1) files
+    BS.writeFile (directory ++ ".tar.gz") (compress bytes)
+
+pkgUrl :: Version -> String
+pkgUrl v = "https://github.com/vmchale/atspkg/raw/master/pkgs/ATS2-Postiats-" ++ show v ++ ".tar.gz"
+
+withCompiler :: String -> Version -> IO ()
+withCompiler s v = putStrLn $ s ++ " compiler v" ++ show v ++ "..."
+
+fetchCompiler :: Maybe FilePath -> Version -> IO ()
+fetchCompiler mp v = do
+
+    cd <- compilerDir mp v
+    needsSetup <- not <$> doesDirectoryExist cd
+
+    when needsSetup $ do
+
+        withCompiler "Fetching" v
+        manager <- newManager tlsManagerSettings
+        initialRequest <- parseRequest $ pkgUrl v
+        response <- responseBody <$> httpLbs (initialRequest { method = "GET" }) manager
+
+        withCompiler "Unpacking" v
+        Tar.unpack cd . Tar.read . decompress $ response
+
+setupCompiler :: Maybe FilePath -> Version -> IO ()
+setupCompiler mp v = do
+
+    withCompiler "Configuring" v
+    cd <- compilerDir mp v
+    let configurePath = cd ++ "/configure"
+    setFileMode configurePath ownerModes
+    setFileMode (cd ++ "/autogen.sh") ownerModes
+    void $ readCreateProcess ((proc (cd ++ "/autogen.sh") []) { cwd = Just cd }) ""
+    void $ readCreateProcess ((proc configurePath ["--prefix", cd]) { cwd = Just cd }) ""
+
+    withCompiler "Building" v
+    void $ readCreateProcess ((proc "make" []) { cwd = Just cd, std_err = CreatePipe }) ""
+    withCompiler "Installing" v
+    void $ readCreateProcess ((proc "make" ["install"]) { cwd = Just cd, std_err = CreatePipe }) ""
