Fossil SCM

Enable building with Tcl integration enabled using autosetup and/or makemake.tcl. Patch provided by Steve Bennett.

mistachkin 2011-10-27 13:45 UTC tcl-integration
Commit 5ffb7d71d373d98499b4aa00e3eb51ec0d469e95
+21
--- auto.def
+++ auto.def
@@ -4,10 +4,11 @@
44
55
options {
66
with-openssl:path|auto|none
77
=> {Look for openssl in the given path, or auto or none}
88
with-zlib:path => {Look for zlib in the given path}
9
+ with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
910
internal-sqlite=1 => {Don't use the internal sqlite, use the system one}
1011
static=0 => {Link a static executable}
1112
lineedit=1 => {Disable line editing}
1213
fossil-debug=0 => {Build with fossil debugging enabled}
1314
}
@@ -78,10 +79,30 @@
7879
define-append EXTRA_LDFLAGS -L$zlibpath
7980
}
8081
if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
8182
user-error "zlib not found please install it or specify the location with --with-zlib"
8283
}
84
+
85
+set tclpath [opt-val with-tcl]
86
+if {$tclpath ne ""} {
87
+ if {$tclpath ne "1"} {
88
+ cc-with [list -cflags [list -I$tclpath/include -L$tclpath/lib]]
89
+ }
90
+ if {![cc-check-includes tcl.h] || ![cc-check-function-in-lib Tcl_CreateInterp tcl]} {
91
+ if {$tclpath eq ""} {
92
+ user-error "No system Tcl available. Try --with-tcl=<path>"
93
+ } else {
94
+ user-error "No Tcl available at $tclpath"
95
+ }
96
+ }
97
+ define FOSSIL_ENABLE_TCL
98
+ define-append LIBS -ltcl
99
+ if {$tclpath ne "1"} {
100
+ define-append EXTRA_CFLAGS -I$tclpath/include
101
+ define-append EXTRA_LDFLAGS -L$tclpath/lib
102
+ }
103
+}
83104
84105
# Helper for openssl checking
85106
proc check-for-openssl {msg {cflags {}}} {
86107
msg-checking "Checking for $msg..."
87108
set rc 0
88109
--- auto.def
+++ auto.def
@@ -4,10 +4,11 @@
4
5 options {
6 with-openssl:path|auto|none
7 => {Look for openssl in the given path, or auto or none}
8 with-zlib:path => {Look for zlib in the given path}
 
9 internal-sqlite=1 => {Don't use the internal sqlite, use the system one}
10 static=0 => {Link a static executable}
11 lineedit=1 => {Disable line editing}
12 fossil-debug=0 => {Build with fossil debugging enabled}
13 }
@@ -78,10 +79,30 @@
78 define-append EXTRA_LDFLAGS -L$zlibpath
79 }
80 if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
81 user-error "zlib not found please install it or specify the location with --with-zlib"
82 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
84 # Helper for openssl checking
85 proc check-for-openssl {msg {cflags {}}} {
86 msg-checking "Checking for $msg..."
87 set rc 0
88
--- auto.def
+++ auto.def
@@ -4,10 +4,11 @@
4
5 options {
6 with-openssl:path|auto|none
7 => {Look for openssl in the given path, or auto or none}
8 with-zlib:path => {Look for zlib in the given path}
9 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
10 internal-sqlite=1 => {Don't use the internal sqlite, use the system one}
11 static=0 => {Link a static executable}
12 lineedit=1 => {Disable line editing}
13 fossil-debug=0 => {Build with fossil debugging enabled}
14 }
@@ -78,10 +79,30 @@
79 define-append EXTRA_LDFLAGS -L$zlibpath
80 }
81 if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
82 user-error "zlib not found please install it or specify the location with --with-zlib"
83 }
84
85 set tclpath [opt-val with-tcl]
86 if {$tclpath ne ""} {
87 if {$tclpath ne "1"} {
88 cc-with [list -cflags [list -I$tclpath/include -L$tclpath/lib]]
89 }
90 if {![cc-check-includes tcl.h] || ![cc-check-function-in-lib Tcl_CreateInterp tcl]} {
91 if {$tclpath eq ""} {
92 user-error "No system Tcl available. Try --with-tcl=<path>"
93 } else {
94 user-error "No Tcl available at $tclpath"
95 }
96 }
97 define FOSSIL_ENABLE_TCL
98 define-append LIBS -ltcl
99 if {$tclpath ne "1"} {
100 define-append EXTRA_CFLAGS -I$tclpath/include
101 define-append EXTRA_LDFLAGS -L$tclpath/lib
102 }
103 }
104
105 # Helper for openssl checking
106 proc check-for-openssl {msg {cflags {}}} {
107 msg-checking "Checking for $msg..."
108 set rc 0
109
+8 -1
--- src/main.mk
+++ src/main.mk
@@ -301,11 +301,15 @@
301301
# using -lsqlite3.
302302
SQLITE3_OBJ.1 =
303303
SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
304304
SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
305305
306
-EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
306
+TCL_OBJ.1 =
307
+TCL_OBJ.0 = $(OBJDIR)/th_tcl.o
308
+TCL_OBJ. = $(TCL_OBJ.0)
309
+
310
+EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o $(TCL_OBJ.$(FOSSIL_ENABLE_TCL))
307311
308312
$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
309313
$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
310314
311315
# This rule prevents make from using its default rules to try build
@@ -909,5 +913,8 @@
909913
$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
910914
911915
$(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
912916
$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
913917
918
+$(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
919
+ $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
920
+
914921
--- src/main.mk
+++ src/main.mk
@@ -301,11 +301,15 @@
301 # using -lsqlite3.
302 SQLITE3_OBJ.1 =
303 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
304 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
305
306 EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
 
 
 
 
307
308 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
309 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
310
311 # This rule prevents make from using its default rules to try build
@@ -909,5 +913,8 @@
909 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
910
911 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
912 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
913
 
 
 
914
--- src/main.mk
+++ src/main.mk
@@ -301,11 +301,15 @@
301 # using -lsqlite3.
302 SQLITE3_OBJ.1 =
303 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
304 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
305
306 TCL_OBJ.1 =
307 TCL_OBJ.0 = $(OBJDIR)/th_tcl.o
308 TCL_OBJ. = $(TCL_OBJ.0)
309
310 EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o $(TCL_OBJ.$(FOSSIL_ENABLE_TCL))
311
312 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
313 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
314
315 # This rule prevents make from using its default rules to try build
@@ -909,5 +913,8 @@
913 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
914
915 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
916 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
917
918 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
919 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_tcl.c -o $(OBJDIR)/th_tcl.o
920
921
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -198,15 +198,20 @@
198198
# using -lsqlite3.
199199
SQLITE3_OBJ.1 =
200200
SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
201201
SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
202202
203
+TCL_OBJ.1 =
204
+TCL_OBJ.0 = $(OBJDIR)/th_tcl.o
205
+TCL_OBJ. = $(TCL_OBJ.0)
206
+
203207
EXTRAOBJ = \
204208
$(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
205209
$(OBJDIR)/shell.o \
206210
$(OBJDIR)/th.o \
207
- $(OBJDIR)/th_lang.o
211
+ $(OBJDIR)/th_lang.o \
212
+ $(TCL_OBJ.$(FOSSIL_ENABLE_TCL))
208213
209214
$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
210215
$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
211216
212217
# This rule prevents make from using its default rules to try build
@@ -265,10 +270,13 @@
265270
writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
266271
267272
writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
268273
writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
269274
275
+writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
276
+writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
277
+
270278
close $output_file
271279
#
272280
# End of the main.mk output
273281
##############################################################################
274282
##############################################################################
275283
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -198,15 +198,20 @@
198 # using -lsqlite3.
199 SQLITE3_OBJ.1 =
200 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
201 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
202
 
 
 
 
203 EXTRAOBJ = \
204 $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
205 $(OBJDIR)/shell.o \
206 $(OBJDIR)/th.o \
207 $(OBJDIR)/th_lang.o
 
208
209 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
210 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
211
212 # This rule prevents make from using its default rules to try build
@@ -265,10 +270,13 @@
265 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
266
267 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
268 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
269
 
 
 
270 close $output_file
271 #
272 # End of the main.mk output
273 ##############################################################################
274 ##############################################################################
275
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -198,15 +198,20 @@
198 # using -lsqlite3.
199 SQLITE3_OBJ.1 =
200 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
201 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
202
203 TCL_OBJ.1 =
204 TCL_OBJ.0 = $(OBJDIR)/th_tcl.o
205 TCL_OBJ. = $(TCL_OBJ.0)
206
207 EXTRAOBJ = \
208 $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
209 $(OBJDIR)/shell.o \
210 $(OBJDIR)/th.o \
211 $(OBJDIR)/th_lang.o \
212 $(TCL_OBJ.$(FOSSIL_ENABLE_TCL))
213
214 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
215 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
216
217 # This rule prevents make from using its default rules to try build
@@ -265,10 +270,13 @@
270 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n"
271
272 writeln "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c"
273 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n"
274
275 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
276 writeln "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_tcl.c -o \$(OBJDIR)/th_tcl.o\n"
277
278 close $output_file
279 #
280 # End of the main.mk output
281 ##############################################################################
282 ##############################################################################
283
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -1,10 +1,13 @@
11
/*
22
** This file contains code used to bridge the TH1 and Tcl scripting languages.
33
*/
44
55
#include "config.h"
6
+
7
+#ifdef FOSSIL_ENABLE_TCL
8
+
69
#include "th.h"
710
#include "tcl.h"
811
912
/*
1013
** Are we being compiled against Tcl 8.6 or higher?
@@ -418,5 +421,7 @@
418421
if( !ctx ) ctx = pContext;
419422
Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
420423
}
421424
return TH_OK;
422425
}
426
+
427
+#endif /* FOSSIL_ENABLE_TCL */
423428
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -1,10 +1,13 @@
1 /*
2 ** This file contains code used to bridge the TH1 and Tcl scripting languages.
3 */
4
5 #include "config.h"
 
 
 
6 #include "th.h"
7 #include "tcl.h"
8
9 /*
10 ** Are we being compiled against Tcl 8.6 or higher?
@@ -418,5 +421,7 @@
418 if( !ctx ) ctx = pContext;
419 Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
420 }
421 return TH_OK;
422 }
 
 
423
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -1,10 +1,13 @@
1 /*
2 ** This file contains code used to bridge the TH1 and Tcl scripting languages.
3 */
4
5 #include "config.h"
6
7 #ifdef FOSSIL_ENABLE_TCL
8
9 #include "th.h"
10 #include "tcl.h"
11
12 /*
13 ** Are we being compiled against Tcl 8.6 or higher?
@@ -418,5 +421,7 @@
421 if( !ctx ) ctx = pContext;
422 Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
423 }
424 return TH_OK;
425 }
426
427 #endif /* FOSSIL_ENABLE_TCL */
428

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button