@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,73 +1,73 @@
1
- /* sample-bdb.txt - BerkeleyDB toy/sample
2
- *
3
- * Do a line-by-line comparison of this and sample-mdb.txt
4
- */
5
- /*
6
- * Copyright 2012-2020 Howard Chu, Symas Corp.
7
- * All rights reserved.
8
- *
9
- * Redistribution and use in source and binary forms, with or without
10
- * modification, are permitted only as authorized by the OpenLDAP
11
- * Public License.
12
- *
13
- * A copy of this license is available in the file LICENSE in the
14
- * top-level directory of the distribution or, alternatively, at
15
- * <http://www.OpenLDAP.org/license.html>.
16
- */
17
- #include <stdio.h>
18
- #include <string.h>
19
- #include <db.h>
20
-
21
- int main(int argc,char * argv[])
22
- {
23
- int rc;
24
- DB_ENV *env;
25
- DB *dbi;
26
- DBT key, data;
27
- DB_TXN *txn;
28
- DBC *cursor;
29
- char sval[32], kval[32];
30
-
31
- /* Note: Most error checking omitted for simplicity */
32
-
33
- #define FLAGS (DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL|DB_CREATE|DB_THREAD)
34
- rc = db_env_create(&env, 0);
35
- rc = env->open(env, "./testdb", FLAGS, 0664);
36
- rc = db_create(&dbi, env, 0);
37
- rc = env->txn_begin(env, NULL, &txn, 0);
38
- rc = dbi->open(dbi, txn, "test.bdb", NULL, DB_BTREE, DB_CREATE, 0664);
39
-
40
- memset(&key, 0, sizeof(DBT));
41
- memset(&data, 0, sizeof(DBT));
42
- key.size = sizeof(int);
43
- key.data = sval;
44
- data.size = sizeof(sval);
45
- data.data = sval;
46
-
47
- sprintf(sval, "%03x %d foo bar", 32, 3141592);
48
- rc = dbi->put(dbi, txn, &key, &data, 0);
49
- rc = txn->commit(txn, 0);
50
- if (rc) {
51
- fprintf(stderr, "txn->commit: (%d) %s\n", rc, db_strerror(rc));
52
- goto leave;
53
- }
54
- rc = env->txn_begin(env, NULL, &txn, 0);
55
- rc = dbi->cursor(dbi, txn, &cursor, 0);
56
- key.flags = DB_DBT_USERMEM;
57
- key.data = kval;
58
- key.ulen = sizeof(kval);
59
- data.flags = DB_DBT_USERMEM;
60
- data.data = sval;
61
- data.ulen = sizeof(sval);
62
- while ((rc = cursor->c_get(cursor, &key, &data, DB_NEXT)) == 0) {
63
- printf("key: %p %.*s, data: %p %.*s\n",
64
- key.data, (int) key.size, (char *) key.data,
65
- data.data, (int) data.size, (char *) data.data);
66
- }
67
- rc = cursor->c_close(cursor);
68
- rc = txn->abort(txn);
69
- leave:
70
- rc = dbi->close(dbi, 0);
71
- rc = env->close(env, 0);
72
- return rc;
73
- }
1
+ /* sample-bdb.txt - BerkeleyDB toy/sample
2
+ *
3
+ * Do a line-by-line comparison of this and sample-mdb.txt
4
+ */
5
+ /*
6
+ * Copyright 2012-2021 Howard Chu, Symas Corp.
7
+ * All rights reserved.
8
+ *
9
+ * Redistribution and use in source and binary forms, with or without
10
+ * modification, are permitted only as authorized by the OpenLDAP
11
+ * Public License.
12
+ *
13
+ * A copy of this license is available in the file LICENSE in the
14
+ * top-level directory of the distribution or, alternatively, at
15
+ * <http://www.OpenLDAP.org/license.html>.
16
+ */
17
+ #include <stdio.h>
18
+ #include <string.h>
19
+ #include <db.h>
20
+
21
+ int main(int argc,char * argv[])
22
+ {
23
+ int rc;
24
+ DB_ENV *env;
25
+ DB *dbi;
26
+ DBT key, data;
27
+ DB_TXN *txn;
28
+ DBC *cursor;
29
+ char sval[32], kval[32];
30
+
31
+ /* Note: Most error checking omitted for simplicity */
32
+
33
+ #define FLAGS (DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL|DB_CREATE|DB_THREAD)
34
+ rc = db_env_create(&env, 0);
35
+ rc = env->open(env, "./testdb", FLAGS, 0664);
36
+ rc = db_create(&dbi, env, 0);
37
+ rc = env->txn_begin(env, NULL, &txn, 0);
38
+ rc = dbi->open(dbi, txn, "test.bdb", NULL, DB_BTREE, DB_CREATE, 0664);
39
+
40
+ memset(&key, 0, sizeof(DBT));
41
+ memset(&data, 0, sizeof(DBT));
42
+ key.size = sizeof(int);
43
+ key.data = sval;
44
+ data.size = sizeof(sval);
45
+ data.data = sval;
46
+
47
+ sprintf(sval, "%03x %d foo bar", 32, 3141592);
48
+ rc = dbi->put(dbi, txn, &key, &data, 0);
49
+ rc = txn->commit(txn, 0);
50
+ if (rc) {
51
+ fprintf(stderr, "txn->commit: (%d) %s\n", rc, db_strerror(rc));
52
+ goto leave;
53
+ }
54
+ rc = env->txn_begin(env, NULL, &txn, 0);
55
+ rc = dbi->cursor(dbi, txn, &cursor, 0);
56
+ key.flags = DB_DBT_USERMEM;
57
+ key.data = kval;
58
+ key.ulen = sizeof(kval);
59
+ data.flags = DB_DBT_USERMEM;
60
+ data.data = sval;
61
+ data.ulen = sizeof(sval);
62
+ while ((rc = cursor->c_get(cursor, &key, &data, DB_NEXT)) == 0) {
63
+ printf("key: %p %.*s, data: %p %.*s\n",
64
+ key.data, (int) key.size, (char *) key.data,
65
+ data.data, (int) data.size, (char *) data.data);
66
+ }
67
+ rc = cursor->c_close(cursor);
68
+ rc = txn->abort(txn);
69
+ leave:
70
+ rc = dbi->close(dbi, 0);
71
+ rc = env->close(env, 0);
72
+ return rc;
73
+ }
@@ -1,62 +1,62 @@
1
- /* sample-mdb.txt - MDB toy/sample
2
- *
3
- * Do a line-by-line comparison of this and sample-bdb.txt
4
- */
5
- /*
6
- * Copyright 2012-2020 Howard Chu, Symas Corp.
7
- * All rights reserved.
8
- *
9
- * Redistribution and use in source and binary forms, with or without
10
- * modification, are permitted only as authorized by the OpenLDAP
11
- * Public License.
12
- *
13
- * A copy of this license is available in the file LICENSE in the
14
- * top-level directory of the distribution or, alternatively, at
15
- * <http://www.OpenLDAP.org/license.html>.
16
- */
17
- #include <stdio.h>
18
- #include "lmdb.h"
19
-
20
- int main(int argc,char * argv[])
21
- {
22
- int rc;
23
- MDB_env *env;
24
- MDB_dbi dbi;
25
- MDB_val key, data;
26
- MDB_txn *txn;
27
- MDB_cursor *cursor;
28
- char sval[32];
29
-
30
- /* Note: Most error checking omitted for simplicity */
31
-
32
- rc = mdb_env_create(&env);
33
- rc = mdb_env_open(env, "./testdb", 0, 0664);
34
- rc = mdb_txn_begin(env, NULL, 0, &txn);
35
- rc = mdb_dbi_open(txn, NULL, 0, &dbi);
36
-
37
- key.mv_size = sizeof(int);
38
- key.mv_data = sval;
39
- data.mv_size = sizeof(sval);
40
- data.mv_data = sval;
41
-
42
- sprintf(sval, "%03x %d foo bar", 32, 3141592);
43
- rc = mdb_put(txn, dbi, &key, &data, 0);
44
- rc = mdb_txn_commit(txn);
45
- if (rc) {
46
- fprintf(stderr, "mdb_txn_commit: (%d) %s\n", rc, mdb_strerror(rc));
47
- goto leave;
48
- }
49
- rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
50
- rc = mdb_cursor_open(txn, dbi, &cursor);
51
- while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
52
- printf("key: %p %.*s, data: %p %.*s\n",
53
- key.mv_data, (int) key.mv_size, (char *) key.mv_data,
54
- data.mv_data, (int) data.mv_size, (char *) data.mv_data);
55
- }
56
- mdb_cursor_close(cursor);
57
- mdb_txn_abort(txn);
58
- leave:
59
- mdb_dbi_close(env, dbi);
60
- mdb_env_close(env);
61
- return 0;
62
- }
1
+ /* sample-mdb.txt - MDB toy/sample
2
+ *
3
+ * Do a line-by-line comparison of this and sample-bdb.txt
4
+ */
5
+ /*
6
+ * Copyright 2012-2021 Howard Chu, Symas Corp.
7
+ * All rights reserved.
8
+ *
9
+ * Redistribution and use in source and binary forms, with or without
10
+ * modification, are permitted only as authorized by the OpenLDAP
11
+ * Public License.
12
+ *
13
+ * A copy of this license is available in the file LICENSE in the
14
+ * top-level directory of the distribution or, alternatively, at
15
+ * <http://www.OpenLDAP.org/license.html>.
16
+ */
17
+ #include <stdio.h>
18
+ #include "lmdb.h"
19
+
20
+ int main(int argc,char * argv[])
21
+ {
22
+ int rc;
23
+ MDB_env *env;
24
+ MDB_dbi dbi;
25
+ MDB_val key, data;
26
+ MDB_txn *txn;
27
+ MDB_cursor *cursor;
28
+ char sval[32];
29
+
30
+ /* Note: Most error checking omitted for simplicity */
31
+
32
+ rc = mdb_env_create(&env);
33
+ rc = mdb_env_open(env, "./testdb", 0, 0664);
34
+ rc = mdb_txn_begin(env, NULL, 0, &txn);
35
+ rc = mdb_dbi_open(txn, NULL, 0, &dbi);
36
+
37
+ key.mv_size = sizeof(int);
38
+ key.mv_data = sval;
39
+ data.mv_size = sizeof(sval);
40
+ data.mv_data = sval;
41
+
42
+ sprintf(sval, "%03x %d foo bar", 32, 3141592);
43
+ rc = mdb_put(txn, dbi, &key, &data, 0);
44
+ rc = mdb_txn_commit(txn);
45
+ if (rc) {
46
+ fprintf(stderr, "mdb_txn_commit: (%d) %s\n", rc, mdb_strerror(rc));
47
+ goto leave;
48
+ }
49
+ rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
50
+ rc = mdb_cursor_open(txn, dbi, &cursor);
51
+ while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
52
+ printf("key: %p %.*s, data: %p %.*s\n",
53
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
54
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
55
+ }
56
+ mdb_cursor_close(cursor);
57
+ mdb_txn_abort(txn);
58
+ leave:
59
+ mdb_dbi_close(env, dbi);
60
+ mdb_env_close(env);
61
+ return 0;
62
+ }
@@ -1,27 +1,22 @@
1
- <tagfile>
2
- <compound kind="page">
3
- <name>mdb_copy_1</name>
4
- <title>mdb_copy - environment copy tool</title>
5
- <filename>mdb_copy.1</filename>
6
- </compound>
7
- <compound kind="page">
8
- <name>mdb_drop_1</name>
9
- <title>mdb_drop - database delete tool</title>
10
- <filename>mdb_drop.1</filename>
11
- </compound>
12
- <compound kind="page">
13
- <name>mdb_dump_1</name>
14
- <title>mdb_dump - environment export tool</title>
15
- <filename>mdb_dump.1</filename>
16
- </compound>
17
- <compound kind="page">
18
- <name>mdb_load_1</name>
19
- <title>mdb_load - environment import tool</title>
20
- <filename>mdb_load.1</filename>
21
- </compound>
22
- <compound kind="page">
23
- <name>mdb_stat_1</name>
24
- <title>mdb_stat - environment status tool</title>
25
- <filename>mdb_stat.1</filename>
26
- </compound>
27
- </tagfile>
1
+ <tagfile>
2
+ <compound kind="page">
3
+ <name>mdb_copy_1</name>
4
+ <title>mdb_copy - environment copy tool</title>
5
+ <filename>mdb_copy.1</filename>
6
+ </compound>
7
+ <compound kind="page">
8
+ <name>mdb_dump_1</name>
9
+ <title>mdb_dump - environment export tool</title>
10
+ <filename>mdb_dump.1</filename>
11
+ </compound>
12
+ <compound kind="page">
13
+ <name>mdb_load_1</name>
14
+ <title>mdb_load - environment import tool</title>
15
+ <filename>mdb_load.1</filename>
16
+ </compound>
17
+ <compound kind="page">
18
+ <name>mdb_stat_1</name>
19
+ <title>mdb_stat - environment status tool</title>
20
+ <filename>mdb_stat.1</filename>
21
+ </compound>
22
+ </tagfile>
@@ -1,11 +1,11 @@
1
- This repository uses 2 different licenses :
2
- - all files in the `lib` directory use a BSD 2-Clause license
3
- - all other files use a GPLv2 license, unless explicitly stated otherwise
4
-
5
- Relevant license is reminded at the top of each source file,
6
- and with presence of COPYING or LICENSE file in associated directories.
7
-
8
- This model is selected to emphasize that
9
- files in the `lib` directory are designed to be included into 3rd party applications,
10
- while all other files, in `programs`, `tests` or `examples`,
11
- receive more limited attention and support for such scenario.
1
+ This repository uses 2 different licenses :
2
+ - all files in the `lib` directory use a BSD 2-Clause license
3
+ - all other files use a GPLv2 license, unless explicitly stated otherwise
4
+
5
+ Relevant license is reminded at the top of each source file,
6
+ and with presence of COPYING or LICENSE file in associated directories.
7
+
8
+ This model is selected to emphasize that
9
+ files in the `lib` directory are designed to be included into 3rd party applications,
10
+ while all other files, in `programs`, `tests` or `examples`,
11
+ receive more limited attention and support for such scenario.
@@ -1,24 +1,24 @@
1
- LZ4 Library
2
- Copyright (c) 2011-2016, Yann Collet
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without modification,
6
- are permitted provided that the following conditions are met:
7
-
8
- * Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- * Redistributions in binary form must reproduce the above copyright notice, this
12
- list of conditions and the following disclaimer in the documentation and/or
13
- other materials provided with the distribution.
14
-
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
19
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ LZ4 Library
2
+ Copyright (c) 2011-2020, Yann Collet
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
19
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,225 @@
1
+ # ################################################################
2
+ # LZ4 library - Makefile
3
+ # Copyright (C) Yann Collet 2011-2020
4
+ # All rights reserved.
5
+ #
6
+ # This Makefile is validated for Linux, macOS, *BSD, Hurd, Solaris, MSYS2 targets
7
+ #
8
+ # BSD license
9
+ # Redistribution and use in source and binary forms, with or without modification,
10
+ # are permitted provided that the following conditions are met:
11
+ #
12
+ # * Redistributions of source code must retain the above copyright notice, this
13
+ # list of conditions and the following disclaimer.
14
+ #
15
+ # * Redistributions in binary form must reproduce the above copyright notice, this
16
+ # list of conditions and the following disclaimer in the documentation and/or
17
+ # other materials provided with the distribution.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ #
30
+ # You can contact the author at :
31
+ # - LZ4 source repository : https://github.com/lz4/lz4
32
+ # - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
33
+ # ################################################################
34
+ SED = sed
35
+
36
+ # Version numbers
37
+ LIBVER_MAJOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
38
+ LIBVER_MINOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
39
+ LIBVER_PATCH_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
40
+ LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
41
+ LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
42
+ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
43
+ LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
44
+ LIBVER := $(shell echo $(LIBVER_SCRIPT))
45
+
46
+ BUILD_SHARED:=yes
47
+ BUILD_STATIC:=yes
48
+
49
+ CPPFLAGS+= -DXXH_NAMESPACE=LZ4_
50
+ CPPFLAGS+= $(MOREFLAGS)
51
+ CFLAGS ?= -O3
52
+ DEBUGFLAGS:= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
53
+ -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \
54
+ -Wundef -Wpointer-arith -Wstrict-aliasing=1
55
+ CFLAGS += $(DEBUGFLAGS)
56
+ FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
57
+
58
+ SRCFILES := $(sort $(wildcard *.c))
59
+
60
+ include ../Makefile.inc
61
+
62
+ # OS X linker doesn't support -soname, and use different extension
63
+ # see : https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html
64
+ ifeq ($(TARGET_OS), Darwin)
65
+ SHARED_EXT = dylib
66
+ SHARED_EXT_MAJOR = $(LIBVER_MAJOR).$(SHARED_EXT)
67
+ SHARED_EXT_VER = $(LIBVER).$(SHARED_EXT)
68
+ SONAME_FLAGS = -install_name $(libdir)/liblz4.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER)
69
+ else
70
+ SONAME_FLAGS = -Wl,-soname=liblz4.$(SHARED_EXT).$(LIBVER_MAJOR)
71
+ SHARED_EXT = so
72
+ SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR)
73
+ SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER)
74
+ endif
75
+
76
+ .PHONY: default
77
+ default: lib-release
78
+
79
+ # silent mode by default; verbose can be triggered by V=1 or VERBOSE=1
80
+ $(V)$(VERBOSE).SILENT:
81
+
82
+ lib-release: DEBUGFLAGS :=
83
+ lib-release: lib
84
+
85
+ .PHONY: lib
86
+ lib: liblz4.a liblz4
87
+
88
+ .PHONY: all
89
+ all: lib
90
+
91
+ .PHONY: all32
92
+ all32: CFLAGS+=-m32
93
+ all32: all
94
+
95
+ liblz4.a: $(SRCFILES)
96
+ ifeq ($(BUILD_STATIC),yes) # can be disabled on command line
97
+ @echo compiling static library
98
+ $(COMPILE.c) $^
99
+ $(AR) rcs $@ *.o
100
+ endif
101
+
102
+ ifeq ($(WINBASED),yes)
103
+ liblz4-dll.rc: liblz4-dll.rc.in
104
+ @echo creating library resource
105
+ $(SED) -e 's|@LIBLZ4@|$(LIBLZ4)|' \
106
+ -e 's|@LIBVER_MAJOR@|$(LIBVER_MAJOR)|g' \
107
+ -e 's|@LIBVER_MINOR@|$(LIBVER_MINOR)|g' \
108
+ -e 's|@LIBVER_PATCH@|$(LIBVER_PATCH)|g' \
109
+ $< >$@
110
+
111
+ liblz4-dll.o: liblz4-dll.rc
112
+ $(WINDRES) -i liblz4-dll.rc -o liblz4-dll.o
113
+
114
+ $(LIBLZ4): $(SRCFILES) liblz4-dll.o
115
+ @echo compiling dynamic library $(LIBVER)
116
+ $(CC) $(FLAGS) -DLZ4_DLL_EXPORT=1 -shared $^ -o dll/$@.dll -Wl,--out-implib,dll/$(LIBLZ4_EXP)
117
+
118
+ else # not windows
119
+
120
+ $(LIBLZ4): $(SRCFILES)
121
+ @echo compiling dynamic library $(LIBVER)
122
+ $(CC) $(FLAGS) -shared $^ -fPIC -fvisibility=hidden $(SONAME_FLAGS) -o $@
123
+ @echo creating versioned links
124
+ $(LN_SF) $@ liblz4.$(SHARED_EXT_MAJOR)
125
+ $(LN_SF) $@ liblz4.$(SHARED_EXT)
126
+
127
+ endif
128
+
129
+ .PHONY: liblz4
130
+ liblz4: $(LIBLZ4)
131
+
132
+ .PHONY: clean
133
+ clean:
134
+ ifeq ($(WINBASED),yes)
135
+ $(RM) *.rc
136
+ endif
137
+ $(RM) core *.o liblz4.pc dll/$(LIBLZ4).dll dll/$(LIBLZ4_EXP)
138
+ $(RM) *.a *.$(SHARED_EXT) *.$(SHARED_EXT_MAJOR) *.$(SHARED_EXT_VER)
139
+ @echo Cleaning library completed
140
+
141
+ #-----------------------------------------------------------------------------
142
+ # make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets
143
+ #-----------------------------------------------------------------------------
144
+ ifeq ($(POSIX_ENV),Yes)
145
+
146
+ .PHONY: listL120
147
+ listL120: # extract lines >= 120 characters in *.{c,h}, by Takayuki Matsuoka (note : $$, for Makefile compatibility)
148
+ find . -type f -name '*.c' -o -name '*.h' | while read -r filename; do awk 'length > 120 {print FILENAME "(" FNR "): " $$0}' $$filename; done
149
+
150
+ DESTDIR ?=
151
+ # directory variables : GNU conventions prefer lowercase
152
+ # see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
153
+ # support both lower and uppercase (BSD), use lower in script
154
+ PREFIX ?= /usr/local
155
+ prefix ?= $(PREFIX)
156
+ EXEC_PREFIX ?= $(prefix)
157
+ exec_prefix ?= $(EXEC_PREFIX)
158
+ BINDIR ?= $(exec_prefix)/bin
159
+ bindir ?= $(BINDIR)
160
+ LIBDIR ?= $(exec_prefix)/lib
161
+ libdir ?= $(LIBDIR)
162
+ INCLUDEDIR ?= $(prefix)/include
163
+ includedir ?= $(INCLUDEDIR)
164
+
165
+ ifneq (,$(filter $(TARGET_OS),OpenBSD FreeBSD NetBSD DragonFly MidnightBSD))
166
+ PKGCONFIGDIR ?= $(prefix)/libdata/pkgconfig
167
+ else
168
+ PKGCONFIGDIR ?= $(libdir)/pkgconfig
169
+ endif
170
+ pkgconfigdir ?= $(PKGCONFIGDIR)
171
+
172
+ liblz4.pc: liblz4.pc.in Makefile
173
+ @echo creating pkgconfig
174
+ $(SED) -e 's|@PREFIX@|$(prefix)|' \
175
+ -e 's|@LIBDIR@|$(libdir)|' \
176
+ -e 's|@INCLUDEDIR@|$(includedir)|' \
177
+ -e 's|@VERSION@|$(LIBVER)|' \
178
+ -e 's|=${prefix}/|=$${prefix}/|' \
179
+ $< >$@
180
+
181
+ install: lib liblz4.pc
182
+ $(INSTALL_DIR) $(DESTDIR)$(pkgconfigdir)/ $(DESTDIR)$(includedir)/ $(DESTDIR)$(libdir)/ $(DESTDIR)$(bindir)/
183
+ $(INSTALL_DATA) liblz4.pc $(DESTDIR)$(pkgconfigdir)/
184
+ @echo Installing libraries in $(DESTDIR)$(libdir)
185
+ ifeq ($(BUILD_STATIC),yes)
186
+ $(INSTALL_DATA) liblz4.a $(DESTDIR)$(libdir)/liblz4.a
187
+ $(INSTALL_DATA) lz4frame_static.h $(DESTDIR)$(includedir)/lz4frame_static.h
188
+ endif
189
+ ifeq ($(BUILD_SHARED),yes)
190
+ # Traditionally, one installs the DLLs in the bin directory as programs
191
+ # search them first in their directory. This allows to not pollute system
192
+ # directories (like c:/windows/system32), nor modify the PATH variable.
193
+ ifeq ($(WINBASED),yes)
194
+ $(INSTALL_PROGRAM) dll/$(LIBLZ4).dll $(DESTDIR)$(bindir)
195
+ $(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir)
196
+ else
197
+ $(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)
198
+ $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
199
+ $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
200
+ endif
201
+ endif
202
+ @echo Installing headers in $(DESTDIR)$(includedir)
203
+ $(INSTALL_DATA) lz4.h $(DESTDIR)$(includedir)/lz4.h
204
+ $(INSTALL_DATA) lz4hc.h $(DESTDIR)$(includedir)/lz4hc.h
205
+ $(INSTALL_DATA) lz4frame.h $(DESTDIR)$(includedir)/lz4frame.h
206
+ @echo lz4 libraries installed
207
+
208
+ uninstall:
209
+ $(RM) $(DESTDIR)$(pkgconfigdir)/liblz4.pc
210
+ ifeq (WINBASED,1)
211
+ $(RM) $(DESTDIR)$(bindir)/$(LIBLZ4).dll
212
+ $(RM) $(DESTDIR)$(libdir)/$(LIBLZ4_EXP)
213
+ else
214
+ $(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
215
+ $(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
216
+ $(RM) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_VER)
217
+ endif
218
+ $(RM) $(DESTDIR)$(libdir)/liblz4.a
219
+ $(RM) $(DESTDIR)$(includedir)/lz4.h
220
+ $(RM) $(DESTDIR)$(includedir)/lz4hc.h
221
+ $(RM) $(DESTDIR)$(includedir)/lz4frame.h
222
+ $(RM) $(DESTDIR)$(includedir)/lz4frame_static.h
223
+ @echo lz4 libraries successfully uninstalled
224
+
225
+ endif