From 3beee228bbab8fee737eb26bedc52669958427d6 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 11 Jan 2024 11:19:58 -0600 Subject: [PATCH] libclang.ffi: find the latest llvm- dir on unix --- extra/libclang/ffi/ffi.factor | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/extra/libclang/ffi/ffi.factor b/extra/libclang/ffi/ffi.factor index 8dc86de4f4..48668ddbf7 100644 --- a/extra/libclang/ffi/ffi.factor +++ b/extra/libclang/ffi/ffi.factor @@ -1,15 +1,23 @@ ! Copyright (C) 2023 Doug Coleman. ! See https://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.libraries alien.syntax -classes.struct combinators kernel system ; +classes.struct combinators io.directories io.pathnames kernel +sequences sorting.human system ; IN: libclang.ffi LIBRARY: clang +<< +: latest-libclang ( -- path/f ) + "/usr/lib/" qualified-directory-files + [ file-name "llvm-" head? ] filter + human-sort ?first ; +>> + << "clang" { { [ os windows? ] [ "libclang.dll" ] } { [ os macosx? ] [ "/Library/Developer/CommandLineTools/usr/lib/libclang.dylib" ] } - { [ os unix? ] [ "/usr/lib/llvm-10/lib/libclang.so" ] } + { [ os unix? ] [ latest-libclang "lib/libclang.so" append-path ] } } cond cdecl add-library >> CONSTANT: UINT_MAX 4294967295 -- 2.34.1