premake/patches/premake.patches.txt
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Nov 2014 04:51:33 -0800
changeset 9246 a761913e5e91
parent 7925 f090a47eb7f7
permissions -rwxr-xr-x
Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead

Jonas Kulla

src/main/windows/SDL_windows_main.c:137:
cmdline = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(text), (SDL_wcslen(text)+1)*sizeof(WCHAR));

I'm trying to compile an SDL2 application for windows using the mingw-w64 32bit toolchain provided by my distro (Fedora 19). However, even the simplest test program that does nothing at all fails to startup with a "Fatal error - out of memory" message because the mingw iconv library provided by my distro does not support the "UCS-2-INTERNAL" encoding and the conversion returns null.

From my little bit of research, it turns out that even though this encoding is supported by the external GNU libiconv library, some glibc versions (?) don't support it with their internal iconv routines, and will instead provide the native endian encoding when "UCS-2" is specified.

Nonetheless, I wonder why the native endianness is considered in the first place when Windows doesn't even run on any big endian archs (to my knowledge). And true enough, 'WIN_StringToUTF8' from core/windows/SDL_windows.h is used everywhere else in the windows backend, which is just a macro to iconv with "UTF-16LE" as source. Therefore it would IMO make sense to use this macro here as well, which would solve my problem (patch attached).
icculus@7925
     1
The patches in this directory are targeted to the premake4 stable branch, based
icculus@7925
     2
on the date of these files and the repository.
icculus@7925
     3
icculus@7925
     4
1. 709.patch: this patch corrects the linking order for generated GNU makefiles.
icculus@7925
     5
   More information on this patch can be found at:
icculus@7925
     6
   https://sourceforge.net/p/premake/bugs/279/
icculus@7925
     7
2. iOS.patch: this patch adds a iOS as a platform option for premake, allowing
icculus@7925
     8
   for potential iOS Xcode project generation.
icculus@7925
     9
3. 711.patch: this patch adds support for Xcode recognizing files added to
icculus@7925
    10
   Xcode projects with the extensions of .bmp or .wav as resource files with
icculus@7925
    11
   the respective file types of image and audio. This is needed to properly
icculus@7925
    12
   bundle the Xcode-iOS resources with the app package. See the following for
icculus@7925
    13
   more information:
icculus@7925
    14
   https://sourceforge.net/p/premake/patches/165/
icculus@7925
    15
4. 712.patch: this patch fixes an issue in Xcode that prevents post-build
icculus@7925
    16
   commands from working for multiple configurations. This is why I had to have
icculus@7925
    17
   debug and release configurations disabled for so long. They are now reenabled
icculus@7925
    18
   and should be working fine. For more information:
icculus@7925
    19
   https://sourceforge.net/p/premake/bugs/280/
icculus@7925
    20
5. 713.patch: this patch allows custom source trees to be set in Xcode links
icculus@7925
    21
   using variables similar to Visual Studio variables. This is necessary to
icculus@7925
    22
   properly link to frameworks for iOS projects. For more information:
icculus@7925
    23
   https://sourceforge.net/p/premake/patches/166/
icculus@7925
    24
icculus@7925
    25
The repository containing these changes can be found at:
icculus@7925
    26
https://bitbucket.org/gsocben/premake-stable-sdlgsoc2013