diff --git a/packages/clangml/clangml.4.7.0/opam b/packages/clangml/clangml.4.7.0/opam index 00e151ee7bd..8a512ac1603 100644 --- a/packages/clangml/clangml.4.7.0/opam +++ b/packages/clangml/clangml.4.7.0/opam @@ -11,7 +11,7 @@ homepage: "https://github.com/thierry-martinez/clangml/" doc: "https://github.com/thierry-martinez/clangml/blob/v4.7.0/README.md" bug-reports: "https://github.com/thierry-martinez/clangml/issues" depends: [ - "conf-libclang" + "conf-libclang" {<= "14"} "conf-ncurses" "conf-zlib" "dune" {>= "1.11.0"} diff --git a/packages/clangml/clangml.4.8.0/opam b/packages/clangml/clangml.4.8.0/opam new file mode 100644 index 00000000000..f47bda3cff2 --- /dev/null +++ b/packages/clangml/clangml.4.8.0/opam @@ -0,0 +1,40 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "OCaml bindings for Clang API" +description: """ +clangml provides bindings to call the Clang API from OCaml. +""" +maintainer: ["Thierry Martinez "] +authors: ["Thierry Martinez "] +license: "BSD-2-Clause" +homepage: "https://github.com/thierry-martinez/clangml/" +doc: "https://github.com/thierry-martinez/clangml/blob/v4.8.0/README.md" +bug-reports: "https://github.com/thierry-martinez/clangml/issues" +depends: [ + "conf-libclang" {<= "15"} + "conf-ncurses" + "conf-zlib" + "dune" {>= "3.0"} + "stdcompat" {>= "19"} + "ocaml" {>= "4.08.0"} + "ocamlfind" {build & >= "1.8.0"} + "ocamlcodoc" {with-test & >= "1.0.1"} + "pattern" {with-test & >= "0.2.0"} + "ppxlib" {>= "0.23"} + "metapp" {>= "0.4.4"} + "metaquot" {>= "0.4.0"} + "refl" {>= "0.4.0"} + "ppxlib" {>= "0.23"} + "odoc" {with-doc & >= "1.5.1"} + "ocaml-migrate-parsetree" {>= "2.2.0"} +] +dev-repo: "git+https://github.com/thierry-martinez/clangml.git" +build: [ + ["./configure" "--prefix=%{prefix}%" "--with-llvm-config=%{conf-libclang:config}%"] + ["./build_with_bigger_stack_size.sh" "dune" "build" "-p" name "-j" jobs "@install" + "@runtest" {with-test} + "@doc" {with-doc}]] +url { + src: "https://github.com/thierry-martinez/clangml/releases/download/v4.8.0/clangml.4.8.0.tar.gz" + checksum: "sha512=493f3693b445268a589c98315d918d0633bd2e76eba34067023d502b10957c1f6bbce3b0c1799c81e06eb3ec6f16158cbafb964228fdb3e303aa74cd57c125b1" +} diff --git a/packages/conf-libclang/conf-libclang.15/files/configure.sh b/packages/conf-libclang/conf-libclang.15/files/configure.sh new file mode 100644 index 00000000000..1a1f8bb29ab --- /dev/null +++ b/packages/conf-libclang/conf-libclang.15/files/configure.sh @@ -0,0 +1,125 @@ +#!/bin/bash -ex + +clean_tempdir () { + rm -f "$tempdir/test_libclang.c" "$tempdir/test_libclang.o" \ + "$tempdir/test_libclang" + rmdir "$tempdir" +} + +maximum_version=15 + +shopt -s nullglob +for version in default $(seq $maximum_version -1 3); do + if [ "$version" = default ]; then + for kind in system brew none; do + case $kind in + system) + llvm_config=$(command -v llvm-config) || continue + ;; + brew) + llvm_config="$(brew --prefix)/opt/llvm/bin/llvm-config" || continue + ;; + none) + continue + ;; + esac + llvm_version="$($llvm_config --version)" || continue + next_version=$((maximum_version + 1)) + if [\ + $(printf "${llvm_version%%.*}\n$next_version" | sort -n | head -n1)\ + = $next_version ]; then + continue + fi + break + done + else + if hash brew 2>/dev/null; then + brew_llvm_config="$(brew --cellar llvm)"/${version}*/bin/llvm-config + fi + for llvm_config in \ + llvm-config-${version} llvm-config-${version}.0 \ + llvm-config${version}0 llvm-config${version} \ + llvm-config-${version}-32 llvm-config-${version}-64 \ + llvm-config-mp-$version \ + llvm-config-mp-${version}.0 $brew_llvm_config \ + /usr/lib64/llvm/${version}/bin/llvm-config \ + /usr/lib/llvm/${version}/bin/llvm-config; do + llvm_version="$($llvm_config --version)" || continue + break + done + if [ -z "$llvm_version" ]; then + continue + fi + fi + + LLVM_CFLAGS="$($llvm_config --cflags)" + LLVM_LDFLAGS="$($llvm_config --ldflags)" + LLVM_LIBDIR="$($llvm_config --libdir)" + + # These filters enable compilation with gcc. + # Filter -Wstring-conversion for OpenSUSE + LLVM_CFLAGS="$(echo $LLVM_CFLAGS | sed 's/-Wstring-conversion //')" + + # Filter -Werror=unguarded-availability-new and -Wcovered-switch-default + # (which appear with LLVM 7) + LLVM_CFLAGS="$(echo $LLVM_CFLAGS | sed 's/-Werror=unguarded-availability-new //')" + LLVM_CFLAGS="$(echo $LLVM_CFLAGS | sed 's/-Wcovered-switch-default //')" + + # Filter "-Wdelete-non-virtual-dtor" (warning only) + LLVM_CFLAGS="$(echo $LLVM_CFLAGS | sed 's/-Wdelete-non-virtual-dtor //')" + + tempdir="$(mktemp -d)" + cat >"$tempdir/test_libclang.c" < +#include + +int +main(int argc, char *argv[]) +{ + CXIndex idx = clang_createIndex(1, 1); + clang_disposeIndex(idx); + return EXIT_SUCCESS; +} +EOF + + CC=cc + if "$CC" -o "$tempdir/test_libclang.o" -c $LLVM_CFLAGS \ + "$tempdir/test_libclang.c" && + "$CC" -o "$tempdir/test_libclang" \ + $LLVM_LDFLAGS "$tempdir/test_libclang.o" \ + "-lclang" "-Wl,-rpath,$LLVM_LIBDIR" && + "$tempdir/test_libclang"; then + true + else + clean_tempdir + continue + fi + + clean_tempdir + checksum= + for hasher in \ + "sha512:sha512sum" \ + "sha512:shasum -a 512" \ + "md5:md5sum" \ + "md5:md5 -q"; do + hasher_output=$(${hasher#*:} "$llvm_config") || continue + checksum="${hasher%%:*}=${hasher_output%% *}" + break + done + if [ -z "$checksum" ]; then + echo "Error: Unable to find a hasher" + exit 1 + fi + cat >"conf-libclang.config" <" +authors: "The LLVM team" +homepage: "http://llvm.org" +bug-reports: "https://llvm.org/bugs/" +license: "MIT" +build: [ + ["bash" "-ex" "configure.sh" version] +] +depexts: [ + ["llvm"] {os = "macos"} + ["llvm" "clang"] {os-distribution = "arch"} + ["libclang-dev" "llvm-dev"] {os-family = "debian"} + ["clang-dev" "llvm-dev" "clang-static"] {os-distribution = "alpine"} + ["clang-devel" "llvm-devel" "llvm-static" "zlib-devel"] + {os-distribution = "centos"} + ["clang-devel" "llvm-devel" "zlib-devel" "redhat-rpm-config"] + {os-distribution = "fedora"} + ["clang-devel" "llvm-devel" "llvm-static" "zlib-devel"] + {os-distribution = "ol" & os-version >= "8"} + ["llvm-clang-devel"] {os-family = "suse"} + ["devel/llvm14"] {os = "freebsd"} + ["sys-devel/clang"] {os-distribution = "gentoo"} +] +x-ci-accept-failures: [ + "oraclelinux-7" # clang-devel is not available + "alpine-3.13" # unavailable system package 'llvm-dev' + "alpine-3.14" # unavailable system package 'llvm-dev' + "opensuse-15.3" # unavailable system package 'llvm-clang-devel' +] +extra-files: [[ + "configure.sh" "sha512=495b1915a845c75033449e8a86b35e399320a50d63cee959f5685dedb085c5efc2a27d5c2672c90c38444a5af4edd212cf2e23bb2b34aaedc5cf271073dce087" +]] +synopsis: "Virtual package relying on the installation of llvm and clang libraries (<= 15.0.x)" +flags: conf