Skip to content

Add libgif port #13139

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

Merged
merged 7 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions embuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'bzip2',
'cocos2d',
'freetype',
'giflib',
'harfbuzz',
'icu',
'libjpeg',
Expand Down Expand Up @@ -193,6 +194,8 @@ def main():
build_port('vorbis', 'libvorbis.a')
elif what == 'ogg':
build_port('ogg', 'libogg.a')
elif what == 'giflib':
build_port('giflib', 'libgif.a')
elif what == 'libjpeg':
build_port('libjpeg', 'libjpeg.a')
elif what == 'libpng':
Expand Down
11 changes: 7 additions & 4 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ var STRICT = 0;
// include `_main`.
var IGNORE_MISSING_MAIN = 1;

// Automatically attempt to add archive indexes at link time to archives that
// Automatically attempt to add archive indexes at link time to archives that
// don't already have them. This can happen when GNU ar or GNU ranlib is used
// rather than `llvm-ar` or `emar` since the former don't understand the wasm
// object format.
Expand Down Expand Up @@ -971,7 +971,7 @@ var DETERMINISTIC = 0;
// (If WASM_ASYNC_COMPILATION is off, that is, if compilation is
// *synchronous*, then it would not make sense to return a Promise, and instead
// the Module object itself is returned, which is ready to be used.)
//
//
// The default name of the function is `Module`, but can be changed using the
// `EXPORT_NAME` option. We recommend renaming it to a more typical name for a
// factory function, e.g. `createModule`.
Expand All @@ -980,14 +980,14 @@ var DETERMINISTIC = 0;
// You use the factory function like so:
//
// const module = await EXPORT_NAME();
//
//
// or:
//
// let module;
// EXPORT_NAME().then(instance => {
// module = instance;
// });
//
//
//
// The factory function accepts 1 parameter, an object with default values for
// the module instance:
Expand Down Expand Up @@ -1201,6 +1201,9 @@ var USE_ZLIB = 0;
// 1 = use bzip2 from emscripten-ports
var USE_BZIP2 = 0;

// 1 = use giflib from emscripten-ports
var USE_GIFLIB = 0;

// 1 = use libjpeg from emscripten-ports
var USE_LIBJPEG = 0;

Expand Down
5 changes: 5 additions & 0 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1499,6 +1499,11 @@ def test_libpng(self):
output = self.run_js('a.out.js')
self.assertContained('libpng passes test', output)

def test_giflib(self):
shutil.copyfile(path_from_root('tests', 'third_party', 'giflib', 'treescap.gif'), 'treescap.gif')
building.emcc(path_from_root('tests', 'third_party', 'giflib', 'giftext.c'), ['--embed-file', 'treescap.gif', '-s', 'USE_GIFLIB'], output_filename='a.out.js')
self.assertContained('GIF file terminated normally', self.run_js('a.out.js', args=['treescap.gif']))

def test_libjpeg(self):
shutil.copyfile(path_from_root('tests', 'screenshot.jpg'), 'screenshot.jpg')
building.emcc(path_from_root('tests', 'jpeg_test.c'), ['--embed-file', 'screenshot.jpg', '-s', 'USE_LIBJPEG'], output_filename='a.out.js')
Expand Down
Loading