[webkit-help] JSC: Minimal MSVC build

Brian Barnes ggadwa at charter.net
Tue Jun 11 08:16:09 PDT 2013


First, let me apologize if I by mistake I sent a blank message to this 
list, got caught by a hot key.

Second: I've created a minimal build that doesn't use any of the ICU 
libraries.  It does assume some things about the scripts (especially 
that the code itself is ascii), but for those of us embedding, it's very 
helpful.  I'll list the changes below (this was a much older version of 
the engine r105480, BTW, I have not tried this on later code.)

====================
Compile changes:
====================

Set active configuration to Release_Cario_CFLite
For JavaScriptCore & WTF: Add to ignore warnings: 4396;4005;4396
For JavaScriptCore & WTF: turn off "treat warnings as errors"
For WTF: add UCONFIG_NO_COLLATION as preprocessor define

===================
Code changes:
===================

in WTF/Platform.h, change:

#if PLATFORM(WIN) && !OS(WINCE)
#define WTF_USE_CF 0
#define WTF_USE_PTHREADS 0
#endif

In JavaScriptCore/API: remove JSStringRefCF.cpp

in source\javascriptcore\parserKeywords.table
has two extra returns at the end, delete these or parser won't compile 
[might no longer be required]

In JavaScriptCore/JavaScriptCore.def
remove:
??0Collator at WTF@@QAE at PBD@Z
??1Collator at WTF@@QAE at XZ
?collate at Collator@WTF@@QBE?AW4Result at 12@PB_WI0I at Z
?setOrderLowerFirst at Collator@WTF@@QAEX_N at Z

In WTF/Unicode/icu/UnicodeICU.h, add:

inline int win32_u_charType(UChar32 c)
{	
if (c==0x20) return(U_SPACE_SEPARATOR);
if ((c>='A') && (c<='Z')) return(U_UPPERCASE_LETTER);
if ((c>='a') && (c<='z')) return(U_LOWERCASE_LETTER);

if ((c>='0') && (c<='9')) return(U_DECIMAL_DIGIT_NUMBER);
return(U_UNASSIGNED);
}

In WTF/Unicode/icu/UnicodeICU.h, change these functions:

inline int toLower(UChar* result, int resultLength, const UChar* src, 
int srcLength, bool* error)
{
	int			idx;
	UChar		c;

	idx=0;

	while (true) {
		if (idx>=resultLength) break;
		if (idx>=srcLength) break;

		c=*src++;
		if (c==0x0) {
			*result=0x0;
			break;
		}
		
		if ((c>='A') && (c<='Z')) c+=(UChar)('a'-'A');
		*result++=c;

		idx++;
	}

	*error=FALSE;
	return(idx);
}

inline UChar32 toLower(UChar32 c)
{
	if ((c>='A') && (c<='Z')) return(c+(UChar)('a'-'A'));
	return(c);
}

inline UChar32 toUpper(UChar32 c)
{
	if ((c>='a') && (c<='z')) return(c+(UChar)('A'-'a'));
	return(c);
}

inline int toUpper(UChar* result, int resultLength, const UChar* src, 
int srcLength, bool* error)
{
	int			idx;
	UChar		c;

	idx=0;

	while (true) {
		if (idx>=resultLength) break;
		if (idx>=srcLength) break;

		c=*src++;
		if (c==0x0) {
			*result=0x0;
			break;
		}
		
		if ((c>='a') && (c<='z')) c+=(UChar)('A'-'a');
		*result++=c;

		idx++;
	}

	*error=FALSE;
	return(idx);
}

In JavaScriptCore/runtime, change this function:

static inline int localeCompare(const UString& a, const UString& b)
{
char		*s1,*s2;

s1=(char*)a.characters8();
s2=(char*)b.characters8();
for ( ; *s1 == *s2; s1++, s2++)
if (*s1 == '\0') return 0;
return ((*(unsigned char *)s1 < *(unsigned char *)s2) ? -1 : +1);
}

----------------------------------------------

That should create a minimal build without the ICU.  The latest build 
without the pthread library is something I can look into in the future. 
  That would create a build without any additional DLLs at all.  Note 
that this is all quick and dirty, and could be buggy.

Obviously, if this kind of stuff got into the code base, it'd be great 
for me, but I fully understand and expect that's an obvious no way, no 
how situation.  So let this be a FYI for anybody attempting a more 
minimal build for embedding.

[>] Brian


More information about the webkit-help mailing list