User Tools

Site Tools


toolsetup:buildingapackagelocally

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
toolsetup:buildingapackagelocally [2022/02/16 10:07] f2b216toolsetup:buildingapackagelocally [2025/10/08 00:48] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~DISCUSSION~~ 
 ====== Building a package locally from source using "stack" ====== ====== Building a package locally from source using "stack" ======
  
Line 6: Line 5:
 One wants to use the original sources of a package (of the Stackage/Hackage repository), to modify it's files locally, and in order to investigate or contribute to improvement. One wants to use the original sources of a package (of the Stackage/Hackage repository), to modify it's files locally, and in order to investigate or contribute to improvement.
  
-===== Procedure =====+===== Procedures ===== 
 + 
 +We can choose out of the following two opportunities: 
 +  *     without use of tarball files 
 +  *     with use of tarball files 
 +==== Procedure without tarball files ==== 
 + 
 +  * unpack the package that should be obtained as source code 
 +    * command:<code> 
 +stack unpack random 
 +</code> 
 +    * or command with dedicated version number:<code> 
 +stack unpack random-1.2.1 
 +</code> 
 +    * output:<code> 
 +Unpacked random (from Hackage) to C:\Qsync\SwEng\GitHub\JB\SandBox\Test7\random-1.2.1\ 
 +</code> 
 + 
 +  * change the current directory 
 +    * command:<code> 
 +cd random-1.2.1 
 +</code> 
 + 
 +  * initialise the folder of the package (here `random-1.2.1`), will create file `stack.yaml` 
 +    * command:<code> 
 +stack init 
 +</code> 
 +    * output:<code> 
 +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. 
 +</code> 
 + 
 +  * change the current directory back to the main one 
 +    * command:<code> 
 +cd .. 
 +</code> 
 + 
 +  * to `stack.yaml` of main project, add package with relative path (here `./random-1.2.1`) to section `packages` !!! 
 + 
 +    * extract<code> 
 +#   - auto-update 
 +#   - wai 
 +packages: 
 +- . 
 +- ./random-1.2.1 
 + 
 +# Dependency packages to be pulled from upstream that are not in the resolver. 
 +# These entries can reference officially published versions as well as 
 +</code> 
 + 
 +  * to `package.yaml` of main project add dependency to package (here `random`) with constraint (here ` == 1.2.1`) to section `dependencies` 
 +    * extract<code> 
 +
 +
 +
 +# common to point users to the README.md file. 
 +description:         Please see the README on GitHub at <https://github.com/githubuser/Test7#readme> 
 + 
 +dependencies: 
 +- base >= 4.7 && < 5 
 +- random == 1.2.1 
 + 
 +library: 
 +  source-dirs: src 
 +
 +
 +
 +</code> 
 + 
 +  * delete cabal-file (here `Test7.cabal`), if any 
 + 
 +  * build the main project 
 +    * command:<code> 
 +stack build 
 +</code> 
 +    * output:<code> 
 +random> configure (lib) 
 +random> Configuring random-1.2.1... 
 +random> build (lib) 
 +random> Preprocessing library for random-1.2.1.. 
 +random> Building library for random-1.2.1.. 
 +random> copy/register 
 +random> Installing library in C:\Qsync\SwEng\GitHub\JB\SandBox\Test7\.stack-work\install\f1fb6c00\lib\x86_64-windows-ghc-8.10.7\random-1.2.1-HT6KBuAXK636deJWA2IfmN 
 +random> Registering library for random-1.2.1.. 
 +Building all executables for `Test7' once. After a successful build of all of them, only specified executables will be rebuilt. 
 +Test7 > configure (lib + exe) 
 +Test7 > Configuring Test7-0.1.0.0... 
 +Test7 > build (lib + exe) 
 +Test7 > Preprocessing library for Test7-0.1.0.0.. 
 +Test7 > Building library for Test7-0.1.0.0.. 
 +Test7 > [1 of 2] Compiling Lib 
 +Test7 > [2 of 2] Compiling Paths_Test7 
 +Test7 > Preprocessing executable 'Test7-exe' for Test7-0.1.0.0.. 
 +Test7 > Building executable 'Test7-exe' for Test7-0.1.0.0.. 
 +Test7 > [1 of 2] Compiling Main 
 +Test7 > [2 of 2] Compiling Paths_Test7 
 +Test7 > Linking .stack-work\dist\274b403a\build\Test7-exe\Test7-exe.exe ... 
 +Test7 > copy/register 
 +Test7 > Installing library in C:\Qsync\SwEng\GitHub\JB\SandBox\Test7\.stack-work\install\f1fb6c00\lib\x86_64-windows-ghc-8.10.7\Test7-0.1.0.0-7rSbgHQwCYG6qywGwlMXqh 
 +Test7 > Installing executable Test7-exe in C:\Qsync\SwEng\GitHub\JB\SandBox\Test7\.stack-work\install\f1fb6c00\bin 
 +Test7 > Registering library for Test7-0.1.0.0.. 
 +Completed 2 action(s). 
 +</code> 
 + 
 +==== Procedure with tarball files ====
  
   * unpack the package that should be obtained as source code   * unpack the package that should be obtained as source code
Line 144: Line 258:
 </code> </code>
  
 +
 +===== ✎ =====
 +~~DISCUSSION~~
toolsetup/buildingapackagelocally.1645002478.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