1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/bin/bash
# This script downloads a specific release of PCRE2, extracts it and copies
# the necessary files to $dest. The actual compilation of PCRE2 happens in
# build.rs. Note that a new release of PCRE2 may require more changes than
# simply updating the version. Namely, we exhaustively enumerate the files that
# need to be copied below. This way, we only vendor into source control what is
# actually necessary for building PCRE2.
pcre2_sys_dir="$(dirname "$0")"
cd "$pcre2_sys_dir"
dest="upstream"
version="10.43"
dir="pcre2-$version"
archive="$dir.tar.gz"
url="https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$version/$archive"
work="tmp/updates/pcre2-$version"
mkdir -p "$work"
curl -L "$url" > "$work/$archive"
(cd "$work" && tar xf "$archive")
upstream="$work/$dir"
rm -rf "$dest"/{src,include}
mkdir -p "$dest"/{src,include}
needed=(
pcre2_auto_possess.c
pcre2_chkdint.c
pcre2_compile.c
pcre2_config.c
pcre2_context.c
pcre2_convert.c
pcre2_dfa_match.c
pcre2_error.c
pcre2_extuni.c
pcre2_find_bracket.c
pcre2_jit_compile.c
pcre2_jit_match.c
pcre2_jit_misc.c
pcre2_maketables.c
pcre2_match.c
pcre2_match_data.c
pcre2_newline.c
pcre2_ord2utf.c
pcre2_pattern_info.c
pcre2_script_run.c
pcre2_serialize.c
pcre2_string_utils.c
pcre2_study.c
pcre2_substitute.c
pcre2_substring.c
pcre2_tables.c
pcre2_ucd.c
pcre2_ucptables.c
pcre2_valid_utf.c
pcre2_xclass.c
pcre2_internal.h
pcre2_intmodedep.h
pcre2_jit_neon_inc.h
pcre2_jit_simd_inc.h
pcre2posix.h
pcre2_ucp.h
)
for name in "${needed[@]}"; do
cp "$upstream/src/$name" "$dest/src/"
done
cp "$upstream/src/pcre2_chartables.c.dist" "$dest/src/pcre2_chartables.c"
cp -a "$upstream/src/sljit" "$dest/src/"
cp "$upstream/src/config.h.generic" "$dest/include/config.h"
cp "$upstream/src/pcre2.h.generic" "$dest/include/pcre2.h"
|