Skip to content

Commit f64c145

Browse files
committed
[lmdb-clib] Pull out LMDB code into a separate package
1 parent 3f6de3e commit f64c145

9 files changed

Lines changed: 109 additions & 5 deletions

File tree

cabal.project

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ packages:
1212
glean.cabal
1313
glean/lang/clang/glean-clang.cabal
1414
glean/lsp
15+
glean/lmdb-clib
1516

1617
optional-packages:
1718
hsthrift/folly-clib/folly-clib.cabal
@@ -52,6 +53,9 @@ package thrift-http
5253
package glean
5354
flags: -opt
5455

56+
package lmdb-clib
57+
flags: -opt
58+
5559
package fb-util
5660
flags: +folly
5761

glean.cabal.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ library lmdb
437437
build-depends:
438438
glean:storage,
439439
glean:rts,
440+
lmdb-clib,
440441

441442
library util
442443
import: fb-haskell, fb-cpp, deps, thrift-client

glean/lmdb-clib/LICENSE

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
The OpenLDAP Public License
2+
Version 2.8, 17 August 2003
3+
4+
Redistribution and use of this software and associated documentation
5+
("Software"), with or without modification, are permitted provided
6+
that the following conditions are met:
7+
8+
1. Redistributions in source form must retain copyright statements
9+
and notices,
10+
11+
2. Redistributions in binary form must reproduce applicable copyright
12+
statements and notices, this list of conditions, and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution, and
15+
16+
3. Redistributions must contain a verbatim copy of this document.
17+
18+
The OpenLDAP Foundation may revise this license from time to time.
19+
Each revision is distinguished by a version number. You may use
20+
this Software under terms of this license revision or under the
21+
terms of any subsequent revision of the license.
22+
23+
THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS
24+
CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
25+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
27+
SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S)
28+
OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
29+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35+
POSSIBILITY OF SUCH DAMAGE.
36+
37+
The names of the authors and copyright holders must not be used in
38+
advertising or otherwise to promote the sale, use or other dealing
39+
in this Software without specific, written prior permission. Title
40+
to copyright in this Software shall at all times remain with copyright
41+
holders.
42+
43+
OpenLDAP is a registered trademark of the OpenLDAP Foundation.
44+
45+
Copyright 1999-2003 The OpenLDAP Foundation, Redwood City,
46+
California, USA. All Rights Reserved. Permission to copy and
47+
distribute verbatim copies of this document is granted.

glean/lmdb-clib/lmdb-clib.cabal

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
cabal-version: 3.4
2+
name: lmdb-clib
3+
version: 0.1.0.0
4+
synopsis: Lightning Memory-Mapped Database
5+
author: Howard Chu, Symas Corporation.
6+
maintainer: Simon Marlow <marlowsd@gmail.com>
7+
copyright: Copyright 2011-2021 Howard Chu, Symas Corp.
8+
homepage: https://www.symas.com/mdb
9+
license: BSD-3-Clause
10+
license-files: LICENSE
11+
build-type: Simple
12+
13+
Description:
14+
Cabal wrapper around the LMDB C library, with one tweak to increase
15+
the default max key size from 511 bytes to ~2kB.
16+
17+
source-repository head
18+
type: git
19+
location: https://git.openldap.org/openldap/openldap/tree/mdb.master
20+
21+
-- Note: if you import a new version, copy the local change to
22+
-- #define PAGEBASE that is needed to increase the max key size.
23+
24+
common fb-cpp
25+
cxx-options: -std=c++20 -Wno-nullability-completeness -fno-omit-frame-pointer
26+
if !flag(clang)
27+
cxx-options: -fcoroutines
28+
if arch(x86_64)
29+
cxx-options: -march=haswell
30+
if flag(opt) && !flag(asan)
31+
cxx-options: -O3 -DNDEBUG
32+
else
33+
cc-options: -g
34+
cxx-options: -g
35+
36+
flag clang
37+
default: False
38+
39+
flag asan
40+
default: False
41+
42+
flag opt
43+
default: True
44+
45+
library
46+
import: fb-cpp
47+
default-language: Haskell2010
48+
c-sources:
49+
mdb.c
50+
midl.c
51+
cc-options: -DMDB_MAXKEYSIZE=0
52+
include-dirs: .
53+
install-includes:
54+
lmdb.h
55+
midl.h
56+
File renamed without changes.

mk/cxx.mk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ CXX_SOURCES_glean_cpp_lmdb = \
6969
glean/lmdb/ffi.cpp \
7070
glean/lmdb/glean_lmdb.cpp
7171

72-
C_SOURCES_glean_cpp_lmdb = \
73-
glean/lmdb/mdb.c \
74-
glean/lmdb/midl.c
75-
76-
CXX_FLAGS_glean_cpp_lmdb = -DOSS=1 -DMDB_MAXKEYSIZE=0
72+
CXX_FLAGS_glean_cpp_lmdb = -DOSS=1
7773

7874
CXX_SOURCES_glean_cpp_client = \
7975
glean/cpp/filewriter.cpp \

0 commit comments

Comments
 (0)