diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 48551f0a..3b34618b 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -64,6 +64,8 @@ jobs: chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + apt-get update + apt-get install -y libclang-dev env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -165,6 +167,12 @@ jobs: echo "package hs-bindgen" >> cabal.project echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local cat cabal.project diff --git a/cabal.haskell-ci b/cabal.haskell-ci new file mode 100644 index 00000000..bca84b5f --- /dev/null +++ b/cabal.haskell-ci @@ -0,0 +1,2 @@ +copy-fields: all +apt: libclang-dev diff --git a/cabal.project b/cabal.project index e8522a6f..4ba5f021 100644 --- a/cabal.project +++ b/cabal.project @@ -1 +1,9 @@ packages: hs-bindgen + +-- TODO: +-- We should instead /discover/ where @libclang@ is. +package hs-bindgen + extra-lib-dirs: + /usr/lib/llvm-18/lib + extra-include-dirs: + /usr/lib/llvm-18/include diff --git a/cabal.project.ci b/cabal.project.ci index dfca401c..6b0743fb 100644 --- a/cabal.project.ci +++ b/cabal.project.ci @@ -1,4 +1,12 @@ packages: hs-bindgen +-- TODO: +-- We should instead /discover/ where @libclang@ is. +package hs-bindgen + extra-lib-dirs: + /usr/lib/llvm-14/lib + extra-include-dirs: + /usr/lib/llvm-14/include + package hs-bindgen ghc-options: -Werror diff --git a/hs-bindgen/hs-bindgen.cabal b/hs-bindgen/hs-bindgen.cabal index 03f19c6d..95139dcd 100644 --- a/hs-bindgen/hs-bindgen.cabal +++ b/hs-bindgen/hs-bindgen.cabal @@ -40,6 +40,8 @@ library HsBindgen.Spec other-modules: HsBindgen.Annotation + HsBindgen.C + HsBindgen.Clang HsBindgen.Spec.Resolved hs-source-dirs: src @@ -48,6 +50,11 @@ library , haskell-src-meta >= 0.8 && < 0.9 , template-haskell >= 2.18 && < 2.23 + -- TODO: + -- It seems @libclang@ does not support @pkg-config@. + extra-libraries: + clang + executable hs-bindgen import: lang diff --git a/hs-bindgen/src/HsBindgen/C.hs b/hs-bindgen/src/HsBindgen/C.hs new file mode 100644 index 00000000..963b4609 --- /dev/null +++ b/hs-bindgen/src/HsBindgen/C.hs @@ -0,0 +1,10 @@ +-- | Abstract syntax tree for C headers +-- +-- The goal of this module is not to be a complete representation of the full +-- C AST, but rather to include only the information that is relevant to us. +-- +-- Intended for qualified import. +-- +-- > import HsBindgen.C qualfified as C +module HsBindgen.C ( + ) where diff --git a/hs-bindgen/src/HsBindgen/Clang.hs b/hs-bindgen/src/HsBindgen/Clang.hs new file mode 100644 index 00000000..c4a6a09e --- /dev/null +++ b/hs-bindgen/src/HsBindgen/Clang.hs @@ -0,0 +1,10 @@ +-- | Bindings to @libclang@ +-- +-- The goal of this module is not to be a complete set of bindings for all of +-- @libclang@, but rather only to the parts that we need. +-- +-- Intended for qualified import. +-- +-- > import Hsbindgen.Clang qualified as Clang +module HsBindgen.Clang ( + ) where