1 USING: alien.libraries.finder arrays assocs
2 combinators.short-circuit io io.encodings.utf8 io.files
3 io.files.info io.launcher kernel sequences sets splitting system
5 IN: alien.libraries.finder.freebsd
8 : parse-ldconfig-lines ( string -- triple )
9 [ ":-" split1 [ drop ] dip
10 "=>" split1 [ [ blank? ] trim ] bi@
14 : load-ldconfig-cache ( -- seq )
15 "/sbin/ldconfig -r" utf8 [ read-lines ] with-process-reader
16 rest parse-ldconfig-lines ;
18 : name-matches? ( lib double -- ? )
19 first swap ?head [ ?first CHAR: . = ] [ drop f ] if ;
23 M: freebsd find-library*
24 "l" prepend load-ldconfig-cache
25 [ name-matches? ] with find nip ?first dup [ ".so" append ] when ;