mdbxmou 0.3.11 → 0.3.13

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 (38) hide show
  1. package/README.md +113 -11
  2. package/deps/libmdbx/ChangeLog.md +44 -0
  3. package/deps/libmdbx/SECURITY.md +18 -0
  4. package/deps/libmdbx/VERSION.json +1 -1
  5. package/deps/libmdbx/mdbx.c +121 -63
  6. package/deps/libmdbx/mdbx.c++ +2 -2
  7. package/deps/libmdbx/mdbx_chk.c +2 -2
  8. package/deps/libmdbx/mdbx_copy.c +2 -2
  9. package/deps/libmdbx/mdbx_drop.c +2 -2
  10. package/deps/libmdbx/mdbx_dump.c +5 -5
  11. package/deps/libmdbx/mdbx_load.c +24 -23
  12. package/deps/libmdbx/mdbx_stat.c +2 -3
  13. package/lib/async.d.mts +6 -4
  14. package/lib/types.d.ts +17 -2
  15. package/package.json +2 -1
  16. package/src/async/envmou_keys.cpp +1 -1
  17. package/src/async/envmou_query.cpp +14 -13
  18. package/src/convmou.cpp +17 -0
  19. package/src/convmou.hpp +4 -8
  20. package/src/cursormou.cpp +2 -1
  21. package/src/cursormou.hpp +1 -0
  22. package/src/dbimou.cpp +71 -18
  23. package/src/dbimou.hpp +3 -1
  24. package/src/modulemou.cpp +14 -0
  25. package/src/querymou.cpp +15 -15
  26. package/src/querymou.hpp +3 -1
  27. package/src/txnmou.cpp +3 -3
  28. package/src/typemou.hpp +85 -5
  29. package/src/valuemou.hpp +62 -83
  30. package/deps/libmdbx/.github/workflows/ci-android.yml +0 -38
  31. package/deps/libmdbx/.github/workflows/ci-mingw.yml +0 -40
  32. package/deps/libmdbx/.github/workflows/ci-posix.yml +0 -34
  33. package/deps/libmdbx/.github/workflows/ci-wincxx.yml +0 -45
  34. package/deps/libmdbx/.github/workflows/ci-windows.yml +0 -32
  35. package/deps/libmdbx/ci.sh +0 -86
  36. package/deps/libmdbx/packages/archlinux/.SRCINFO +0 -16
  37. package/deps/libmdbx/packages/archlinux/PKGBUILD +0 -38
  38. package/deps/libmdbx/packages/buildroot/0001-package-libmdbx.patch +0 -75
package/src/typemou.hpp CHANGED
@@ -171,19 +171,80 @@ struct query_mode
171
171
  };
172
172
  int val{get};
173
173
 
174
+ bool is_get() const noexcept {
175
+ return (val & get) != 0;
176
+ }
177
+
178
+ bool is_del() const noexcept {
179
+ return (val & del) != 0;
180
+ }
181
+
182
+ bool is_write() const noexcept {
183
+ return !is_get() && !is_del();
184
+ }
185
+
174
186
  static inline query_mode parse(const txn_mode& mode, const Napi::Value& arg0) {
175
187
  query_mode rc{arg0.As<Napi::Number>().Int32Value() & mask};
176
- if ((mode.val & txn_mode::ro) && (rc.val & (del|write_mask))) {
188
+ if ((rc.is_get() || rc.is_del()) && (rc.val & write_mask)) {
189
+ throw std::runtime_error(
190
+ "queryMode must be one of get/del/upsert/update/insertUnique");
191
+ }
192
+ if (rc.is_get() && rc.is_del()) {
193
+ throw std::runtime_error(
194
+ "queryMode must be one of get/del/upsert/update/insertUnique");
195
+ }
196
+ if ((mode.val & txn_mode::ro) && (rc.is_del() || rc.is_write())) {
177
197
  throw std::runtime_error("rw query in read-only transaction");
178
198
  }
179
199
  return rc;
180
200
  }
181
201
 
202
+ int write_flags() const noexcept {
203
+ return val & write_mask;
204
+ }
205
+
182
206
  operator mdbx::put_mode() const noexcept {
183
207
  return static_cast<mdbx::put_mode>(val & write_mask);
184
208
  }
185
209
  };
186
210
 
211
+ struct put_flag
212
+ {
213
+ enum type : int {
214
+ no_overwrite = MDBX_NOOVERWRITE,
215
+ no_dup_data = MDBX_NODUPDATA,
216
+ current = MDBX_CURRENT,
217
+ all_dups = MDBX_ALLDUPS,
218
+ reserve = MDBX_RESERVE,
219
+ append = MDBX_APPEND,
220
+ append_dup = MDBX_APPENDDUP,
221
+ multiple = MDBX_MULTIPLE,
222
+ query_mask = MDBX_NOOVERWRITE | MDBX_NODUPDATA | MDBX_CURRENT |
223
+ MDBX_APPEND | MDBX_APPENDDUP,
224
+ mask = MDBX_NOOVERWRITE | MDBX_NODUPDATA | MDBX_CURRENT |
225
+ MDBX_ALLDUPS | MDBX_RESERVE | MDBX_APPEND |
226
+ MDBX_APPENDDUP | MDBX_MULTIPLE
227
+ };
228
+ int val{};
229
+
230
+ static inline put_flag parse(const Napi::Value& arg0) {
231
+ return {arg0.As<Napi::Number>().Int32Value() & mask};
232
+ }
233
+
234
+ static inline put_flag parse_query(const Napi::Value& arg0) {
235
+ put_flag rc = parse(arg0);
236
+ if (rc.val & ~query_mask) {
237
+ throw Napi::TypeError::New(arg0.Env(),
238
+ "query putFlag supports only noOverwrite/noDupData/current/append/appendDup");
239
+ }
240
+ return rc;
241
+ }
242
+
243
+ operator MDBX_put_flags_t() const noexcept {
244
+ return static_cast<MDBX_put_flags_t>(val & mask);
245
+ }
246
+ };
247
+
187
248
  struct key_mode
188
249
  {
189
250
  enum type : int {
@@ -223,6 +284,11 @@ struct value_mode
223
284
  }
224
285
  };
225
286
 
287
+ static inline bool is_ordinal(const value_mode& mode) noexcept
288
+ {
289
+ return (mode.val & static_cast<int>(MDBX_INTEGERDUP)) != 0;
290
+ }
291
+
226
292
 
227
293
  struct base_flag
228
294
  {
@@ -231,7 +297,7 @@ struct base_flag
231
297
  number = 4,
232
298
  bigint = 8,
233
299
  mask_key = string | number | bigint,
234
- mask_val = string
300
+ mask_val = string | number | bigint
235
301
  };
236
302
  int val{};
237
303
 
@@ -270,11 +336,12 @@ struct base_flag
270
336
  }
271
337
 
272
338
  static inline void validate_value(const Napi::Value& arg0, int value) {
273
- if (value == 0 || value == string) {
339
+ if (value == 0 || value == string ||
340
+ value == number || value == bigint) {
274
341
  return;
275
342
  }
276
343
  throw Napi::Error::New(arg0.Env(),
277
- "valueFlag must be 0 or string");
344
+ "valueFlag must be 0, string, number or bigint");
278
345
  }
279
346
 
280
347
  static inline base_flag parse_key(const Napi::Value& arg0) {
@@ -287,7 +354,11 @@ struct base_flag
287
354
  const Napi::Value& arg0) {
288
355
  auto value = arg0.As<Napi::Number>().Int32Value() & mask_val;
289
356
  validate_value(arg0, value);
290
- return {value};
357
+ base_flag rc{value};
358
+ if (is_ordinal(mode) && !rc.is_numeric()) {
359
+ rc = number;
360
+ }
361
+ return rc;
291
362
  }
292
363
 
293
364
  static inline base_flag parse_value(const Napi::Value& arg0) {
@@ -327,6 +398,15 @@ static inline key_mode parse_key_mode(Napi::Env env, const Napi::Value& arg0, ba
327
398
  return mode;
328
399
  }
329
400
 
401
+ static inline value_mode parse_value_mode(const Napi::Value& arg0, base_flag& value_flag)
402
+ {
403
+ auto mode = value_mode::parse(arg0);
404
+ if (is_ordinal(mode) && !value_flag.is_numeric()) {
405
+ value_flag = base_flag::number;
406
+ }
407
+ return mode;
408
+ }
409
+
330
410
  struct db_mode
331
411
  {
332
412
  enum type : int {
package/src/valuemou.hpp CHANGED
@@ -29,6 +29,10 @@ struct valuemou
29
29
  : mdbx::slice{arg0.data(), arg0.size()}
30
30
  { }
31
31
 
32
+ valuemou(const std::uint64_t& arg0) noexcept
33
+ : mdbx::slice{&arg0, sizeof(arg0)}
34
+ { }
35
+
32
36
  valuemou(const Napi::Buffer<char>& arg0, buffer_type& mem)
33
37
  {
34
38
  auto ptr = arg0.Data();
@@ -59,6 +63,28 @@ struct valuemou
59
63
  assign(mem.data(), mem.size());
60
64
  }
61
65
 
66
+ valuemou(const Napi::Number& arg0,
67
+ const Napi::Env& env, std::uint64_t& mem)
68
+ {
69
+ auto value = arg0.Int64Value();
70
+ if (value < 0) {
71
+ throw Napi::Error::New(env, "Number negative");
72
+ }
73
+ mem = static_cast<std::uint64_t>(value);
74
+ assign(&mem, sizeof(mem));
75
+ }
76
+
77
+ valuemou(const Napi::BigInt& arg0,
78
+ const Napi::Env& env, std::uint64_t& mem)
79
+ {
80
+ bool looseless;
81
+ mem = arg0.Uint64Value(&looseless);
82
+ if (!looseless) {
83
+ throw Napi::Error::New(env, "BigInt !looseless");
84
+ }
85
+ assign(&mem, sizeof(mem));
86
+ }
87
+
62
88
  static inline valuemou from(const Napi::Value& arg0,
63
89
  const Napi::Env& env, buffer_type& mem)
64
90
  {
@@ -70,6 +96,23 @@ struct valuemou
70
96
  return {arg0.As<Napi::String>(), env, mem};
71
97
  }
72
98
 
99
+ static inline valuemou from(const Napi::Value& arg0,
100
+ const Napi::Env& env, std::uint64_t& mem)
101
+ {
102
+ if (arg0.IsBigInt()) {
103
+ return {arg0.As<Napi::BigInt>(), env, mem};
104
+ } else if (!arg0.IsNumber()) {
105
+ throw Napi::Error::New(env, "value must be a Number or BigInt");
106
+ }
107
+ return {arg0.As<Napi::Number>(), env, mem};
108
+ }
109
+
110
+ static inline valuemou from(const Napi::Value& arg0,
111
+ const Napi::Env& env, buffer_type& buf, std::uint64_t& num, bool ordinal)
112
+ {
113
+ return ordinal ? from(arg0, env, num) : from(arg0, env, buf);
114
+ }
115
+
73
116
  Napi::Value to_string(const Napi::Env& env) const
74
117
  {
75
118
  return Napi::String::New(env,
@@ -81,92 +124,38 @@ struct valuemou
81
124
  return Napi::Buffer<char>::Copy(env,
82
125
  char_ptr(), length());
83
126
  }
127
+
128
+ Napi::Value to_number(const Napi::Env& env) const
129
+ {
130
+ return Napi::Number::New(env, static_cast<double>(as_int64()));
131
+ }
132
+
133
+ Napi::Value to_bigint(const Napi::Env& env) const
134
+ {
135
+ return Napi::BigInt::New(env, as_uint64());
136
+ }
84
137
  };
85
138
 
86
139
  struct keymou final
87
140
  : valuemou
88
141
  {
142
+ using valuemou::valuemou;
143
+
89
144
  keymou() = default;
90
145
  keymou(const keymou&) = default;
91
146
  keymou& operator=(const keymou&) = default;
92
147
  keymou(keymou&&) = default;
93
148
  keymou& operator=(keymou&&) = default;
94
149
 
95
- keymou(const valuemou& arg0) noexcept
96
- : valuemou{arg0}
97
- { }
98
-
99
- keymou(const mdbx::slice& arg0) noexcept
100
- : valuemou{arg0}
101
- { }
102
-
103
- keymou(const Napi::Buffer<char>& arg0)
104
- : valuemou{arg0}
105
- { }
106
-
107
- keymou(const buffer_type& arg0) noexcept
108
- : valuemou{arg0}
109
- { }
110
-
111
- keymou(const std::uint64_t& arg0) noexcept
112
- : valuemou{mdbx::slice{&arg0, sizeof(arg0)}}
113
- { }
114
-
115
- keymou(const Napi::Buffer<char>& arg0, buffer_type& mem)
116
- : valuemou{arg0, mem}
117
- { }
118
-
119
- keymou(const Napi::String& arg0,
120
- const Napi::Env& env, buffer_type& mem)
121
- : valuemou{arg0, env, mem}
122
- { }
123
-
124
- keymou(const Napi::Number& arg0, std::uint64_t& mem)
125
- {
126
- auto value = arg0.Int64Value();
127
- if (value < 0) {
128
- throw std::runtime_error("Number negative");
129
- }
130
- mem = static_cast<std::uint64_t>(value);
131
- assign(&mem, sizeof(mem));
132
- }
133
-
134
- keymou(const Napi::Number& arg0,
135
- const Napi::Env& env, std::uint64_t& mem)
136
- {
137
- auto value = arg0.Int64Value();
138
- if (value < 0) {
139
- throw Napi::Error::New(env, "Number negative");
140
- }
141
- mem = static_cast<std::uint64_t>(value);
142
- assign(&mem, sizeof(mem));
143
- }
144
-
145
- keymou(const Napi::BigInt& arg0,std::uint64_t& mem)
146
- {
147
- bool looseless;
148
- mem = arg0.Uint64Value(&looseless);
149
- if (!looseless) {
150
- throw std::runtime_error("BigInt !looseless");
151
- }
152
- assign(&mem, sizeof(mem));
153
- }
154
-
155
- keymou(const Napi::BigInt& arg0,
156
- const Napi::Env& env, std::uint64_t& mem)
157
- {
158
- bool looseless;
159
- mem = arg0.Uint64Value(&looseless);
160
- if (!looseless) {
161
- throw Napi::Error::New(env, "BigInt !looseless");
162
- }
163
- assign(&mem, sizeof(mem));
164
- }
165
-
166
150
  static inline keymou from(const Napi::Value& arg0,
167
151
  const Napi::Env& env, buffer_type& mem)
168
152
  {
169
- return {valuemou::from(arg0, env, mem)};
153
+ if (arg0.IsBuffer()) {
154
+ return {arg0.As<Napi::Buffer<char>>()};
155
+ } else if (!arg0.IsString()) {
156
+ throw Napi::Error::New(env, "key must be a Buffer or String");
157
+ }
158
+ return {arg0.As<Napi::String>(), env, mem};
170
159
  }
171
160
 
172
161
  static inline keymou from(const Napi::Value& arg0,
@@ -190,16 +179,6 @@ struct keymou final
190
179
  }
191
180
  return from(arg0, env, num);
192
181
  }
193
-
194
- Napi::Value to_number(const Napi::Env& env) const
195
- {
196
- return Napi::Number::New(env, static_cast<double>(as_int64()));
197
- }
198
-
199
- Napi::Value to_bigint(const Napi::Env& env) const
200
- {
201
- return Napi::BigInt::New(env, as_uint64());
202
- }
203
182
  };
204
183
 
205
- } // mdbxmou
184
+ } // mdbxmou
@@ -1,38 +0,0 @@
1
- name: ci-android
2
-
3
- env:
4
- CI: GITHUB
5
-
6
- concurrency:
7
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8
- cancel-in-progress: true
9
-
10
- on: [push]
11
-
12
- jobs:
13
- ci-job:
14
- runs-on: ${{ matrix.os }}
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ndk: [r26d, r27c]
19
- target: [arm64-v8a, "armeabi-v7a with NEON", x86_64]
20
- build-type: [Debug, Release]
21
- os: [ubuntu-latest]
22
- exclude:
23
- - ndk: r26d
24
- build-type: Debug
25
- steps:
26
- - uses: actions/checkout@v4
27
- - uses: nttld/setup-ndk@v1
28
- id: setup-ndk
29
- with:
30
- ndk-version: ${{ matrix.ndk }}
31
- add-to-path: true
32
- - name: ci-step
33
- env:
34
- ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
35
- CI_MAKE_TARGET: ""
36
- shell: bash
37
- run: |
38
- . ci.sh "-DANDROID_ABI=${{ matrix.target }}|-DCMAKE_TOOLCHAIN_FILE:PATH=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake|-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}"
@@ -1,40 +0,0 @@
1
- name: ci-mingw
2
-
3
- env:
4
- CI: GITHUB
5
-
6
- concurrency:
7
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8
- cancel-in-progress: true
9
-
10
- on: [push]
11
-
12
- jobs:
13
- ci-job:
14
- runs-on: ${{ matrix.os }}
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- build-type: [Debug, Release]
19
- dll: [ON, OFF]
20
- without_crt: [ON, OFF]
21
- os: [windows-latest]
22
- exclude:
23
- - build-type: Debug
24
- dll: OFF
25
- - build-type: Release
26
- without_crt: ON
27
- steps:
28
- - uses: actions/checkout@v4
29
- # - name: Update mingw64
30
- # run: choco upgrade mingw -y --no-progress
31
- - name: ci-step
32
- shell: bash
33
- env:
34
- CI_MAKE_TARGET: smoke
35
- run: |
36
- echo "initial-PATH=$PATH" && \
37
- export "PATH=/c/mingw64/bin:/c/programdata/mingw64/mingw64/bin:$PATH" && \
38
- export MDBX_BUILD_OPTIONS=$(if [ "${{ matrix.build-type }}" = 'Debug' ]; then echo '-DMDBX_FORCE_ASSERTIONS=1'; else echo '-DNDEBUG=1'; fi) && \
39
- export MDBX_BUILD_CXX=$(if [ "${{ matrix.without_crt }}" = 'OFF' ]; then echo 'YES'; else echo 'NO'; fi) && \
40
- . ci.sh "-G|MinGW Makefiles|-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}|-DMDBX_BUILD_SHARED_LIBRARY:BOOL=${{ matrix.dll }}|-DMDBX_WITHOUT_MSVC_CRT:BOOL=${{ matrix.without_crt }}"
@@ -1,34 +0,0 @@
1
- name: ci-posix
2
-
3
- env:
4
- CI: GITHUB
5
-
6
- concurrency:
7
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8
- cancel-in-progress: true
9
-
10
- on: [push]
11
-
12
- jobs:
13
- ci-job:
14
- runs-on: ${{ matrix.os }}
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- os: [ubuntu-24.04, macos-14, macos-26]
19
- build-type: [Debug, Release]
20
- # alloy: [ON, OFF]
21
- cxx: [ON, OFF]
22
- # exclude:
23
- # - os: macos-14
24
- # cxx: OFF
25
- # alloy: ON
26
- steps:
27
- - uses: actions/checkout@v4
28
- - name: ci-step
29
- shell: bash
30
- run: |
31
- export CI_MAKE_TARGET=$(if [ "$(uname)" = 'Linux' ]; then echo 'check'; elif [ "${{ matrix.build-type }}" != 'Debug' ]; then echo 'test'; else echo 'smoke'; fi) && \
32
- export MDBX_BUILD_OPTIONS=$(if [ "${{ matrix.build-type }}" = 'Debug' ]; then echo '-DMDBX_FORCE_ASSERTIONS=1'; else echo '-DNDEBUG=1'; fi) && \
33
- export MDBX_BUILD_CXX=$(if [ "${{ matrix.cxx }}" = 'ON' ]; then echo 'YES'; else echo 'NO'; fi) && \
34
- . ci.sh "-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}|-DMDBX_BUILD_CXX:BOOL=${{ matrix.cxx }}"
@@ -1,45 +0,0 @@
1
- name: ci-wincxx
2
-
3
- env:
4
- CI: GITHUB
5
-
6
- concurrency:
7
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8
- cancel-in-progress: true
9
-
10
- on: [push]
11
-
12
- jobs:
13
- ci-job:
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- toolset: [v142, v143]
18
- cxx: [11, 14, 17, 20]
19
- target: [Win32, x64, ARM64]
20
- build-type: [Debug, Release]
21
- os: [windows-latest, windows-2022]
22
- exclude:
23
- - os: windows-latest
24
- toolset: v142
25
- - os: windows-latest
26
- cxx: 11
27
- - os: windows-2022
28
- toolset: v143
29
- - os: windows-2022
30
- cxx: 20
31
- # - target: x64
32
- # build-type: Debug
33
- - target: ARM64
34
- toolset: v142
35
- runs-on: ${{ matrix.os }}
36
- steps:
37
- - uses: actions/checkout@v4
38
- - name: ci-step
39
- env:
40
- CI_MAKE_TARGET: ""
41
- CXXSTD: "-std=gnu++${{ matrix.cxx }}"
42
- shell: bash
43
- run: |
44
- . ci.sh "-A|${{ matrix.target }}|-T|${{ matrix.toolset }}|-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}|-DCMAKE_CXX_STANDARD=${{ matrix.cxx }}" \
45
- "--config|${{ matrix.build-type }}" "--build-config|${{ matrix.build-type }}"
@@ -1,32 +0,0 @@
1
- name: ci-windows
2
-
3
- env:
4
- CI: GITHUB
5
-
6
- concurrency:
7
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8
- cancel-in-progress: true
9
-
10
- on: [push]
11
-
12
- jobs:
13
- ci-job:
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- toolset: [v143]
18
- dll: [ON, OFF]
19
- without_crt: [ON, OFF]
20
- target: [x64, Win32]
21
- build-type: [Debug, Release]
22
- os: [windows-latest]
23
- runs-on: ${{ matrix.os }}
24
- steps:
25
- - uses: actions/checkout@v4
26
- - name: ci-step
27
- env:
28
- CI_MAKE_TARGET: ""
29
- shell: bash
30
- run: |
31
- . ci.sh "-A|${{ matrix.target }}|-T|${{ matrix.toolset }}|-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}|-DMDBX_BUILD_SHARED_LIBRARY:BOOL=${{ matrix.dll }}|-DMDBX_WITHOUT_MSVC_CRT:BOOL=${{ matrix.without_crt }}" \
32
- "--config|${{ matrix.build-type }}" "--build-config|${{ matrix.build-type }}"
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # This script is temporary, is not part of libmdbx, and is used only for CI testing.
4
- #
5
- #######################################################################################
6
-
7
- function failure() {
8
- echo "Oops, $* failed ;(" >&2
9
- exit 2
10
- }
11
-
12
- export ci_script_recursion="$((++ci_script_recursion))"
13
- if [ $ci_script_recursion -gt 3 ]; then
14
- failure "WTF: ci_script_recursion = $ci_script_recursion ?"
15
- fi
16
-
17
- IFS='|' read -r -a config_args <<< "${1:-}"
18
- IFS='|' read -r -a build_args <<< "${2:-}"
19
- IFS='|' read -r -a test_args <<< "${3:-}"
20
- set -euxo pipefail
21
-
22
- function provide_toolchain {
23
- set +ex
24
- export CC="$((which ${CC:-cc} || which gcc || which clang || which true) 2>/dev/null)"
25
- export CXX="$((which ${CXX:-c++} || which g++ || which clang++ || which true) 2>/dev/null)"
26
- echo "CC: ${CC} => $($CC --version | head -1)"
27
- echo "CXX: ${CXX} => $($CXX --version | head -1)"
28
- CMAKE="$(which cmake 2>/dev/null)"
29
- if [ -z "${CMAKE}" -o -z "$(which ninja 2>/dev/null)" ]; then
30
- SUDO=$(which sudo 2>&-)
31
- if [ -n "$(which apt 2>/dev/null)" ]; then
32
- ${SUDO} apt update && sudo apt install -y cmake ninja-build libgtest-dev
33
- elif [ -n "$(which dnf 2>/dev/null)" ]; then
34
- ${SUDO} dnf install -y cmake ninja-build gtest-devel
35
- elif [ -n "$(which yum 2>/dev/null)" ]; then
36
- ${SUDO} yum install -y cmake ninja-build gtest-devel
37
- fi
38
- CMAKE="$(which cmake 2>/dev/null) | echo false"
39
- fi
40
- CMAKE_VERSION=$(eval expr $("${CMAKE}" --version | sed -n 's/cmake version \([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)/\10000 + \200 + \3/p' || echo '00000'))
41
- echo "CMAKE: ${CMAKE} => $(""${CMAKE}"" --version | head -1) ($CMAKE_VERSION)"
42
- set -euxo pipefail
43
- }
44
-
45
- function default_test {
46
- GTEST_SHUFFLE=1 GTEST_RUNTIME_LIMIT=99 MALLOC_CHECK_=7 MALLOC_PERTURB_=42 \
47
- ctest --output-on-failure --parallel 3 --schedule-random --no-tests=error \
48
- "${test_args[@]+"${test_args[@]}"}"
49
- }
50
-
51
- function default_build {
52
- local cmake_use_ninja=""
53
- if "${CMAKE}" --help | grep -iq ninja && [ -n "$(which ninja 2>/dev/null)" ] && echo " ${config_args[@]+"${config_args[@]}"}" | grep -qv -e ' -[GTA] '; then
54
- echo "NINJA: $(which ninja 2>/dev/null) => $(ninja --version | head -1)"
55
- cmake_use_ninja="-G Ninja"
56
- fi
57
- "${CMAKE}" ${cmake_use_ninja} "${config_args[@]+"${config_args[@]}"}" .. && "${CMAKE}" --build . --verbose "${build_args[@]+"${build_args[@]}"}"
58
- }
59
-
60
- function default_ci {
61
- provide_toolchain
62
- local skipped=true
63
- local ok=true
64
- if [ -e CMakeLists.txt -a $CMAKE_VERSION -ge 30002 ]; then
65
- skipped=false
66
- mkdir @ci-cmake-build && (cd @ci-cmake-build && default_build && default_test && echo "Done (cmake)") || ok=false
67
- fi
68
- if [ -n "$CC" -a -n "${CI_MAKE_TARGET=test}" ] && [ -e GNUmakefile -o -e Makefile -o -e makefile ]; then
69
- skipped=false
70
- make -j2 all && make ${CI_MAKE_TARGET} && echo "Done (make)" || ok=false
71
- fi
72
- if [ $skipped = "true" ]; then
73
- echo "Skipped since CMAKE_VERSION ($CMAKE_VERSION) < 3.0.2 and no Makefile"
74
- elif [ $ok != "true" ]; then
75
- exit 1
76
- fi
77
- }
78
-
79
- git clean -x -f -d || echo "ignore 'git clean' error"
80
- git describe --tags || git show --oneline -s
81
-
82
- if [ -z "${CI_ACTION:-}" ]; then
83
- CI_ACTION=default_ci
84
- fi
85
-
86
- $CI_ACTION || failure $CI_ACTION
@@ -1,16 +0,0 @@
1
- pkgbase = libmdbx
2
- pkgdesc = One of the fastest compact key-value ACID database without WAL, which surpasses the legendary LMDB in terms of reliability, features and performance. At the end of 2024 MDBX was chosen by all modern Ethereum frontiers/nodes as a storage engine.
3
- pkgver = 0.13.10
4
- pkgrel = 2
5
- url = https://libmdbx.dqdkfa.ru/
6
- arch = x86_64
7
- arch = i686
8
- arch = ARM
9
- arch = aarch64
10
- arch = powerpc64le
11
- license = Apache-2
12
- depends = glibc
13
- source = libmdbx-0.13.10.tar.xz::https://libmdbx.dqdkfa.ru/release/libmdbx-amalgamated-0.13.10.tar.xz
14
- sha256sums = e6c9af085390c41d101fce0a72794c77159e1e271e41077ea0fd4270b43cc56c
15
-
16
- pkgname = libmdbx
@@ -1,38 +0,0 @@
1
- # Maintainer: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2
- # Contributor: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
3
- # Contributor: Noel Kuntze <noel.kuntze@thermi.consulting>
4
- pkgname=libmdbx
5
- pkgver=0.13.10
6
- pkgrel=2
7
- pkgdesc="One of the fastest compact key-value ACID database without WAL, which surpasses the legendary LMDB in terms of reliability, features and performance. At the end of 2024 MDBX was chosen by all modern Ethereum frontiers/nodes as a storage engine."
8
- url="https://libmdbx.dqdkfa.ru/"
9
- arch=('x86_64' 'i686' 'ARM' 'aarch64' 'powerpc64le')
10
- license=('Apache-2')
11
- depends=('glibc')
12
- subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
13
- source=("$pkgname-$pkgver.tar.xz::https://libmdbx.dqdkfa.ru/release/libmdbx-amalgamated-$pkgver.tar.xz")
14
- sha256sums=('e6c9af085390c41d101fce0a72794c77159e1e271e41077ea0fd4270b43cc56c')
15
-
16
- build() {
17
- make -C "$srcdir" \
18
- DESTDIR="$pkgdir" prefix=/usr \
19
- CFLAGS="$CFLAGS -std=gnu11 -ffunction-sections -fPIC -fvisibility=hidden -pthread" \
20
- CXXFLAGS="$CXXFLAGS -std=gnu++20 -ffunction-sections -fPIC -fvisibility=hidden -pthread" \
21
- lib-shared tools
22
- }
23
-
24
- check() {
25
- echo " Testing a storage engine is a very voluminous and complex task that requires many hours of processor time."
26
- echo " Any simple tests will only verify the success of the build and create an unjustified illusion."
27
- echo " Therefore, full-fledged testing of libmdbx is performed during development and releasing, but the test framework used for this purpose is not included in the amalgamated source code of libmdbx releases."
28
- echo " The users are invited to use their own integration and functional tests, and if necessary to test libmdbx itself use a whole source code from the git repository."
29
- }
30
-
31
- package() {
32
- make -C "$srcdir" \
33
- DESTDIR="$pkgdir" prefix=/usr \
34
- CFLAGS="$CFLAGS -std=gnu11 -ffunction-sections -fPIC -fvisibility=hidden -pthread" \
35
- CXXFLAGS="$CXXFLAGS -std=gnu++20 -ffunction-sections -fPIC -fvisibility=hidden -pthread" \
36
- install-no-strip
37
- }
38
-