diff --git a/CMakeLists.txt b/CMakeLists.txt index 29112db008..48ee59ac7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -490,7 +490,12 @@ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf") # Tcl (mandatory for Draw Harness) if (USE_TCL) message (STATUS "Info: TCL is used by OCCT") - OCCT_ADD_VCPKG_FEATURE ("tcl") + if (CAN_USE_TK AND USE_TK) + OCCT_ADD_VCPKG_FEATURE ("tcltk") + else() + OCCT_ADD_VCPKG_FEATURE ("tcl") + OCCT_UNSET_VCPKG_FEATURE ("tcltk") + endif() list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/tcl") else() OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL") @@ -501,7 +506,6 @@ endif() # Tk (optional for Draw Harness) if (CAN_USE_TK AND USE_TK) message (STATUS "Info: TK is used by OCCT") - OCCT_ADD_VCPKG_FEATURE ("tk") list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/tk") else() if (NOT CAN_USE_TK) @@ -509,7 +513,6 @@ else() endif() OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK") OCCT_CHECK_AND_UNSET ("INSTALL_TK") - OCCT_UNSET_VCPKG_FEATURE ("tk") endif() # Xlib diff --git a/adm/cmake/tk.cmake b/adm/cmake/tk.cmake index ec48b17f92..297fe1d9a8 100644 --- a/adm/cmake/tk.cmake +++ b/adm/cmake/tk.cmake @@ -18,11 +18,11 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR) set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk") endif() -# if (BUILD_USE_VCPKG) -# set (3RDPARTY_TK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tk" FORCE) -# set (3RDPARTY_TCLTK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcltk" FORCE) -# set (3RDPARTY_TK_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tk" FORCE) -# endif() +if (BUILD_USE_VCPKG) + set (3RDPARTY_TK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tk" FORCE) + set (3RDPARTY_TCLTK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcltk" FORCE) + set (3RDPARTY_TK_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tk" FORCE) +endif() if (BUILD_SHARED_LIBS) # tk library file (with absolute path) diff --git a/adm/templates/env.bat.in b/adm/templates/env.bat.in index d83de73336..246ec2a9ab 100644 --- a/adm/templates/env.bat.in +++ b/adm/templates/env.bat.in @@ -166,10 +166,8 @@ if not "%CSF_OCCTBinPath%" == "" ( set "PATH=%CSF_OCCTBinPath%;%PATH%" ) -if not ["%TK_DIR%"] == ["%TCL_DIR%"] ( - if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%" - if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%" -) +if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%" +if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%" rem ----- Set envoronment variables used by OCCT ----- set CSF_LANGUAGE=us diff --git a/adm/vcpkg/ports/tcl/0001-Add-tk-build.patch b/adm/vcpkg/ports/tcl/0001-Add-tk-build.patch new file mode 100644 index 0000000000..cf2aa6b4c0 --- /dev/null +++ b/adm/vcpkg/ports/tcl/0001-Add-tk-build.patch @@ -0,0 +1,48 @@ +diff --git a/win/makefile.vc b/win/makefile.vc +index c88c0ec3dc..6c9dd624d7 100644 +--- a/win/makefile.vc ++++ b/win/makefile.vc +@@ -466,13 +466,13 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) + # release - Everything that builds as part of a release + #--------------------------------------------------------------------- + +-release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs ++release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs tk-build + all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs + core: setup $(TCLLIB) $(TCLSTUBLIB) + shell: setup $(TCLSH) + dlls: setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll + tcltest: setup $(TCLTEST) dlls $(CAT32) +-install: install-binaries install-libraries install-docs install-pkgs ++install: install-binaries install-libraries install-docs install-pkgs tk-build tk-install + !if $(SYMBOLS) + install: install-pdbs + !endif +@@ -569,6 +569,24 @@ pkgs: + popd \ + ) + ++tk-build: ++!if defined(TKDIR) && defined(INSTALLDIR) ++ @if exist "$(TKDIR)\win\makefile.vc" ( \ ++ pushd "$(TKDIR)\win" & \ ++ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) INSTALLDIR=$(INSTALLDIR) OPTS=$(OPTS) STATS=$(STATS) CHECKS=$(CHECKS) MACHINE=$(MACHINE) &\ ++ popd \ ++ ) ++!endif ++ ++tk-install: ++!if defined(TKDIR) && defined(INSTALLDIR) ++ @if exist "$(TKDIR)\win\makefile.vc" ( \ ++ pushd "$(TKDIR)\win" & \ ++ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) INSTALLDIR=$(INSTALLDIR) OPTS=$(OPTS) STATS=$(STATS) CHECKS=$(CHECKS) MACHINE=$(MACHINE) install &\ ++ popd \ ++ ) ++!endif ++ + test-pkgs: + @for /d %d in ($(PKGSDIR)\*) do \ + @if exist "%~fd\win\makefile.vc" ( \ +-- +2.47.1.windows.2 + diff --git a/adm/vcpkg/ports/tcl/0002-Add-setpath-target.patch b/adm/vcpkg/ports/tcl/0002-Add-setpath-target.patch new file mode 100644 index 0000000000..0f517e922d --- /dev/null +++ b/adm/vcpkg/ports/tcl/0002-Add-setpath-target.patch @@ -0,0 +1,51 @@ +diff --git a/win/makefile.vc b/win/makefile.vc +index 6c9dd624d7..d29185feed 100644 +--- a/win/makefile.vc ++++ b/win/makefile.vc +@@ -420,6 +420,7 @@ TCLSTUBOBJS = \ + ### the left side of implicit rules. + TOMMATHDIR = $(ROOT)\libtommath + PKGSDIR = $(ROOT)\pkgs ++WINDIR = $(ROOT)\win + + # Additional include and C macro definitions for the implicit rules + # defined in rules.vc +@@ -438,6 +439,7 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) + !endif + + ++ + #--------------------------------------------------------------------- + # Project specific targets + # There are 4 primary build configurations to consider from the combination +@@ -466,18 +468,24 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) + # release - Everything that builds as part of a release + #--------------------------------------------------------------------- + +-release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs tk-build +-all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs ++release: setup $(TCLSH) $(TCLSTUBLIB) dlls setpath pkgs tk-build ++all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) setpath pkgs + core: setup $(TCLLIB) $(TCLSTUBLIB) + shell: setup $(TCLSH) + dlls: setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll + tcltest: setup $(TCLTEST) dlls $(CAT32) +-install: install-binaries install-libraries install-docs install-pkgs tk-build tk-install ++install: setpath install-binaries install-libraries install-docs install-pkgs tk-build tk-install + !if $(SYMBOLS) + install: install-pdbs + !endif + setup: default-setup + ++# Add TCL win directory to PATH for current session ++setpath: ++ @echo Adding $(WINDIR) to PATH ++ @set PATH=$(WINDIR);$(PATH) ++ @echo PATH updated for current session ++ + test: test-core test-pkgs + test-core: setup $(TCLTEST) dlls $(CAT32) + set TCL_LIBRARY=$(ROOT:\=/)/library +-- +2.47.1.windows.2 + diff --git a/adm/vcpkg/ports/tcl/0003-Update-unix-build.patch b/adm/vcpkg/ports/tcl/0003-Update-unix-build.patch new file mode 100644 index 0000000000..164eead590 --- /dev/null +++ b/adm/vcpkg/ports/tcl/0003-Update-unix-build.patch @@ -0,0 +1,119 @@ +From 34a5ac55260871875c3ad678df8c21ef31500d21 Mon Sep 17 00:00:00 2001 +From: dpasukhi +Date: Sun, 22 Jun 2025 14:18:19 +0100 +Subject: [PATCH] Add Tk build and install support to Makefile; include + automatic clean and distclean steps + +--- + unix/Makefile.in | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 69 insertions(+) + +diff --git a/unix/Makefile.in b/unix/Makefile.in +index bc743b3892..7464e3f930 100644 +--- a/unix/Makefile.in ++++ b/unix/Makefile.in +@@ -95,6 +95,12 @@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ + # Tcl Module default path roots (TIP189). + TCL_MODULE_PATH = @TCL_MODULE_PATH@ + ++# Tk-related directories and settings ++# These can be overridden on the command line or set via environment ++TKDIR = @TKDIR@ ++TK_BUILD_TOP = $(TKDIR)/unix ++TK_SRC_DIR = $(TKDIR) ++ + # warning flags + CFLAGS_WARNING = @CFLAGS_WARNING@ + +@@ -623,6 +629,34 @@ SRCS = $(GENERIC_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ + #-------------------------------------------------------------------------- + + all: binaries libraries doc packages ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \ ++ echo "TKDIR detected - automatically building Tk..."; \ ++ echo "========== TK BUILD PARAMETERS =========="; \ ++ echo "TKDIR=$(TKDIR)"; \ ++ echo "TCLDIR=$(TOP_DIR)"; \ ++ echo "prefix=$(prefix)"; \ ++ echo "exec_prefix=$(exec_prefix)"; \ ++ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}"; \ ++ echo "=========================================="; \ ++ if test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "Building Tk using existing Makefile..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE)) || exit $$?; \ ++ elif test -f "$(TK_SRC_DIR)/unix/configure"; then \ ++ echo "Configuring and building Tk..."; \ ++ mkdir -p "$(TK_BUILD_TOP)"; \ ++ (cd "$(TK_BUILD_TOP)" && \ ++ "$(TK_SRC_DIR)/unix/configure" \ ++ --prefix="$(prefix)" \ ++ --exec-prefix="$(exec_prefix)" \ ++ --with-tcl="$(CONFIG_INSTALL_DIR)" && \ ++ $(MAKE)) || exit $$?; \ ++ else \ ++ echo "ERROR: Tk configure script not found at $(TK_SRC_DIR)/unix/configure"; \ ++ exit 1; \ ++ fi; \ ++ else \ ++ echo "TKDIR not set or directory does not exist - skipping Tk build"; \ ++ fi + + binaries: ${LIB_FILE} ${TCL_EXE} + +@@ -671,11 +705,25 @@ clean: clean-packages + errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ + minizip${HOST_EXEEXT} *.${HOST_OBJEXT} *.zip *.vfs + (cd dltest ; $(MAKE) clean) ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "TKDIR detected - automatically cleaning Tk..."; \ ++ echo "Cleaning Tk build..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE) clean) || exit $$?; \ ++ else \ ++ echo "TKDIR not set, directory does not exist, or no Tk build to clean"; \ ++ fi + + distclean: distclean-packages clean + rm -rf Makefile config.status config.cache config.log tclConfig.sh \ + tclConfig.h *.plist Tcl.framework tcl.pc tclUuid.h + (cd dltest ; $(MAKE) distclean) ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "TKDIR detected - automatically distcleaning Tk..."; \ ++ echo "Distcleaning Tk build..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE) distclean) || exit $$?; \ ++ else \ ++ echo "TKDIR not set, directory does not exist, or no Tk build to distclean"; \ ++ fi + + depend: + makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) +@@ -796,6 +844,27 @@ INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_T + $(INSTALL_PACKAGE_TARGETS) $(INSTALL_EXTRA_TARGETS) + + install: $(INSTALL_TARGETS) ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \ ++ echo "TKDIR detected - automatically installing Tk..."; \ ++ echo "========== TK INSTALL PARAMETERS =========="; \ ++ echo "TKDIR=$(TKDIR)"; \ ++ echo "TCLDIR=$(TOP_DIR)"; \ ++ echo "prefix=$(prefix)"; \ ++ echo "exec_prefix=$(exec_prefix)"; \ ++ echo "DESTDIR=$(INSTALL_ROOT)"; \ ++ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}"; \ ++ echo "==========================================="; \ ++ if test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "Installing Tk..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE) install DESTDIR="$(INSTALL_ROOT)") || exit $$?; \ ++ else \ ++ echo "ERROR: Tk Makefile not found at $(TK_BUILD_TOP)/Makefile"; \ ++ echo "Please run 'make all' first to build Tk"; \ ++ exit 1; \ ++ fi; \ ++ else \ ++ echo "TKDIR not set or directory does not exist - skipping Tk install"; \ ++ fi + + install-strip: + $(MAKE) $(INSTALL_TARGETS) \ +-- +2.47.1.windows.2 + diff --git a/adm/vcpkg/ports/tcl/0004-Update-mingw-build.patch b/adm/vcpkg/ports/tcl/0004-Update-mingw-build.patch new file mode 100644 index 0000000000..278f1f0c8e --- /dev/null +++ b/adm/vcpkg/ports/tcl/0004-Update-mingw-build.patch @@ -0,0 +1,117 @@ +From bf55f8558b8ca6603f6539c6421391f26ab6139a Mon Sep 17 00:00:00 2001 +From: dpasukhi +Date: Sun, 22 Jun 2025 15:20:03 +0100 +Subject: [PATCH] Add Tk build and install automation to Makefile; include + clean and distclean targets + +--- + win/Makefile.in | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + +diff --git a/win/Makefile.in b/win/Makefile.in +index 8dd107670f..f0cf267329 100644 +--- a/win/Makefile.in ++++ b/win/Makefile.in +@@ -129,6 +129,11 @@ ROOT_DIR_WIN_NATIVE = $(shell cd '$(ROOT_DIR)' ; pwd -W 2>/dev/null || pwd -P) + ZLIB_DIR_NATIVE = $(shell $(CYGPATH) '$(ZLIB_DIR)') + TOMMATH_DIR_NATIVE = $(shell $(CYGPATH) '$(TOMMATH_DIR)') + ++# Tk-related directories (TKDIR can be set by user) ++TK_SRC_DIR = $(TKDIR) ++TK_BUILD_TOP = $(TKDIR)/win ++CONFIG_INSTALL_DIR = $(LIB_INSTALL_DIR) ++ + # Fully qualify library path so that `make test` + # does not depend on the current directory. + LIBRARY_DIR1 = $(shell cd '$(ROOT_DIR_NATIVE)/library' ; pwd -P) +@@ -432,6 +437,34 @@ TCL_OBJS = ${GENERIC_OBJS} ${WIN_OBJS} @ZLIB_OBJS@ $(TOMMATH_OBJS) + TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] + + all: binaries libraries doc packages ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \ ++ echo "TKDIR detected - automatically building Tk..."; \ ++ echo "========== TK BUILD PARAMETERS =========="; \ ++ echo "TKDIR=$(TKDIR)"; \ ++ echo "TCLDIR=$(TOP_DIR)"; \ ++ echo "prefix=$(prefix)"; \ ++ echo "exec_prefix=$(exec_prefix)"; \ ++ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VER)${EXESUFFIX}"; \ ++ echo "=========================================="; \ ++ if test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "Building Tk using existing Makefile..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE)) || exit $$?; \ ++ elif test -f "$(TK_SRC_DIR)/win/configure"; then \ ++ echo "Configuring and building Tk..."; \ ++ mkdir -p "$(TK_BUILD_TOP)"; \ ++ (cd "$(TK_BUILD_TOP)" && \ ++ "$(TK_SRC_DIR)/win/configure" \ ++ --prefix="$(prefix)" \ ++ --exec-prefix="$(exec_prefix)" \ ++ --with-tcl="$(CONFIG_INSTALL_DIR)" && \ ++ $(MAKE)) || exit $$?; \ ++ else \ ++ echo "ERROR: Tk configure script not found at $(TK_SRC_DIR)/win/configure"; \ ++ exit 1; \ ++ fi; \ ++ else \ ++ echo "TKDIR not set or directory does not exist - skipping Tk build"; \ ++ fi + + # Test-suite helper (can be used to test Tcl from build directory with all expected modules). + # To start from windows shell use: +@@ -648,6 +681,27 @@ gentommath_h: + > "$(GENERIC_DIR_NATIVE)/tclTomMath.h" + + install: all install-binaries install-libraries install-doc install-packages ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \ ++ echo "TKDIR detected - automatically installing Tk..."; \ ++ echo "========== TK INSTALL PARAMETERS =========="; \ ++ echo "TKDIR=$(TKDIR)"; \ ++ echo "TCLDIR=$(TOP_DIR)"; \ ++ echo "prefix=$(prefix)"; \ ++ echo "exec_prefix=$(exec_prefix)"; \ ++ echo "DESTDIR=$(INSTALL_ROOT)"; \ ++ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VER)${EXESUFFIX}"; \ ++ echo "==========================================="; \ ++ if test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "Installing Tk..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE) install DESTDIR="$(INSTALL_ROOT)") || exit $$?; \ ++ else \ ++ echo "ERROR: Tk Makefile not found at $(TK_BUILD_TOP)/Makefile"; \ ++ echo "Please run 'make all' first to build Tk"; \ ++ exit 1; \ ++ fi; \ ++ else \ ++ echo "TKDIR not set or directory does not exist - skipping Tk install"; \ ++ fi + + install-binaries: binaries + @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)"; \ +@@ -848,10 +902,24 @@ clean: cleanhelp clean-packages + $(RM) $(TCLSH) $(CAT32) $(TEST_EXE_FILE) $(TEST_DLL_FILE) tcltest.cmd tcltest.sh + $(RM) *.pch *.ilk *.pdb *.zip + $(RMDIR) *.vfs ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "TKDIR detected - automatically cleaning Tk..."; \ ++ echo "Cleaning Tk build..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE) clean) || exit $$?; \ ++ else \ ++ echo "TKDIR not set, directory does not exist, or no Tk build to clean"; \ ++ fi + + distclean: distclean-packages clean + $(RM) Makefile config.status config.cache config.log tclConfig.sh \ + tcl.hpj config.status.lineno tclsh.exe.manifest tclUuid.h ++ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \ ++ echo "TKDIR detected - automatically distcleaning Tk..."; \ ++ echo "Distcleaning Tk build..."; \ ++ (cd "$(TK_BUILD_TOP)" && $(MAKE) distclean) || exit $$?; \ ++ else \ ++ echo "TKDIR not set, directory does not exist, or no Tk build to distclean"; \ ++ fi + + # + # Bundled package targets +-- +2.47.1.windows.2 + diff --git a/adm/vcpkg/ports/tcl/portfile.cmake b/adm/vcpkg/ports/tcl/portfile.cmake index 5c28634664..2055f9025c 100644 --- a/adm/vcpkg/ports/tcl/portfile.cmake +++ b/adm/vcpkg/ports/tcl/portfile.cmake @@ -1,20 +1,56 @@ vcpkg_from_sourceforge( OUT_SOURCE_PATH SOURCE_PATH REPO tcl/Tcl - REF 8.6.15 - FILENAME tcl8.6.15-src.tar.gz - SHA512 9ae652823084899091467744da5a35d0fdfb453c055baea96af1bb181d161abe58b83382315cc3abee5fd57acc4ad5028df486a3e53645a28d1467e9c8d1d23e + REF 8.6.16 + FILENAME tcl8.6.16-src.tar.gz + SHA512 434c92f8181fb8dca6bc065b0f1f5078779086f19adf008818c90a3108596c63465ef43e9f3c1cfb3d4151a9de244d0bf0e6ee5b40e714b1ddca4a78eb43050b + PATCHES + 0001-Add-tk-build.patch + 0002-Add-setpath-target.patch + 0003-Update-unix-build.patch + 0004-Update-mingw-build.patch ) -if (VCPKG_TARGET_IS_WINDOWS) - if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") +set(USE_TCL_TK OFF) + +if ("tk" IN_LIST FEATURES) + vcpkg_from_sourceforge( + OUT_SOURCE_PATH TK_SOURCE_PATH + REPO tcl/Tcl + REF 8.6.16 + FILENAME tk8.6.16-src.tar.gz + SHA512 b7d37bee25f826f156137a04859ac756c682f1dd155ec9629119dc3690509ce1b6e308e23b291f2debbc10f3b1650993fea66463e5445c505860a10acac901d0 + ) + + # Copy TK to TCL package source path (SOURCE_PATH/extra/tk) if TK is used + if (NOT EXISTS "${SOURCE_PATH}/extra/tk.8.6.16-src") + file(MAKE_DIRECTORY "${SOURCE_PATH}/extra/tk.8.6.16-src") + file(COPY ${TK_SOURCE_PATH}/ DESTINATION "${SOURCE_PATH}/extra/tk.8.6.16-src") + endif() + set (USE_TCL_TK ON) +endif() + +# Copy TK to TCL package source path if TK is used + +# Use Windows NMAKE build for MSVC, but Unix build for MinGW +if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") set(TCL_BUILD_MACHINE_STR MACHINE=AMD64) - else() + set(TCL_BUILD_ARCH_STR ARCH=AMD64) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + set(TCL_BUILD_MACHINE_STR MACHINE=ARM64) + set(TCL_BUILD_ARCH_STR ARCH=ARM64) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86") set(TCL_BUILD_MACHINE_STR MACHINE=IX86) + set(TCL_BUILD_ARCH_STR ARCH=IX86) + else() + # Default fallback for unknown architectures + set(TCL_BUILD_MACHINE_STR MACHINE=IX86) + set(TCL_BUILD_ARCH_STR ARCH=IX86) endif() # Handle features - set(TCL_BUILD_OPTS OPTS=pdbs) + set(TCL_BUILD_OPTS OPTS=) set(TCL_BUILD_STATS STATS=none) set(TCL_BUILD_CHECKS CHECKS=none) if (VCPKG_LIBRARY_LINKAGE STREQUAL static) @@ -42,109 +78,47 @@ if (VCPKG_TARGET_IS_WINDOWS) PROJECT_SUBPATH win OPTIONS ${TCL_BUILD_MACHINE_STR} + ${TCL_BUILD_ARCH_STR} ${TCL_BUILD_STATS} ${TCL_BUILD_CHECKS} + TKDIR=../extra/tk.8.6.16-src OPTIONS_DEBUG - ${TCL_BUILD_OPTS},symbols + ${TCL_BUILD_OPTS},symbols,pdbs INSTALLDIR=${CURRENT_PACKAGES_DIR}/debug - SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0 OPTIONS_RELEASE - release ${TCL_BUILD_OPTS} INSTALLDIR=${CURRENT_PACKAGES_DIR} - SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0 ) - # Install - # Note: tcl shell requires it to be in a folder adjacent to the /lib/ folder, i.e. in a /bin/ folder - if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) - file(GLOB_RECURSE TOOL_BIN - "${CURRENT_PACKAGES_DIR}/bin/*.exe" - "${CURRENT_PACKAGES_DIR}/bin/*.dll" - ) - file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/bin/") - - # Remove .exes only after copying - file(GLOB_RECURSE TOOL_EXES - ${CURRENT_PACKAGES_DIR}/bin/*.exe - ) - file(REMOVE ${TOOL_EXES}) - - file(GLOB_RECURSE TOOLS - "${CURRENT_PACKAGES_DIR}/lib/dde1.4/*" - "${CURRENT_PACKAGES_DIR}/lib/nmake/*" - "${CURRENT_PACKAGES_DIR}/lib/reg1.3/*" - "${CURRENT_PACKAGES_DIR}/lib/tcl8/*" - "${CURRENT_PACKAGES_DIR}/lib/tcl8.6/*" - "${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0/*" - ) - - foreach(TOOL ${TOOLS}) - get_filename_component(DST_DIR ${TOOL} PATH) - file(COPY "${TOOL}" DESTINATION ${DST_DIR}) - endforeach() - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/dde1.4" - "${CURRENT_PACKAGES_DIR}/lib/nmake" - "${CURRENT_PACKAGES_DIR}/lib/reg1.3" - "${CURRENT_PACKAGES_DIR}/lib/tcl8" - "${CURRENT_PACKAGES_DIR}/lib/tcl8.6" - "${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0" - ) - file(CHMOD_RECURSE - "${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/tzdata" - PERMISSIONS - OWNER_READ OWNER_WRITE - GROUP_READ GROUP_WRITE - WORLD_READ WORLD_WRITE - ) - endif() - if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) - file(GLOB_RECURSE TOOL_BIN - "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe" - "${CURRENT_PACKAGES_DIR}/debug/bin/*.dll" - ) - file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/bin/") - - # Remove .exes only after copying - file(GLOB_RECURSE EXES - "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe" - ) - file(REMOVE ${EXES}) - - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/dde1.4" - "${CURRENT_PACKAGES_DIR}/debug/lib/nmake" - "${CURRENT_PACKAGES_DIR}/debug/lib/reg1.3" - "${CURRENT_PACKAGES_DIR}/debug/lib/tcl8" - "${CURRENT_PACKAGES_DIR}/debug/lib/tcl8.6" - "${CURRENT_PACKAGES_DIR}/debug/lib/tdbcsqlite31.1.0" - ) - - file(CHMOD_RECURSE - "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/tzdata" - PERMISSIONS - OWNER_READ OWNER_WRITE - GROUP_READ GROUP_WRITE - WORLD_READ WORLD_WRITE - ) - endif() - if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() file (REMOVE ${CURRENT_PACKAGES_DIR}/bin/zlib1.dll) file (REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/zlib1.dll) - - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") else() + set (TCL_PROJECT_SUBPATH unix) + if (VCPKG_TARGET_IS_MINGW) + set (TCL_PROJECT_SUBPATH win) + endif() + file(REMOVE "${SOURCE_PATH}/${TCL_PROJECT_SUBPATH}/configure") + # For MinGW and other Unix-like environments on Windows, use unix build path + # MinGW can use either win/ (with MinGW-compatible Makefiles) or unix/ (with autotools) vcpkg_configure_make( SOURCE_PATH "${SOURCE_PATH}" - PROJECT_SUBPATH unix + PROJECT_SUBPATH ${TCL_PROJECT_SUBPATH} + OPTIONS + TKDIR=${SOURCE_PATH}/extra/tk.8.6.16-src ) - - vcpkg_install_make() + + vcpkg_install_make( + OPTIONS + TKDIR=${SOURCE_PATH}/extra/tk.8.6.16-src + ) + vcpkg_fixup_pkgconfig() - + if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() @@ -153,4 +127,9 @@ endif() file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tclConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tclConfig.sh") +# Remove TK configuration files if TK was built +if(USE_TCL_TK) + file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tkConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tkConfig.sh") +endif() + vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.terms") diff --git a/adm/vcpkg/ports/tcl/vcpkg.json b/adm/vcpkg/ports/tcl/vcpkg.json index 89a8001164..e1acd43e1a 100644 --- a/adm/vcpkg/ports/tcl/vcpkg.json +++ b/adm/vcpkg/ports/tcl/vcpkg.json @@ -20,6 +20,9 @@ }, "utfmax": { "description": "Forces Tcl_UniChar to be a 32-bit quantity in stead of 16-bits" + }, + "tk" : { + "description": "Enables optional usage of Tk. Part of the module-foundation-classes." } } } diff --git a/adm/vcpkg/vcpkg.json b/adm/vcpkg/vcpkg.json index d3ee6b74b6..43676d24e9 100644 --- a/adm/vcpkg/vcpkg.json +++ b/adm/vcpkg/vcpkg.json @@ -26,7 +26,7 @@ }, { "name": "angle", - "platform": "uwp" + "platform": "uwp" }, { "name": "opengl", @@ -52,6 +52,17 @@ "tcl" ] }, + "tcltk": { + "description": "Enables optional usage of TclTk. Part of the module-foundation-classes.", + "dependencies": [ + { + "name": "tcl", + "features": [ + "tk" + ] + } + ] + }, "freeimage": { "description": "Enables optional usage of FreeImage. Part of the module-visualization.", "dependencies": [