Commit Graph

327 Commits

Author SHA1 Message Date
Filiph Siitam Sandström
fd694e8672 AK+Lagom: Make it possible to build for iOS
This commit makes it possible to build AK and most of Lagom for iOS,
based on the work for the Ladybird build demoed on discord:
https://discord.com/channels/830522505605283862/830525031720943627/1211987732646068314
2024-03-03 13:13:42 -07:00
Andrew Kaster
5a1944ce64 Meta: Link AK to libexecinfo on BSDs and Haiku
This requirement was missed when AK was split into its own library
in 5945cdc054
2024-02-26 16:04:39 -07:00
Hendiadyoin1
0fa718ead8 Meta: Compile fdtdump on lagom 2024-02-24 16:43:44 -07:00
implicitfield
84252db976 Utilities: Add mkfs.fat
This adds a basic `mkfs.fat` utility, which can format FAT12, FAT16
and FAT32 partitions.

This does have a few limitations, namely in that FAT12 formatting is
limited to a set known floppy disk sizes, and we can only generate
512-byte sectors.
2024-02-24 15:54:52 -07:00
vincent-rg
a9df60ff1c AK: Update OptionParser::m_arg_index by substracting skipped args
On argument swapping to put positional ones toward the end,
m_arg_index was pointing at "last arg  index" + "skipped args" +
"consumed args" and thus was pointing ahead of the skipped ones.

m_arg_index now points after the current parsed option arguments.
2024-02-06 00:08:30 +01:00
Nico Weber
d1036c915d Meta: Create Build/lagom/Root/res with resources for lagom binaries
This way, build files can install things into
`${CMAKE_BINARY_DIR}/Root/res/` and it'll work in both serenity and
lagom builds.

It allows using a single `Core::ResourceImplementation::install()`
call to install both checked-in and generated files (as long as both
get copied into this new build-time staging dir).

No behavior change.
2024-01-30 18:43:06 -07:00
Timothy Flynn
5945cdc054 Ladybird+Meta: Extract AK into its own library on Lagom
We currently bundle AK with LibCore on Lagom. This means that to use AK,
all libraries must also depend on LibCore. This will create circular
dependencies when we create LibURL, as LibURL will depend on LibUnicode,
which will depend on LibCore, which will depend on LibURL.
2024-01-22 08:48:34 -05:00
Timothy Flynn
1e7b06aa11 Meta: Add a helper to create a Lagom utility
This helper can automatically link against libraries needed by all
utilities, such as LibCore. This is to make extracting AK into its own
library a bit easier.
2024-01-22 08:48:34 -05:00
kleines Filmröllchen
d125d16287 LibAudio+LibRIFF: Move general RIFF handling to LibRIFF
This splits the RIFFTypes header/TU into the WAV specific parts, which
move to WavTypes.h, as well as the general RIFF parts which move to the
new LibRIFF.

Sidenote for the spec comments: even though they are linked from a site
that explains the WAV format, the document is the (an) overall RIFF spec
from Microsoft. A better source may be used later; the changes to the
header are as minimal as possible.
2024-01-15 23:23:26 -07:00
Nico Weber
5a47e71604 Utilities: Add test-jpeg-roundtrip
This creates a bitmap filled with a fixed color, then (in memory)
saves it as jpeg and loads it again, and repeats that until the
color of the bitmap no longer changes. It then reports how many
iterations that took, and what the final color was.

It does this for a couple of colors.

This is for quality assessment of the jpeg codec. Ideally, it should
converge quickly (in one iteration), and on a color not very far from
the original input color.
2024-01-14 11:35:40 +00:00
kleines Filmröllchen
c5a6214a3b Tests: Don't include LibWebView test if LibWeb is disabled
This unbreaks ENABLE_LAGOM_LIBWEB=OFF again.
2023-12-29 09:44:22 -05:00
Andrew Kaster
08108ac579 Meta: Disable -fsanitize=function on macOS with clang 17 or higher
This seems to trip on calling file static functions through a function
pointer directly. Still need to reduce and report upstream.
2023-12-20 12:25:40 -07:00
Dan Klishch
107a3b44fa JSSpecCompiler: Add regression test runner 2023-12-07 10:13:21 -07:00
Dan Klishch
610fe28115 Meta: Add option to specify custom test names for Lagom 2023-12-07 10:13:21 -07:00
Timothy Flynn
82398e5724 Meta: Silence warnings from optional CMake packages
These can be quite verbose on the command line if the packages aren't
found. As they do not break the build, let's not spam warnings.

The OpenGL package is also now skipped on macOS, where there's no point
in looking for the package anyways.
2023-11-28 06:54:16 -05:00
Stephan Vedder
8c65cc185a Meta: Add a minimal SDL2 based videoplayer for Lagom 2023-11-27 09:04:47 -07:00
Andrew Kaster
a0d8990c82 CMake: Bump CMake minimum up to 3.21 to work around CLion bug
Fix the recursive directory bug in CLion Nova EAP's CMake version in a
way that doesn't also break `./Meta/serenity.sh run lagom ladybird`.

This brings the Lagom minimum required closer to the Serenity minimum
required. Which is still fine, because the serenity.sh script knows how
to build CMake from source if a developer's local copy is too old.
2023-11-10 09:36:22 +01:00
Andrew Kaster
7eda36bbf4 CMake: Don't recursively include Ladybird/Lagom in buggy CMake versions
Ran into this with the new EAP for CLion Nova. When using Ladybird as
source directory, we would recursively look in Ladybird --> Lagom -->
Ladybird when exporting components. This seems to be because
ENABLE_LAGOM_LADYBIRD is set to ON by Ladybird's CMakeLists and
something about their build, when invoked from their IDE, has buggy
behavior around the SUBDIRECTORIES directory property.
2023-11-10 08:32:12 +01:00
Timothy Flynn
350fdf1e43 LibCore+LibTimeZone: Support time zone names in Core::DateTime::parse
LibCore currently cannot depend on LibTimeZone directly. All build-time
code generators depend on LibCore, so there'd be a circular dependency:
LibCore -> LibTimeZone -> GenerateTZData -> LibCore.

So to support parsing time zone names and applying their offsets, add a
couple of weakly-defined helper functions. These work similar to the way
AK::String declares some methods that LibUnicode defines. Any user who
wants to parse time zone names (from outside of LibCore itself) can link
against LibTimeZone to receive full support.
2023-11-08 09:28:17 +01:00
Aliaksandr Kalenik
7d26cbf523 LibWeb: Add painting command executor that uses LibAccelGfx
This change introduces a command executor for RecordingPainter that
utilizes LibAccelGfx.
2023-10-29 17:13:23 +01:00
Timothy Flynn
8dc25dffc2 LibWebView: Protect URL highlighting against partially-typed URLs
The current helpers assume that a valid URL is a full URL (i.e. contains
the "://" separator between the scheme and domain). This isn't true, as
"file:" alone is parsed as a valid URL.

We must also avoid simply searching for the parsed public suffix in the
original URL string. For example, "com" is a public suffix. If we search
for that in the URL "com.com", we will think the public suffix starts at
index 0.
2023-10-28 19:03:19 +02:00
Andreas Kling
5b87d26027 LibJIT+LibJS: Move JIT::Assembler into a new LibJIT library
This will allow other parts of the system to generate machine code
at runtime. :^)
2023-10-27 19:07:22 +02:00
Lucas CHOLLET
8659a6d3a7 Lagom: Port LibImageDecoderClient to Lagom
This library offers tools to communicate with an ImageDecoder server
through IPC. There is currently no such executable for Lagom but that
shouldn't take long :^)
2023-10-27 07:26:32 +02:00
Martin Janiczek
7c2a569fca LibTest: Add a suite of tests for the generators 2023-10-26 17:26:52 -06:00
Timothy Flynn
a8f0fa5dd4 LibWebView+LibPublicSuffix: Merge LibPublicSuffix into LibWebView
After d2c7e1ea7d, there is now only one
user of LibPublicSuffix - the URL sanitation utility within LibWebView.
Rather than having an entire library for the small Public Suffix data
accessor, merge it into LibWebView.
2023-10-16 09:06:02 -04:00
Andrew Kaster
99ffc935ef Lagom: Include all generated installed files on library targets
Do this with INSTALL_INTERFACE genex include directory rules. We should
really standardize where the generated headers *actually* get installed
to though.
2023-10-11 12:35:35 -04:00
Tim Ledbetter
e6d9bb0774 LibTLS: Don't attempt to read past EOF when parsing TBSCertificate
This allows the decoder to fail gracefully when reading a partial or
malformed TBSCertificate. We also now ensure that the certificate data
is valid before making a copy of it.
2023-10-11 07:08:22 +02:00
Nico Weber
91e0438fca MacPDF: Make buildable from CMake
Use `Meta/serenity.sh build lagom MacPDF` to build, and either of
`open Build/lagom/bin/MacPDF.app` or
`Build/lagom/bin/MacPDF.app/Contents/MacOS/MacPDF` to run.

Xcode used to insert a bunch of things to Info.plist. Now it can
no longer do that, so manually put them there
2023-09-30 08:08:11 +02:00
Niklas Poslovski
485ae28ba7 AK: Add support for backtraces on Haiku 2023-09-29 15:11:52 +01:00
nipos
2e0960a7ef Meta: Don't link LibCrypt to native libcrypt on Haiku 2023-09-17 13:38:12 -06:00
nipos
2691c079d4 Meta+Ladybird: Link to libnetwork on Haiku 2023-09-17 13:38:12 -06:00
nipos
e345085329 Meta+Ladybird: Add some extra definitions for Haiku 2023-09-17 13:38:12 -06:00
Daniel Bertalan
dac443fbff Meta: Link Lagom with LLD by default and allow configuring the linker
This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
2023-09-05 14:50:36 +02:00
Andrew Kaster
4641af7873 AK: Always use our assertion failure method, and add backtrace to it
On platforms that support it, enable using ``<execinfo.h>`` to get
backtrace(3) to dump a backtrace on assertion failure. This should make
debugging things like WebContent crashes in Lagom much easier.
2023-09-01 11:50:47 +02:00
Timothy Flynn
f7adc3320d Meta: Replace Lagom's LibWebView setup with LibWebView's CMakeLists.txt
This lets us add new sources to LibWebView in a single location.
2023-08-31 06:33:04 -04:00
Timothy Flynn
bf59e06d2a Ladybird+LibWebView: Extract common JS console functionality to a helper
This creates WebView::ConsoleClient to handle functionality that will be
common to the JS consoles of all Ladybird chromes. This will let each
chrome focus on just the UI.

Note that this includes the `console.group` functionality that only the
Serenity chrome previously had. This was a FIXME in the Qt chrome, and
it is implemented such that all chromes will receive this functionality
for free.
2023-08-30 09:24:59 +02:00
Timothy Flynn
1e1c3e5a34 LibWebView: Create a method to syntax-highlight page source with HTML
This tokenizes a page's source to produce HTML with syntax highlighting.
The first implementation here is rather simple; we do not yet implement
code folding, line numbers, etc.

The goal is for this to be used as the View Source implementation for
all Ladybird chromes.
2023-08-29 08:11:11 -04:00
Timothy Flynn
3f122b7335 LibWebView: Allow using native/user style sheets on Lagom
Move the methods to set the native/user style sheets to the base
ViewImplementation class. We must also generate the native style sheet
explicitly for now, as LibWebView on Lagom isn't able to include the
main LibWebView CMakeLists.txt file yet.
2023-08-26 15:32:36 -04:00
Ali Mohammad Pur
2462064fcd LibWasm+LibWeb: Parse and validate all Wasm SIMD instructions 2023-08-21 13:39:32 +03:30
Cameron Youell
8fcf42f684 LibPublicSuffix: Add Library and Generators 2023-08-17 15:30:23 +01:00
Andrew Kaster
ea0e07ec8f Meta: Include RPATH rules at top level to share them with Ladybird
When using Ladybird/ as CMake source directory, the RPATH rules were
left at the default, which is almost never correct.
2023-08-13 23:31:00 -06:00
Daniel Bertalan
44365074fe CMake: Add UNDEFINED_BEHAVIOR_IS_FATAL configure option
This is mainly intended for use on CI, as UBSan instrumentation results
in a serious load and execution time penalty there. See the previous
commit for more details.

With this enabled, the size of LibWeb, built for x86-64 with Clang 17 as
of 0b91d36a is reduced as follows:

      FILE SIZE        VM SIZE
   --------------  --------------
     +18% +2.99Mi  [ = ]       0    .debug_info
     +14%  +758Ki  [ = ]       0    .debug_addr
    +2.6% +7.92Ki  [ = ]       0    .debug_abbrev
    +129% +2.66Ki  [ = ]       0    [Unmapped]
    -0.2%    -208  -0.2%    -208    .plt
    -0.2%    -312  -0.2%    -312    .rela.plt
    -0.1%    -336  -0.1%    -336    .dynsym
    -0.0%    -647  -0.0%    -513    [8 Others]
    -0.1% -1.14Ki  -0.1% -1.14Ki    .dynstr
   -20.1% -53.5Ki -20.1% -53.5Ki    .eh_frame_hdr
    -7.2% -56.8Ki  [ = ]       0    .debug_str_offsets
    -7.1%  -156Ki  [ = ]       0    .debug_str
   -15.0%  -160Ki  [ = ]       0    .symtab
   -63.6%  -245Ki -63.6%  -245Ki    .relr.dyn
   -25.4%  -357Ki -25.4%  -357Ki    .eh_frame
   -27.7% -1.09Mi  [ = ]       0    .strtab
   -59.3% -10.0Mi  [ = ]       0    .debug_rnglists
   -41.3% -11.0Mi  [ = ]       0    .debug_line
   -70.0% -12.0Mi -70.0% -12.0Mi    .rodata
   -65.2% -15.1Mi -65.2% -15.1Mi    .data
   -53.0% -15.7Mi -53.0% -15.7Mi    .text
   -41.7% -62.1Mi -57.7% -43.4Mi    TOTAL
2023-08-13 05:14:07 +02:00
Andrew Kaster
a0a1411ec9 CMake: Set CMAKE_RUNTIME_OUTPUT_DIRECTORY based on CMAKE_INSTALL_BINDIR
Instead of hardcoding bin/, we should use the INSTALL_BINDIR directly
to reflect the intent of the way we're doing the settings.

This should have the benefit of fixing the build when a distro sets the
GNUInstallDirs variables to exciting values, like on NixOS.
2023-08-12 18:21:38 -06:00
Valtteri Koskivuori
077a8058c3 LibIMAP+Mail: Implement RFC2047 message header encoding
This enables us to display email subject fields with non-ASCII
characters in Mail :^)
2023-08-12 11:45:52 -06:00
kleines Filmröllchen
e304ba492f Meta: Fix ENABLE_LAGOM_LIBWEB CMake configuration 2023-08-12 11:29:43 -06:00
kleines Filmröllchen
d1645efde9 Meta+Userland: Allow generating C++ initializer code from GML
This does the exact same thing as the runtime initializer,
except it is faster and can catch some errors much earlier.

The code generator includes these important features:
- Automatic include generation where necessary
- Special-casing for TabWidget and ScrollableContainerWidget
- No use of DeprecatedString where possible
2023-08-11 21:33:48 +02:00
Andrew Kaster
92214b59ab CMake: Make sure to install generated sources and header files
We weren't installing a lot of generated sources for the top level Lagom
build or for LibWeb, making it impossible to use LibWeb from a
find_package. ...And also Kernel/API/KeyCode.h, which is included by
no less than 8 different files in Userland/Libraries. We also weren't
installing any Ladybird header files.
2023-08-10 20:10:05 -06:00
Andrew Kaster
1d78e07f6b Meta: Promote SERENITY_CACHE_DIR to a real option
We've had it as a secret option for long enough, let's make it more
visible.
2023-08-10 20:10:05 -06:00
Andreas Kling
196e04d1c7 CI: Stop running test-js with the AST interpreter 2023-08-08 13:07:13 +02:00
Zaggy1024
50c73d02f0 LibAudio: Add a test for creating and destructing a PlaybackStream
This will ensure that we don't leak any memory while playing back
audio.

There is an expectation value in the test that is only set to true when
PulseAudio is present for the moment. When any new implementation is
added for other libraries/platforms, we should hopefully get a CI
failure due to unexpected success in creating the `PlaybackStream`.

To ensure that we clean up our PulseAudio connection whenever audio
output is not needed, add `PulseAudioContext::weak_instance()` to allow
us to check whether an instance exists without creating one.
2023-08-07 10:40:34 -06:00