git-sqlite-vfs 0.0.0 → 0.0.2
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.
- package/c/Makefile +10 -2
- package/index.js +1 -1
- package/install.js +1 -1
- package/package.json +1 -1
package/c/Makefile
CHANGED
|
@@ -2,13 +2,21 @@ CC = gcc
|
|
|
2
2
|
CFLAGS = -Wall -Wextra -g -O2 -std=c99 -D_POSIX_C_SOURCE=200809L
|
|
3
3
|
LDFLAGS = -lsqlite3
|
|
4
4
|
|
|
5
|
+
# On macOS, loadable extensions must dynamically look up SQLite symbols
|
|
6
|
+
UNAME_S := $(shell uname -s)
|
|
7
|
+
ifeq ($(UNAME_S),Darwin)
|
|
8
|
+
SHARED_LDFLAGS = -undefined dynamic_lookup
|
|
9
|
+
else
|
|
10
|
+
SHARED_LDFLAGS =
|
|
11
|
+
endif
|
|
12
|
+
|
|
5
13
|
SRC_DIR = .
|
|
6
14
|
OUT_DIR = output
|
|
7
15
|
|
|
8
16
|
all: $(OUT_DIR)/gitvfs_test $(OUT_DIR)/git-merge-sqlitevfs $(OUT_DIR)/gitvfs.so
|
|
9
17
|
|
|
10
18
|
$(OUT_DIR)/gitvfs.so: $(SRC_DIR)/gitvfs.c $(SRC_DIR)/gitvfs.h | $(OUT_DIR)
|
|
11
|
-
$(CC) $(CFLAGS) -fPIC -shared -DCOMPILE_SQLITE_EXTENSION $(SRC_DIR)/gitvfs.c -o $(OUT_DIR)/gitvfs.so $(
|
|
19
|
+
$(CC) $(CFLAGS) -fPIC -shared -DCOMPILE_SQLITE_EXTENSION $(SRC_DIR)/gitvfs.c -o $(OUT_DIR)/gitvfs.so $(SHARED_LDFLAGS)
|
|
12
20
|
|
|
13
21
|
$(OUT_DIR)/gitvfs.o: $(SRC_DIR)/gitvfs.c $(SRC_DIR)/gitvfs.h | $(OUT_DIR)
|
|
14
22
|
$(CC) $(CFLAGS) -c $(SRC_DIR)/gitvfs.c -o $(OUT_DIR)/gitvfs.o
|
|
@@ -27,4 +35,4 @@ $(OUT_DIR):
|
|
|
27
35
|
|
|
28
36
|
clean:
|
|
29
37
|
rm -rf $(OUT_DIR)
|
|
30
|
-
rm -rf .db .git
|
|
38
|
+
rm -rf .db .git
|
package/index.js
CHANGED
|
@@ -18,7 +18,7 @@ class GitSQLite {
|
|
|
18
18
|
const tempDb = new Database(':memory:');
|
|
19
19
|
|
|
20
20
|
// 2. Enable extensions and load our compiled C VFS extension (.so)
|
|
21
|
-
tempDb.loadExtension(path.resolve(__dirname, '
|
|
21
|
+
tempDb.loadExtension(path.resolve(__dirname, 'c/output/gitvfs'));
|
|
22
22
|
|
|
23
23
|
// 3. Close tempDb. The SQLite runtime inside the Node process
|
|
24
24
|
// will permanently retain the global 'gitvfs' registration!
|
package/install.js
CHANGED
|
@@ -29,7 +29,7 @@ function buildFromSource() {
|
|
|
29
29
|
function downloadAndExtract() {
|
|
30
30
|
// If the SKIP_DOWNLOAD env var is set, or if we are building locally from the repo root
|
|
31
31
|
// we should just build from source.
|
|
32
|
-
if (process.env.SKIP_DOWNLOAD || !
|
|
32
|
+
if (process.env.SKIP_DOWNLOAD || !__dirname.includes('node_modules')) {
|
|
33
33
|
return buildFromSource();
|
|
34
34
|
}
|
|
35
35
|
|