Skip to content

Commit ff46872

Browse files
sbc100dschuff
andauthored
Fix freetype build on windows and mark test as crossplaform (#22602)
The subprocess creation on windows really doesn't like it when an argument contains < or >. Instead use the default `FT_CONFIG_CONFT_CONFIG_CONFIG_H` and define the two `HAVE_` macros on the command line. See #22585 (comment) --------- Co-authored-by: Derek Schuff <[email protected]>
1 parent 8eb432e commit ff46872

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

test/test_other.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,6 +2479,7 @@ def test_bzip2(self):
24792479

24802480
@with_all_sjlj
24812481
@requires_network
2482+
@crossplatform
24822483
def test_freetype(self):
24832484
# copy the Liberation Sans Bold truetype file located in the
24842485
# <emscripten_root>/test/freetype to the compilation folder

tools/ports/freetype.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get(ports, settings, shared):
2828

2929
def create(final):
3030
source_path = ports.get_dir('freetype', f'freetype-{TAG}')
31-
ports.write_file(os.path.join(source_path, 'include/ftconfig.h'), ftconf_h)
31+
# Overwrite the default config file with our own.
3232
ports.install_header_dir(os.path.join(source_path, 'include'),
3333
target=os.path.join('freetype2'))
3434

@@ -78,8 +78,9 @@ def create(final):
7878

7979
flags = [
8080
'-DFT2_BUILD_LIBRARY',
81-
'-DFT_CONFIG_CONFIG_H=<ftconfig.h>',
8281
'-DFT_CONFIG_OPTION_SYSTEM_ZLIB',
82+
'-DHAVE_UNISTD_H',
83+
'-DHAVE_FCNTL_H',
8384
'-I' + source_path + '/include',
8485
'-I' + source_path + '/truetype',
8586
'-I' + source_path + '/sfnt',
@@ -110,38 +111,3 @@ def process_args(ports):
110111

111112
def show():
112113
return 'freetype (-sUSE_FREETYPE=1 or --use-port=freetype; freetype license)'
113-
114-
115-
ftconf_h = r'''
116-
/**************************************************************************
117-
*
118-
* This header file contains a number of macro definitions that are used by
119-
* the rest of the engine. Most of the macros here are automatically
120-
* determined at compile time, and you should not need to change it to port
121-
* FreeType, except to compile the library with a non-ANSI compiler.
122-
*
123-
* Note however that if some specific modifications are needed, we advise
124-
* you to place a modified copy in your build directory.
125-
*
126-
* The build directory is usually `builds/<system>`, and contains
127-
* system-specific files that are always included first when building the
128-
* library.
129-
*
130-
*/
131-
132-
#ifndef FTCONFIG_H_
133-
#define FTCONFIG_H_
134-
135-
#include <ft2build.h>
136-
#include FT_CONFIG_OPTIONS_H
137-
#include FT_CONFIG_STANDARD_LIBRARY_H
138-
139-
#define HAVE_UNISTD_H
140-
#define HAVE_FCNTL_H
141-
142-
#include <freetype/config/integer-types.h>
143-
#include <freetype/config/public-macros.h>
144-
#include <freetype/config/mac-support.h>
145-
146-
#endif /* FTCONFIG_H_ */
147-
'''

0 commit comments

Comments
 (0)