User Tools

Site Tools


toolsetup:buildingapackagelocally

This is an old revision of the document!


Building a package locally from source using "stack"

  • in the project folder type:
    • command:
      stack unpack random-1.2.1
    • output:
      Unpacked random (from Hackage) to C:\Qsync\SwEng\GitHub\JB\SandBox\Test6\random-1.2.1\
    • command:
      cd random-1.2.1
    • command:
      stack init
    • output:
      Looking for .cabal or package.yaml files to use to init the project.
      Using cabal packages:
      - .\
      
      Selecting the best among 20 snapshots...
      
      * Matches https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/25.yaml
      
      Selected resolver: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/25.yaml
      Initialising configuration using resolver: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/25.yaml
      Total number of user packages considered: 1
      Writing configuration to file: stack.yaml
      All done.
    • command:
      stack sdist
    • output:
      Getting file list for C:\Qsync\SwEng\GitHub\JB\SandBox\Test6\random-1.2.1\
      random> List of package sources written to file
      random> 'C:\Users\Joerg\AppData\Local\Temp\stack-sdist-fede07f57c5e6536\source-files-list'
      Building sdist tarball for C:\Qsync\SwEng\GitHub\JB\SandBox\Test6\random-1.2.1\
      Wrote sdist tarball to C:\Qsync\SwEng\GitHub\JB\SandBox\Test6\random-1.2.1\.stack-work\dist\274b403a\random-1.2.1.tar.gz
      Checking package 'random' for common mistakes
      Package check reported the following warnings:
      'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer compile times on your users.
    • command:
      cd ..
  • to `stack.yaml` of main project add package (here `random-1.2.1`) to `extra-deps` section
    • extract
      .
      .
      .
      # extra-deps:
      # - acme-missiles-0.3
      # - git: https://github.com/commercialhaskell/stack.git
      #   commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
      #
      # extra-deps: []
      extra-deps:
      - random-1.2.1
      
      # Override default flag values for local packages and extra-deps
      # flags: {}
      .
      .
      .
    • command:
      stack build
    • command:
      stack build
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
You could leave a comment if you were logged in.
toolsetup/buildingapackagelocally.1644957632.txt.gz · Last modified: (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki