alien.libraries.finder: Linux32 ldconfig has (libc6) or (libc6,x32) as the platform strings. Refactor parsing to not use regular expressions and change the matching from exact to requiring the ldconfig line to be a subset of the supported platforms.
parent
72cbd5722c
commit
f1f76dead7
|
@ -1,32 +1,38 @@
|
||||||
! Copyright (C) 2013 Björn Lindqvist
|
! Copyright (C) 2013 Björn Lindqvist, Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
|
USING: alien.libraries alien.libraries.finder arrays assocs
|
||||||
USING: alien.libraries alien.libraries.finder assocs
|
|
||||||
combinators.short-circuit io io.encodings.utf8 io.files
|
combinators.short-circuit io io.encodings.utf8 io.files
|
||||||
io.files.info io.launcher kernel sequences splitting system ;
|
io.files.info io.launcher kernel sequences sets splitting system
|
||||||
|
unicode.categories ;
|
||||||
IN: alien.libraries.finder.linux
|
IN: alien.libraries.finder.linux
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
CONSTANT: mach-map {
|
CONSTANT: mach-map {
|
||||||
{ ppc.64 "libc6,64bit" }
|
{ ppc.64 { "libc6" "64bit" } }
|
||||||
{ x86.32 "libc6,x86-32" }
|
{ x86.32 { "libc6" "x32" } }
|
||||||
{ x86.64 "libc6,x86-64" }
|
{ x86.64 { "libc6" "x86-64" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
: ldconfig-cache ( -- seq )
|
: parse-ldconfig-lines ( string -- triple )
|
||||||
"/sbin/ldconfig -p" utf8 [ lines ] with-process-reader rest
|
[
|
||||||
[ "=>" "" replace "\t " split harvest ] map ;
|
|
||||||
|
"=>" split1 [ [ blank? ] trim ] bi@
|
||||||
|
[ " " split1 [ "()" in? ] trim "," split ] dip 3array
|
||||||
|
] map ;
|
||||||
|
|
||||||
: ldconfig-filter ( -- str )
|
: load-ldconfig-cache ( -- seq )
|
||||||
mach-map cpu of "libc6" or "(" ")" surround ;
|
"/sbin/ldconfig -p" utf8 [ lines ] with-process-reader
|
||||||
|
rest parse-ldconfig-lines ;
|
||||||
|
|
||||||
: ldconfig-matches? ( lib this-lib this-arch -- ? )
|
: ldconfig-arch ( -- str )
|
||||||
[ start 0 = ] [ ldconfig-filter = ] bi* and ;
|
mach-map cpu of { "libc6" } or ;
|
||||||
|
|
||||||
|
: ldconfig-matches? ( lib triple -- ? )
|
||||||
|
{ [ first head? ] [ nip second ldconfig-arch subset? ] } 2&& ;
|
||||||
|
|
||||||
: ldconfig-find-soname ( lib -- seq )
|
: ldconfig-find-soname ( lib -- seq )
|
||||||
ldconfig-cache [ first2 ldconfig-matches? ] with filter [ third ] map ;
|
load-ldconfig-cache [ ldconfig-matches? ] with filter [ third ] map ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue