From 20a1c09a423455eca9e3c079969ffe896f31b81d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 5 Jun 2015 17:05:57 -0700 Subject: [PATCH] alien.libraries.finder: Allow library to match just by name. Related to #1099. Add some more unit tests. Fix a typo fidner->finder. --- basis/alien/libraries/finder/linux/linux-tests.factor | 9 +++++++-- basis/alien/libraries/finder/linux/linux.factor | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/basis/alien/libraries/finder/linux/linux-tests.factor b/basis/alien/libraries/finder/linux/linux-tests.factor index 416217560f..3b5bc2cb39 100644 --- a/basis/alien/libraries/finder/linux/linux-tests.factor +++ b/basis/alien/libraries/finder/linux/linux-tests.factor @@ -1,5 +1,10 @@ -USING: alien.libraries.finder sequences tools.test ; -IN: alien.libraries.fidner.linux +USING: alien.libraries.finder sequences tools.test +alien.libraries.finder.linux.private ; +IN: alien.libraries.finder.linux { t } [ "libm.so" "m" find-library subseq? ] unit-test { t } [ "libc.so" "c" find-library subseq? ] unit-test + +{ t } [ "libSDL" { "libSDL-1.2.so.0" f f } name-matches? ] unit-test +{ t } [ "libSDL-1" { "libSDL-1.2.so.0" f f } name-matches? ] unit-test +{ t } [ "libSDL-1.2" { "libSDL-1.2.so.0" f f } name-matches? ] unit-test diff --git a/basis/alien/libraries/finder/linux/linux.factor b/basis/alien/libraries/finder/linux/linux.factor index 406cb9a41e..234d688526 100644 --- a/basis/alien/libraries/finder/linux/linux.factor +++ b/basis/alien/libraries/finder/linux/linux.factor @@ -32,7 +32,7 @@ CONSTANT: mach-map { mach-map cpu of { "libc6" } or ; : name-matches? ( lib triple -- ? ) - first swap ?head [ ?first CHAR: . = ] [ drop f ] if ; + first swap ?head [ ?first ".-" member? ] [ drop f ] if ; : arch-matches? ( lib triple -- ? ) [ drop ldconfig-arch ] [ second swap subset? ] bi* ;