@@ -14,22 +14,38 @@ NB. =========================================================
1414NB. pcre2 library is in bin or tools/regex
15153 : 0' '
1616select. UNAME
17- case. ' Win' do. t=. ' jpcre2.dll'
18- case. ' Darwin' do. t=. ' libjpcre2.dylib'
1917case. ' Android' do. pcre2dll=: ' libjpcre2.so' return.
20- case. do. t=. ' libjpcre2.so'
18+ case. ' Darwin' do. t0=. ' libpcre2' [ ext=. ' .dylib' [ arch=. ' '
19+ case. ' Win' do. t0=. ' pcre2' [ ext=. ' .dll' [ arch=. ((-. IF64)#< ' -32' ), ((' arm64' -: 9 !: 56 ' cpu' )#< ' -a64' )
20+ case. do.
21+ t0=. ' libpcre2' [ ext=. ' .so'
22+ if. IFRASPI do.
23+ arch=. ((-. IF64)#< ' -32' )
24+ else.
25+ arch=. ((-. IF64)#< ' -32' ), ((' arm64' -: 9 !: 56 ' cpu' )#< ' -a64' )
26+ end.
2127end.
2228
23- f=. BINPATH, ' /' , t
24- if. 0 = 1 !: 4 :: 0: < f do.
25- f=. jpath ' ~tools/regex/' , t
29+ found=. 0
30+ for_ar. arch do.
31+ if. 1 = ftype f=. BINPATH, ' /' , t0, (> ar), ext do.
32+ found=. 1 break.
33+ elseif. 1 = ftype f=. jpath ' ~tools/regex/' , t0, (> ar), ext do.
34+ found=. 1 break.
35+ end.
36+ end.
37+
38+ if. -. found do.
39+ if. 1 = ftype f=. BINPATH, ' /' , t0, ext do.
40+ found=. 1
41+ elseif. 1 = ftype f=. jpath ' ~tools/regex/' , t0, ext do.
42+ found=. 1
43+ end.
2644end.
2745
2846NB. fall back one more time
29- if. IFUNIX *. 0 = 1 !: 4 :: 0: < f do.
30- f=. unxlib ' pcre2'
31- elseif. 0 = 1 !: 4 :: 0: < f do.
32- f=. t
47+ if. -. found do.
48+ if. IFUNIX do. f=. unxlib ' pcre2' else. f=. t0, ext end.
3349end.
3450
3551pcre2dll=: f
0 commit comments