Skip to content

Commit

Permalink
SERVER-65275 Add dependency on PCRE2 library
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferpeshansky authored and Evergreen Agent committed Apr 25, 2022
1 parent af74666 commit f9c7dc1
Show file tree
Hide file tree
Showing 83 changed files with 112,308 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.third_party.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ a notice will be included in
| Name | License | Vendored Version | Emits persisted data | Distributed in Release Binaries |
| ---------------------------| ----------------- | ------------------| :------------------: | :-----------------------------: |
| [abseil-cpp] | Apache-2.0 | 20210324.1 | ||
| Aladdin MD5 | Zlib | Unknown |||
| [Aladdin MD5] | Zlib | Unknown |||
| [ASIO] | BSL-1.0 | b0926b61b0 | ||
| [benchmark] | Apache-2.0 | 1.5.2 | | |
| [Boost] | BSL-1.0 | 1.76.0 | ||
Expand All @@ -40,6 +40,7 @@ a notice will be included in
| [ocspresponder] | Apache-2.0 | 0.5.0 | | |
| [peglib] | MIT | 0.1.12 | ||
| [Pcre] | BSD-3-Clause | 8.42 | ||
| [pcre2] | BSD-3-Clause | 10.39 | ||
| [S2] | Apache-2.0 | Unknown |||
| [SafeInt] | MIT | 3.0.26 | | |
| [schemastore.org] | Apache-2.0 | 6847cfc3a1 | | |
Expand Down Expand Up @@ -74,6 +75,7 @@ a notice will be included in
[ocspresponder]: https://github.com/threema-ch/ocspresponder
[peglib]: https://github.com/yhirose/cpp-peglib
[Pcre]: http:https://www.pcre.org/
[pcre2]: http:https://www.pcre.org/
[S2]: https://github.com/google/s2geometry
[SafeInt]: https://github.com/dcleblanc/SafeInt
[schemastore.org]: https://www.schemastore.org/json/
Expand Down
6 changes: 6 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ for pack in [
('intel_decimal128', 'intel decimal128'),
('kms-message',),
('pcre',),
('pcre2',),
('snappy',),
('stemmer',),
('tcmalloc',),
Expand Down Expand Up @@ -4241,6 +4242,11 @@ def doConfigure(myenv):
else:
conf.env.Prepend(CPPDEFINES=['PCRE_STATIC'])

if use_system_version_of_library("pcre2"):
conf.FindSysLibDep("pcre2", ["pcre2-8"])
else:
conf.env.Prepend(CPPDEFINES=['PCRE2_STATIC'])

if use_system_version_of_library("snappy"):
conf.FindSysLibDep("snappy", ["snappy"])

Expand Down
98 changes: 98 additions & 0 deletions distsrc/THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,104 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

3.1) License Notice for PCRE2
--------------------------

http:https://www.pcre.org/licence.txt

PCRE2 LICENCE
-------------

PCRE2 is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.

Releases 10.00 and above of PCRE2 are distributed under the terms of the "BSD"
licence, as specified below, with one exemption for certain binary
redistributions. The documentation for PCRE2, supplied in the "doc" directory,
is distributed under the same terms as the software itself. The data in the
testdata directory is not copyrighted and is in the public domain.

The basic library functions are written in C and are freestanding. Also
included in the distribution is a just-in-time compiler that can be used to
optimize pattern matching. This is an optional feature that can be omitted when
the library is built.


THE BASIC LIBRARY FUNCTIONS
---------------------------

Written by: Philip Hazel
Email local part: Philip.Hazel
Email domain: gmail.com

Retired from University of Cambridge Computing Service,
Cambridge, England.

Copyright (c) 1997-2021 University of Cambridge
All rights reserved.


PCRE2 JUST-IN-TIME COMPILATION SUPPORT
--------------------------------------

Written by: Zoltan Herczeg
Email local part: hzmester
Email domain: freemail.hu

Copyright(c) 2010-2021 Zoltan Herczeg
All rights reserved.


STACK-LESS JUST-IN-TIME COMPILER
--------------------------------

Written by: Zoltan Herczeg
Email local part: hzmester
Email domain: freemail.hu

Copyright(c) 2009-2021 Zoltan Herczeg
All rights reserved.


THE "BSD" LICENCE
-----------------

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notices,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notices, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the University of Cambridge nor the names of any
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.


EXEMPTION FOR BINARY LIBRARY-LIKE PACKAGES
------------------------------------------

The second condition in the BSD licence (covering binary redistributions) does
not apply all the way down a chain of software. If binary package A includes
PCRE2, it must respect the condition, but if package B is software that
includes package A, the condition is not imposed on package B unless it uses
PCRE2 independently.


4) License notice for Aladdin MD5
---------------------------------
Expand Down
7 changes: 7 additions & 0 deletions etc/third_party_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ components:
team_owner: "Query"
upgrade_suppression: TODO SERVER-47278

PCRE2:
homepage_url: https://www.pcre.org/
open_hub_url: https://www.openhub.net/p/pcre2
release_monitoring_id: 5832
local_directory_path: src/third_party/pcre2
team_owner: "Query"

python-testscenarios:
homepage_url: https://launchpad.net/testscenarios
open_hub_url: https://www.openhub.net/p/testscenarios
Expand Down
1 change: 0 additions & 1 deletion src/mongo/util/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ env.Library(
],
)


env.Library(
target='summation',
source=[
Expand Down
21 changes: 21 additions & 0 deletions src/third_party/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ if not use_system_version_of_library('pcre'):
'CPPPATH' : ['#/src/third_party/pcre' + pcreSuffix],
}

if not use_system_version_of_library('pcre2'):
thirdPartyEnvironmentModifications['pcre2'] = {
'CPPPATH' : ['#/src/third_party/pcre2'],
}

if not use_system_version_of_library('boost'):


Expand Down Expand Up @@ -340,6 +345,22 @@ else:

pcreEnv.ShimLibrary(name="pcrecpp")

pcre2Env = env.Clone()
if use_system_version_of_library("pcre2"):
pcre2Env = pcre2Env.Clone(
SYSLIBDEPS=[
env['LIBDEPS_PCRE2_SYSLIBDEP'],
])
else:
pcre2Env = pcre2Env.Clone()
pcre2Env.InjectThirdParty(libraries=['pcre2'])
pcre2Env.SConscript('pcre2' + '/SConscript', exports={ 'env' : pcre2Env })
pcre2Env = pcre2Env.Clone(
LIBDEPS_INTERFACE=[
'pcre2/pcre2',
])

pcre2Env.ShimLibrary(name="pcre2")

boostEnv = env.Clone()
if use_system_version_of_library("boost"):
Expand Down
94 changes: 94 additions & 0 deletions src/third_party/pcre2/LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
PCRE2 LICENCE
-------------

PCRE2 is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.

Releases 10.00 and above of PCRE2 are distributed under the terms of the "BSD"
licence, as specified below, with one exemption for certain binary
redistributions. The documentation for PCRE2, supplied in the "doc" directory,
is distributed under the same terms as the software itself. The data in the
testdata directory is not copyrighted and is in the public domain.

The basic library functions are written in C and are freestanding. Also
included in the distribution is a just-in-time compiler that can be used to
optimize pattern matching. This is an optional feature that can be omitted when
the library is built.


THE BASIC LIBRARY FUNCTIONS
---------------------------

Written by: Philip Hazel
Email local part: Philip.Hazel
Email domain: gmail.com

Retired from University of Cambridge Computing Service,
Cambridge, England.

Copyright (c) 1997-2021 University of Cambridge
All rights reserved.


PCRE2 JUST-IN-TIME COMPILATION SUPPORT
--------------------------------------

Written by: Zoltan Herczeg
Email local part: hzmester
Email domain: freemail.hu

Copyright(c) 2010-2021 Zoltan Herczeg
All rights reserved.


STACK-LESS JUST-IN-TIME COMPILER
--------------------------------

Written by: Zoltan Herczeg
Email local part: hzmester
Email domain: freemail.hu

Copyright(c) 2009-2021 Zoltan Herczeg
All rights reserved.


THE "BSD" LICENCE
-----------------

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notices,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notices, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the University of Cambridge nor the names of any
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.


EXEMPTION FOR BINARY LIBRARY-LIKE PACKAGES
------------------------------------------

The second condition in the BSD licence (covering binary redistributions) does
not apply all the way down a chain of software. If binary package A includes
PCRE2, it must respect the condition, but if package B is software that
includes package A, the condition is not imposed on package B unless it uses
PCRE2 independently.

End
65 changes: 65 additions & 0 deletions src/third_party/pcre2/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Append(
CPPDEFINES=[
('PCRE2_CODE_UNIT_WIDTH', 8),
'HAVE_CONFIG_H',
],
)

# Directories that include generated config.h for various platforms
#
# Generated via
# AutoTools (non-Windows)
# ./configure --disable-jit --with-match-limit-recursion=4000 --with-link-size=2 -enable-newline-is-lf --with-match-limit=200000 --with-parens-nest-limit=250 --enable-shared=no

# CMake (Windows)
# -DPCRE_SUPPORT_PCREGREP_JIT:BOOL="0" -DPCRE_BUILD_TESTS:BOOL="0"
# -DPCRE_POSIX_MALLOC_THRESHOLD:STRING="10" -DPCRE_MATCH_LIMIT_RECURSION:STRING="4000"
# -DPCRE_NO_RECURSE:BOOL="1" -DPCRE_LINK_SIZE:STRING="2" -DPCRE_NEWLINE:STRING="LF"
# -DPCRE_SUPPORT_UNICODE_PROPERTIES:BOOL="1" -DPCREGREP_BUFSIZE:STRING="20480"
# -DPCRE_MATCH_LIMIT:STRING="200000" -DPCRE_PARENS_NEST_LIMIT:STRING="250"
# -DPCRE_SUPPORT_UTF:BOOL="1"
#
if env.TargetOSIs('windows'):
env.Append(CPPPATH=["build_windows"])
else:
env.Append(CPPPATH=["build_posix"])

env.Library(
target="pcre2",
source=[
"src/pcre2_auto_possess.c",
"src/pcre2_chartables.c",
"src/pcre2_compile.c",
"src/pcre2_config.c",
"src/pcre2_context.c",
"src/pcre2_convert.c",
"src/pcre2_dfa_match.c",
"src/pcre2_error.c",
"src/pcre2_extuni.c",
"src/pcre2_find_bracket.c",
"src/pcre2_fuzzsupport.c",
"src/pcre2_jit_compile.c",
"src/pcre2_maketables.c",
"src/pcre2_match.c",
"src/pcre2_match_data.c",
"src/pcre2_newline.c",
"src/pcre2_ord2utf.c",
"src/pcre2_pattern_info.c",
"src/pcre2_script_run.c",
"src/pcre2_serialize.c",
"src/pcre2_string_utils.c",
"src/pcre2_study.c",
"src/pcre2_xclass.c",
"src/pcre2_substitute.c",
"src/pcre2_substring.c",
"src/pcre2_tables.c",
"src/pcre2_ucd.c",
"src/pcre2_valid_utf.c",
],
)
Loading

0 comments on commit f9c7dc1

Please sign in to comment.