@ohos-ports/lmdb 2.5.3 → 2.8.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +72 -28
  3. package/SECURITY.md +12 -12
  4. package/bin/download-prebuilds.js +15 -0
  5. package/binding.gyp +115 -111
  6. package/build/Release/lmdb.node +0 -0
  7. package/caching.js +212 -156
  8. package/dependencies/lmdb/libraries/liblmdb/COPYRIGHT +20 -20
  9. package/dependencies/lmdb/libraries/liblmdb/Doxyfile +1631 -1631
  10. package/dependencies/lmdb/libraries/liblmdb/LICENSE +47 -47
  11. package/dependencies/lmdb/libraries/liblmdb/Makefile +136 -136
  12. package/dependencies/lmdb/libraries/liblmdb/chacha8.c +183 -183
  13. package/dependencies/lmdb/libraries/liblmdb/chacha8.h +14 -14
  14. package/dependencies/lmdb/libraries/liblmdb/crypto.c +121 -121
  15. package/dependencies/lmdb/libraries/liblmdb/intro.doc +192 -192
  16. package/dependencies/lmdb/libraries/liblmdb/lmdb.h +28 -3
  17. package/dependencies/lmdb/libraries/liblmdb/mdb.c +157 -31
  18. package/dependencies/lmdb/libraries/liblmdb/mdb_copy.1 +74 -74
  19. package/dependencies/lmdb/libraries/liblmdb/mdb_copy.c +106 -106
  20. package/dependencies/lmdb/libraries/liblmdb/mdb_drop.1 +53 -53
  21. package/dependencies/lmdb/libraries/liblmdb/mdb_drop.c +154 -154
  22. package/dependencies/lmdb/libraries/liblmdb/mdb_dump.1 +94 -94
  23. package/dependencies/lmdb/libraries/liblmdb/mdb_dump.c +333 -333
  24. package/dependencies/lmdb/libraries/liblmdb/mdb_load.1 +97 -97
  25. package/dependencies/lmdb/libraries/liblmdb/mdb_load.c +530 -530
  26. package/dependencies/lmdb/libraries/liblmdb/mdb_stat.1 +83 -83
  27. package/dependencies/lmdb/libraries/liblmdb/mdb_stat.c +276 -276
  28. package/dependencies/lmdb/libraries/liblmdb/midl-sparse.c +452 -0
  29. package/dependencies/lmdb/libraries/liblmdb/midl.c +452 -452
  30. package/dependencies/lmdb/libraries/liblmdb/midl.h +208 -208
  31. package/dependencies/lmdb/libraries/liblmdb/module.c +101 -101
  32. package/dependencies/lmdb/libraries/liblmdb/module.h +16 -16
  33. package/dependencies/lmdb/libraries/liblmdb/mtest.c +178 -178
  34. package/dependencies/lmdb/libraries/liblmdb/mtest2.c +124 -124
  35. package/dependencies/lmdb/libraries/liblmdb/mtest3.c +133 -133
  36. package/dependencies/lmdb/libraries/liblmdb/mtest4.c +168 -168
  37. package/dependencies/lmdb/libraries/liblmdb/mtest5.c +135 -135
  38. package/dependencies/lmdb/libraries/liblmdb/mtest6.c +141 -141
  39. package/dependencies/lmdb/libraries/liblmdb/mtest_enc.c +190 -190
  40. package/dependencies/lmdb/libraries/liblmdb/mtest_enc2.c +189 -189
  41. package/dependencies/lmdb/libraries/liblmdb/mtest_remap.c +177 -177
  42. package/dependencies/lmdb/libraries/liblmdb/sample-bdb.txt +73 -73
  43. package/dependencies/lmdb/libraries/liblmdb/sample-mdb.txt +62 -62
  44. package/dependencies/lmdb/libraries/liblmdb/tooltag +27 -27
  45. package/dependencies/lmdb-data-v1/libraries/liblmdb/CHANGES +266 -0
  46. package/dependencies/lmdb-data-v1/libraries/liblmdb/COPYRIGHT +20 -20
  47. package/dependencies/lmdb-data-v1/libraries/liblmdb/Doxyfile +1631 -1631
  48. package/dependencies/lmdb-data-v1/libraries/liblmdb/LICENSE +47 -47
  49. package/dependencies/lmdb-data-v1/libraries/liblmdb/intro.doc +192 -192
  50. package/dependencies/lmdb-data-v1/libraries/liblmdb/lmdb.h +1608 -1653
  51. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb.c +10320 -11359
  52. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_copy.1 +55 -61
  53. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_copy.c +82 -84
  54. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_dump.1 +75 -81
  55. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_dump.c +319 -319
  56. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_load.1 +84 -84
  57. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_load.c +496 -492
  58. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_stat.1 +64 -70
  59. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_stat.c +263 -264
  60. package/dependencies/lmdb-data-v1/libraries/liblmdb/midl.c +359 -421
  61. package/dependencies/lmdb-data-v1/libraries/liblmdb/midl.h +186 -200
  62. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest.c +177 -177
  63. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest2.c +124 -124
  64. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest3.c +133 -133
  65. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest4.c +168 -168
  66. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest5.c +135 -135
  67. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest6.c +141 -141
  68. package/dependencies/lmdb-data-v1/libraries/liblmdb/sample-bdb.txt +73 -73
  69. package/dependencies/lmdb-data-v1/libraries/liblmdb/sample-mdb.txt +62 -62
  70. package/dependencies/lmdb-data-v1/libraries/liblmdb/tooltag +22 -27
  71. package/dependencies/lz4/LICENSE +11 -11
  72. package/dependencies/lz4/lib/LICENSE +24 -24
  73. package/dependencies/lz4/lib/Makefile +225 -0
  74. package/dependencies/lz4/lib/README.md +169 -137
  75. package/dependencies/lz4/lib/dll/example/Makefile +63 -0
  76. package/dependencies/lz4/lib/dll/example/README.md +69 -69
  77. package/dependencies/lz4/lib/dll/liblz4.def +62 -62
  78. package/dependencies/lz4/lib/liblz4-dll.rc.in +35 -35
  79. package/dependencies/lz4/lib/liblz4.pc.in +14 -14
  80. package/dependencies/lz4/lib/lz4.c +2722 -2495
  81. package/dependencies/lz4/lib/lz4.h +842 -774
  82. package/dependencies/lz4/lib/lz4file.c +311 -0
  83. package/dependencies/lz4/lib/lz4file.h +93 -0
  84. package/dependencies/lz4/lib/lz4frame.c +2078 -1899
  85. package/dependencies/lz4/lib/lz4frame.h +692 -623
  86. package/dependencies/lz4/lib/lz4frame_static.h +47 -47
  87. package/dependencies/lz4/lib/lz4hc.c +1631 -1615
  88. package/dependencies/lz4/lib/lz4hc.h +413 -413
  89. package/dependencies/lz4/lib/xxhash.c +1030 -1030
  90. package/dependencies/lz4/lib/xxhash.h +328 -328
  91. package/dependencies/v8/v8-fast-api-calls-v16.h +790 -790
  92. package/dependencies/v8/v8-fast-api-calls.h +784 -888
  93. package/dist/index.cjs +1050 -584
  94. package/dist/index.cjs.map +1 -1
  95. package/index.d.cts +420 -0
  96. package/index.d.ts +450 -385
  97. package/index.js +38 -37
  98. package/keys.js +116 -102
  99. package/level.js +26 -26
  100. package/native.js +8 -5
  101. package/node-index.js +21 -17
  102. package/open.js +51 -17
  103. package/package.json +63 -21
  104. package/read.js +338 -95
  105. package/src/compression.cpp +12 -9
  106. package/src/cursor.cpp +82 -31
  107. package/src/dbi.cpp +78 -40
  108. package/src/env.cpp +336 -68
  109. package/src/lmdb-js.cpp +64 -64
  110. package/src/lmdb-js.h +83 -49
  111. package/src/misc.cpp +297 -28
  112. package/src/ordered-binary.cpp +46 -46
  113. package/src/txn.cpp +210 -257
  114. package/src/v8-functions.cpp +170 -166
  115. package/src/windows.c +34 -34
  116. package/src/writer.cpp +169 -84
  117. package/util/RangeIterable.js +112 -17
  118. package/util/set-optional-deps.cjs +14 -10
  119. package/util/when.js +8 -8
  120. package/write.js +145 -121
  121. package/dependencies/lmdb-data-v1/libraries/liblmdb/Makefile +0 -118
  122. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_drop.1 +0 -40
  123. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_drop.c +0 -135
  124. package/rollup.config.js +0 -12
@@ -1,47 +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.
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.
@@ -1,136 +1,136 @@
1
- # Makefile for liblmdb (Lightning memory-mapped database library).
2
-
3
- ########################################################################
4
- # Configuration. The compiler options must enable threaded compilation.
5
- #
6
- # Preprocessor macros (for CPPFLAGS) of interest...
7
- # Note that the defaults should already be correct for most
8
- # platforms; you should not need to change any of these.
9
- # Read their descriptions in mdb.c if you do:
10
- #
11
- # - MDB_USE_POSIX_MUTEX, MDB_USE_POSIX_SEM, MDB_USE_SYSV_SEM
12
- # - MDB_DSYNC
13
- # - MDB_FDATASYNC
14
- # - MDB_FDATASYNC_WORKS
15
- # - MDB_USE_PWRITEV
16
- # - MDB_USE_ROBUST
17
- #
18
- # There may be other macros in mdb.c of interest. You should
19
- # read mdb.c before changing any of them.
20
- #
21
- CC = gcc
22
- AR = ar
23
- W = -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized
24
- THREADS = -pthread
25
- OPT = -O2 -g
26
- CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS)
27
- LDFLAGS = $(THREADS)
28
- LDLIBS =
29
- SOLIBS =
30
- SOEXT = .so
31
- LDL = -ldl
32
- prefix = /usr/local
33
- exec_prefix = $(prefix)
34
- bindir = $(exec_prefix)/bin
35
- libdir = $(exec_prefix)/lib
36
- includedir = $(prefix)/include
37
- datarootdir = $(prefix)/share
38
- mandir = $(datarootdir)/man
39
-
40
- ########################################################################
41
-
42
- IHDRS = lmdb.h
43
- ILIBS = liblmdb.a liblmdb$(SOEXT)
44
- IPROGS = mdb_stat mdb_copy mdb_dump mdb_load mdb_drop
45
- IDOCS = mdb_stat.1 mdb_copy.1 mdb_dump.1 mdb_load.1 mdb_drop.1
46
- PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
47
- RPROGS = mtest_remap mtest_enc mtest_enc2
48
-
49
- all: $(ILIBS) $(PROGS)
50
- # Requires CPPFLAGS=-DMDB_VL32 and/or -DMDB_RPAGE_CACHE
51
- rall: all $(RPROGS)
52
-
53
- install: $(ILIBS) $(IPROGS) $(IHDRS)
54
- mkdir -p $(DESTDIR)$(bindir)
55
- mkdir -p $(DESTDIR)$(libdir)
56
- mkdir -p $(DESTDIR)$(includedir)
57
- mkdir -p $(DESTDIR)$(mandir)/man1
58
- for f in $(IPROGS); do cp $$f $(DESTDIR)$(bindir); done
59
- for f in $(ILIBS); do cp $$f $(DESTDIR)$(libdir); done
60
- for f in $(IHDRS); do cp $$f $(DESTDIR)$(includedir); done
61
- for f in $(IDOCS); do cp $$f $(DESTDIR)$(mandir)/man1; done
62
-
63
- clean:
64
- rm -rf $(PROGS) $(RPROGS) *.[ao] *.[ls]o *~ testdb
65
-
66
- test: all
67
- rm -rf testdb && mkdir testdb
68
- ./mtest && ./mdb_stat testdb
69
-
70
- liblmdb.a: mdb.o midl.o
71
- $(AR) rs $@ mdb.o midl.o
72
-
73
- liblmdb$(SOEXT): mdb.lo midl.lo
74
- # $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS)
75
- $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.lo midl.lo $(SOLIBS)
76
-
77
- mdb_stat: mdb_stat.o module.o liblmdb.a
78
- $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
79
- mdb_copy: mdb_copy.o module.o liblmdb.a
80
- $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
81
- mdb_dump: mdb_dump.o module.o liblmdb.a
82
- $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
83
- mdb_load: mdb_load.o module.o liblmdb.a
84
- $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
85
- mdb_drop: mdb_drop.o module.o liblmdb.a
86
- $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
87
- mtest: mtest.o liblmdb.a
88
- mtest2: mtest2.o liblmdb.a
89
- mtest3: mtest3.o liblmdb.a
90
- mtest4: mtest4.o liblmdb.a
91
- mtest5: mtest5.o liblmdb.a
92
- mtest6: mtest6.o liblmdb.a
93
- mtest_remap: mtest_remap.o liblmdb.a
94
- mtest_enc: mtest_enc.o chacha8.o liblmdb.a
95
- mtest_enc2: mtest_enc2.o module.o liblmdb.a crypto.lm
96
- $(CC) $(LDFLAGS) -pthread -o $@ mtest_enc2.o module.o liblmdb.a $(LDL)
97
-
98
- crypto.lm: crypto.c
99
- $(CC) -shared -o $@ -lcrypto
100
-
101
- mdb.o: mdb.c lmdb.h midl.h
102
- $(CC) $(CFLAGS) $(CPPFLAGS) -c mdb.c
103
-
104
- midl.o: midl.c midl.h
105
- $(CC) $(CFLAGS) $(CPPFLAGS) -c midl.c
106
-
107
- mdb.lo: mdb.c lmdb.h midl.h
108
- $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c mdb.c -o $@
109
-
110
- midl.lo: midl.c midl.h
111
- $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c midl.c -o $@
112
-
113
- %: %.o
114
- $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
115
-
116
- %.o: %.c lmdb.h
117
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
118
-
119
- COV_FLAGS=-fprofile-arcs -ftest-coverage
120
- COV_OBJS=xmdb.o xmidl.o
121
-
122
- coverage: xmtest
123
- for i in mtest*.c [0-9]*.c; do j=`basename \$$i .c`; $(MAKE) $$j.o; \
124
- gcc -o x$$j $$j.o $(COV_OBJS) -pthread $(COV_FLAGS); \
125
- rm -rf testdb; mkdir testdb; ./x$$j; done
126
- gcov xmdb.c
127
- gcov xmidl.c
128
-
129
- xmtest: mtest.o xmdb.o xmidl.o
130
- gcc -o xmtest mtest.o xmdb.o xmidl.o -pthread $(COV_FLAGS)
131
-
132
- xmdb.o: mdb.c lmdb.h midl.h
133
- $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -O0 $(COV_FLAGS) -c mdb.c -o $@
134
-
135
- xmidl.o: midl.c midl.h
136
- $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -O0 $(COV_FLAGS) -c midl.c -o $@
1
+ # Makefile for liblmdb (Lightning memory-mapped database library).
2
+
3
+ ########################################################################
4
+ # Configuration. The compiler options must enable threaded compilation.
5
+ #
6
+ # Preprocessor macros (for CPPFLAGS) of interest...
7
+ # Note that the defaults should already be correct for most
8
+ # platforms; you should not need to change any of these.
9
+ # Read their descriptions in mdb.c if you do:
10
+ #
11
+ # - MDB_USE_POSIX_MUTEX, MDB_USE_POSIX_SEM, MDB_USE_SYSV_SEM
12
+ # - MDB_DSYNC
13
+ # - MDB_FDATASYNC
14
+ # - MDB_FDATASYNC_WORKS
15
+ # - MDB_USE_PWRITEV
16
+ # - MDB_USE_ROBUST
17
+ #
18
+ # There may be other macros in mdb.c of interest. You should
19
+ # read mdb.c before changing any of them.
20
+ #
21
+ CC = gcc
22
+ AR = ar
23
+ W = -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized
24
+ THREADS = -pthread
25
+ OPT = -O2 -g
26
+ CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS)
27
+ LDFLAGS = $(THREADS)
28
+ LDLIBS =
29
+ SOLIBS =
30
+ SOEXT = .so
31
+ LDL = -ldl
32
+ prefix = /usr/local
33
+ exec_prefix = $(prefix)
34
+ bindir = $(exec_prefix)/bin
35
+ libdir = $(exec_prefix)/lib
36
+ includedir = $(prefix)/include
37
+ datarootdir = $(prefix)/share
38
+ mandir = $(datarootdir)/man
39
+
40
+ ########################################################################
41
+
42
+ IHDRS = lmdb.h
43
+ ILIBS = liblmdb.a liblmdb$(SOEXT)
44
+ IPROGS = mdb_stat mdb_copy mdb_dump mdb_load mdb_drop
45
+ IDOCS = mdb_stat.1 mdb_copy.1 mdb_dump.1 mdb_load.1 mdb_drop.1
46
+ PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
47
+ RPROGS = mtest_remap mtest_enc mtest_enc2
48
+
49
+ all: $(ILIBS) $(PROGS)
50
+ # Requires CPPFLAGS=-DMDB_VL32 and/or -DMDB_RPAGE_CACHE
51
+ rall: all $(RPROGS)
52
+
53
+ install: $(ILIBS) $(IPROGS) $(IHDRS)
54
+ mkdir -p $(DESTDIR)$(bindir)
55
+ mkdir -p $(DESTDIR)$(libdir)
56
+ mkdir -p $(DESTDIR)$(includedir)
57
+ mkdir -p $(DESTDIR)$(mandir)/man1
58
+ for f in $(IPROGS); do cp $$f $(DESTDIR)$(bindir); done
59
+ for f in $(ILIBS); do cp $$f $(DESTDIR)$(libdir); done
60
+ for f in $(IHDRS); do cp $$f $(DESTDIR)$(includedir); done
61
+ for f in $(IDOCS); do cp $$f $(DESTDIR)$(mandir)/man1; done
62
+
63
+ clean:
64
+ rm -rf $(PROGS) $(RPROGS) *.[ao] *.[ls]o *~ testdb
65
+
66
+ test: all
67
+ rm -rf testdb && mkdir testdb
68
+ ./mtest && ./mdb_stat testdb
69
+
70
+ liblmdb.a: mdb.o midl.o
71
+ $(AR) rs $@ mdb.o midl.o
72
+
73
+ liblmdb$(SOEXT): mdb.lo midl.lo
74
+ # $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS)
75
+ $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.lo midl.lo $(SOLIBS)
76
+
77
+ mdb_stat: mdb_stat.o module.o liblmdb.a
78
+ $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
79
+ mdb_copy: mdb_copy.o module.o liblmdb.a
80
+ $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
81
+ mdb_dump: mdb_dump.o module.o liblmdb.a
82
+ $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
83
+ mdb_load: mdb_load.o module.o liblmdb.a
84
+ $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
85
+ mdb_drop: mdb_drop.o module.o liblmdb.a
86
+ $(CC) $(LDFLAGS) -o $@ $^ $(LDL)
87
+ mtest: mtest.o liblmdb.a
88
+ mtest2: mtest2.o liblmdb.a
89
+ mtest3: mtest3.o liblmdb.a
90
+ mtest4: mtest4.o liblmdb.a
91
+ mtest5: mtest5.o liblmdb.a
92
+ mtest6: mtest6.o liblmdb.a
93
+ mtest_remap: mtest_remap.o liblmdb.a
94
+ mtest_enc: mtest_enc.o chacha8.o liblmdb.a
95
+ mtest_enc2: mtest_enc2.o module.o liblmdb.a crypto.lm
96
+ $(CC) $(LDFLAGS) -pthread -o $@ mtest_enc2.o module.o liblmdb.a $(LDL)
97
+
98
+ crypto.lm: crypto.c
99
+ $(CC) -shared -o $@ -lcrypto
100
+
101
+ mdb.o: mdb.c lmdb.h midl.h
102
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c mdb.c
103
+
104
+ midl.o: midl.c midl.h
105
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c midl.c
106
+
107
+ mdb.lo: mdb.c lmdb.h midl.h
108
+ $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c mdb.c -o $@
109
+
110
+ midl.lo: midl.c midl.h
111
+ $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c midl.c -o $@
112
+
113
+ %: %.o
114
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
115
+
116
+ %.o: %.c lmdb.h
117
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
118
+
119
+ COV_FLAGS=-fprofile-arcs -ftest-coverage
120
+ COV_OBJS=xmdb.o xmidl.o
121
+
122
+ coverage: xmtest
123
+ for i in mtest*.c [0-9]*.c; do j=`basename \$$i .c`; $(MAKE) $$j.o; \
124
+ gcc -o x$$j $$j.o $(COV_OBJS) -pthread $(COV_FLAGS); \
125
+ rm -rf testdb; mkdir testdb; ./x$$j; done
126
+ gcov xmdb.c
127
+ gcov xmidl.c
128
+
129
+ xmtest: mtest.o xmdb.o xmidl.o
130
+ gcc -o xmtest mtest.o xmdb.o xmidl.o -pthread $(COV_FLAGS)
131
+
132
+ xmdb.o: mdb.c lmdb.h midl.h
133
+ $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -O0 $(COV_FLAGS) -c mdb.c -o $@
134
+
135
+ xmidl.o: midl.c midl.h
136
+ $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -O0 $(COV_FLAGS) -c midl.c -o $@