Skip to content

Commit e8a8cd2

Browse files
committed
tcltk build script
1 parent f334452 commit e8a8cd2

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

tools/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
TCL_REPO=https://github.com/tcltk/tcl
2+
TK_REPO=https://github.com/tcltk/tk
3+
TCL_TK_TAG=core-8-6-12
4+
WORK_DIR=./.build
5+
TCL_CONFIGURE="--enable-threads --enable-64bit"
6+
TK_CONFIGURE="--enable-threads --enable-64bit --enable-embedded-manifest --with-tcl=../../tcl/win"
7+
INSTALL_DIR=/tmp/tcltk

tools/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.env
2+
.build/
3+
tcltk.zip

tools/BUILD-WIN.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Building Tcl and Tk for Windows with MSYS2
2+
==========================================
3+
4+
1. Get MSYS2: https://msys2.github.io/
5+
2. Open MSYS2 MINGW64
6+
3. Install all the required build dependencies:
7+
```sh
8+
pacman -Syuu make mingw-w64-i686-gcc tar wget zip unzip
9+
```
10+
4. `./build.sh`
11+

tools/build.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
3+
if [ ! -f .env ]; then
4+
echo ".env is required, please create .env file to proceed"
5+
exit 1
6+
fi
7+
8+
. .env
9+
10+
[ ! -d $WORK_DIR ] && mkdir $WORK_DIR
11+
12+
TCL_WORK_DIR=$WORK_DIR/tcl
13+
TK_WORK_DIR=$WORK_DIR/tk
14+
ROOT_DIR=$(pwd)
15+
16+
case "$(uname -o)" in
17+
Msys)
18+
OS="win"
19+
;;
20+
Linux)
21+
OS="unix"
22+
;;
23+
*)
24+
echo "Unsupported os"
25+
exit 1
26+
;;
27+
esac
28+
29+
if [ ! -d $TCL_WORK_DIR ]; then
30+
git clone $TCL_REPO $TCL_WORK_DIR
31+
fi
32+
33+
if [ ! -d $TK_WORK_DIR ]; then
34+
git clone $TK_REPO $TK_WORK_DIR
35+
fi
36+
37+
build_tcl() {
38+
echo "Building Tcl ..."
39+
cd $TCL_WORK_DIR
40+
git checkout main
41+
git fetch
42+
git checkout $TCL_TK_TAG
43+
cd $OS
44+
[ -f Makefile ] && make distclean
45+
./configure $TCL_CONFIGURE --prefix=$INSTALL_DIR
46+
make -j$(nproc)
47+
make install
48+
}
49+
50+
build_tk() {
51+
echo "Building Tk ..."
52+
cd $TK_WORK_DIR
53+
git checkout main
54+
git fetch
55+
git checkout $TCL_TK_TAG
56+
cd $OS
57+
[ -f Makefile ] && make distclean
58+
./configure $TK_CONFIGURE --prefix=$INSTALL_DIR
59+
make -j$(nproc)
60+
make install
61+
}
62+
63+
rm -rf $INSTALL_DIR
64+
cd $ROOT_DIR
65+
build_tcl
66+
cd $ROOT_DIR
67+
build_tk
68+
cd $INSTALL_DIR && zip -r $ROOT_DIR/tcltk.zip *

0 commit comments

Comments
 (0)