Skip to content

Commit 95e9438

Browse files
committed
refactored to Makefile
1 parent 418974f commit 95e9438

File tree

5 files changed

+89
-81
lines changed

5 files changed

+89
-81
lines changed

tools/.env.example

Lines changed: 0 additions & 7 deletions
This file was deleted.

tools/.gitignore

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

tools/BUILD-WIN.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
Building Tcl and Tk for Windows with MSYS2
22
==========================================
33

4-
1. Get MSYS2: https://msys2.github.io/
5-
2. Open MSYS2 MINGW64
4+
1. Get MSYS2: https://www.msys2.org/
5+
2. Open `MSYS2 UCRT64`
66
3. Install all the required build dependencies:
77
```sh
8-
pacman -Syuu make mingw-w64-i686-gcc tar wget zip unzip
8+
pacman -Syuu
9+
pacman -S mingw-w64-ucrt-x86_64-gcc make git zip wget
910
```
10-
4. `./build.sh`
11+
4. cd into the project `tools` directory and run `OS=win make dist`
12+
5. `tcltk.zip` will be created in `.build` directory
1113

tools/Makefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Tcl/Tk build distribution makefile.
2+
#
3+
# By default, it builds tcl and tk for Windows but the build target can be
4+
# overrided with OS variable, for example, Linux:
5+
# OS=unix make dist
6+
#
7+
#
8+
9+
TCL_REPO=https://github.com/tcltk/tcl
10+
TK_REPO=https://github.com/tcltk/tk
11+
TCL_TK_TAG=core-8-6-13
12+
13+
OS=win
14+
WORK_DIR=./.build
15+
INSTALL_DIR=/tmp/tcltk
16+
17+
TCL_SOURCE_DIR=$(WORK_DIR)/tcl-$(TCL_TK_TAG)
18+
TCL_RELEASE_DIST=$(TCL_REPO)/archive/refs/tags/$(TCL_TK_TAG).tar.gz
19+
TCL_SOURCE_DIST=$(WORK_DIR)/tcl-$(TCL_TK_TAG).tar.gz
20+
TCL_CONFIGURE=--enable-threads --enable-64bit --prefix=$(INSTALL_DIR)
21+
22+
TK_SOURCE_DIR=$(WORK_DIR)/tk-$(TCL_TK_TAG)
23+
TK_RELEASE_DIST=$(TK_REPO)/archive/refs/tags/$(TCL_TK_TAG).tar.gz
24+
TK_SOURCE_DIST=$(WORK_DIR)/tk-$(TCL_TK_TAG).tar.gz
25+
TK_CONFIGURE=--enable-threads --enable-64bit --enable-embedded-manifest --with-tcl=../../tcl-$(TCL_TK_TAG)/$(OS) --prefix=$(INSTALL_DIR)
26+
27+
##############################################################################################
28+
29+
help:
30+
@echo "Usage:"
31+
@echo " dist Build Tcl and Tk distribution"
32+
@echo " build-tcl Build Tcl only"
33+
@echo " build-tk Build Tk only"
34+
@echo " clean Remove build and installation directories"
35+
36+
.PHONY: dist clean build-tcl build-tk
37+
38+
$(WORK_DIR):
39+
mkdir -p $(WORK_DIR)
40+
41+
dist: build-tcl build-tk
42+
cd $(INSTALL_DIR) \
43+
&& zip -r /tmp/tcltk.zip . -x \
44+
include/* include/ include/X11/ include/X11/* \
45+
lib/tk8.6/demos lib/tk8.6/demos/* \
46+
lib/tk8.6/demos/images/ lib/tk8.6/demos/images/* \
47+
lib/libtcl86.dll.a lib/libtclstub86.a \
48+
lib/libtk86.dll.a lib/libtkstub86.a \
49+
lib/tclConfig.sh lib/tclooConfig.sh lib/tkConfig.sh
50+
[ -f /tmp/tcltk.zip ] && mv /tmp/tcltk.zip $(WORK_DIR)
51+
52+
##############################################################################################
53+
54+
build-tcl: $(WORK_DIR) $(TCL_SOURCE_DIR)
55+
cd $(TCL_SOURCE_DIR)/$(OS) \
56+
&& ./configure $(TCL_CONFIGURE) \
57+
&& make -j`nproc` \
58+
&& make install
59+
60+
$(TCL_SOURCE_DIR): $(TCL_SOURCE_DIST)
61+
tar -zxf $(TCL_SOURCE_DIST) -C $(WORK_DIR)
62+
63+
$(TCL_SOURCE_DIST):
64+
wget $(TCL_RELEASE_DIST) -O $(TCL_SOURCE_DIST)
65+
66+
##############################################################################################
67+
68+
build-tk: $(WORK_DIR) $(TK_SOURCE_DIR)
69+
cd $(TK_SOURCE_DIR)/$(OS) \
70+
&& ./configure $(TK_CONFIGURE) \
71+
&& make -j`nproc` \
72+
&& make install
73+
74+
$(TK_SOURCE_DIR): $(TK_SOURCE_DIST)
75+
tar -zxf $(TK_SOURCE_DIST) -C $(WORK_DIR)
76+
77+
$(TK_SOURCE_DIST):
78+
wget $(TK_RELEASE_DIST) -O $(TK_SOURCE_DIST)
79+
80+
##############################################################################################
81+
82+
clean:
83+
rm -rf $(WORK_DIR) $(INSTALL_DIR)

tools/build.sh

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)