Commit Graph

428 Commits

Author SHA1 Message Date
WeebDataHoarder
163115879e Set -s AUTONATIVE_LIBRARIES=0
When -flto is enabled emscripten will generate "system libraries" cache, for all available libraries, including non-used ones.
This includes libGL.a, libal.a, libhtml5.a, which are not used in the project.
Disabling AUTONATIVE_LIBRARIES decreases compile time with -flto enabled.

Cherry-picked from: 741d41808d
2024-03-20 15:32:51 +03:00
WeebDataHoarder
e9b67a2ed1 Enable -flto, -sEVAL_CTORS=1
Do link-time optimizations and pre-evaluate code.

-s EVAL_CTORS=1 has no change in output currently.
-flto increases output size after optimizations

Cherry-picked from: ae80c98914
2024-03-20 15:32:51 +03:00
Dmitry Lyzo
3461d90246
Merge pull request #53 from dmitrylyzo/ci-deps
Update CI dependencies
2024-03-20 15:28:25 +03:00
Dmitry Lyzo
e9fbd69b12 ci: Update CI dependencies 2024-03-20 13:43:42 +03:00
Dmitry Lyzo
d6f76d8a9a
Merge pull request #50 from dmitrylyzo/WeebDataHoarder/lazy-fonts
[WeebDataHoarder] Implement lazy font loading + customizable fallback font
2023-06-08 11:52:47 +03:00
WeebDataHoarder
06edd4fcde Implement lazy font loading (off by default)
Extracts default.woff2 from binary, embeds fonts.conf,
removes .data files on output.
Use --memory-init-file=0 to remove .mem files on output.
Specify fallbackFont to override default.woff2.
If lazyFileLoading is set to true, use FS.createLazyFile(). This is
off by default, as it depends on correct HTTP headers sent back.

Cherry-picked from: 7988397f91
2023-06-07 16:46:50 +03:00
Dmitry Lyzo
3df655a9df
Merge pull request #49 from dmitrylyzo/WeebDataHoarder/embedded-fonts
[WeebDataHoarder] Enable embedded fonts
2023-06-06 22:41:10 +03:00
WeebDataHoarder
7b1e24a21f Use embedded fonts
ASS subtitles can embed fonts with a custom encoding in
their [Fonts] section. For historic reasons ass_set_extract_fonts
defaults to disabled, so we need to explicitly opt-in.
There’s currently also an issue, with embedded fonts outliving
their track, which can lead to indefinitely growing memory consumption
if not all memory fonts are cleared on track reinit.

However, ass_clear_fonts can only be safely called if the renderer
also has been released first. At this point it is simpler to just
reinit the whole library-renderer-track triplet and library inits
are not that costly anyway.

JSO never uses (non-embedded) memory fonts itself and does not expose
any way to add them so this does not constitute a user-visible change.
Even oct_add_font cannot be used by consumers of upstream JSO binaries.

Note: the JS pointers of the libass handles are updated in this patch,
      but it appears they are actually never used.

Cherry-picked from: 6f2bbdb61f
2023-06-05 11:58:49 +03:00
Dmitry Lyzo
d51494ccf3
Merge pull request #48 from dmitrylyzo/sort-licenses
Sort licenses
2023-03-24 15:07:12 +03:00
Dmitry Lyzo
49d371c2fa build: sort licenses 2023-01-16 15:20:51 +03:00
Dmitry Lyzo
72346b3a39
Merge pull request #47 from dmitrylyzo/TheOneric/bump-deps
[TheOneric] Bump dependencies
2023-01-16 12:58:50 +03:00
Oneric
a61f5bf312 lib: bump dependencies
libexpat:   R_2_4_9  ->  R_2_5_0
fontconfig: 2.14.0  ->  2.14.1
harfbuzz:   5.2.0  ->  5.3.1
libass:     git-1a533e5d  ->  0.17.0

For libass nothing relevant changed except the logged version number.

Cherry-picked from: 3041c58fb1
2023-01-12 13:33:40 +03:00
Oneric
7d3039c12b Bump libass
New features and fixes:
 - LayoutRes{X,Y}
 - handle anamorphic blur correctly
 - support v4++’s \kt
 - support SSA’s AlphaLevel
 - parse integer headers like VSFilter
 - parse ScriptType header

Cherry-picked from: 530afd001f
2023-01-12 13:33:40 +03:00
Oneric
3b888700c4 lib: bump dependencies
libass is bumped to current master,
everything else to its latest release.

Cherry-picked from: 8db03e57bb
2023-01-12 13:33:40 +03:00
Oneric
f4bb2685c5 Bump libass
A new version (0.16.0) was released.

Cherry-picked from: 18a53fdb77
2023-01-12 13:33:40 +03:00
Dmitry Lyzo
c079153799
Merge pull request #45 from dmitrylyzo/TheOneric/code_cleanup
[TheOneric] Code cleanup
2023-01-10 00:41:43 +03:00
Oneric
2926481ee7 cosmetic: declare loop counter inside for
Cherry-picked from: 6fcb094c86
2023-01-10 00:22:45 +03:00
Oneric
98a70e4dd2 cosmetic/src: use canonical include for ass.h
pkg-config sets up the necessary lookup paths.

Cherry-picked from: 23c3f91ed7
2023-01-10 00:22:45 +03:00
Dmitry Lyzo
0150e52926
Merge pull request #44 from dmitrylyzo/TheOneric/license_speedup
[TheOneric] Speedup license extraction
2023-01-10 00:20:44 +03:00
Oneric
780b0734be build: use -o pipefail in license_extract.sh
The portable mkfifo approach works fine locally and worked fine in
initial GHA testing, but now it started to run into various stalling
issues on GHA. Presumably depending on whether the pipe is first written
to or read from and attempts to find a simple workaround for it failed.
Sometimes (but not always!) this is accompanied by an error like this:
  cannot open ./__LICENSE_EXTRACT_QUEUE.tmp: Interrupted system call

So convert the script to bash and just use set -o pipefail.

Cherry-picked from: 94cfe111f8
2022-12-26 14:09:17 +03:00
Oneric
0d3ffb7f5e build: speed up license extraction
Apparently licensecheck has a high startup cost, so merging invocations
promises a neat speedup. However, currently some "\x{....} cannot be
represented as ascii" error messages appear in our logs. If that happens
licensecheck exits with 255, which omits all following files of the
same invocation and also prompts `find -exec .. {} +` or `xargs` to not
spawn any more invocations. If we were to simply merge invocations by
one of those means it would result in an incomplete COPYRIGHT file.

Those encoding errors appear to be due to an ASCII locale being set in
the container, so override LC_ALL to an UTF-8 one. To further make this
bit more resilient ensure licensecheck errors are no longer ignored by
capturing and processing its exit code.

Cherry-picked from: cf04e0361a
2022-12-26 13:49:30 +03:00
Oneric
d7a44f18b4 build: ignore Unlicense
Cherry-picked from: 0d8d68b72f
2022-12-26 13:49:30 +03:00
Dmitry Lyzo
eef75b7907 make: remove redundant COPYRIGHT target
It exists in the toplevel Makefile.
2022-12-26 13:49:30 +03:00
Dmitry Lyzo
57e6d98580 make: mark 'all' target as .PHONY 2022-12-26 13:49:30 +03:00
Oneric
e271469d79 make: split off license extraction
As an intermediate measure improving build times with multiple jobs
until the toplevel Makefile can properly handle parallelism.

Cherry-picked from: e3e00035b1
2022-12-26 13:49:30 +03:00
Dmitry Lyzo
e8b5837931
Merge pull request #43 from dmitrylyzo/TheOneric/build_cleanup
[TheOneric] Build cleanup
2022-12-26 13:48:15 +03:00
Dmitry Lyzo
6fb73112f0 make: remove redundant 'touch configured'
PREPARE_SRC_VPATH is supposed to prepare the source, so leave
the creation of the 'configured' file to the actual Makefile target.
2022-12-26 12:03:40 +03:00
Oneric
44abd8ef19 make: limit --disable-debug to fribidi
It is the only project actually recognising this option.

Cherry-picked from: 190b281586
2022-12-26 12:03:40 +03:00
Oneric
6617fe771d cosmetic/make: drop superfluous default target make
Cherry-picked from: d95ddf5bef
2022-12-26 12:03:40 +03:00
Oneric
3aa82178ad cosmetic/make: drop GLOBAL_* variables in favour of only *
The latter is required as it's picked up by buildsystems,
the former is only used once by us and can easily be replaced
by the latter.

Cherry-picked from: e2e315834e
2022-12-26 12:03:40 +03:00
Oneric
9afa163b8f make: put uniform comments before dependency builds
Cherry-picked from: e341e1bcd5
2022-12-26 12:03:40 +03:00
Oneric
f71d90af09 cosmetic/make: remove comment with unused flags
They appear to have been commented out since the first public release
and it's not clear what they were intended for or if they'd even still
work with current emscripten.

Cherry-picked from: 4370e7b52b
2022-12-26 12:03:40 +03:00
Oneric
9d3ea2a31b make: adjust number of jobs to available threads
Previously some builds used a hardcoded number of 8 and others
didn't set it at all falling back to a single threaded build.

This still isn't ideal though. What we actually want is to fix up
or Makefile to allow builders to pass the number of jobs to the toplevel
and then a buildserver can distribute the available jobs across the
targets allowing inter-target parallelism.
For now, this already is a clear improvement.

The fribidi build appears to have a borked dependency on generated
sources when running from a subdir, which resulted in parallel builds
sometimes failing. To fix this the relevant header is now generated
explicitly before other build steps.

Cherry-picked from: 89e899a462
2022-12-26 12:03:40 +03:00
Oneric
8ce704eca7 make: macroise configuration
To be more concise and to keep config flags from drifting apart
(they already varied slightly between submodules).

Cherry-picked from: 85817b32a9
2022-12-26 12:03:40 +03:00
Oneric
5c5e19426b make: export CFLAGS globally
autoconf and cmake will pick up the variable from the environment.

Cherry-picked from: 0559838d43
2022-12-26 12:03:40 +03:00
Oneric
67458fedb9 make: remove superfluous dependency disables
emscripten already sets PKG_CONFIG_LIBDIR preventing non-wasm libraries
installed in the system to be detected (and it doesn't provide a way for
us to set _LIBDIR ourselves).

Cherry-picked from: e88b1645e0
2022-12-26 12:03:40 +03:00
Oneric
2f82c5259c make: export pkg-config path globally
Cherry-picked from: 7823300715
2022-12-26 12:03:40 +03:00
Oneric
578511836e make: macroise source setup
Cherry-picked from: b91a88e35d
2022-12-26 12:03:37 +03:00
Oneric
67fdfcb9e0 make: use regular install for brotli
The last released version of brotli we use, blocks the install target
when building with emscripten, which is why we currently need to
manually copy files of interest to their installed location.
This adds complexity and is prone to failure with future changes.
Upstream no longer blocks installations with emscripten since
  ce222e317e
from 23.06.2021.

We could just bump the brotli version to latest master, but then our
already existing patch would need updating and from a quick look
it appears as if other things changed as well which might not all be
compatible with our baseline target out of the box. AN eventual new
release with release notes will hopefully detail the changes in a
more accessible form.
As a safe option, just backport the upstream commit as another patch.

We still need to normalise the static library names though.

Cherry-picked from: ab214a6fe2
2022-12-26 11:34:42 +03:00
Oneric
3133ff4334 make: drop redundant extern for fribidi
Cherry-picked from: 1ad143424d
2022-12-26 11:34:42 +03:00
Oneric
3a10525d50 make: remove no-op macro define
Possibly it did something in older versions, in current ones only
the compiler set __EMSCRIPTEN__ macro is used in checks.

Cherry-picked from: e240038da7
2022-12-26 11:34:42 +03:00
Oneric
db2f75f366 make: disable pthreads in global flags
Cherry-picked from: cd33db7e4a
2022-12-26 11:34:42 +03:00
Oneric
991ce0a05f make: mark non-file targets as .PHONY
Cherry-picked from: 2348874632
2022-12-26 11:34:42 +03:00
Oneric
20d39b3be6 src/make: use -c to compile instead of -r
The build currently warns about building an executable with an
object-file extension and recommends to use -c, -shared or -r
eventhough we already use -r.
I'm not sure what -r is supposed to do, but -c only compiles and not
links the input which should be exactly what we want here and using -c
gets rid of the warning without any apparent negative effects.

Cherry-picked from: 3ce0643440
2022-12-26 11:34:42 +03:00
Oneric
6f3e5c322c src: use a custom Makefile
We are bound to one toolchain and most results of the
config-time checks were ignored anyway. This is more
concise and doesn't require a configuration step.

Cherry-picked from: 25bd9261ab
2022-12-26 11:34:42 +03:00
Oneric
f8ea6aaafa src/make: suppress deprecation warnings
We knowingly expose deprecated API.

Cherry-picked from: b2fd3e7ecb
2022-12-26 11:34:42 +03:00
Dmitry Lyzo
e199c32c45
Merge pull request #42 from dmitrylyzo/TheOneric/submodules_cleanup
[TheOneric] Submodules cleanup
2022-12-26 11:33:48 +03:00
Oneric
70132293f0 cosmetic/make: move server target down
So that all git-* targets are grouped together.

Cherry-picked from: 6287102fe3
2022-12-26 00:05:43 +03:00
Oneric
a3f61902c7 make: replace submodule update with reset
This is likely more common action. Also updating submodules
usually involves updating our patches which can't be automated.

Cherry-picked from: fa25ef0d7e
2022-12-26 00:05:39 +03:00
Oneric
401db10a44 make: macroise submodule updates
Cherry-picked from: 79307896e5

[part of]
make: mark non-file targets as .PHONY

Cherry-picked from: 2348874632
2022-12-26 00:04:26 +03:00