diff options
author | Ismael Luceno | 2021-12-31 08:06:13 +0100 |
---|---|---|
committer | Ismael Luceno | 2021-12-31 19:59:06 +0100 |
commit | 367a118117fb1574fa61a518dd08435fcdb7cd8b (patch) | |
tree | 0273adcf3e8a50274b033eb7971c9cb0e81bfce1 | |
parent | c5032ef68eeb303b8c57f8e425f204f5b72b2725 (diff) |
allegro 4.4.2
20 files changed, 556 insertions, 55 deletions
diff --git a/games-libs/allegro/BUILD b/games-libs/allegro/BUILD index e773624a..b89387ea 100755 --- a/games-libs/allegro/BUILD +++ b/games-libs/allegro/BUILD @@ -1,3 +1,3 @@ -OPTS="$ALLEGRO_ALL_OPTS $OPTS" && -make_single && +OPTS+=' -DSHARED=on -DWANT_EXAMPLES=off' && +CFLAGS+=' -Wno-unused' && default_build diff --git a/games-libs/allegro/CONFIGURE b/games-libs/allegro/CONFIGURE index c69517ab..b85c91a5 100755 --- a/games-libs/allegro/CONFIGURE +++ b/games-libs/allegro/CONFIGURE @@ -1,32 +1,20 @@ -message ${MESSAGE_COLOR}General options${DEFAULT_COLOR} -config_query_option ALLEGRO_ASM "Enable assembler optimizations" y "--enable-asm=yes" "--enable-asm=no" -config_query_option ALLEGRO_MMX "Enable mmx support" y "--enable-mmx=yes" "--enable-mmx=no" -config_query_option ALLEGRO_SSE "Enable sse support" y "--enable-sse=yes" "--enable-sse=no" -config_query_option ALLEGRO_PTHREADS "Enable threads" y "--enable-pthreads=yes" "--enable-pthreads=no" +. "$GRIMOIRE"/CMAKE_CONFIGURE && -message ${MESSAGE_COLOR}Audio options${DEFAULT_COLOR} -config_query_option ALLEGRO_OSSDIGI "Enable OSS digi support" n "--enable-ossdigi=yes" "--enable-ossdigi=no" -config_query_option ALLEGRO_OSSMIDI "Enable OSS midi support" n "--enable-ossmidi=yes" "--enable-ossmidi=no" -config_query_option ALLEGRO_ALSAMIDI "Enable ALSA midi" n "--enable-alsamidi=yes" "--enable-alsamidi=no" -config_query_option ALLEGRO_SGIALDIGI "Enable SGI support" n "--enable-sgialdigi=yes" "--enable-sgialdigi=no" +message ${MESSAGE_COLOR}Audio options${DEFAULT_COLOR} && +config_query_option ALLEGRO_OPTS "Enable OSS digi support" n \ + -DWANT_OSS={on,off} && -message ${MESSAGE_COLOR}Video options${DEFAULT_COLOR} -config_query_option ALLEGRO_COLOR8 "Enable 8bpp colors" y "--enable-color8=yes" "--enable-color8=no" -config_query_option ALLEGRO_COLOR16 "Enable 16bpp colors" y "--enable-color16=yes" "--enable-color16=no" -config_query_option ALLEGRO_COLOR24 "Enable 24bpp colors" y "--enable-color24=yes" "--enable-color24=yes" -config_query_option ALLEGRO_COLOR32 "Enable 32bpp colors" y "--enable-color32=yes" "--enable-color32=no" -config_query_option ALLEGRO_SHM "Enable shared memory support" n "--enable-xwin-shm=yes" "--enable-xwin-shm=no" -config_query_option ALLEGRO_VIDMODE "Enable use of X VidMode extensions" n "--enable-xwin-vidmode=yes" "--enable-xwin-vidmode=no" -config_query_option ALLEGRO_DGA2 "Enable support for DGA2" n "--enable-xwin-dga2=yes" "--enable-xwin-dga2=no" -config_query_option ALLEGRO_LINUX "Enable linux console support" y "--enable-linux=yes" "--enable-linux=no" -config_query_option ALLEGRO_VGA "Enable vga support" y "--enable-vga=yes" "--enable-vga=no" -config_query_option ALLEGRO_FBCON "Enable frambuffer console support" n "--enable-fbcon=yes" "--enable-fbcon=no" -config_query_option ALLEGRO_VBEAF "Enable VBE/AF support" n "--enable-vbeaf=yes" "--enable-vbeaf=no" +message ${MESSAGE_COLOR}Video options${DEFAULT_COLOR} && +config_query_option ALLEGRO_OPTS "Enable linux console support" n \ + -DWANT_LINUX_CONSOLE={on,off} && +config_query_option ALLEGRO_OPTS "Enable vga support" n \ + -DWANT_LINUX_VGA={on,off} && +config_query_option ALLEGRO_OPTS "Enable frambuffer console support" n \ + -DWANT_LINUX_FBCON={on,off} && -ALLEGRO_ALL_OPTS="$ALLEGRO_ASM \ -$ALLEGRO_MMX $ALLEGRO_SSE $ALLEGRO_PTHREADS \ -$ALLEGRO_OSSDIGI $ALLEGRO_OSSMIDI $ALLEGRO_ALSAMIDI \ -$ALLEGRO_SGIALDIGI $ALLEGRO_COLOR8 $ALLEGRO_COLOR16 \ -$ALLEGRO_COLOR24 $ALLEGRO_COLOR32 $ALLEGRO_SHM \ -$ALLEGRO_VIDMODE $ALLEGRO_DGA2 $ALLEGRO_LINUX \ -$ALLEGRO_VGA $ALLEGRO_FBCON $ALLEGRO_VBEAF" +message ${MESSAGE_COLOR}Addons${DEFAULT_COLOR} && +config_query_option ALLEGRO_OPTS "Enable JPGAlleg" y \ + -DWANT_JPGALLEG={on,off} && + +config_query_option ALLEGRO_OPTS "Enable Loadpng" y \ + -DWANT_LOADPNG={on,off} diff --git a/games-libs/allegro/DEPENDS b/games-libs/allegro/DEPENDS index 06a29999..4d220474 100755 --- a/games-libs/allegro/DEPENDS +++ b/games-libs/allegro/DEPENDS @@ -1,4 +1,19 @@ -optional_depends svgalib "--enable-svgalib=yes" "--enable-svgalib=no" "Enable svgalib support" -optional_depends jack "--enable-jackdigi=yes" "--enable-jackdigi=no" "Enable JACK support" -optional_depends alsa-lib "--enable-alsadigi=yes" "--enable-alsadigi=no" "Enable alsa support" -optional_depends esound "--enable-esddigi=yes" "--enable-esddigi=no" "Enable esd support" +. "$GRIMOIRE"/CMAKE_DEPENDS && +optional_depends svgalib \ + -DWANT_LINUX_SVGALIB={on,off} \ + 'Enable svgalib support' && +optional_depends jack \ + -DWANT_JACK={on,off} \ + 'Enable JACK support' && +optional_depends alsa-lib \ + -DWANT_ALSA={on,off} \ + 'Enable ALSA audio support' && +optional_depends libx11 \ + -DWANT_X11={on,off} \ + 'for X11 support' && +optional_depends libvorbis \ + -DWANT_LOGG={on,off} \ + 'for Logg addon (Vorbis support)' && +optional_depends OPENGL \ + -DWANT_ALLEGROGL={on,off} \ + 'for AllegroGL addon (OpenGL support)' diff --git a/games-libs/allegro/DETAILS b/games-libs/allegro/DETAILS index 52905cd5..78aa85e1 100755 --- a/games-libs/allegro/DETAILS +++ b/games-libs/allegro/DETAILS @@ -1,9 +1,10 @@ +. "$GRIMOIRE"/CMAKE_FUNCTIONS SPELL=allegro - VERSION=4.2.2 + VERSION=4.4.2 SOURCE=${SPELL}-${VERSION}.tar.gz SOURCE_DIRECTORY=${BUILD_DIRECTORY}/${SPELL}-${VERSION} SOURCE_URL[0]=${SOURCEFORGE_URL}/alleg/${SOURCE} - SOURCE_HASH=sha512:e8df1e6d3e9c671e2e6e9bbc619dd5ae0391465e8cd295cea1a6c60bb7e856f6906038ef9f21556877c8eb65ed0d179ca93cc70cae172b63c05518ce28a23943 + SOURCE_HASH=sha512:ad4bc1c15fc83bc8a019031fed82f37a793664bb6683cf023ec05fd9cd945f00f43764f3126892426036249c63afa5678fb4906407bb325ce5827b36aee0fa86 WEB_SITE=http://alleg.sourceforge.net/ ENTERED=20020107 LICENSE[0]=http://alleg.sourceforge.net/license.html diff --git a/games-libs/allegro/HISTORY b/games-libs/allegro/HISTORY index 31aaeb33..68abd5d6 100644 --- a/games-libs/allegro/HISTORY +++ b/games-libs/allegro/HISTORY @@ -1,3 +1,21 @@ +2021-12-30 Ismael Luceno <ismael@sourcemage.org> + * CONFIGURE, DEPENDS, DETAILS: updated spell to 4.4.2 + * BUILD, INSTALL, asm.patch: removed, no longer needed + * PRE_BUILD: switched to apply_patch_dir + * 0001-Don-t-override-CMAKE_INSTALL_PREFIX-if-it-is-already-set..patch, + 0001-Fix-building-with-Mesa-18.2.5-and-later.patch, + 0001-Fix-typo-preventing-get_executable_name-from-using-System-V-procfs.patch, + 0001-Include-stdio.h-for-printf-declaration..patch, + 0001-Make-internal-function-get_value-in-jpgalleg-static.patch, + 0001-Remove-f-variants-of-fixed-math-functions.patch, + 0001-Fix-format-string-warnings-Andreas-R-nnquist-..patch, + 0001-The-keyboard-handler-has-a-race-condition-that-can-cause-Allegro.patch, + 0001-fixes-wrong-assert-in-mouse.c-in-set_mouse_range.patch, + 0001-x-xkeyboard.c-Changes-setlocale-to-LC_CTYPE.patch, + 0001-xwin.c-fix-broken-xwin_set_window_name.patch, + 0001-xwin.c-increase-X_MAX_EVENTS-to-50.patch: + added build fixes and bug fixes + 2011-10-10 Bor Kraljič <pyrobor@ver.si> * DEPENDS: removed arts as optional dependency diff --git a/games-libs/allegro/INSTALL b/games-libs/allegro/INSTALL deleted file mode 100755 index 97b4a3f6..00000000 --- a/games-libs/allegro/INSTALL +++ /dev/null @@ -1,3 +0,0 @@ -make install && -make install-gzipped-man && -make install-gzipped-info diff --git a/games-libs/allegro/PRE_BUILD b/games-libs/allegro/PRE_BUILD index e528ea97..c230ad14 100755 --- a/games-libs/allegro/PRE_BUILD +++ b/games-libs/allegro/PRE_BUILD @@ -1,3 +1,3 @@ -default_pre_build && -cd $SOURCE_DIRECTORY && -patch -p1 < $SCRIPT_DIRECTORY/asm.patch +default_pre_build && +cd "$SOURCE_DIRECTORY" && +apply_patch_dir patches diff --git a/games-libs/allegro/asm.patch b/games-libs/allegro/asm.patch deleted file mode 100644 index d6085d55..00000000 --- a/games-libs/allegro/asm.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uarpN allegro-4.2.2.orig/src/i386/icpus.s allegro-4.2.2/src/i386/icpus.s ---- allegro-4.2.2.orig/src/i386/icpus.s 2009-06-24 15:03:05.000000000 +0800 -+++ allegro-4.2.2/src/i386/icpus.s 2009-06-24 15:03:50.000000000 +0800 -@@ -67,7 +67,7 @@ FUNC(_i_is_fpu) - - fninit - movl $0x5A5A, %eax -- fnstsw %eax -+ fnstsw %ax - cmpl $0, %eax - jne is_fpu_not_found - diff --git a/games-libs/allegro/patches/0001-Don-t-override-CMAKE_INSTALL_PREFIX-if-it-is-already-set..patch b/games-libs/allegro/patches/0001-Don-t-override-CMAKE_INSTALL_PREFIX-if-it-is-already-set..patch new file mode 100644 index 00000000..1ab88c98 --- /dev/null +++ b/games-libs/allegro/patches/0001-Don-t-override-CMAKE_INSTALL_PREFIX-if-it-is-already-set..patch @@ -0,0 +1,41 @@ +From 5fc337cf9225ce1706ff438a2dc5279cef79bcbf Mon Sep 17 00:00:00 2001 +From: Pavel Sountsov <siege@google.com> +Date: Fri, 12 Aug 2016 21:27:11 -0700 +Subject: Don't override CMAKE_INSTALL_PREFIX if it is already set. + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dd22353f1c00..d661bd9c78f3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -224,8 +224,6 @@ endif(UNIX) + + option(STRICT_WARN "Halt at warnings" off) + +-set(INSTALL_PREFIX "") +- + if(CMAKE_COMPILER_IS_GNUCC) + set(COMPILER_GCC 1) + set(ALLEGRO_GCC 1) +@@ -254,11 +252,9 @@ if(MINGW) + set(CMAKE_PREFIX_PATH "${MINGDIR}") + + # Install to MINGDIR +- if(INSTALL_PREFIX STREQUAL "") ++ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX ${MINGDIR}) +- else(INSTALL_PREFIX STREQUAL "") +- set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX}) +- endif(INSTALL_PREFIX STREQUAL "") ++ endif() + + message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") + endif(MINGW) +@@ -310,7 +306,6 @@ if(PSP) + set(ALLEGRO_PSP 1) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -G0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -G0 -fno-exceptions -fno-rtti") +- set(CMAKE_INSTALL_PREFIX ${PSP_PREFIX}) + endif(PSP) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WFLAGS} ${WFLAGS_C_ONLY}") diff --git a/games-libs/allegro/patches/0001-Fix-building-with-Mesa-18.2.5-and-later.patch b/games-libs/allegro/patches/0001-Fix-building-with-Mesa-18.2.5-and-later.patch new file mode 100644 index 00000000..44fbc166 --- /dev/null +++ b/games-libs/allegro/patches/0001-Fix-building-with-Mesa-18.2.5-and-later.patch @@ -0,0 +1,40 @@ +From 4d46f276f847a39db182fe55a2fbb244f4fc6b34 Mon Sep 17 00:00:00 2001 +From: Andreas Rönnquist <andreas@ronnquist.net> +Date: Wed, 12 Dec 2018 16:27:37 +0100 +Subject: Fix building with Mesa 18.2.5 and later + +Based on the patch on Allegro5, +https://github.com/liballeg/allegro5/commit/a40d30e21802ecf5c9382cf34af9b01bd3781e47 + +diff --git a/addons/allegrogl/include/alleggl.h b/addons/allegrogl/include/alleggl.h +index 12d71c3c5a62..fa36c9844ac2 100644 +--- a/addons/allegrogl/include/alleggl.h ++++ b/addons/allegrogl/include/alleggl.h +@@ -62,10 +62,14 @@ typedef __int64 INT64; + + /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */ + #define __glext_h_ ++#define __gl_glext_h_ + #define __glxext_h_ ++#define __glx_glxext_h_ + #include <GL/gl.h> + #undef __glext_h_ ++#undef __gl_glext_h_ + #undef __glxext_h_ ++#undef __glx_glxext_h_ + + #endif /* ALLEGRO_MACOSX */ + +diff --git a/addons/allegrogl/include/allegrogl/GLext/glx_ext_defs.h b/addons/allegrogl/include/allegrogl/GLext/glx_ext_defs.h +index 6b2e5712053a..30f0dce236d0 100644 +--- a/addons/allegrogl/include/allegrogl/GLext/glx_ext_defs.h ++++ b/addons/allegrogl/include/allegrogl/GLext/glx_ext_defs.h +@@ -1,6 +1,8 @@ + /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */ + #define __glxext_h_ ++#define __glx_glxext_h_ + #include <GL/glx.h> ++#undef __glx_glxext_h_ + #undef __glxext_h_ + + #ifndef GLX_VERSION_1_3 diff --git a/games-libs/allegro/patches/0001-Fix-format-string-warnings-Andreas-R-nnquist-..patch b/games-libs/allegro/patches/0001-Fix-format-string-warnings-Andreas-R-nnquist-..patch new file mode 100644 index 00000000..917c9072 --- /dev/null +++ b/games-libs/allegro/patches/0001-Fix-format-string-warnings-Andreas-R-nnquist-..patch @@ -0,0 +1,135 @@ +From 15633498073044f0d0cbf4e102a6f51b2065e67d Mon Sep 17 00:00:00 2001 +From: Peter Wang <tjaden@users.sourceforge.net> +Date: Thu, 12 Apr 2012 13:32:41 +0000 +Subject: Fix format string warnings (Andreas Rönnquist). +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ismael@sourcemage.org: Merged with followup patch by Peter Wang + 7c331f1b8115 ("Replace unnecessary uses of format string functions") + plus added a missing edit in the same spirit] + +diff --git a/examples/exkeys.c b/examples/exkeys.c +index 9ea8485f5073..6d16202c7d04 100644 +--- a/examples/exkeys.c ++++ b/examples/exkeys.c +@@ -73,7 +73,7 @@ void keypress_handler(int scancode) + color = scancode & 0x80 ? makecol(255, 255, 0) : makecol(128, 0, 0); + rectfill(screen, x, y, x + 95, y + 8, color); + ustrzncpy(str, sizeof(str), scancode_to_name(i), 12); +- textprintf_ex(screen, font, x + 1, y + 1, makecol(0, 0, 0), -1, "%s", str); ++ textout_ex(screen, font, str, x + 1, y + 1, makecol(0, 0, 0), -1); + } + END_OF_FUNCTION(keypress_handler) + +@@ -193,7 +193,7 @@ int main(void) + if (key_shifts & KB_NUMLOCK_FLAG) strcat(buf, " num"); + if (key_shifts & KB_SCROLOCK_FLAG) strcat(buf, " scrl"); + scroll(); +- textprintf_ex(screen, font, 8, SCREEN_H-16, makecol(0, 0, 0), makecol(255, 255, 255), buf); ++ textout_ex(screen, font, buf, 8, SCREEN_H-16, makecol(0, 0, 0), makecol(255, 255, 255); + } while (k != 27); + + /* various scan codes are defined in allegro.h as KEY_* constants */ +@@ -234,7 +234,7 @@ int main(void) + if (key[KEY_8]) buf[8] = '8'; else buf[8] = ' '; + if (key[KEY_9]) buf[9] = '9'; else buf[9] = ' '; + buf[10] = 0; +- textprintf_ex(screen, font, 8, SCREEN_H-16, makecol(0, 0, 0), makecol(255, 255, 255), buf); ++ textout_ex(screen, font, buf, 8, SCREEN_H-16, makecol(0, 0, 0), makecol(255, 255, 255)); + rest(1); + } while (!keypressed() || (readkey() >> 8) != KEY_ESC); + +diff --git a/examples/extrans2.c b/examples/extrans2.c +index 4400a117b930..1b25f56446b8 100644 +--- a/examples/extrans2.c ++++ b/examples/extrans2.c +@@ -211,7 +211,7 @@ int main(int argc, char **argv) + } else { + msg = "no flipping"; + } +- textprintf_ex(buffer, font, 1, 1, makecol(255, 255, 255), -1, msg); ++ textout_ex(buffer, font, msg, 1, 1, makecol(255, 255, 255), -1); + + /* finally blit the back buffer on the screen */ + blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h); +diff --git a/setup/setup.c b/setup/setup.c +index 894bacbe283a..915ffeb55719 100644 +--- a/setup/setup.c ++++ b/setup/setup.c +@@ -1163,7 +1163,7 @@ static void plot_joystick_state(BITMAP *bmp, int i) + textprintf_ex(bmp, font, SCREEN_W/2-96, SCREEN_H/2-60+c*20, -1, -1, uconvert_ascii("%s (%d/%d)", tmp), + joystick_driver->name, i+1, num_joysticks); + else +- textprintf_ex(bmp, font, SCREEN_W/2-96, SCREEN_H/2-60+c*20, -1, -1, joystick_driver->name); ++ textout_ex(bmp, font, joystick_driver->name, SCREEN_W/2-96, SCREEN_H/2-60+c*20, -1, -1); + c++; + } + +@@ -2879,7 +2879,7 @@ int main(void) + alert(uconvert_ascii("Error loading " SETUP_DATA_FILE, tmp1), NULL, NULL, uconvert_ascii("OK", tmp2), NULL, 13, 0); + #else + set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); +- allegro_message(uconvert_ascii("Error loading " SETUP_DATA_FILE "\n", tmp1)); ++ allegro_message("%s", uconvert_ascii("Error loading " SETUP_DATA_FILE "\n", tmp1)); + #endif + return 1; + } +diff --git a/src/linux/ljoy.c b/src/linux/ljoy.c +index 283b8093c3f1..b60402315f4c 100644 +--- a/src/linux/ljoy.c ++++ b/src/linux/ljoy.c +@@ -93,7 +93,7 @@ static int joy_init(void) + + if (ioctl(joy_fd[i], JSIOCGVERSION, &raw_version) < 0) { + /* NOTE: IOCTL fails if the joystick API is version 0.x */ +- uszprintf(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Your Linux joystick API is version 0.x which is unsupported.")); ++ ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Your Linux joystick API is version 0.x which is unsupported.")); + return -1; + } + +diff --git a/src/unix/umodules.c b/src/unix/umodules.c +index aaa070c48b7a..15afda0c8b7a 100644 +--- a/src/unix/umodules.c ++++ b/src/unix/umodules.c +@@ -126,11 +126,11 @@ void _unix_load_modules(int system_driver) + continue; + + if (!fullpath_slash) { +- snprintf(fullpath, sizeof fullpath, filename); ++ strncpy(fullpath, filename, sizeof fullpath); + fullpath[(sizeof fullpath) - 1] = 0; + } + else { +- snprintf(fullpath_slash+1, (sizeof fullpath) - (fullpath_slash - fullpath) - 1, filename); ++ strncpy(fullpath_slash+1, filename, (sizeof fullpath) - (fullpath_slash - fullpath) - 1); + fullpath[(sizeof fullpath) - 1] = 0; + } + +diff --git a/tests/play.c b/tests/play.c +index c28230286efa..4885223aeca8 100644 +--- a/tests/play.c ++++ b/tests/play.c +@@ -74,7 +74,7 @@ void usage(void) + + strcat(msg, "\nIf you don't specify the card, Allegro will auto-detect (ie. guess :-)\n"); + +- allegro_message(msg); ++ allegro_message("%s", msg); + free(msg); + } + +diff --git a/tools/pack.c b/tools/pack.c +index 09418530ee67..58d7f17b862f 100644 +--- a/tools/pack.c ++++ b/tools/pack.c +@@ -42,7 +42,7 @@ static void err(char *s1, char *s2) + printf(": %s", s1); + + if (s2) +- printf(s2); ++ printf("%s", s2); + + printf("\n"); + diff --git a/games-libs/allegro/patches/0001-Fix-typo-preventing-get_executable_name-from-using-System-V-procfs.patch b/games-libs/allegro/patches/0001-Fix-typo-preventing-get_executable_name-from-using-System-V-procfs.patch new file mode 100644 index 00000000..473b08d5 --- /dev/null +++ b/games-libs/allegro/patches/0001-Fix-typo-preventing-get_executable_name-from-using-System-V-procfs.patch @@ -0,0 +1,20 @@ +From cb670b9a856a1aaf6baf95b873e909f36e68688a Mon Sep 17 00:00:00 2001 +From: Peter Wang <tjaden@users.sourceforge.net> +Date: Tue, 13 Mar 2012 12:15:53 +0000 +Subject: Fix typo preventing get_executable_name from using System V procfs + correctly. Reported by Max Savenkov. + + +diff --git a/src/unix/usystem.c b/src/unix/usystem.c +index a8a171cc300b..3812c8e46e27 100644 +--- a/src/unix/usystem.c ++++ b/src/unix/usystem.c +@@ -370,7 +370,7 @@ void _unix_get_executable_name(char *output, int size) + #ifdef ALLEGRO_HAVE_SV_PROCFS_H + sprintf (linkname, "/proc/%d/exe", (int)pid); + fd = open(linkname, O_RDONLY); +- if (!fd == -1) { ++ if (fd != -1) { + ioctl(fd, PIOCPSINFO, &psinfo); + close(fd); + diff --git a/games-libs/allegro/patches/0001-Include-stdio.h-for-printf-declaration..patch b/games-libs/allegro/patches/0001-Include-stdio.h-for-printf-declaration..patch new file mode 100644 index 00000000..e4a9be7c --- /dev/null +++ b/games-libs/allegro/patches/0001-Include-stdio.h-for-printf-declaration..patch @@ -0,0 +1,15 @@ +From cd8edcd7b360fe9991d679c06e5dab62eae65615 Mon Sep 17 00:00:00 2001 +From: Peter Wang <tjaden@users.sourceforge.net> +Date: Tue, 13 Mar 2012 12:16:28 +0000 +Subject: Include stdio.h for printf declaration. + + +diff --git a/addons/logg/play_ogg.c b/addons/logg/play_ogg.c +index da23da83dd52..f51a097faad9 100644 +--- a/addons/logg/play_ogg.c ++++ b/addons/logg/play_ogg.c +@@ -1,3 +1,4 @@ ++#include <stdio.h> + #include "logg.h" + + int main(int argc, char** argv) diff --git a/games-libs/allegro/patches/0001-Make-internal-function-get_value-in-jpgalleg-static.patch b/games-libs/allegro/patches/0001-Make-internal-function-get_value-in-jpgalleg-static.patch new file mode 100644 index 00000000..8fac1cd0 --- /dev/null +++ b/games-libs/allegro/patches/0001-Make-internal-function-get_value-in-jpgalleg-static.patch @@ -0,0 +1,19 @@ +From 71088c7ad2e7764d1aecdea2dbca9cd46cae18e8 Mon Sep 17 00:00:00 2001 +From: Trent Gamblin <trent@nooskewl.ca> +Date: Tue, 3 Jan 2017 12:36:10 -0700 +Subject: Make internal function get_value in jpgalleg static + + +diff --git a/addons/jpgalleg/src/decode.c b/addons/jpgalleg/src/decode.c +index 6d5510c6999c..db1b9f2fcf18 100644 +--- a/addons/jpgalleg/src/decode.c ++++ b/addons/jpgalleg/src/decode.c +@@ -477,7 +477,7 @@ get_bits(int num_bits) + * Reads a string of bits from the input stream and returns a properly signed + * number given the category. + */ +-INLINE int ++static INLINE int + get_value(int category) + { + int result = get_bits(category); diff --git a/games-libs/allegro/patches/0001-Remove-f-variants-of-fixed-math-functions.patch b/games-libs/allegro/patches/0001-Remove-f-variants-of-fixed-math-functions.patch new file mode 100644 index 00000000..6d76536d --- /dev/null +++ b/games-libs/allegro/patches/0001-Remove-f-variants-of-fixed-math-functions.patch @@ -0,0 +1,38 @@ +From 4848f1583c3dbe41f5f056869ff2c796d33d8121 Mon Sep 17 00:00:00 2001 +From: Andreas Rönnquist <andreas@ronnquist.net> +Date: Wed, 12 Dec 2018 16:39:23 +0100 +Subject: Remove f* variants of fixed math functions + +Removing functions that conflicts with later glibc implementations, +people should use fix* variants instead. +(Simply use fixadd instead of fadd). + +diff --git a/include/allegro/alcompat.h b/include/allegro/alcompat.h +index d31ab5b6d95d..c9536839deb6 100644 +--- a/include/allegro/alcompat.h ++++ b/include/allegro/alcompat.h +@@ -40,24 +40,6 @@ + #endif + #endif + +- #ifndef ALLEGRO_NO_FIX_ALIASES +- AL_ALIAS(fixed fadd(fixed x, fixed y), fixadd(x, y)) +- AL_ALIAS(fixed fsub(fixed x, fixed y), fixsub(x, y)) +- AL_ALIAS(fixed fmul(fixed x, fixed y), fixmul(x, y)) +- AL_ALIAS(fixed fdiv(fixed x, fixed y), fixdiv(x, y)) +- AL_ALIAS(int fceil(fixed x), fixceil(x)) +- AL_ALIAS(int ffloor(fixed x), fixfloor(x)) +- AL_ALIAS(fixed fcos(fixed x), fixcos(x)) +- AL_ALIAS(fixed fsin(fixed x), fixsin(x)) +- AL_ALIAS(fixed ftan(fixed x), fixtan(x)) +- AL_ALIAS(fixed facos(fixed x), fixacos(x)) +- AL_ALIAS(fixed fasin(fixed x), fixasin(x)) +- AL_ALIAS(fixed fatan(fixed x), fixatan(x)) +- AL_ALIAS(fixed fatan2(fixed y, fixed x), fixatan2(y, x)) +- AL_ALIAS(fixed fsqrt(fixed x), fixsqrt(x)) +- AL_ALIAS(fixed fhypot(fixed x, fixed y), fixhypot(x, y)) +- #endif +- + #endif /* !defined ALLEGRO_SRC */ + + diff --git a/games-libs/allegro/patches/0001-The-keyboard-handler-has-a-race-condition-that-can-cause-Allegro.patch b/games-libs/allegro/patches/0001-The-keyboard-handler-has-a-race-condition-that-can-cause-Allegro.patch new file mode 100644 index 00000000..0e9043db --- /dev/null +++ b/games-libs/allegro/patches/0001-The-keyboard-handler-has-a-race-condition-that-can-cause-Allegro.patch @@ -0,0 +1,97 @@ +From ec6196afeeefe83c9e717ea5fba7a2f81632680d Mon Sep 17 00:00:00 2001 +From: Etienne Vouga <evouga@gmail.com> +Date: Sun, 13 Aug 2017 01:38:32 -0500 +Subject: The keyboard handler has a race condition that can cause Allegro + programs to stop accepting any keyboard input (usually manifests itself after + the program has been running a considerable length of time). Replaced the old + attempt at protecting the critical section with a mutex. + + +diff --git a/src/keyboard.c b/src/keyboard.c +index c433268a7f6a..34fced3d9f2f 100644 +--- a/src/keyboard.c ++++ b/src/keyboard.c +@@ -134,6 +134,7 @@ typedef struct KEY_BUFFER + static volatile KEY_BUFFER key_buffer; + static volatile KEY_BUFFER _key_buffer; + ++static void *key_mutex; + + + /* add_key: +@@ -163,12 +164,7 @@ static INLINE void add_key(volatile KEY_BUFFER *buffer, int key, int scancode) + } + } + +- buffer->lock++; +- +- if (buffer->lock != 1) { +- buffer->lock--; +- return; +- } ++ system_driver->lock_mutex(key_mutex); + + if ((waiting_for_input) && (keyboard_driver) && (keyboard_driver->stop_waiting_for_input)) + keyboard_driver->stop_waiting_for_input(); +@@ -184,7 +188,7 @@ static INLINE void add_key(volatile KEY_BUFFER *buffer, int key, int scancode) + buffer->end = c; + } + +- buffer->lock--; ++ system_driver->unlock_mutex(key_mutex); + } + + +@@ -197,14 +193,12 @@ void clear_keybuf(void) + if (keyboard_polled) + poll_keyboard(); + +- key_buffer.lock++; +- _key_buffer.lock++; ++ system_driver->lock_mutex(key_mutex); + + key_buffer.start = key_buffer.end = 0; + _key_buffer.start = _key_buffer.end = 0; + +- key_buffer.lock--; +- _key_buffer.lock--; ++ system_driver->unlock_mutex(key_mutex); + + if ((keypressed_hook) && (readkey_hook)) + while (keypressed_hook()) +@@ -400,6 +394,13 @@ END_OF_STATIC_FUNCTION(repeat_timer); + { + key_buffer.lock = _key_buffer.lock = 0; + ++ // since this mode of using the keyboard handler does not have a removal ++ // function, it leaks memory---but at least we can limit the leak to only ++ // a single mutex even if the user calls this function a bunch of times ++ // for some reason. ++ if(!key_mutex) ++ key_mutex = system_driver->create_mutex(); ++ + clear_keybuf(); + clear_key(); + +@@ -651,6 +652,9 @@ int install_keyboard(void) + LOCK_FUNCTION(repeat_timer); + + key_buffer.lock = _key_buffer.lock = 0; ++ ++ if(!key_mutex) ++ key_mutex = system_driver->create_mutex(); + + clear_keybuf(); + clear_key(); +@@ -720,6 +724,11 @@ void remove_keyboard(void) + + clear_keybuf(); + clear_key(); ++ ++ if(key_mutex) { ++ system_driver->destroy_mutex(key_mutex); ++ key_mutex = NULL; ++ } + + key_shifts = _key_shifts = 0; + diff --git a/games-libs/allegro/patches/0001-fixes-wrong-assert-in-mouse.c-in-set_mouse_range.patch b/games-libs/allegro/patches/0001-fixes-wrong-assert-in-mouse.c-in-set_mouse_range.patch new file mode 100644 index 00000000..30d2bdd5 --- /dev/null +++ b/games-libs/allegro/patches/0001-fixes-wrong-assert-in-mouse.c-in-set_mouse_range.patch @@ -0,0 +1,19 @@ +From 30aabedb5c520ef5696acbb791d080ebc6b037a1 Mon Sep 17 00:00:00 2001 +From: Érico Vieira Porto <ericoporto2008@gmail.com> +Date: Sun, 21 Jun 2020 15:17:11 -0300 +Subject: fixes wrong assert in mouse.c in set_mouse_range + + +diff --git a/src/mouse.c b/src/mouse.c +index 96b25b284946..7f9c6a551879 100644 +--- a/src/mouse.c ++++ b/src/mouse.c +@@ -858,7 +858,7 @@ void set_mouse_range(int x1, int y1, int x2, int y2) + ASSERT(x1 >= 0); + ASSERT(y1 >= 0); + ASSERT(x2 >= x1); +- ASSERT(y2 >= y2); ++ ASSERT(y2 >= y1); + + if (!mouse_driver) + return; diff --git a/games-libs/allegro/patches/0001-x-xkeyboard.c-Changes-setlocale-to-LC_CTYPE.patch b/games-libs/allegro/patches/0001-x-xkeyboard.c-Changes-setlocale-to-LC_CTYPE.patch new file mode 100644 index 00000000..e1c0ed28 --- /dev/null +++ b/games-libs/allegro/patches/0001-x-xkeyboard.c-Changes-setlocale-to-LC_CTYPE.patch @@ -0,0 +1,20 @@ +From 1ec647dd0ae9ca74a03fb959b5242b4b468a589e Mon Sep 17 00:00:00 2001 +From: Érico Vieira Porto <ericoporto2008@gmail.com> +Date: Sat, 20 Jun 2020 10:42:21 -0300 +Subject: x/xkeyboard.c Changes setlocale to LC_CTYPE + +This fixes allegro changing the locale for LC_NUMERIC and more when installing keyboard in the x platform. + +diff --git a/src/x/xkeyboard.c b/src/x/xkeyboard.c +index 247fea748a1a..b02d7b18fb82 100644 +--- a/src/x/xkeyboard.c ++++ b/src/x/xkeyboard.c +@@ -707,7 +707,7 @@ static int x_keyboard_init(void) + + #ifdef ALLEGRO_XWINDOWS_WITH_XIM + /* Otherwise we are restricted to ISO-8859-1 characters. */ +- if (setlocale(LC_ALL, "") == NULL) { ++ if (setlocale(LC_CTYPE, "") == NULL) { + TRACE(PREFIX_W "Could not set default locale.\n"); + } + diff --git a/games-libs/allegro/patches/0001-xwin.c-fix-broken-xwin_set_window_name.patch b/games-libs/allegro/patches/0001-xwin.c-fix-broken-xwin_set_window_name.patch new file mode 100644 index 00000000..777ca9ba --- /dev/null +++ b/games-libs/allegro/patches/0001-xwin.c-fix-broken-xwin_set_window_name.patch @@ -0,0 +1,29 @@ +From 76337ac3ec9e122bd5c8b1b53a158b38d14683b6 Mon Sep 17 00:00:00 2001 +From: Florian Léger <florian.leger6@gmail.com> +Date: Sun, 19 Jul 2020 11:17:43 +0200 +Subject: xwin.c: fix broken xwin_set_window_name + +Commit f05270883f2b4382b79ea3248d985938cd9934dc that introduced the use of three windows +broke xwin_set_window_name. + +Adopt the same approach as commit 2e64350d03ff958960c3ccf4c2cc87437727afea +and fix this by setting the Class Hints for the managed window instead of +the real window. + +diff --git a/src/x/xwin.c b/src/x/xwin.c +index 040603880712..eba84fc39d7e 100644 +--- a/src/x/xwin.c ++++ b/src/x/xwin.c +@@ -2722,10 +2722,10 @@ static void _xwin_private_set_window_name(AL_CONST char *name, AL_CONST char *gr + else + _al_sane_strncpy(_xwin.application_class, group, sizeof(_xwin.application_class)); + +- if (_xwin.window != None) { ++ if (_xwin.wm_window != None) { + hint.res_name = _xwin.application_name; + hint.res_class = _xwin.application_class; +- XSetClassHint(_xwin.display, _xwin.window, &hint); ++ XSetClassHint(_xwin.display, _xwin.wm_window, &hint); + } + } + diff --git a/games-libs/allegro/patches/0001-xwin.c-increase-X_MAX_EVENTS-to-50.patch b/games-libs/allegro/patches/0001-xwin.c-increase-X_MAX_EVENTS-to-50.patch new file mode 100644 index 00000000..28ac4bb9 --- /dev/null +++ b/games-libs/allegro/patches/0001-xwin.c-increase-X_MAX_EVENTS-to-50.patch @@ -0,0 +1,21 @@ +From 987f67ac1026871788b9a78761c20c1cfd13c227 Mon Sep 17 00:00:00 2001 +From: rofl0r <retnyg@gmx.net> +Date: Sun, 13 Jan 2019 14:38:20 +0000 +Subject: xwin.c: increase X_MAX_EVENTS to 50 + +this should fix mouse lag on Linux with hi-res devices. +( see https://github.com/aseprite/aseprite/issues/283 ) + +diff --git a/src/x/xwin.c b/src/x/xwin.c +index a37f864ac4ed..040603880712 100644 +--- a/src/x/xwin.c ++++ b/src/x/xwin.c +@@ -162,7 +162,7 @@ static int use_bgr_palette_hack = FALSE; /* use BGR hack for color conversion pa + int _xwin_missed_input; + #endif + +-#define X_MAX_EVENTS 5 ++#define X_MAX_EVENTS 50 + #define MOUSE_WARP_DELAY 200 + + static char _xwin_driver_desc[256] = EMPTY_STRING; |