ladybird/Meta/gn/secondary/Ladybird/BUILD.gn
Sebastian Zaha 8dcb7c29ad Meta: Port recent build changes to gn build
This ports the following commits:

e26ead0995
5c5a00dd3a
2023-09-01 09:00:03 +02:00

308 lines
9.1 KiB
Text

import("//Ladybird/compile_qt_resource_file.gni")
import("//Ladybird/link_qt.gni")
import("//Ladybird/moc_qt_objects.gni")
group("ladybird") {
if (current_os == "mac") {
deps = [ ":ladybird.app" ]
} else {
deps = [ ":ladybird_executable" ]
}
}
moc_qt_objects("generate_moc") {
sources = [
"Qt/AutoComplete.h",
"Qt/BrowserWindow.h",
"Qt/ConsoleWidget.h",
"Qt/EventLoopImplementationQtEventTarget.h",
"Qt/InspectorWidget.h",
"Qt/LocationEdit.h",
"Qt/ModelTranslator.h",
"Qt/SettingsDialog.h",
"Qt/Tab.h",
"Qt/WebContentView.h",
]
}
compile_qt_resource_file("compile_resource_file") {
sources = [ "Qt/ladybird.qrc" ]
}
link_qt("ladybird_qt_components") {
qt_components = [
"Core",
"Gui",
"Widgets",
"Network",
"Svg",
]
}
config("ladybird_config") {
include_dirs = [
"//Userland/Applications",
"//Userland/Services",
]
defines = [ "AK_DONT_REPLACE_STD" ]
}
executable("ladybird_executable") {
configs += [
":ladybird_config",
":ladybird_qt_components",
]
data_deps = [
":headless-browser",
"RequestServer",
"SQLServer",
"WebContent",
"WebDriver",
"WebSocket",
]
deps = [
":compile_resource_file",
":generate_moc",
"//AK",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibFileSystem",
"//Userland/Libraries/LibGUI",
"//Userland/Libraries/LibGfx",
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibJS",
"//Userland/Libraries/LibMain",
"//Userland/Libraries/LibProtocol",
"//Userland/Libraries/LibPublicSuffix",
"//Userland/Libraries/LibSQL",
"//Userland/Libraries/LibWeb",
"//Userland/Libraries/LibWebView",
]
sources = [
"HelperProcess.cpp",
"Qt/AutoComplete.cpp",
"Qt/BrowserWindow.cpp",
"Qt/ConsoleWidget.cpp",
"Qt/EventLoopImplementationQt.cpp",
"Qt/EventLoopImplementationQtEventTarget.cpp",
"Qt/InspectorWidget.cpp",
"Qt/LocationEdit.cpp",
"Qt/ModelTranslator.cpp",
"Qt/Settings.cpp",
"Qt/SettingsDialog.cpp",
"Qt/StringUtils.cpp",
"Qt/TVGIconEngine.cpp",
"Qt/Tab.cpp",
"Qt/WebContentView.cpp",
"Qt/main.cpp",
"Utilities.cpp",
]
sources += get_target_outputs(":generate_moc") +
get_target_outputs(":compile_resource_file")
if (current_os == "android") {
sources += [ "AndroidPlatform.cpp" ]
}
output_name = "ladybird"
}
executable("headless-browser") {
include_dirs = [ "//Userland/Services" ]
configs += [ ":ladybird_config" ]
deps = [
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibCrypto",
"//Userland/Libraries/LibDiff",
"//Userland/Libraries/LibFileSystem",
"//Userland/Libraries/LibGemini",
"//Userland/Libraries/LibGfx",
"//Userland/Libraries/LibHTTP",
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibJS",
"//Userland/Libraries/LibMain",
"//Userland/Libraries/LibProtocol",
"//Userland/Libraries/LibTLS",
"//Userland/Libraries/LibWeb",
"//Userland/Libraries/LibWebSocket",
"//Userland/Libraries/LibWebView",
]
sources = [
"//Userland/Services/WebContent/WebDriverConnection.cpp",
"//Userland/Utilities/headless-browser.cpp",
"HelperProcess.cpp",
"Utilities.cpp",
]
}
if (current_os == "mac") {
bundle_data("ladybird_bundle_info_plist") {
sources = [ "Info.plist" ]
outputs = [ "{{bundle_contents_dir}}/Info.plist" ]
}
bundle_data("ladybird_bundle_executables") {
public_deps = [
":headless-browser",
":ladybird_executable",
"RequestServer",
"SQLServer",
"WebContent",
"WebDriver",
"WebSocket",
]
sources = [
"$root_out_dir/bin/RequestServer",
"$root_out_dir/bin/SQLServer",
"$root_out_dir/bin/WebContent",
"$root_out_dir/bin/WebDriver",
"$root_out_dir/bin/WebSocket",
"$root_out_dir/bin/headless-browser",
"$root_out_dir/bin/ladybird",
]
outputs = [ "{{bundle_executable_dir}}/{{source_file_part}}" ]
}
bundle_data("ladybird_bundle_libs") {
public_deps = [
"//Userland/Libraries/LibAudio",
"//Userland/Libraries/LibCompress",
"//Userland/Libraries/LibCore",
"//Userland/Libraries/LibCrypto",
"//Userland/Libraries/LibDiff",
"//Userland/Libraries/LibFileSystem",
"//Userland/Libraries/LibGL",
"//Userland/Libraries/LibGLSL",
"//Userland/Libraries/LibGPU",
"//Userland/Libraries/LibGUI",
"//Userland/Libraries/LibGemini",
"//Userland/Libraries/LibGfx",
"//Userland/Libraries/LibHTTP",
"//Userland/Libraries/LibIDL",
"//Userland/Libraries/LibIPC",
"//Userland/Libraries/LibJS",
"//Userland/Libraries/LibLine",
"//Userland/Libraries/LibMarkdown",
"//Userland/Libraries/LibProtocol",
"//Userland/Libraries/LibPublicSuffix",
"//Userland/Libraries/LibRegex",
"//Userland/Libraries/LibSQL",
"//Userland/Libraries/LibSoftGPU",
"//Userland/Libraries/LibSyntax",
"//Userland/Libraries/LibTLS",
"//Userland/Libraries/LibTextCodec",
"//Userland/Libraries/LibThreading",
"//Userland/Libraries/LibVideo",
"//Userland/Libraries/LibWasm",
"//Userland/Libraries/LibWeb",
"//Userland/Libraries/LibWebSocket",
"//Userland/Libraries/LibWebView",
"//Userland/Libraries/LibXML",
]
sources = [
"$root_out_dir/lib/liblagom-audio.dylib",
"$root_out_dir/lib/liblagom-compress.dylib",
"$root_out_dir/lib/liblagom-core.dylib",
"$root_out_dir/lib/liblagom-crypto.dylib",
"$root_out_dir/lib/liblagom-diff.dylib",
"$root_out_dir/lib/liblagom-filesystem.dylib",
"$root_out_dir/lib/liblagom-gemini.dylib",
"$root_out_dir/lib/liblagom-gfx.dylib",
"$root_out_dir/lib/liblagom-gl.dylib",
"$root_out_dir/lib/liblagom-glsl.dylib",
"$root_out_dir/lib/liblagom-gpu.dylib",
"$root_out_dir/lib/liblagom-gui.dylib",
"$root_out_dir/lib/liblagom-http.dylib",
"$root_out_dir/lib/liblagom-idl.dylib",
"$root_out_dir/lib/liblagom-ipc.dylib",
"$root_out_dir/lib/liblagom-js.dylib",
"$root_out_dir/lib/liblagom-line.dylib",
"$root_out_dir/lib/liblagom-markdown.dylib",
"$root_out_dir/lib/liblagom-protocol.dylib",
"$root_out_dir/lib/liblagom-publicsuffix.dylib",
"$root_out_dir/lib/liblagom-regex.dylib",
"$root_out_dir/lib/liblagom-softgpu.dylib",
"$root_out_dir/lib/liblagom-sql.dylib",
"$root_out_dir/lib/liblagom-syntax.dylib",
"$root_out_dir/lib/liblagom-textcodec.dylib",
"$root_out_dir/lib/liblagom-threading.dylib",
"$root_out_dir/lib/liblagom-tls.dylib",
"$root_out_dir/lib/liblagom-video.dylib",
"$root_out_dir/lib/liblagom-wasm.dylib",
"$root_out_dir/lib/liblagom-web.dylib",
"$root_out_dir/lib/liblagom-websocket.dylib",
"$root_out_dir/lib/liblagom-webview.dylib",
"$root_out_dir/lib/liblagom-xml.dylib",
]
outputs = [ "{{bundle_contents_dir}}/lib/{{source_file_part}}" ]
}
bundle_data("ladybird_resources") {
sources = [
"//Base/res/color-palettes",
"//Base/res/cursor-themes",
"//Base/res/fonts",
"//Base/res/html",
"//Base/res/icons",
"//Base/res/themes",
]
outputs = [ "{{bundle_resources_dir}}/res/" + "{{source_file_part}}" ]
}
bundle_data("ladybird_config_resources") {
public_deps = [ "//Userland/Libraries/LibTLS:ca_certificates_download" ]
sources = [
"$root_build_dir/cacert.pem",
"//Base/home/anon/.config/BrowserAutoplayAllowlist.txt",
"//Base/home/anon/.config/BrowserContentFilters.txt",
]
outputs = [ "{{bundle_resources_dir}}/res/ladybird/{{source_file_part}}" ]
}
action("ladybird_create_icon") {
script = "//Meta/gn/secondary/Ladybird/invoke_process_with_args.py"
icon_path = "//Ladybird/Icons/macos/app_icon.iconset"
sources = [
"$icon_path/icon_128x128.png",
"$icon_path/icon_128x128@2x.png",
"$icon_path/icon_16x16.png",
"$icon_path/icon_16x16@2x.png",
"$icon_path/icon_256x256.png",
"$icon_path/icon_256x256@2x.png",
"$icon_path/icon_32x32.png",
"$icon_path/icon_32x32@2x.png",
"$icon_path/icon_512x512.png",
"$icon_path/icon_512x512@2x.png",
]
outputs = [ "$target_gen_dir/app_icon.icns" ]
args = [
"iconutil",
"--convert",
"icns",
rebase_path(icon_path, root_build_dir),
"--output",
rebase_path(outputs[0], root_build_dir),
]
}
bundle_data("ladybird_icon") {
public_deps = [ ":ladybird_create_icon" ]
sources = get_target_outputs(public_deps[0])
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}
create_bundle("ladybird.app") {
product_type = "com.apple.product-type.application"
bundle_root_dir = "$root_build_dir/$target_name"
bundle_contents_dir = "$bundle_root_dir/Contents"
bundle_resources_dir = "$bundle_contents_dir/Resources"
bundle_executable_dir = "$bundle_contents_dir/MacOS"
deps = [
":ladybird_bundle_executables",
":ladybird_bundle_info_plist",
":ladybird_bundle_libs",
":ladybird_config_resources",
":ladybird_icon",
":ladybird_resources",
]
}
}