- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.4k
Update freetype.py to 2.12.1 #18088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update freetype.py to 2.12.1 #18088
Changes from 2 commits
719312e
              8b95490
              9e27ee2
              2dd8897
              0002fc7
              70dbd90
              63cf5f3
              291d5eb
              48de39f
              2a4432c
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|  | @@ -5,56 +5,47 @@ | |||
|  | ||||
| import os | ||||
|  | ||||
| TAG = 'version_1' | ||||
| HASH = '0d0b1280ba0501ad0a23cf1daa1f86821c722218b59432734d3087a89acd22aabd5c3e5e1269700dcd41e87073046e906060f167c032eb91a3ac8c5808a02783' | ||||
| TAG = '2-12-1' | ||||
| HASH = '3ef3e47752b7c3cd158c738d7e0194f1c9f97ac85c754b02be6ee0f7999c3c19050f713d1e975f5310a4689337463e7b54450ef62e02c3f09864f4c6b13740d9' | ||||
|  | ||||
|  | ||||
| def needed(settings): | ||||
| return settings.USE_FREETYPE | ||||
|  | ||||
|  | ||||
| def get(ports, settings, shared): | ||||
| ports.fetch_project('freetype', 'https://github.com/emscripten-ports/FreeType/archive/' + TAG + '.zip', 'FreeType-' + TAG, sha512hash=HASH) | ||||
| ports.fetch_project('freetype', 'https://github.com/freetype/freetype/archive/refs/tags/VER-' + TAG + '.zip', 'FreeType-' + TAG, sha512hash=HASH) | ||||
|  | ||||
| def create(final): | ||||
| source_path = os.path.join(ports.get_dir(), 'freetype', 'FreeType-' + TAG) | ||||
| source_path = os.path.join(ports.get_dir(), 'freetype', 'freetype-VER-' + TAG) | ||||
| ports.write_file(os.path.join(source_path, 'include/ftconfig.h'), ftconf_h) | ||||
| ports.install_header_dir(os.path.join(source_path, 'include'), | ||||
| target=os.path.join('freetype2')) | ||||
|  | ||||
| with open(os.path.join(source_path, 'include', 'freetype', 'config', 'ftoption.h'), 'a') as ftheader: | ||||
| ftheader.write('#define FT_CONFIG_OPTION_SYSTEM_ZLIB') | ||||
|          | ||||
|  | ||||
| # build | ||||
| srcs = ['src/autofit/autofit.c', | ||||
| 'src/base/ftadvanc.c', | ||||
| 'src/base/ftbase.c', | ||||
| 'src/base/ftbbox.c', | ||||
| 'src/base/ftbdf.c', | ||||
| 'src/base/ftbitmap.c', | ||||
| 'src/base/ftcalc.c', | ||||
| 'src/base/ftcid.c', | ||||
| 'src/base/ftdbgmem.c', | ||||
| 'src/base/ftdebug.c', | ||||
| 'src/base/ftfntfmt.c', | ||||
| 'src/base/ftfstype.c', | ||||
| 'src/base/ftgasp.c', | ||||
| 'src/base/ftgloadr.c', | ||||
| 'src/base/ftglyph.c', | ||||
| 'src/base/ftgxval.c', | ||||
| 'src/base/ftinit.c', | ||||
| 'src/base/ftlcdfil.c', | ||||
| 'src/base/ftmm.c', | ||||
| 'src/base/ftobjs.c', | ||||
| 'src/base/ftotval.c', | ||||
| 'src/base/ftoutln.c', | ||||
| 'src/base/ftpatent.c', | ||||
| 'src/base/ftpfr.c', | ||||
| 'src/base/ftrfork.c', | ||||
| 'src/base/ftsnames.c', | ||||
| 'src/base/ftstream.c', | ||||
| 'src/base/ftstroke.c', | ||||
| 'src/base/ftsynth.c', | ||||
| 'src/base/ftsystem.c', | ||||
|          | ||||
| set(UNIX 1) | 
https://gitlab.freedesktop.org/freetype/freetype/-/blob/VER-2-12-1/CMakeLists.txt#L415
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I use builds/unix/ftsystem.c, the compile is missing the fcntl.h header. It looks like we'll need to pull the #undef HAVE_FCNTL_H from the config file.
/local/emsdk/upstream/emscripten/cache/ports/freetype/freetype-VER-2-12-1/builds/unix/ftsystem.c:258:12: error: call to undeclared function 'open'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    file = open( filepathname, O_RDONLY );
           ^
/local/emsdk/upstream/emscripten/cache/ports/freetype/freetype-VER-2-12-1/builds/unix/ftsystem.c:258:32: error: use of undeclared identifier 'O_RDONLY'
    file = open( filepathname, O_RDONLY );
                               ^
/local/emsdk/upstream/emscripten/cache/ports/freetype/freetype-VER-2-12-1/builds/unix/ftsystem.c:341:22: error: call to undeclared function 'read'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        read_count = read( file,
                     ^
/local/emsdk/upstream/emscripten/cache/ports/freetype/freetype-VER-2-12-1/builds/unix/ftsystem.c:341:22: note: did you mean 'fread'?
/local/emsdk/upstream/emscripten/cache/sysroot/include/stdio.h:106:8: note: 'fread' declared here
size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
       ^
/local/emsdk/upstream/emscripten/cache/ports/freetype/freetype-VER-2-12-1/builds/unix/ftsystem.c:362:5: error: call to undeclared function 'close'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    close( file );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some testing. All 3 settings for HAVE_FCNTL_H had build failures with builds/unix/ftsystem.c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check HAVE_UNISTD_H too? It was the only other thing of notice reverse engineering the cmake files...
The methods from the error are here: https://github.com/emscripten-core/emscripten/blob/e05e72d9c49fe15578e73934ce525a894d1b712a/system/lib/libc/musl/include/unistd.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried #define HAVE_UNISTD_H and HAVE_STDINT_H in the ftconfig.h, and it doesn't work with any of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be working if I put them in ftoption.h, however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revising CMake, the full ftconfig.h file should be:
#ifndef FTCONFIG_H_
#define FTCONFIG_H_
#include <ft2build.h>
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
#define HAVE_UNISTD_H 1
#define HAVE_FCNTL_H 1
#include <freetype/config/integer-types.h>
#include <freetype/config/public-macros.h>
#include <freetype/config/mac-support.h>
#endif /* FTCONFIG_H_ */There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where the ftconfig.h file in the build script comes from. I looked at the files from 2.6.1 and didn't get anywhere. It doesn't look like the other header files were inlined.
I tried this, and HAVE_UNISTD_H and HAVE_FCNTL_H don't seem to work from ftconfig.h. I'm going to put them back into ftoption.h and see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving them in ftoption.h seems to work.
Uh oh!
There was an error while loading. Please reload this page.