Skip to content

Commit 81ac8d8

Browse files
committed
WIP add script to build custom GHC and workflow. Link directly in build.rs
1 parent 8280992 commit 81ac8d8

File tree

4 files changed

+449
-218
lines changed

4 files changed

+449
-218
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build ghc with statically linked libraries
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
ghcVersion:
6+
description: Specify the version of GHC to build
7+
required: true
8+
jobs:
9+
build-ghc:
10+
name: Build ghc for linux x64
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
- name: Run the build script
16+
run: ./scripts/build-static-ghc.sh ${{ github.event.inputs.ghcVersion }} ${{ runner.temp }}
17+
- name: Upload artifacts
18+
uses: actions/upload-artifact@v6
19+
with:
20+
name: ghc
21+
if-no-files-found: error
22+
compression-level: 0 # no compression since this is already compressed
23+
path: |
24+
${{ runner.temp }}/ghc-${{ github.event.inputs.ghcVersion }}/_build/bindist/ghc-${{ github.event.inputs.ghcVersion }}-x86_64-unknown-linux.tar.xz
25+
upload:
26+
name: Upload to S3
27+
runs-on: ubuntu-latest
28+
environment: s3-push
29+
steps:
30+
- name: Setup AWS CLI
31+
uses: aws-actions/configure-aws-credentials@v1
32+
with:
33+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
aws-region: us-east-1
36+
- name: Download artifacts
37+
uses: actions/download-artifact@v7
38+
with:
39+
name: ghc
40+
- name: Upload to S3
41+
run: |
42+
aws s3 cp ghc/ghc-${{ github.event.inputs.ghcVersion }}-x86_64-unknown-linux.tar.xz s3://static-libraries.concordium.com/ --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers

concordium-consensus/stack.static.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
resolver: lts-24.0
22

3+
# To be able to produce a statically linked shared library, we need to use a ghc
4+
# and libraries variant compiled with Position Independent Code (PIC) enabled.
5+
# Such a build is not provided by default, so instead we use a custom build.
6+
#
7+
# See `/scripts/build-static-ghc.sh` for how to do this.
8+
ghc-variant: static-build
9+
setup-info:
10+
ghc:
11+
linux64-custom-static-build-tinfo6:
12+
9.10.2:
13+
url: "/home/lime/Concordium/concordium-node/ghc2/ghc-9.10.2/_build/bindist/ghc-9.10.2-x86_64-unknown-linux.tar.xz"
14+
# "https://s3-eu-west-1.amazonaws.com/static-libraries.concordium.com/ghc-9.10.2-fpic-gmp-x86_64-unknown-linux-gnu.tar.gz"
15+
# sha256: 07d347a6d28bd818fde1a5b9d5ae79fcca63e225
16+
317
packages:
418
- .
519
- haskell-lmdb
@@ -14,3 +28,7 @@ extra-lib-dirs:
1428
ghc-options:
1529
# `simpl-tick-factor` parameter here is necessary due to a bug in the ghc: https://gitlab.haskell.org/ghc/ghc/-/issues/14637#note_413425
1630
"$everything": -fPIC -fsimpl-tick-factor=10000
31+
32+
flags:
33+
concordium-consensus:
34+
dynamic: false

0 commit comments

Comments
 (0)