mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
Everywhere: Move the Ladybird folder to UI
This commit is contained in:
parent
93712b24bf
commit
db47cc41f8
Notes:
github-actions[bot]
2024-11-10 11:51:45 +00:00
Author: https://github.com/trflynn89
Commit: db47cc41f8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
203 changed files with 266 additions and 244 deletions
33
UI/cmake/AndroidExtras.cmake
Normal file
33
UI/cmake/AndroidExtras.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
|
||||
#
|
||||
# Copy resources into tarball for inclusion in /assets of APK
|
||||
#
|
||||
set(LADYBIRD_RESOURCE_ROOT "${LADYBIRD_SOURCE_DIR}/Base/res")
|
||||
macro(copy_res_folder folder)
|
||||
add_custom_target(copy-${folder}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${LADYBIRD_RESOURCE_ROOT}/${folder}"
|
||||
"asset-bundle/res/${folder}"
|
||||
)
|
||||
add_dependencies(archive-assets copy-${folder})
|
||||
endmacro()
|
||||
add_custom_target(archive-assets COMMAND ${CMAKE_COMMAND} -E chdir asset-bundle tar cf ../ladybird-assets.tar ./ )
|
||||
copy_res_folder(ladybird)
|
||||
copy_res_folder(html)
|
||||
copy_res_folder(fonts)
|
||||
copy_res_folder(icons)
|
||||
copy_res_folder(emoji)
|
||||
copy_res_folder(themes)
|
||||
add_custom_target(copy-certs
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${Lagom_BINARY_DIR}/cacert.pem"
|
||||
"asset-bundle/res/ladybird/cacert.pem"
|
||||
)
|
||||
add_dependencies(archive-assets copy-certs)
|
||||
add_custom_target(copy-assets COMMAND ${CMAKE_COMMAND} -E copy_if_different ladybird-assets.tar "${CMAKE_SOURCE_DIR}/UI/Android/src/main/assets/")
|
||||
add_dependencies(copy-assets archive-assets)
|
||||
add_dependencies(ladybird copy-assets)
|
16
UI/cmake/EnableLagom.cmake
Normal file
16
UI/cmake/EnableLagom.cmake
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Copyright (c) 2021, Andrew Kaster <akaster@serenityos.org>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set(LAGOM_SOURCE_DIR "${LADYBIRD_SOURCE_DIR}/Meta/Lagom")
|
||||
set(LAGOM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/Lagom")
|
||||
|
||||
# FIXME: Setting target_include_directories on Lagom libraries might make this unnecessary?
|
||||
include_directories(${LADYBIRD_SOURCE_DIR})
|
||||
include_directories(${LADYBIRD_SOURCE_DIR}/Services)
|
||||
include_directories(${LADYBIRD_SOURCE_DIR}/Libraries)
|
||||
include_directories(${LAGOM_BINARY_DIR})
|
||||
include_directories(${LAGOM_BINARY_DIR}/Services)
|
||||
include_directories(${LAGOM_BINARY_DIR}/Libraries)
|
||||
|
||||
add_subdirectory("${LAGOM_SOURCE_DIR}" "${LAGOM_BINARY_DIR}")
|
111
UI/cmake/InstallRules.cmake
Normal file
111
UI/cmake/InstallRules.cmake
Normal file
|
@ -0,0 +1,111 @@
|
|||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(package Ladybird)
|
||||
|
||||
set(ladybird_applications ladybird ${ladybird_helper_processes})
|
||||
|
||||
set(app_install_targets ${ladybird_applications})
|
||||
|
||||
install(TARGETS ladybird
|
||||
EXPORT ladybirdTargets
|
||||
RUNTIME
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION bundle
|
||||
LIBRARY
|
||||
COMPONENT ladybird_Runtime
|
||||
NAMELINK_COMPONENT ladybird_Development
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
FILE_SET browser
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILE_SET ladybird
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
install(TARGETS ${ladybird_helper_processes}
|
||||
EXPORT ladybirdTargets
|
||||
RUNTIME
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
|
||||
)
|
||||
|
||||
include("${LADYBIRD_SOURCE_DIR}/Meta/Lagom/get_linked_lagom_libraries.cmake")
|
||||
foreach (application IN LISTS ladybird_applications)
|
||||
get_linked_lagom_libraries("${application}" "${application}_lagom_libraries")
|
||||
list(APPEND all_required_lagom_libraries "${${application}_lagom_libraries}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES all_required_lagom_libraries)
|
||||
|
||||
# Remove ladybird shlib if it exists
|
||||
list(REMOVE_ITEM all_required_lagom_libraries ladybird)
|
||||
|
||||
if (APPLE)
|
||||
# Fixup the app bundle and copy:
|
||||
# - Libraries from lib/ to Ladybird.app/Contents/lib
|
||||
# Remove the symlink we created at build time for the lib directory first
|
||||
install(CODE "
|
||||
file(REMOVE \${CMAKE_INSTALL_PREFIX}/bundle/Ladybird.app/Contents/lib)
|
||||
set(lib_dir \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||
if (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
|
||||
set(lib_dir ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
set(contents_dir \${CMAKE_INSTALL_PREFIX}/bundle/Ladybird.app/Contents)
|
||||
file(COPY \${lib_dir} DESTINATION \${contents_dir})
|
||||
"
|
||||
COMPONENT ladybird_Runtime)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${all_required_lagom_libraries}
|
||||
EXPORT ladybirdTargets
|
||||
COMPONENT ladybird_Runtime
|
||||
LIBRARY
|
||||
COMPONENT ladybird_Runtime
|
||||
NAMELINK_COMPONENT ladybird_Development
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
FILE_SET server
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILE_SET ladybird
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${package}ConfigVersion.cmake"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
# Allow package maintainers to freely override the path for the configs
|
||||
set(
|
||||
ladybird_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}"
|
||||
CACHE PATH "CMake package config location relative to the install prefix"
|
||||
)
|
||||
mark_as_advanced(ladybird_INSTALL_CMAKEDIR)
|
||||
|
||||
install(
|
||||
FILES cmake/LadybirdInstallConfig.cmake
|
||||
DESTINATION "${ladybird_INSTALL_CMAKEDIR}"
|
||||
RENAME "${package}Config.cmake"
|
||||
COMPONENT ladybird_Development
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/${package}ConfigVersion.cmake"
|
||||
DESTINATION "${ladybird_INSTALL_CMAKEDIR}"
|
||||
COMPONENT ladybird_Development
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT ladybirdTargets
|
||||
NAMESPACE ladybird::
|
||||
DESTINATION "${ladybird_INSTALL_CMAKEDIR}"
|
||||
COMPONENT ladybird_Development
|
||||
)
|
||||
|
||||
if (NOT APPLE)
|
||||
# On macOS the resources are handled via the MACOSX_PACKAGE_LOCATION property on each resource file
|
||||
install_ladybird_resources("${CMAKE_INSTALL_DATADIR}/Lagom" ladybird_Runtime)
|
||||
endif()
|
1
UI/cmake/LadybirdInstallConfig.cmake
Normal file
1
UI/cmake/LadybirdInstallConfig.cmake
Normal file
|
@ -0,0 +1 @@
|
|||
include("${CMAKE_CURRENT_LIST_DIR}/ladybirdTargets.cmake")
|
192
UI/cmake/ResourceFiles.cmake
Normal file
192
UI/cmake/ResourceFiles.cmake
Normal file
|
@ -0,0 +1,192 @@
|
|||
set(FONTS
|
||||
NotoEmoji.ttf
|
||||
SerenitySans-Regular.ttf
|
||||
)
|
||||
list(TRANSFORM FONTS PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/fonts/")
|
||||
|
||||
set(16x16_ICONS
|
||||
app-system-monitor.png
|
||||
box.png
|
||||
audio-volume-high.png
|
||||
audio-volume-muted.png
|
||||
close-tab.png
|
||||
download.png
|
||||
edit-copy.png
|
||||
filetype-css.png
|
||||
filetype-folder-open.png
|
||||
filetype-html.png
|
||||
filetype-image.png
|
||||
filetype-sound.png
|
||||
filetype-video.png
|
||||
find.png
|
||||
go-forward.png
|
||||
history.png
|
||||
layers.png
|
||||
layout.png
|
||||
network.png
|
||||
new-tab.png
|
||||
open-parent-directory.png
|
||||
paste.png
|
||||
pause.png
|
||||
play.png
|
||||
select-all.png
|
||||
settings.png
|
||||
spoof.png
|
||||
trash-can.png
|
||||
zoom-in.png
|
||||
zoom-out.png
|
||||
zoom-reset.png
|
||||
)
|
||||
set(32x32_ICONS
|
||||
app-system-monitor.png
|
||||
filetype-folder.png
|
||||
filetype-unknown.png
|
||||
msgbox-warning.png
|
||||
)
|
||||
set(48x48_ICONS
|
||||
app-browser.png
|
||||
)
|
||||
set(128x128_ICONS
|
||||
app-browser.png
|
||||
app-browser-dark.png
|
||||
)
|
||||
set(BROWSER_ICONS
|
||||
clear-cache.png
|
||||
cookie.png
|
||||
dom-tree.png
|
||||
local-storage.png
|
||||
)
|
||||
list(TRANSFORM 16x16_ICONS PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/icons/16x16/")
|
||||
list(TRANSFORM 32x32_ICONS PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/icons/32x32/")
|
||||
list(TRANSFORM 48x48_ICONS PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/icons/48x48/")
|
||||
list(TRANSFORM 128x128_ICONS PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/icons/128x128/")
|
||||
list(TRANSFORM BROWSER_ICONS PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/icons/browser/")
|
||||
|
||||
set(WEB_RESOURCES
|
||||
about.html
|
||||
inspector.css
|
||||
inspector.html
|
||||
inspector.js
|
||||
newtab.html
|
||||
)
|
||||
set(WEB_TEMPLATES
|
||||
directory.html
|
||||
error.html
|
||||
version.html
|
||||
)
|
||||
list(TRANSFORM WEB_RESOURCES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/ladybird/")
|
||||
list(TRANSFORM WEB_TEMPLATES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/ladybird/templates/")
|
||||
|
||||
set(THEMES
|
||||
Default.ini
|
||||
Dark.ini
|
||||
)
|
||||
list(TRANSFORM THEMES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/themes/")
|
||||
|
||||
set(CONFIG_RESOURCES
|
||||
bookmarks.json
|
||||
BrowserAutoplayAllowlist.txt
|
||||
BrowserContentFilters.txt
|
||||
)
|
||||
list(TRANSFORM CONFIG_RESOURCES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/ladybird/default-config/")
|
||||
|
||||
set(DOWNLOADED_RESOURCES
|
||||
cacert.pem
|
||||
)
|
||||
list(TRANSFORM DOWNLOADED_RESOURCES PREPEND "${Lagom_BINARY_DIR}/")
|
||||
|
||||
function(copy_resource_set subdir)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 "COPY" "" "TARGET;DESTINATION" "RESOURCES")
|
||||
set(inputs ${COPY_RESOURCES})
|
||||
|
||||
if (APPLE)
|
||||
target_sources(${COPY_TARGET} PRIVATE ${inputs})
|
||||
set_source_files_properties(${inputs} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${subdir}")
|
||||
else()
|
||||
set(outputs "")
|
||||
foreach (input IN LISTS inputs)
|
||||
get_filename_component(input_name "${input}" NAME)
|
||||
list(APPEND outputs "${COPY_DESTINATION}/${subdir}/${input_name}")
|
||||
endforeach()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${outputs}
|
||||
DEPENDS ${inputs}
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${COPY_DESTINATION}/${subdir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${inputs}" "${COPY_DESTINATION}/${subdir}"
|
||||
COMMAND_EXPAND_LISTS
|
||||
VERBATIM
|
||||
)
|
||||
string(REPLACE "/" "_" subdir_underscores "${subdir}")
|
||||
set(target_name "copy_${subdir_underscores}_resources_to_build")
|
||||
while (TARGET ${target_name})
|
||||
set(target_name "${target_name}_")
|
||||
endwhile()
|
||||
add_custom_target(${target_name} DEPENDS ${outputs})
|
||||
add_dependencies(all_generated ${target_name})
|
||||
add_dependencies("${COPY_TARGET}_build_resource_files" ${target_name})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(copy_resources_to_build base_directory bundle_target)
|
||||
add_custom_target("${bundle_target}_build_resource_files")
|
||||
|
||||
copy_resource_set(fonts RESOURCES ${FONTS}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(icons/16x16 RESOURCES ${16x16_ICONS}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(icons/32x32 RESOURCES ${32x32_ICONS}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(icons/48x48 RESOURCES ${48x48_ICONS}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(icons/128x128 RESOURCES ${128x128_ICONS}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(icons/browser RESOURCES ${BROWSER_ICONS}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(themes RESOURCES ${THEMES}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(ladybird RESOURCES ${WEB_RESOURCES}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(ladybird/templates RESOURCES ${WEB_TEMPLATES}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(ladybird/default-config RESOURCES ${CONFIG_RESOURCES}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
copy_resource_set(ladybird RESOURCES ${DOWNLOADED_RESOURCES}
|
||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||
)
|
||||
|
||||
add_dependencies(${bundle_target} "${bundle_target}_build_resource_files")
|
||||
endfunction()
|
||||
|
||||
function(install_ladybird_resources destination component)
|
||||
install(FILES ${16x16_ICONS} DESTINATION "${destination}/icons/16x16" COMPONENT ${component})
|
||||
install(FILES ${32x32_ICONS} DESTINATION "${destination}/icons/32x32" COMPONENT ${component})
|
||||
install(FILES ${48x48_ICONS} DESTINATION "${destination}/icons/48x48" COMPONENT ${component})
|
||||
install(FILES ${128x128_ICONS} DESTINATION "${destination}/icons/128x128" COMPONENT ${component})
|
||||
install(FILES ${BROWSER_ICONS} DESTINATION "${destination}/icons/browser" COMPONENT ${component})
|
||||
install(FILES ${THEMES} DESTINATION "${destination}/themes" COMPONENT ${component})
|
||||
install(FILES ${WEB_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
||||
install(FILES ${WEB_TEMPLATES} DESTINATION "${destination}/ladybird/templates" COMPONENT ${component})
|
||||
install(FILES ${CONFIG_RESOURCES} DESTINATION "${destination}/ladybird/default-config" COMPONENT ${component})
|
||||
install(FILES ${DOWNLOADED_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
||||
endfunction()
|
Loading…
Add table
Add a link
Reference in a new issue