Skip to content

Commit

Permalink
Link to libclang
Browse files Browse the repository at this point in the history
  • Loading branch information
edsko committed Aug 6, 2024
1 parent 1951140 commit f4a57bd
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -165,6 +167,12 @@ jobs:
echo "package hs-bindgen" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
package hs-bindgen
extra-lib-dirs: /usr/lib/llvm-18/lib
extra-include-dirs: /usr/lib/llvm-18/include
package hs-bindgen
ghc-options: -Werror
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(hs-bindgen)$/; }' >> cabal.project.local
cat cabal.project
Expand Down
2 changes: 2 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
copy-fields: all
apt: libclang-dev
8 changes: 8 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
packages: hs-bindgen

-- TODO: <https://github.com/well-typed/hs-bindgen/issues/78>
-- 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
8 changes: 8 additions & 0 deletions cabal.project.ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
packages: hs-bindgen

-- TODO: <https://github.com/well-typed/hs-bindgen/issues/78>
-- 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
7 changes: 7 additions & 0 deletions hs-bindgen/hs-bindgen.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ library
HsBindgen.Spec
other-modules:
HsBindgen.Annotation
HsBindgen.C
HsBindgen.Clang
HsBindgen.Spec.Resolved
hs-source-dirs:
src
Expand All @@ -48,6 +50,11 @@ library
, haskell-src-meta >= 0.8 && < 0.9
, template-haskell >= 2.18 && < 2.23

-- TODO: <https://github.com/llvm/llvm-project/issues/9777>
-- It seems @libclang@ does not support @pkg-config@.
extra-libraries:
clang

executable hs-bindgen
import:
lang
Expand Down
10 changes: 10 additions & 0 deletions hs-bindgen/src/HsBindgen/C.hs
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions hs-bindgen/src/HsBindgen/Clang.hs
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f4a57bd

Please sign in to comment.