I’m trying to take advantage of the ISC license for juce_core and porting it to “special” set-top boxes that are Broadcom and uClibc based.
I’m running into a few blocking compilation issues though, which I will PR to help unify the changes needed.
The two macros here don’t exist, because there’s no locale nor xlocale support.
String SystemStats::getUserLanguage() { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); }
String SystemStats::getUserRegion() { return getLocaleValue (_NL_IDENTIFICATION_TERRITORY); }
We could just define them in juce_core when necessary:
#ifndef _NL_IDENTIFICATION_LANGUAGE
#define _NL_IDENTIFICATION_LANGUAGE 0x42
#endif
#ifndef _NL_IDENTIFICATION_TERRITORY
#define _NL_IDENTIFICATION_TERRITORY 0x43
#endif
Another issue is that std::_Exit
is not supported. I need to somehow shoehorn this to use the Android solution…
void JUCE_CALLTYPE Process::terminate()
{
#if JUCE_ANDROID || CRAPPYSETTOPBOXES
_exit (EXIT_FAILURE);
#else
std::_Exit (EXIT_FAILURE);
#endif
}
Next, backtrace is unsupported because there’s no exec info on this platform. So you could check if this macro is available, _GLIBCXX_HAVE_EXECINFO_H
, but I’m not so sure that’s the most generic solution.
//in "juce_core/system/juce_SystemStats.cpp" - SystemStats::getStackBacktrace()
#else
void* stack[128];
int frames = backtrace (stack, numElementsInArray (stack));
char** frameStrings = backtrace_symbols (stack, frames);
for (int i = 0; i < frames; ++i)
result << frameStrings[i] << newLine;
::free (frameStrings);
#endif
And lastly, because of the missing locale/xlocale, and nonexistent C++11 std::stod
, this needs a quick patch in juce_CharacterFunctions.h
. Obviously I hate this solution as much you do, so am totally open to a proper one.
#if JUCE_WINDOWS
static _locale_t locale = _create_locale (LC_ALL, "C");
return _strtod_l (&buffer[0], nullptr, locale);
#else
#if __UCLIBC_HAS_LOCALE__
static locale_t locale = newlocale (LC_ALL_MASK, "C", nullptr);
#if JUCE_ANDROID
return (double) strtold_l (&buffer[0], nullptr, locale);
#else
return strtod_l (&buffer[0], nullptr, locale);
#endif
//I added this crap
#else
std::stringstream ss;
ss << &buffer[0];
double result = 0.0;
ss >> result;
return result;
#endif
#endif
…and a warning:
In function `juce::File::setFileTimesInternal(long long, long long, long long) const':
[...]/c++/4.8.2/bits/stl_algobase.h:(.text+0x864c4): warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'