! Copyright (C) 2013 Björn Lindqvist ! See http://factorcode.org/license.txt for BSD license USING: alien.libraries alien.libraries.finder assocs combinators.short-circuit io io.encodings.utf8 io.files io.files.info io.launcher kernel sequences splitting system ; IN: alien.libraries.finder.linux " "" replace "\t " split harvest ] map ; : ldconfig-filter ( -- str ) mach-map cpu of "libc6" or "(" ")" surround ; : ldconfig-matches? ( lib this-lib this-arch -- ? ) [ start 0 = ] [ ldconfig-filter = ] bi* and ; : ldconfig-find-soname ( lib -- seq ) ldconfig-cache [ first2 ldconfig-matches? ] with filter [ first ] map ; PRIVATE> M: linux find-library "lib" ".so" surround ldconfig-find-soname [ { [ exists? ] [ file-info regular-file? ] } 1&& ] map-find nip ;