diff --git a/dev-lang/tk/patches/tk-8.6.10.patchset b/dev-lang/tk/patches/tk-8.6.10.patchset new file mode 100644 index 000000000..7fd2c735e --- /dev/null +++ b/dev-lang/tk/patches/tk-8.6.10.patchset @@ -0,0 +1,190 @@ +From 2aceca35462c26243dfdf9c76963a03172fc7355 Mon Sep 17 00:00:00 2001 +From: Augustin Cavalier +Date: Wed, 17 Nov 2021 17:42:17 -0500 +Subject: Fixes for Haiku. + + +diff --git a/sdl/SdlTkX.c b/sdl/SdlTkX.c +index 4ac99ba..78f102d 100644 +--- a/sdl/SdlTkX.c ++++ b/sdl/SdlTkX.c +@@ -106,7 +106,7 @@ struct EventThreadStartup { + int init_done; + int *root_width; + int *root_height; +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + int want_startup_script; + char *startup_script; + #endif +@@ -128,7 +128,7 @@ static Tcl_Condition xlib_cond; + static Tcl_Condition time_cond; + static SDL_atomic_t timer_enabled; + static int num_displays = 0; +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + struct EventThreadStartup evt_startup = { 0, NULL, NULL, 0, NULL }; + #endif + +@@ -155,6 +155,12 @@ static void SdlTkLostFocusWindow(void); + void + SdlTkLock(Display *display) + { ++#ifdef __HAIKU__ ++ // We may get called before things are fully initialized. ++ while (!tclStubsPtr) ++ sched_yield(); ++#endif ++ + Tcl_MutexLock(&xlib_lock); + if (display != NULL) { + while ((xlib_grab != NULL) && (xlib_grab != display)) { +@@ -5752,6 +5758,15 @@ fatal: + } + #endif + ++#ifdef __HAIKU__ ++ // Set defaults so that things work better. ++ SdlTkX.arg_nogl = 1; ++ SdlTkX.arg_resizable = 1; ++ SdlTkX.arg_swcursor = 1; ++ width = 800; ++ height = 600; ++#endif ++ + /* Preset some defaults. */ + SdlTkX.dec_frame_width = 6; + SdlTkX.dec_title_height = 20; +@@ -5785,8 +5800,10 @@ fatal: + if (SdlTkX.arg_noborder) { + videoFlags |= SDL_WINDOW_BORDERLESS; + } ++#ifndef __HAIKU__ + width = 1024; + height = 768; ++#endif + /* + * Start the root window hidden since font init + * may take some time. At end of font init in +@@ -6523,7 +6540,7 @@ ctxRetry: + *---------------------------------------------------------------------- + */ + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + void + SdlTkEventThread(void) + #else +@@ -6543,7 +6560,7 @@ EventThread(ClientData clientData) + Uint16 rate, Uint16 delay); + extern int SDL_SendKeyboardText(const char *text); + #endif +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + struct EventThreadStartup *evs = &evt_startup; + #else + struct EventThreadStartup *evs = (struct EventThreadStartup *) clientData; +@@ -6554,13 +6571,13 @@ EventThread(ClientData clientData) + Android_JNI_SetupThread(); + #endif + SdlTkLock(NULL); +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + while (evs->root_width == NULL && evs->root_height == NULL) { + SdlTkWaitLock(); + } + #endif + initSuccess = PerformSDLInit(evs->root_width, evs->root_height); +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + evs->root_width = evs->root_height = NULL; + SDL_PumpEvents(); + if (evs->want_startup_script) { +@@ -6774,7 +6791,7 @@ EventThread(ClientData clientData) + } + + eventThreadEnd: +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + exit(3); + #else + Tcl_ExitThread(0); +@@ -6782,7 +6799,7 @@ eventThreadEnd: + #endif + } + +-#ifndef __APPLE__ ++#if !defined(__APPLE__) && !defined(__HAIKU__) + static void + EventThreadExitHandler(ClientData clientData) + { +@@ -6802,7 +6819,7 @@ EventThreadExitHandler(ClientData clientData) + static void + OpenVeryFirstDisplay(int *root_width, int *root_height) + { +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + struct EventThreadStartup *evs = &evt_startup; + #else + extern void TclCreateLateExitHandler(Tcl_ExitProc *, ClientData); +@@ -6812,7 +6829,7 @@ OpenVeryFirstDisplay(int *root_width, int *root_height) + evs->init_done = 0; + evs->root_width = root_width; + evs->root_height = root_height; +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + /* + * Rendezvous with already running event thread, which + * in MacOSX must be the main thread. +diff --git a/sdl/tkAppInit.c b/sdl/tkAppInit.c +index e40eab2..e2ae821 100644 +--- a/sdl/tkAppInit.c ++++ b/sdl/tkAppInit.c +@@ -68,7 +68,7 @@ MODULE_SCOPE int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv); + #undef Tcl_ObjSetVar2 + #undef Tcl_NewStringObj + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + struct ThreadStartup { + int argc; + char **argv; +@@ -308,7 +308,7 @@ GetOBBDir(void) + } + #endif + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + /* + *---------------------------------------------------------------------- + * +@@ -356,7 +356,7 @@ main( + const char *path, *temp, *pcpath; + char *ldpath = NULL, *end; + #endif +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + Tcl_ThreadId thrId; + struct ThreadStartup startup; + extern void SdlTkEventThread(void); +@@ -438,7 +438,7 @@ main( + free(ldpath); + ldpath = NULL; + } +- } ++ } + } + /* now enhance LD_LIBRARY_PATH and PATH */ + if (ldpath != NULL) { +@@ -504,7 +504,7 @@ main( + #else + Tcl_FindExecutable(argv[0]); + #endif +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__HAIKU__) + /* + * We need the SDL event handling run in the main thread, + * which seems to be a Cocoa requirement. Therefore Tk_MainEx() +-- +2.30.2 + diff --git a/dev-lang/tk/tk-8.6.9.recipe b/dev-lang/tk/tk-8.6.10.recipe similarity index 83% rename from dev-lang/tk/tk-8.6.9.recipe rename to dev-lang/tk/tk-8.6.10.recipe index 61d8758a5..50aa4c652 100644 --- a/dev-lang/tk/tk-8.6.9.recipe +++ b/dev-lang/tk/tk-8.6.10.recipe @@ -11,12 +11,12 @@ HOMEPAGE="https://www.androwish.org" COPYRIGHT="Regents of the University of California, Sun Microsystems, Inc., Scriptics Corporation, and other parties" LICENSE="BSD (2-clause)" REVISION="1" -SOURCE_URI="https://www.androwish.org/download/androwish-6e2085e6e4.tar.gz" -CHECKSUM_SHA256="71bb1a7421c4c07e0762084def72d0af7b645c0ae5188d0f2389e74305be8de7" -SOURCE_DIR="androwish-6e2085e6e4/jni/sdl2tk/" +SOURCE_URI="http://androwish.org/download/androwish-c48f047f5b.tar.gz" +CHECKSUM_SHA256="4ecbc23193cb00b9fc34c0942e2327f0b6badbe587ab574b492780994707683d" +SOURCE_DIR="androwish-c48f047f5b/jni/sdl2tk/" +PATCHES="tk-$portVersion.patchset" -# disabled: builds but does not work -ARCHITECTURES="?all" +ARCHITECTURES="all" PROVIDES=" tk = $portVersion compat >= 8.6 @@ -27,6 +27,7 @@ PROVIDES=" REQUIRES=" haiku tcl + lib:libz lib:libfreetype lib:libSDL2_2.0 " @@ -42,6 +43,7 @@ REQUIRES_devel=" BUILD_REQUIRES=" tcl_devel + devel:libz devel:libfreetype devel:libSDL2 " @@ -57,7 +59,7 @@ BUILD() { cd sdl - LDFLAGS="-Wl,--no-undefined -ltcl8.6" \ + LDFLAGS="-Wl,--no-undefined" \ CFLAGS=-DTclpGetMonotonicTime=Tcl_GetTime \ runConfigure ./configure \ --with-tcl=/system/develop/lib/ \ @@ -69,6 +71,9 @@ BUILD() sed -i s/-lstdc++/-lstdc++.r4/ Makefile fi + # patch Makefile for shared Tcl compatibility + sed -i 's/-ltcl8.6/-ltcl8.6 -ltclstub8.6/' Makefile + # patch Makefile to be "regular Tk" sed -i s/tkZipMain/tkMain/ Makefile sed -i s/libsdl2tk/libtk/ Makefile