forked from petasis/tkdnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcl-conf
executable file
·164 lines (150 loc) · 6.64 KB
/
tcl-conf
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}
set srcdir [file dirname [file normalize [info script]]]
puts "TkDND sources: $srcdir"
set libpath [file dirname [file normalize [info library]]]
set root [file dirname $libpath]
set tcl_includepath $root/include
set tk_includepath $root/include
set tcl_libpath $libpath
set tk_libpath $libpath
set tk_includepath_int $tk_includepath
catch {file delete -force config.cache}
# puts "ROOT: $root"
catch {
switch -nocase -- $::tcl_platform(os) {
darwin {
set sdk {}
catch {
set sdk [exec xcodebuild -version -sdk macosx Path]
}
foreach dir [list \
$root/Headers \
[string map {Tcl Tk} $root]/Headers \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers/tk-private \
$sdk/System/Library/Frameworks/Tcl.framework/Versions/Current \
$sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers \
$sdk/System/Library/Frameworks/Tk.framework/Versions/Current \
$sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers \
$sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers/tk-private \
/System/Library/Frameworks/Tcl.framework \
/System/Library/Frameworks/Tk.framework \
] {
if {[file exists $dir/tclConfig.sh]} {set tcl_libpath $dir}
if {[file exists $dir/tkConfig.sh]} {set tk_libpath $dir}
if {[file exists $dir/tcl.h]} {set tcl_includepath $dir}
if {[file exists $dir/tk.h]} {set tk_includepath $dir}
if {[file exists $dir/tkInt.h]} {set tk_includepath_int $dir}
}
}
}
}
set bits --disable-64bit
catch {
switch $::tcl_platform(machine) {
x86_64 -
amd64 {set bits --enable-64bit}
default {set bits --disable-64bit}
}
}
## Do we have Tcllib's fileutil?
if {[catch {package require fileutil}]} {
puts "Tcllib's package \"fileutil\" not found! Simulating..."
## From: http://wiki.tcl.tk/2042
proc rglob { dirpath patterns } {
set rlist {}
foreach fpath [glob -nocomplain -types f -directory ${dirpath} \
{*}${patterns}] {
lappend rlist ${fpath}
}
foreach dir [glob -nocomplain -types d -directory ${dirpath} *] {
lappend rlist {*}[rglob ${dir} ${patterns}]
}
return ${rlist}
};# rglob
proc find_file {path filename} {
set found [rglob $path $filename]
if {![llength $found]} {
puts stderr "Cannot find file \"$filename\" within directory (and\
sub-directories) \"$path\"."
exit 1
}
lindex $found 0
};# find_file
} else {
puts "Tcllib's package \"fileutil\" found!"
proc find_file {path filename} {
set found [fileutil::findByPattern $path -glob -- $filename]
if {![llength $found]} {
puts stderr "Cannot find file \"$filename\" within directory (and\
sub-directories) \"$path\"."
exit 2
}
lindex $found 0
};# find_file
}
puts {}
## Ensure we can find tclConfig.sh & tkConfig.sh
if {![file exists $tcl_libpath/tclConfig.sh]} {
## Ok, we are missing the configuration file. Can we find it?
set tcl_libpath [file dirname [find_file $root tclConfig.sh]]
}
puts "Found \"tclConfig.sh\" in \"$tcl_libpath\"."
if {![file exists $tk_libpath/tkConfig.sh]} {
## Ok, we are missing the configuration file. Can we find it?
set tk_libpath [file dirname [find_file $root tkConfig.sh]]
}
puts "Found \"tkConfig.sh\" in \"$tk_libpath\"."
## Ensure we can find tclConfig.sh & tkConfig.sh
if {![file exists $tcl_includepath/tcl.h]} {
## Ok, we are missing the configuration file. Can we find it?
set tcl_includepath [file dirname [find_file $root tcl.h]]
}
puts "Found \"tcl.h\" in \"$tcl_includepath\"."
if {![file exists $tk_includepath/tk.h]} {
## Ok, we are missing the configuration file. Can we find it?
set tk_includepath [file dirname [find_file $root tk.h]]
}
puts "Found \"tk.h\" in \"$tk_includepath\"."
puts {}
if {$tk_includepath_int ne $tk_includepath} {
puts "+++ Running 'bash configure -srcdir=$srcdir\n\
\ --prefix=$srcdir/cmake/runtime\n\
\ --exec-prefix=$srcdir/cmake/runtime\n\
\ --with-tcl=$tcl_libpath\n\
\ --with-tk=$tk_libpath\n\
\ --with-tclinclude=$tcl_includepath\n\
\ --with-tkinclude=$tk_includepath\n\
\ PKG_INCLUDES=-I\"$tk_includepath_int\"\n\
\ $bits'\n\
\ in directory [pwd]..."
catch {exec bash configure -srcdir=$srcdir --prefix=$srcdir/cmake/runtime \
--exec-prefix=$srcdir/cmake/runtime \
--with-tcl=$tcl_libpath --with-tk=$tk_libpath \
--with-tclinclude=$tcl_includepath \
--with-tkinclude=$tk_includepath \
PKG_INCLUDES=-I"$tk_includepath_int" \
$bits >@stdout 2>@stderr}
} else {
puts "+++ Running 'bash configure -srcdir=$srcdir\n\
\ --prefix=$srcdir/cmake/runtime\n\
\ --exec-prefix=$srcdir/cmake/runtime\n\
\ --with-tcl=$tcl_libpath\n\
\ --with-tk=$tk_libpath\n\
\ --with-tclinclude=$tcl_includepath\n\
\ --with-tkinclude=$tk_includepath\n\
\ $bits'\n\
\ in directory [pwd]..."
catch {exec bash configure -srcdir=$srcdir --prefix=$srcdir/cmake/runtime \
--exec-prefix=$srcdir/cmake/runtime \
--with-tcl=$tcl_libpath --with-tk=$tk_libpath \
--with-tclinclude=$tcl_includepath \
--with-tkinclude=$tk_includepath \
$bits >@stdout 2>@stderr}
}
exit 0