Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
---
kind: pipeline
name: linux - arm64 - Julia 1.5
name: linux - arm64 - Julia 1.10

platform:
os: linux
arch: arm64

steps:
- name: build
image: julia:1.5
image: julia:1.10
commands:
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"

---
kind: pipeline
name: linux - arm - Julia 1.6
name: linux - arm - Julia 1.13

platform:
os: linux
arch: arm

steps:
- name: build
image: julia:1.6
image: julia:1.13
commands:
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"

---
kind: pipeline
name: linux - arm64 - Julia 1.6
name: linux - arm64 - Julia 1.13

platform:
os: linux
arch: arm64

steps:
- name: build
image: julia:1.6
image: julia:1.13
commands:
- "julia --project=. --check-bounds=yes --color=yes -e 'using InteractiveUtils; versioninfo(verbose=true); using Pkg; Pkg.build(); Pkg.test(coverage=true)'"
35 changes: 14 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,27 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.7'
- '1.10'
- '1'
- 'nightly'
os:
arch:
- x64
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v3
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: actions/cache@v4
- uses: julia-actions/cache@v3
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v7
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords = ["Strings", "PCRE", "Regex"]
license = "MIT"
name = "PCRE2"
uuid = "c9310f65-a42c-5928-aca3-d34f64192029"
version = "1.1.0"
version = "1.2.0"

[deps]
PCRE2_jll = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ The `PCRE2` package implements a low-level API for accessing the PCRE libraries
It was intended to replace `Base.PCRE` which was not threadsafe, as well as missing non-UTF-8 support.

`Base.PCRE` still only supports UTF-8, which is why this is needed for the Strs package.
It is my intention to change this to use the libraries now created by the BinaryBuilder.
It is my intention to change this to use the libraries now created by the BinaryBuilder.

As a backup, if it can't get the libraries from BinaryBuilder, it will look for the libpcre2
libraries in /usr/local/lib (on MacOS and Linux), so a "brew install pcre2" should work to get
those installed correctly.
20 changes: 15 additions & 5 deletions src/PCRE2.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#=
Low-level wrapper for PCRE2 library

Copyright 2018,2022 Gandalf Software, Inc., Scott P. Jones, and contributors to pcre.jl and pcre2.h
Copyright 2018,2022,2026 Gandalf Software, Inc., Scott P. Jones, and contributors to pcre.jl and pcre2.h
(Based in part on julia/base/pcre.jl, and on pcre2.h (copyright University of Cambridge))
Licensed under MIT License, see LICENSE.md
=#
Expand Down Expand Up @@ -34,15 +34,25 @@ else
const libpcre2_32 = "libpcre2-32.so.0"
end

function tryopen(file)
handle = C_NULL
try
handle = Libdl.dlopen(file)
catch
# try to deal with case where only the 8-bit PCRE2 library is available
handle = Libdl.dlopen(joinpath("/usr/local/lib", file))
end
handle
end


function __init__()
global libpcre2_16_handle = Libdl.dlopen(libpcre2_16)
global libpcre2_16_handle = tryopen(libpcre2_16)
global libpcre2_16_path = Libdl.dlpath(libpcre2_16_handle)
global libpcre2_32_handle = Libdl.dlopen(libpcre2_32)
global libpcre2_32_handle = tryopen(libpcre2_32)
global libpcre2_32_path = Libdl.dlpath(libpcre2_32_handle)
end

# ??? get_libpcre2_8_path() = libpcre2_8_path

const CodeUnitTypes = Union{UInt8, UInt16, UInt32}

import Base.GC: @preserve
Expand Down