查找适用于macOS的预编译或编译的Tcl / Tk框架 [英] Find precompiled or compile Tcl/Tk Frameworks for macOS
问题描述
我是Tcl / Tk的初学者,但是我已经需要在其中部署带有Tcl / Tk框架的.app(因为.app需要依赖于自己的Tcl / Tk版本而不是macOS标准和旧的Tcl / Tk)。有人可以指出我在哪里可以找到预编译的框架,或者有关如何在macOS上进行编译的分步指南吗?
I am a beginner with Tcl/Tk, but I am already in need to deploy an .app with Tcl/Tk frameworks in it (because the .app needs to rely on its own Tcl/Tk version and not on macOS standard and old Tcl/Tk). Can somebody point me to where I can find precompiled Frameworks or to a step-by-step guide on how to compile them on macOS?
半天的搜索没有在这方面非常富有成果。我想我的需求根本不是很特别,因为我看到许多.app都发布了自己的Tcl / Tk框架。 (PS:我需要从Perl访问这些框架,但这没有什么区别。)
Half a day of search has not been very fruitful in this regard. I guess my need is not at all very special, as I see many .apps shipping their own Tcl/Tk Frameworks. (PS: I need to access these Frameworks from Perl, but this shouldn't make any difference.)
推荐答案
这是我的构建脚本。您将需要进行修改以满足
的需求。
Here is my build script. You will need to make modifications to suit your needs.
- 我对init.tcl进行了修改,以便Tcl可以在其中进行搜索适当的位置
,并且不会在MacOS标准位置中优先显示。
脚本的这一部分将从Tcl / Tk 8.7开始中断。它的路径也非常适合我的安装
( darwin 64 tcl lib部分)。
保留它不会有任何伤害,或者您可以根据需要修改路径。 - 我使应用程序可重定位,以便可以在任何位置运行。
这可能是一个安全问题。建议在安装后再进行
额外的处理,以将库路径设置为静态位置。
我个人建议Tcl / Tk 8.6.8目前是这样,但它必须使用
来构建较早的XCode版本(我在Sierra上使用XCode命令行工具9.2)。
仍然存在各种错误修复适用于MacOS Mojave。
其他人可能会另外建议。
I personally recommend Tcl/Tk 8.6.8 at this time, but it has to be built with
an earlier XCode version (I use XCode Command Line Tools 9.2 on Sierra).
There are still various bug fixes for MacOS Mojave being worked on.
Other people may recommend otherwise.
变量:
- macosxminver :编译Tcl / Tk的最早的MacOS版本。
- INSTLOC:安装位置。将其指向目标
目录之外的其他位置,然后将文件复制到目标目录。
请注意,脚本已将INSTLOC目录完全删除。 - sver:Tcl的简短版本。仅在SRCDIR定义中使用此位置。
您可能不需要此文件,具体取决于您的SRCDIR目录结构。 - ver:Tcl版本号。
- mver:Tcl主版本号
- SRCDIR:Tcl / Tk源树所在的位置。出于此
脚本的目的,我有一个具有以下结构的目录:
- macosxminver : The earliest version of MacOS that Tcl/Tk will be compiled for.
- INSTLOC : The installation location. Point this somewhere other than your target directory and copy the files to your target directory afterwards. Note that the INSTLOC directory is completely removed by the script.
- sver : short Tcl version. The only place this is used is in the SRCDIR definition. You may not need this depending on your SRCDIR directory structure.
- ver : Tcl version number.
- mver : Tcl major version number.
- SRCDIR : Where the Tcl/Tk source trees are located. For the purposes of this script, I have a directory with the following structure:
目录结构:
tcl868/
tcl8.6.8/
tk8.6.8/
tclbuild.sh:
tclbuild.sh:
#!/bin/bash
macosxminver=10.9
sver=868cp
ver=8.6.8
mver=8.6
tclmver=$mver
tkmver=$mver
SRCDIR=$HOME/t/tcl${sver}
INSTLOC=$HOME/t/localB
if [[ $1 != "" ]]; then
INSTLOC=$1
fi
if [[ -d $INSTLOC ]]; then
rm -rf $INSTLOC
fi
mkdir $INSTLOC
cd $SRCDIR
test -d build && rm -rf build
cd $SRCDIR
cd tcl${ver}
if [[ $? -eq 0 ]]; then
f=library/init.tcl
if [[ ! -f $f-orig ]]; then
cp -pf $f $f-orig
fi
cp -pf $f-orig $f
ed $f << _HERE_
/issafe/
i
foreach Dir [list \$::tcl_library [file dirname \$::tcl_library]] {
if { [string match *Tcl.framework* \$Dir] } {
regsub Tcl.framework \$Dir Tk.framework Dir
if {\$Dir ni \$::auto_path} {
lappend ::auto_path \$Dir
}
}
}
# This needs to be at the end
# The real wish executable is in an odd place.
# Find the tcl directory in the path.
set Dir [file dirname [info nameofexecutable]]
if { [string match *MacOS* \$Dir] } {
regsub {MacOS.*} \$Dir {MacOS} Dir
set Dir [file join \$Dir darwin 64 tcl lib]
lappend ::auto_path \$Dir
} else {
set Dir [file join [file dirname [file dirname \\
[info nameofexecutable]]] lib]
}
.
?catch
?set Dir
.,.+4 s/^/#/
/catch
.+1,.+5 s/^/#/
w
q
_HERE_
make -C macosx \
PREFIX="" \
CFLAGS_OPTIMIZE="-O2 -mmacosx-version-min=${macosxminver}" \
INSTALL_ROOT=$INSTLOC install
cd $SRCDIR
chmod u+w $INSTLOC/bin/tclsh${tclmver}
install_name_tool -change \
"/Library/Frameworks/Tcl.framework/Versions/${tclmver}/Tcl" \
@executable_path/../Library/Frameworks/Tcl.framework/Versions/${tclmver}/Tcl \
$INSTLOC/bin/tclsh${tclmver}
fi
cd $SRCDIR
cd tk${ver}
if [[ $? -eq 0 ]]; then
make -C macosx \
PREFIX="" \
CFLAGS_OPTIMIZE="-O2 -mmacosx-version-min=${macosxminver}" \
INSTALL_ROOT=$INSTLOC install
cd $SRCDIR
chmod u+w $INSTLOC/Library/Frameworks/Tk.framework/Versions/${tkmver}/Resources/Wish.app/Contents/MacOS/Wish
install_name_tool -change \
"/Library/Frameworks/Tk.framework/Versions/${tkmver}/Tk" \
@executable_path/../../../../Tk \
$INSTLOC/Library/Frameworks/Tk.framework/Versions/${tkmver}/Resources/Wish.app/Contents/MacOS/Wish
install_name_tool -change \
"/Library/Frameworks/Tcl.framework/Versions/${tclmver}/Tcl" \
@executable_path/../../../../../../../Tcl.framework/Versions/${tclmver}/Tcl \
$INSTLOC/Library/Frameworks/Tk.framework/Versions/${tkmver}/Resources/Wish.app/Contents/MacOS/Wish
fi
cd $SRCDIR
find $INSTLOC -type f -print0 | xargs -0 chmod u+w
exit 0
这篇关于查找适用于macOS的预编译或编译的Tcl / Tk框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!