1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
Index: Makefile.in
==================================================================
--- Makefile.in
+++ Makefile.in
@@ -1598,11 +1598,11 @@
# Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD
# to find it.
#
tclextension-install: tclsqlite3.c
- $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --cc "$(CC)" $(CFLAGS) $(OPT_FEATURE_FLAGS) $(OPTS)
+ $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --destdir "$(DESTDIR)" --cc "$(CC)" $(CFLAGS) $(OPT_FEATURE_FLAGS) $(OPTS)
# Install the SQLite TCL extension that is used by $TCLSH_CMD
#
tclextension-uninstall:
$(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall
Index: tool/buildtclext.tcl
==================================================================
--- tool/buildtclext.tcl
+++ tool/buildtclext.tcl
@@ -15,6 +15,7 @@
--info Show info on existing SQLite TCL extension installs
--install-only Install an extension previously build
--uninstall Uninstall the extension
+ --destdir DIR Installation root (used by "make install DESTDIR=...")
Other options are retained and passed through into the compiler.}
@@ -25,6 +26,7 @@
set infoonly 0
set CC {}
set OPTS {}
+set DESTDIR ""; # --destdir "$(DESTDIR)"
for {set ii 0} {$ii<[llength $argv]} {incr ii} {
set a0 [lindex $argv $ii]
if {$a0=="--install-only"} {
@@ -42,6 +44,9 @@
} elseif {$a0=="--cc" && $ii+1<[llength $argv]} {
incr ii
set CC [lindex $argv $ii]
+ } elseif {$a0=="--destdir" && $ii+1<[llength $argv]} {
+ incr ii
+ set DESTDIR [lindex $argv $ii]
} elseif {[string match -* $a0]} {
append OPTS " $a0"
} else {
@@ -245,7 +250,7 @@
if {$install} {
# Install the extension
- set DEST2 $DEST/sqlite$VERSION
+ set DEST2 ${DESTDIR}$DEST/sqlite$VERSION
file mkdir $DEST2
puts "installing $DEST2/pkgIndex.tcl"
file copy -force pkgIndex.tcl $DEST2
Index: tool/buildtclext.tcl
==================================================================
--- tool/buildtclext.tcl
+++ tool/buildtclext.tcl
@@ -196,11 +196,19 @@
# Figure out where the extension will be installed. Put the extension
# in the first writable directory on $auto_path.
#
set DEST {}
foreach dir $auto_path {
- if {[file writable $dir]} {
+ if {[string match //*:* $dir]} {
+ # We can't install to //zipfs: paths
+ continue
+ } elseif {"" ne $DESTDIR && ![file writable $DESTDIR]} {
+ continue
+ }
+ set dir ${DESTDIR}$dir
+ if {[file writable $dir] || "" ne $DESTDIR} {
+ # the dir will be created later ^^^^^^^^
set DEST $dir
break
} elseif {[glob -nocomplain $dir/sqlite3*/pkgIndex.tcl]!=""} {
set conflict [lindex [glob $dir/sqlite3*/pkgIndex.tcl] 0]
puts "Unable to install. There is already a conflicting version"
@@ -214,11 +222,11 @@
puts "None of the directories on \$auto_path are writable by this process,"
puts "so the installation cannot take place. Consider running using sudo"
puts "to work around this problem.\n"
puts "These are the (unwritable) \$auto_path directories:\n"
foreach dir $auto_path {
- puts " * $dir"
+ puts " * ${DESTDIR}$dir"
}
exit 1
}
}
@@ -248,12 +256,12 @@
}
if {$install} {
# Install the extension
- set DEST2 ${DESTDIR}$DEST/sqlite$VERSION
+ set DEST2 $DEST/sqlite$VERSION
file mkdir $DEST2
puts "installing $DEST2/pkgIndex.tcl"
file copy -force pkgIndex.tcl $DEST2
puts "installing $DEST2/$OUT"
file copy -force $OUT $DEST2
}
|