From 5793f5b00c58c99013c056690a6b34f384ade625 Mon Sep 17 00:00:00 2001 From: "Scott P. Jones" Date: Fri, 21 May 2021 10:45:00 -0400 Subject: [PATCH] Updated to use ICU_jll (#25) --- .github/workflows/ci.yml | 2 ++ Project.toml | 6 +----- deps/.gitignore | 1 - deps/build.jl | 35 ----------------------------------- deps/versions.jl | 2 -- src/StrICU.jl | 33 +++++++-------------------------- test/runtests.jl | 2 +- 7 files changed, 11 insertions(+), 70 deletions(-) delete mode 100644 deps/.gitignore delete mode 100644 deps/build.jl delete mode 100644 deps/versions.jl diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36c5c31..9988bd9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,8 @@ jobs: exclude: - os: macOS-latest arch: x86 + - os: windows-latest + arch: x86 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/Project.toml b/Project.toml index 46f7c00..c370e31 100644 --- a/Project.toml +++ b/Project.toml @@ -7,15 +7,11 @@ uuid = "124badd8-7747-5df6-9c35-5cbf8cd52816" version = "1.1.0" [deps] -Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee" +ICU_jll = "a51ab1cf-af8e-5615-a023-bc2c838bba6b" ModuleInterfaceTools = "5cb8414e-7aab-5a03-a681-351269c074bf" StrBase = "e79e7a6a-7bb1-5a4d-9d64-da657b06f53a" # 2v12uwlr0ueale6n -WinRPM = "c17dfb99-b4f7-5aad-8812-456da1ad7187" - [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/deps/.gitignore b/deps/.gitignore deleted file mode 100644 index 839e8a5..0000000 --- a/deps/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/deps.jl diff --git a/deps/build.jl b/deps/build.jl deleted file mode 100644 index dae4969..0000000 --- a/deps/build.jl +++ /dev/null @@ -1,35 +0,0 @@ -using BinDeps - -include("versions.jl") - -const is_windows = Sys.iswindows -const is_apple = Sys.isapple - -@BinDeps.setup - -icu_aliases = ["libicuuc"] -i18n_aliases = ["libicui18n"] -@static if is_apple() - icu_aliases = ["libicucore"] - i18n_aliases = ["libicucore"] -end -@static if is_windows() - icu_aliases = ["icuuc$v" for v in versions] - i18n_aliases = [["icui18n$v" for v in versions]; - ["icuin$v" for v in versions]] -end -icu = library_dependency("icu", aliases=icu_aliases) -icui18n = library_dependency("icui18n", aliases=i18n_aliases) - -@static if is_windows() - using WinRPM - provides(WinRPM.RPM, "icu", [icu,icui18n], os=:Windows) -end -dict = Dict{String, Any}() -for v in apt_versions - push!(dict, "libicu$v" => [icu, icui18n]) -end -provides(AptGet, dict) -provides(Yum, "icu", [icu, icui18n]) - -@BinDeps.install Dict(:icu => :iculib, :icui18n => :iculibi18n) diff --git a/deps/versions.jl b/deps/versions.jl deleted file mode 100644 index 6a4cdf8..0000000 --- a/deps/versions.jl +++ /dev/null @@ -1,2 +0,0 @@ -const versions = 69:-1:52 -const apt_versions = [69, 68, 67, 66, 65, 64, 63, 62, 60, 58, 57, 55, 52] diff --git a/src/StrICU.jl b/src/StrICU.jl index bb780fd..32ebbd9 100644 --- a/src/StrICU.jl +++ b/src/StrICU.jl @@ -10,6 +10,13 @@ module StrICU using ModuleInterfaceTools +using ICU_jll + +# for now, just leave this hardcoded, until I can see how to get the version from ICU_jll +const suffix = "_68" +const iculib = ICU_jll.libicuuc +const iculibi18n = ICU_jll.libicui18n + @api extend! StrBase finalizer(o, f::Function) = Base.finalizer(f, o) @@ -30,36 +37,10 @@ const WordStrings = Str{<:WordStringCSE} export set_locale! -include("../deps/deps.jl") -include("../deps/versions.jl") - -@static if Sys.iswindows() - # make sure versions match - v1 = last(matchall(r"\d{2}", iculib)) - v2 = last(matchall(r"\d{2}", iculibi18n)) - v1 == v2 || - error("ICU library version mismatch $v1 != $v2 -- please correct $(realpath("../deps/deps.jl"))") -end - function __init__() set_locale!("") end -global version -global suffix - -dliculib = Libdl.dlopen(iculib) - -for (suf,ver) in [("",0); - [("_$i",i) for i in versions]; - [("_$(string(i)[1])_$(string(i)[2])",i) for i in versions]] - if Libdl.dlsym_e(dliculib, "u_strToUpper"*suf) != C_NULL - @eval const version = $ver - @eval const suffix = $suf - break - end -end - _libicu(s, lib, p) = ( Symbol(string(p, s, suffix)), lib ) const UBool = Int8 diff --git a/test/runtests.jl b/test/runtests.jl index dea5efb..9fff182 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using StrICU -@static ICU.V6_COMPAT ? (using Base.Test) : (using Test) +using Test # Tests for not overrunning buffer let str = "\u3b0",