Skip to content

Commit

Permalink
Updated to use ICU_jll (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones authored May 21, 2021
1 parent efa214f commit 5793f5b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion deps/.gitignore

This file was deleted.

35 changes: 0 additions & 35 deletions deps/build.jl

This file was deleted.

2 changes: 0 additions & 2 deletions deps/versions.jl

This file was deleted.

33 changes: 7 additions & 26 deletions src/StrICU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 5793f5b

Please sign in to comment.