diff --git a/.gitignore b/.gitignore index cc2306bd..da444947 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,4 @@ tags /test/notsosimplevector /test/shapes /test/trie -/test/unicode-test +/test/unicode-test \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..b41eb99a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,209 @@ +cmake_minimum_required(VERSION 3.10) +project(dillo VERSION 3.3.0 LANGUAGES C CXX) + +# CMake policy settings +cmake_policy(SET CMP0072 NEW) # OpenGL preference +cmake_policy(SET CMP0009 NEW) # FILE GLOB_RECURSE behavior + +# Include GNUInstallDirs for standard installation directories +include(GNUInstallDirs) + +# Set output directories to build directory root +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +# Multi-config generators support +foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${CONFIG} CONFIG_UPPER) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_UPPER} ${CMAKE_BINARY_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_UPPER} ${CMAKE_BINARY_DIR}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_UPPER} ${CMAKE_BINARY_DIR}) +endforeach() + +# Set C and C++ standards +set(CMAKE_C_STANDARD 99) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Configuration options +option(ENABLE_COOKIES "Enable cookies support" ON) +option(ENABLE_PNG "Enable PNG images support" ON) +option(ENABLE_WEBP "Enable WebP images support" ON) +option(ENABLE_JPEG "Enable JPEG images support" ON) +option(ENABLE_GIF "Enable GIF images support" ON) +option(ENABLE_SVG "Enable SVG images support" ON) +option(ENABLE_IPV6 "Enable IPv6 support" ON) +option(ENABLE_TLS "Enable TLS support" ON) +option(ENABLE_XEMBED "Enable X11 XEmbed support" ON) +option(ENABLE_CONTROL_SOCKET "Enable control socket" ON) + +# Find required packages +find_package(PkgConfig) + +# Find FLTK +find_package(FLTK REQUIRED) + +# Find X11 +find_package(X11 REQUIRED) + +# Find threading +find_package(Threads REQUIRED) + +# Find iconv +find_path(ICONV_INCLUDE_DIR iconv.h) +find_library(ICONV_LIBRARY iconv) +if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) + set(ICONV_FOUND TRUE) +else() + set(ICONV_FOUND FALSE) +endif() + +# Find zlib +find_package(ZLIB) + +# Find OpenSSL for TLS support +if(ENABLE_TLS) + find_package(OpenSSL) + if(OPENSSL_FOUND) + set(HAVE_OPENSSL TRUE) + add_definitions(-DHAVE_OPENSSL) + endif() +endif() + +# Find libpng +if(ENABLE_PNG) + find_package(PNG) + if(PNG_FOUND) + add_definitions(-DENABLE_PNG) + endif() +endif() + +# Find libjpeg +if(ENABLE_JPEG) + find_package(JPEG) + if(JPEG_FOUND) + add_definitions(-DENABLE_JPEG) + endif() +endif() + +# Find libwebp +if(ENABLE_WEBP) + pkg_check_modules(WEBP libwebp) + if(WEBP_FOUND) + add_definitions(-DENABLE_WEBP) + endif() +endif() + +# Compiler flags +# Suppress unused parameter warnings - many function parameters are required for API compatibility +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter") + +# Debug flags for Debug builds +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0") +endif() + +# Release flags for Release builds +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -DNDEBUG") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -DNDEBUG") +endif() + +# Add FLTK flags +add_compile_options(${FLTK_CXXFLAGS}) + +# Configuration definitions +add_definitions(-DDILLO_SYSCONF="${CMAKE_INSTALL_FULL_SYSCONFDIR}/dillo/") +add_definitions(-DDILLO_DOCDIR="${CMAKE_INSTALL_FULL_DOCDIR}/") +add_definitions(-DDILLO_LIBDIR="${CMAKE_INSTALL_FULL_LIBDIR}/dillo/") + +# System paths for dpid +add_definitions(-DDPIDRC_SYS="${CMAKE_INSTALL_SYSCONFDIR}/dpidrc") + + +# Enable features based on options +if(ENABLE_COOKIES) + add_definitions(-DENABLE_COOKIES) +endif() + +if(ENABLE_GIF) + add_definitions(-DENABLE_GIF) +endif() + +if(ENABLE_SVG) + add_definitions(-DENABLE_SVG) +endif() + +if(ENABLE_IPV6) + add_definitions(-DENABLE_IPV6) +endif() + +if(ENABLE_XEMBED) + add_definitions(-DENABLE_XEMBED) +endif() + +# Include directories +include_directories(${CMAKE_SOURCE_DIR}) +include_directories(${CMAKE_SOURCE_DIR}/src) +include_directories(${ICONV_INCLUDE_DIR}) + +# Subdirectories +add_subdirectory(lout) +add_subdirectory(dw) +add_subdirectory(dlib) +add_subdirectory(dpip) +add_subdirectory(src/IO) +add_subdirectory(dpid) +add_subdirectory(dpi) +add_subdirectory(src) + + +# Installation configuration +install(FILES dillorc DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dillo) +install(FILES dillo.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) + +# Install icons if they exist +if(EXISTS "${CMAKE_SOURCE_DIR}/icons/48x48/dillo.png") + install(FILES icons/48x48/dillo.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps/) +endif() +if(EXISTS "${CMAKE_SOURCE_DIR}/icons/128x128/dillo.png") + install(FILES icons/128x128/dillo.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps/) +endif() + +# Install scripts +install(PROGRAMS dillo-install-hyphenation DESTINATION ${CMAKE_INSTALL_BINDIR}) + +# Add uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY + ) + + add_custom_target(uninstall + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" + COMMENT "Uninstalling Dillo..." + ) +endif() + +# Print configuration summary +message(STATUS "Dillo Configuration Summary:") +message(STATUS " Version: ${PROJECT_VERSION}") +message(STATUS " Install prefix: ${CMAKE_INSTALL_PREFIX}") +message(STATUS " Cookies: ${ENABLE_COOKIES}") +message(STATUS " PNG: ${ENABLE_PNG}") +message(STATUS " JPEG: ${ENABLE_JPEG}") +message(STATUS " GIF: ${ENABLE_GIF}") +message(STATUS " SVG: ${ENABLE_SVG}") +message(STATUS " WebP: ${ENABLE_WEBP}") +message(STATUS " IPv6: ${ENABLE_IPV6}") +message(STATUS " TLS: ${ENABLE_TLS}") +message(STATUS " XEmbed: ${ENABLE_XEMBED}") +message(STATUS " Control Socket: ${ENABLE_CONTROL_SOCKET}") diff --git a/README.CMake.md b/README.CMake.md new file mode 100644 index 00000000..fc5dd627 --- /dev/null +++ b/README.CMake.md @@ -0,0 +1,137 @@ +# Dillo CMake Build System + +This directory contains a modern CMake build system for the Dillo web browser, replacing the traditional autotools-based build process. + +## Quick Start + +### Prerequisites +- CMake 3.10 or higher +- C++11 compatible compiler +- FLTK development libraries +- OpenSSL (for TLS support) +- libpng, libjpeg (for image support) +- pkg-config + +### Build +```bash +# Configure and build +cmake -B build -DCMAKE_BUILD_TYPE=Debug +cmake --build build --parallel 4 + +# Install (requires sudo for system installation) +sudo cmake --install build + +# Run from build directory (development) +./build/dillo +``` + +### Uninstall +```bash +sudo cmake --build build --target uninstall +``` + +## Build Options + +All features can be enabled/disabled with CMake options: + +```bash +cmake -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_COOKIES=ON \ + -DENABLE_PNG=ON \ + -DENABLE_JPEG=ON \ + -DENABLE_GIF=ON \ + -DENABLE_SVG=ON \ + -DENABLE_WEBP=ON \ + -DENABLE_IPV6=ON \ + -DENABLE_TLS=ON \ + -DENABLE_XEMBED=ON \ + -DENABLE_CONTROL_SOCKET=ON +``` + +## Installation Paths + +By default, files are installed to standard locations: +- Executables: `/usr/local/bin/` +- Configuration: `/usr/local/etc/dillo/` +- DPI plugins: `/usr/local/lib/dillo/dpi/` +- Desktop files: `/usr/local/share/applications/` +- Icons: `/usr/local/share/icons/hicolor/` + +To change the installation prefix: +```bash +cmake -B build -DCMAKE_INSTALL_PREFIX=/usr +``` + +## Development + +### Running from Build Directory +After building, you can run dillo directly from the build directory: + +```bash +./build/dillo +``` + +Note: For full functionality (DPI plugins, configuration files), you should install the package first with `sudo cmake --install build`. + +### Build Targets +- `dillo` - Main browser executable +- `dpid_bin` - DPI daemon (installed as `dpid`) +- `dpidc` - DPI client +- `dilloc` - Control socket client +- Various `.dpi` plugins for different protocols + +### Output Directory +All executables are built to the build directory root for easy access during development. + +## Migration from Autotools + +This CMake build system is a drop-in replacement for the autotools build system. Key differences: + +1. **Build commands**: Use `cmake` instead of `./configure && make` +2. **Configuration**: CMake options instead of configure flags +3. **Modern build system**: Better dependency management and cross-platform support +4. **Clean output**: All executables built to build directory root + +## Troubleshooting + +### Common Issues + +**"cannot open output file .: Is a directory"** +- This was a target name conflict that has been resolved +- The `dpid` target is now built as `dpid_bin` to avoid directory conflicts + +**Missing dependencies** +- Install FLTK development packages: `libfltk1.3-dev` +- Install image libraries: `libpng-dev libjpeg-dev` +- Install OpenSSL: `libssl-dev` + +### Clean Build +To start fresh: +```bash +rm -rf build/ +cmake -B build -DCMAKE_BUILD_TYPE=Debug +cmake --build build --parallel 4 +``` + +## Architecture + +The build system is organized as follows: +- `CMakeLists.txt` - Main configuration and options +- `lout/CMakeLists.txt` - Utility library +- `dw/CMakeLists.txt` - Display widget libraries (3 sub-libraries) +- `dlib/CMakeLists.txt` - Dillo utility library +- `dpip/CMakeLists.txt` - DPI interface library +- `src/IO/CMakeLists.txt` - Input/output library with TLS support +- `src/CMakeLists.txt` - Main browser and control client +- `dpid/CMakeLists.txt` - DPI daemon and client +- `dpi/CMakeLists.txt` - All DPI plugins + +## Contributing + +When modifying the build system: +1. Test both Debug and Release builds +2. Verify installation and uninstallation work +3. Test running from build directory +4. Ensure all targets build without warnings +5. Update this documentation for any new features diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 00000000..783e1838 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,44 @@ +# CMake uninstall script for Dillo + +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") + +foreach(file ${files}) + message(STATUS "Removing: ${file}") + if(EXISTS "${file}") + execute_process( + COMMAND @CMAKE_COMMAND@ -E remove "${file}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error + ) + if(NOT result EQUAL 0) + message(FATAL_ERROR "Failed to remove ${file}: ${error}") + endif() + else() + message(STATUS "File does not exist: ${file}") + endif() +endforeach() + +# Remove empty directories +file(GLOB_RECURSE dirs "@CMAKE_INSTALL_PREFIX@/*") +list(REVERSE dirs) + +foreach(dir ${dirs}) + if(IS_DIRECTORY "${dir}") + file(GLOB dir_contents "${dir}/*") + if(dir_contents STREQUAL "") + message(STATUS "Removing empty directory: ${dir}") + execute_process( + COMMAND @CMAKE_COMMAND@ -E remove_directory "${dir}" + RESULT_VARIABLE result + ) + endif() + endif() +endforeach() + +message(STATUS "Uninstall completed successfully!") diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt new file mode 100644 index 00000000..db76dfc8 --- /dev/null +++ b/dlib/CMakeLists.txt @@ -0,0 +1,8 @@ +# dlib library +set(DLIB_SOURCES + dlib.h + dlib.c +) + +add_library(Dlib STATIC ${DLIB_SOURCES}) +target_include_directories(Dlib PUBLIC ${CMAKE_SOURCE_DIR}) diff --git a/dpi/CMakeLists.txt b/dpi/CMakeLists.txt new file mode 100644 index 00000000..65e0ccbb --- /dev/null +++ b/dpi/CMakeLists.txt @@ -0,0 +1,104 @@ +# DPI (Dillo Plugin Interface) programs + +# Common DPI utility sources +set(DPI_UTIL_SOURCES + dpiutil.c + dpiutil.h +) + +# bookmarks.dpi +add_executable(bookmarks.dpi + bookmarks.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(bookmarks.dpi Dpip Dlib) +set_target_properties(bookmarks.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# downloads.dpi (C++) +add_executable(downloads.dpi + downloads.cc + ${DPI_UTIL_SOURCES} +) +target_link_libraries(downloads.dpi + Dpip + Dlib + ${FLTK_LIBRARIES} +) +target_compile_options(downloads.dpi PRIVATE ${FLTK_CXXFLAGS}) +set_target_properties(downloads.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# ftp.filter.dpi +add_executable(ftp.filter.dpi + ftp.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(ftp.filter.dpi Dpip Dlib) +set_target_properties(ftp.filter.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# hello.filter.dpi +add_executable(hello.filter.dpi + hello.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(hello.filter.dpi Dpip Dlib) +set_target_properties(hello.filter.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# vsource.filter.dpi +add_executable(vsource.filter.dpi + vsource.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(vsource.filter.dpi Dpip Dlib) +set_target_properties(vsource.filter.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# file.dpi +add_executable(file.dpi + file.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(file.dpi Dpip Dlib) +set_target_properties(file.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# cookies.dpi +add_executable(cookies.dpi + cookies.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(cookies.dpi Dpip Dlib) +set_target_properties(cookies.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# datauri.filter.dpi +add_executable(datauri.filter.dpi + datauri.c + ${DPI_UTIL_SOURCES} +) +target_link_libraries(datauri.filter.dpi Dpip Dlib) +set_target_properties(datauri.filter.dpi PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# Installation directories for DPI programs +set(DPI_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}/dillo/dpi") + +install(TARGETS bookmarks.dpi DESTINATION "${DPI_LIBDIR}/bookmarks") +install(TARGETS downloads.dpi DESTINATION "${DPI_LIBDIR}/downloads") +install(TARGETS ftp.filter.dpi DESTINATION "${DPI_LIBDIR}/ftp") +install(TARGETS hello.filter.dpi DESTINATION "${DPI_LIBDIR}/hello") +install(TARGETS vsource.filter.dpi DESTINATION "${DPI_LIBDIR}/vsource") +install(TARGETS file.dpi DESTINATION "${DPI_LIBDIR}/file") +install(TARGETS cookies.dpi DESTINATION "${DPI_LIBDIR}/cookies") +install(TARGETS datauri.filter.dpi DESTINATION "${DPI_LIBDIR}/datauri") diff --git a/dpid/CMakeLists.txt b/dpid/CMakeLists.txt new file mode 100644 index 00000000..b3fa7db0 --- /dev/null +++ b/dpid/CMakeLists.txt @@ -0,0 +1,50 @@ +# dpid daemon and client +add_definitions(-DEXEEXT="${CMAKE_EXECUTABLE_SUFFIX}") + +# dpid daemon +set(DPID_SOURCES + dpi.h + dpi_socket_dir.h + dpid.h + dpid_common.h + misc_new.h + dpi.c + dpi_socket_dir.c + dpid.c + dpid_common.c + main.c + misc_new.c +) + +add_executable(dpid_bin ${DPID_SOURCES}) +target_link_libraries(dpid_bin + Dpip + Dlib + ${CMAKE_THREAD_LIBS_INIT} +) +set_target_properties(dpid_bin PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# dpidc client +add_executable(dpidc dpidc.c) +target_link_libraries(dpidc + Dpip + Dlib +) +set_target_properties(dpidc PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# Generate dpidrc configuration file +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/dpidrc.in" + "${CMAKE_CURRENT_BINARY_DIR}/dpidrc" + @ONLY +) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dpidrc" + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) + +install(TARGETS dpid_bin dpidc DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(PROGRAMS ${CMAKE_BINARY_DIR}/dpid_bin DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME dpid) diff --git a/dpip/CMakeLists.txt b/dpip/CMakeLists.txt new file mode 100644 index 00000000..21743c8d --- /dev/null +++ b/dpip/CMakeLists.txt @@ -0,0 +1,8 @@ +# dpip library +set(DPIP_SOURCES + dpip.h + dpip.c +) + +add_library(Dpip STATIC ${DPIP_SOURCES}) +target_include_directories(Dpip PUBLIC ${CMAKE_SOURCE_DIR}) diff --git a/dw/CMakeLists.txt b/dw/CMakeLists.txt new file mode 100644 index 00000000..7e56930e --- /dev/null +++ b/dw/CMakeLists.txt @@ -0,0 +1,115 @@ +# dw libraries +add_definitions(-DDILLO_LIBDIR="${CMAKE_INSTALL_FULL_LIBDIR}/dillo/") +add_definitions(-DCUR_WORKING_DIR="${CMAKE_CURRENT_SOURCE_DIR}") + +# Core library +set(DW_CORE_SOURCES + core.hh + events.hh + findtext.cc + findtext.hh + imgbuf.hh + imgrenderer.hh + imgrenderer.cc + iterator.cc + iterator.hh + layout.cc + layout.hh + platform.hh + selection.hh + selection.cc + stackingcontextmgr.hh + stackingcontextmgr.cc + style.cc + style.hh + tools.cc + tools.hh + types.cc + types.hh + ui.cc + ui.hh + view.hh + widget.cc + widget.hh +) + +add_library(Dw-core STATIC ${DW_CORE_SOURCES}) +target_include_directories(Dw-core PUBLIC ${CMAKE_SOURCE_DIR}) + +# FLTK library +set(DW_FLTK_SOURCES + fltkcomplexbutton.cc + fltkcomplexbutton.hh + fltkcore.hh + fltkflatview.cc + fltkflatview.hh + fltkimgbuf.cc + fltkimgbuf.hh + fltkmisc.cc + fltkmisc.hh + fltkplatform.cc + fltkplatform.hh + fltkpreview.hh + fltkpreview.cc + fltkui.cc + fltkui.hh + fltkviewbase.cc + fltkviewbase.hh + fltkviewport.cc + fltkviewport.hh +) + +add_library(Dw-fltk STATIC ${DW_FLTK_SOURCES}) +target_include_directories(Dw-fltk PUBLIC ${CMAKE_SOURCE_DIR}) +target_compile_options(Dw-fltk PRIVATE ${FLTK_CXXFLAGS}) + +# Widgets library +set(DW_WIDGETS_SOURCES + alignedtablecell.cc + alignedtablecell.hh + alignedtextblock.cc + alignedtextblock.hh + bullet.cc + bullet.hh + hyphenator.cc + hyphenator.hh + image.cc + image.hh + listitem.cc + listitem.hh + oofawarewidget.cc + oofawarewidget_iterator.cc + oofawarewidget.hh + ooffloatsmgr.cc + ooffloatsmgr.hh + oofposabslikemgr.cc + oofposabslikemgr.hh + oofposabsmgr.cc + oofposabsmgr.hh + oofposfixedmgr.cc + oofposfixedmgr.hh + oofpositionedmgr.cc + oofpositionedmgr.hh + oofposrelmgr.cc + oofposrelmgr.hh + outofflowmgr.cc + outofflowmgr.hh + regardingborder.cc + regardingborder.hh + ruler.cc + ruler.hh + simpletablecell.cc + simpletablecell.hh + table.cc + table_iterator.cc + table.hh + tablecell.cc + tablecell.hh + textblock.cc + textblock_iterator.cc + textblock_linebreaking.cc + textblock.hh +) + +add_library(Dw-widgets STATIC ${DW_WIDGETS_SOURCES}) +target_include_directories(Dw-widgets PUBLIC ${CMAKE_SOURCE_DIR}) diff --git a/lout/CMakeLists.txt b/lout/CMakeLists.txt new file mode 100644 index 00000000..ea1adddd --- /dev/null +++ b/lout/CMakeLists.txt @@ -0,0 +1,23 @@ +# lout library +add_definitions(-DCUR_WORKING_DIR="${CMAKE_CURRENT_SOURCE_DIR}") + +set(LOUT_SOURCES + container.cc + container.hh + debug.hh + debug_rtfl.hh + identity.cc + identity.hh + misc.cc + misc.hh + object.cc + object.hh + signal.cc + signal.hh + unicode.cc + unicode.hh + msg.h +) + +add_library(lout STATIC ${LOUT_SOURCES}) +target_include_directories(lout PUBLIC ${CMAKE_SOURCE_DIR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..dd4a5484 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,241 @@ +# Main dillo browser executable +add_definitions(-DCUR_WORKING_DIR="${CMAKE_CURRENT_SOURCE_DIR}") + +# Generate commit.h if git is available +find_package(Git) +if(GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --dirty + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + set(GIT_COMMIT_DEFINE "#define GIT_COMMIT \"${GIT_COMMIT}\"") +else() + set(GIT_COMMIT_DEFINE "#define GIT_COMMIT \"\"") +endif() + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/commit.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/commit.h" + @ONLY +) + +# Main dillo executable sources +set(DILLO_SOURCES + dillo.cc + version.cc + version.hh + paths.cc + paths.hh + tipwin.cc + tipwin.hh + ui.cc + ui.hh + uicmd.cc + uicmd.hh + bw.h + bw.c + cookies.c + cookies.h + actions.c + actions.h + hsts.c + hsts.h + auth.c + auth.h + md5.c + md5.h + digest.c + digest.h + colors.c + colors.h + binaryconst.h + misc.c + misc.h + history.h + history.c + prefs.c + prefs.h + prefsparser.cc + prefsparser.hh + keys.cc + keys.hh + msg.h + list.h + url.c + url.h + bitvec.c + bitvec.h + klist.c + klist.h + chain.c + chain.h + utf8.cc + utf8.hh + timeout.cc + timeout.hh + dialog.cc + dialog.hh + web.cc + web.hh + nav.c + nav.h + cache.c + cache.h + decode.c + decode.h + dicache.c + dicache.h + capi.c + capi.h + domain.c + domain.h + css.cc + css.hh + cssparser.cc + cssparser.hh + doctree.hh + styleengine.cc + styleengine.hh + plain.cc + html.cc + html.hh + html_charrefs.h + html_common.hh + form.cc + form.hh + table.cc + table.hh + bookmark.c + bookmark.h + dns.c + dns.h + imgbuf.cc + imgbuf.hh + image.cc + image.hh + menu.hh + menu.cc + dpiapi.c + dpiapi.h + pixmaps.h + findbar.cc + findbar.hh + xembed.cc + xembed.hh +) + +# Add image format sources based on enabled features +if(ENABLE_GIF) + list(APPEND DILLO_SOURCES + gif.c + dgif.h + ) +endif() + +if(ENABLE_JPEG) + list(APPEND DILLO_SOURCES + jpeg.c + djpeg.h + ) +endif() + +if(ENABLE_PNG) + list(APPEND DILLO_SOURCES + png.c + dpng.h + ) +endif() + +if(ENABLE_WEBP AND WEBP_FOUND) + list(APPEND DILLO_SOURCES + webp.c + dwebp.h + ) +endif() + +if(ENABLE_SVG) + list(APPEND DILLO_SOURCES + svg.c + nanosvg.h + nanosvgrast.h + dsvg.h + ) +endif() + +# Create the main dillo executable +add_executable(dillo + ${DILLO_SOURCES} + "${CMAKE_CURRENT_BINARY_DIR}/commit.h" +) + +# Link libraries for dillo +set(DILLO_LIBS + Dlib + Dpip + Diof + Dw-core + Dw-fltk + Dw-widgets + lout + ${FLTK_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${X11_LIBRARIES} +) + +# Add image libraries +if(ENABLE_JPEG AND JPEG_FOUND) + list(APPEND DILLO_LIBS ${JPEG_LIBRARIES}) +endif() + +if(ENABLE_PNG AND PNG_FOUND) + list(APPEND DILLO_LIBS ${PNG_LIBRARIES}) +endif() + +if(ENABLE_WEBP AND WEBP_FOUND) + list(APPEND DILLO_LIBS ${WEBP_LIBRARIES}) +endif() + +if(ZLIB_FOUND) + list(APPEND DILLO_LIBS ${ZLIB_LIBRARIES}) +endif() + +if(ICONV_FOUND) + list(APPEND DILLO_LIBS ${ICONV_LIBRARY}) +endif() + +if(OPENSSL_FOUND) + list(APPEND DILLO_LIBS ${OPENSSL_LIBRARIES}) +endif() + +target_link_libraries(dillo ${DILLO_LIBS}) +target_compile_options(dillo PRIVATE ${FLTK_CXXFLAGS}) +target_include_directories(dillo PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties(dillo PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} +) + +# Control socket client (optional) +if(ENABLE_CONTROL_SOCKET) + add_executable(dilloc dilloc.c) + target_link_libraries(dilloc Dlib) + set_target_properties(dilloc PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + ) +endif() + +# Install targets +install(TARGETS dillo DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(ENABLE_CONTROL_SOCKET) + install(TARGETS dilloc DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() + +# Install configuration files +install(FILES + domainrc + keysrc + hsts_preload + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dillo +) diff --git a/src/IO/CMakeLists.txt b/src/IO/CMakeLists.txt new file mode 100644 index 00000000..600a6e43 --- /dev/null +++ b/src/IO/CMakeLists.txt @@ -0,0 +1,61 @@ +# IO library +add_definitions(-DDILLO_BINDIR="${CMAKE_INSTALL_BINDIR}/") + +# Define CA certificates paths +if(NOT DEFINED CA_CERTS_FILE) + set(CA_CERTS_FILE "/etc/ssl/certs/ca-certificates.crt") +endif() +if(NOT DEFINED CA_CERTS_DIR) + set(CA_CERTS_DIR "/etc/ssl/certs/") +endif() + +add_definitions(-DCA_CERTS_FILE="${CA_CERTS_FILE}") +add_definitions(-DCA_CERTS_DIR="${CA_CERTS_DIR}") + +# Check for TLS implementation +if(OPENSSL_FOUND) + set(TLS_SOURCES + tls_openssl.c + tls_openssl.h + ) + add_definitions(-DUSE_OPENSSL) +elseif(HAVE_MBEDTLS) + set(TLS_SOURCES + tls_mbedtls.c + tls_mbedtls.h + ) + add_definitions(-DUSE_MBEDTLS) +else() + set(TLS_SOURCES) +endif() + +set(IO_SOURCES + mime.c + mime.h + about.c + control.c + control.h + Url.h + http.c + tls.h + tls.c + ${TLS_SOURCES} + dpi.c + IO.c + iowatch.cc + iowatch.hh + IO.h +) + +add_library(Diof STATIC ${IO_SOURCES}) +target_include_directories(Diof PUBLIC + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/src +) + +if(OPENSSL_FOUND) + target_include_directories(Diof PRIVATE ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(Diof ${OPENSSL_LIBRARIES}) +endif() + +target_compile_options(Diof PRIVATE ${FLTK_CXXFLAGS}) diff --git a/src/commit.h.in b/src/commit.h.in new file mode 100644 index 00000000..c42bca34 --- /dev/null +++ b/src/commit.h.in @@ -0,0 +1,6 @@ +#ifndef __COMMIT_H__ +#define __COMMIT_H__ + +@GIT_COMMIT_DEFINE@ + +#endif /* __COMMIT_H__ */