439 lines
16 KiB
HTML
439 lines
16 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="en">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>Building from Source - DWN Documentation</title>
|
||
|
|
<link rel="stylesheet" href="css/style.css">
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<button class="mobile-menu-btn">Menu</button>
|
||
|
|
|
||
|
|
<div class="layout">
|
||
|
|
<aside class="sidebar">
|
||
|
|
<div class="sidebar-header">
|
||
|
|
<h1>DWN</h1>
|
||
|
|
<span class="version">v1.0.0</span>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="search-box">
|
||
|
|
<input type="text" class="search-input" placeholder="Search docs...">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<nav class="sidebar-nav">
|
||
|
|
<div class="nav-section">
|
||
|
|
<div class="nav-section-title">Getting Started</div>
|
||
|
|
<a href="index.html" class="nav-link">Introduction</a>
|
||
|
|
<a href="installation.html" class="nav-link">Installation</a>
|
||
|
|
<a href="quickstart.html" class="nav-link">Quick Start</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="nav-section">
|
||
|
|
<div class="nav-section-title">User Guide</div>
|
||
|
|
<a href="features.html" class="nav-link">Features</a>
|
||
|
|
<a href="shortcuts.html" class="nav-link">Keyboard Shortcuts</a>
|
||
|
|
<a href="configuration.html" class="nav-link">Configuration</a>
|
||
|
|
<a href="layouts.html" class="nav-link">Layouts</a>
|
||
|
|
<a href="ai-features.html" class="nav-link">AI Integration</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="nav-section">
|
||
|
|
<div class="nav-section-title">API Reference</div>
|
||
|
|
<a href="api-overview.html" class="nav-link">API Overview</a>
|
||
|
|
<a href="api-reference.html" class="nav-link">API Reference</a>
|
||
|
|
<a href="api-examples.html" class="nav-link">API Examples</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="nav-section">
|
||
|
|
<div class="nav-section-title">Advanced</div>
|
||
|
|
<a href="architecture.html" class="nav-link">Architecture</a>
|
||
|
|
<a href="building.html" class="nav-link active">Building from Source</a>
|
||
|
|
</div>
|
||
|
|
</nav>
|
||
|
|
</aside>
|
||
|
|
|
||
|
|
<main class="main-content">
|
||
|
|
<div class="content">
|
||
|
|
<div class="page-header">
|
||
|
|
<h1>Building from Source</h1>
|
||
|
|
<p class="lead">Compile DWN for development or custom builds</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="toc">
|
||
|
|
<div class="toc-title">On this page</div>
|
||
|
|
<ul class="toc-list">
|
||
|
|
<li><a href="#requirements">Requirements</a></li>
|
||
|
|
<li><a href="#dependencies">Dependencies</a></li>
|
||
|
|
<li><a href="#building">Building</a></li>
|
||
|
|
<li><a href="#targets">Make Targets</a></li>
|
||
|
|
<li><a href="#development">Development</a></li>
|
||
|
|
<li><a href="#troubleshooting">Troubleshooting</a></li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h2 id="requirements">Requirements</h2>
|
||
|
|
<ul>
|
||
|
|
<li>Linux with X11 (Xorg)</li>
|
||
|
|
<li>GCC compiler (or Clang)</li>
|
||
|
|
<li>GNU Make</li>
|
||
|
|
<li>pkg-config</li>
|
||
|
|
</ul>
|
||
|
|
|
||
|
|
<h2 id="dependencies">Dependencies</h2>
|
||
|
|
|
||
|
|
<h3>Required Libraries</h3>
|
||
|
|
<div class="table-container">
|
||
|
|
<table>
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>Library</th>
|
||
|
|
<th>Purpose</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<tr>
|
||
|
|
<td>libX11</td>
|
||
|
|
<td>Core X11 protocol</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libXext</td>
|
||
|
|
<td>X11 extensions</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libXinerama</td>
|
||
|
|
<td>Multi-monitor support</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libXrandr</td>
|
||
|
|
<td>Display configuration</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libXft</td>
|
||
|
|
<td>Font rendering</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libXtst</td>
|
||
|
|
<td>Input simulation (API)</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>fontconfig</td>
|
||
|
|
<td>Font discovery</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libdbus-1</td>
|
||
|
|
<td>Notifications</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libcurl</td>
|
||
|
|
<td>HTTP for AI features</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libpng</td>
|
||
|
|
<td>Screenshot encoding</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libtesseract</td>
|
||
|
|
<td>OCR text extraction</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>libleptonica</td>
|
||
|
|
<td>Image processing for OCR</td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Ubuntu / Debian</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>sudo apt update && sudo apt install -y \
|
||
|
|
build-essential \
|
||
|
|
pkg-config \
|
||
|
|
libx11-dev \
|
||
|
|
libxext-dev \
|
||
|
|
libxinerama-dev \
|
||
|
|
libxrandr-dev \
|
||
|
|
libxft-dev \
|
||
|
|
libxtst-dev \
|
||
|
|
libfontconfig1-dev \
|
||
|
|
libdbus-1-dev \
|
||
|
|
libcurl4-openssl-dev \
|
||
|
|
libpng-dev \
|
||
|
|
libtesseract-dev \
|
||
|
|
libleptonica-dev \
|
||
|
|
tesseract-ocr \
|
||
|
|
tesseract-ocr-eng</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Fedora / RHEL</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>sudo dnf install -y \
|
||
|
|
gcc make \
|
||
|
|
pkg-config \
|
||
|
|
libX11-devel \
|
||
|
|
libXext-devel \
|
||
|
|
libXinerama-devel \
|
||
|
|
libXrandr-devel \
|
||
|
|
libXtst-devel \
|
||
|
|
dbus-devel \
|
||
|
|
libcurl-devel \
|
||
|
|
libpng-devel \
|
||
|
|
tesseract-devel \
|
||
|
|
leptonica-devel \
|
||
|
|
tesseract-langpack-eng</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Arch Linux</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>sudo pacman -S --needed \
|
||
|
|
base-devel \
|
||
|
|
pkg-config \
|
||
|
|
libx11 \
|
||
|
|
libxext \
|
||
|
|
libxinerama \
|
||
|
|
libxrandr \
|
||
|
|
libxtst \
|
||
|
|
dbus \
|
||
|
|
curl \
|
||
|
|
libpng \
|
||
|
|
tesseract \
|
||
|
|
tesseract-data-eng \
|
||
|
|
leptonica</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Automatic Installation</h3>
|
||
|
|
<p>The Makefile can auto-detect your package manager:</p>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make deps</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h2 id="building">Building</h2>
|
||
|
|
|
||
|
|
<h3>Clone Repository</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>git clone https://github.com/retoor/dwn.git
|
||
|
|
cd dwn</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Build Release</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>Output: <code>bin/dwn</code></p>
|
||
|
|
|
||
|
|
<h3>Build Debug</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make debug</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>Includes debug symbols (<code>-g</code>) and <code>-DDEBUG</code> define.</p>
|
||
|
|
|
||
|
|
<h3>Build with Sanitizers</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make sanitize</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>Enables AddressSanitizer and UndefinedBehaviorSanitizer for debugging memory issues.</p>
|
||
|
|
|
||
|
|
<h3>Install System-wide</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>sudo make install</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>Installs to:</p>
|
||
|
|
<ul>
|
||
|
|
<li><code>/usr/local/bin/dwn</code> - Binary</li>
|
||
|
|
<li><code>/usr/local/share/xsessions/dwn.desktop</code> - Session file</li>
|
||
|
|
<li><code>/etc/dwn/config.example</code> - Example config</li>
|
||
|
|
</ul>
|
||
|
|
|
||
|
|
<h3>Custom Prefix</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make PREFIX=/opt/dwn install</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h2 id="targets">Make Targets</h2>
|
||
|
|
<div class="table-container">
|
||
|
|
<table>
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>Target</th>
|
||
|
|
<th>Description</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<tr>
|
||
|
|
<td><code>make</code></td>
|
||
|
|
<td>Build release version (optimized)</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make debug</code></td>
|
||
|
|
<td>Build with debug symbols</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make sanitize</code></td>
|
||
|
|
<td>Build with sanitizers</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make clean</code></td>
|
||
|
|
<td>Remove build artifacts</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make install</code></td>
|
||
|
|
<td>Install to PREFIX</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make uninstall</code></td>
|
||
|
|
<td>Remove installation</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make run</code></td>
|
||
|
|
<td>Test in Xephyr</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make deps</code></td>
|
||
|
|
<td>Install dependencies</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make format</code></td>
|
||
|
|
<td>Run clang-format</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td><code>make check</code></td>
|
||
|
|
<td>Run cppcheck static analysis</td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h2 id="development">Development</h2>
|
||
|
|
|
||
|
|
<h3>Testing in Xephyr</h3>
|
||
|
|
<p>Test without affecting your current session:</p>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code># Automatic (recommended)
|
||
|
|
make run
|
||
|
|
|
||
|
|
# Manual
|
||
|
|
Xephyr :1 -screen 1920x1080 &
|
||
|
|
DISPLAY=:1 ./bin/dwn</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Code Formatting</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make format</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>Uses clang-format with project style.</p>
|
||
|
|
|
||
|
|
<h3>Static Analysis</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>make check</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<p>Runs cppcheck for common issues.</p>
|
||
|
|
|
||
|
|
<h3>Debug Logging</h3>
|
||
|
|
<p>Debug builds write to <code>~/.local/share/dwn/dwn.log</code>:</p>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>tail -f ~/.local/share/dwn/dwn.log</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Directory Structure</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>dwn/
|
||
|
|
├── include/ # Header files
|
||
|
|
│ ├── dwn.h # Main state struct
|
||
|
|
│ ├── client.h # Window management
|
||
|
|
│ ├── workspace.h # Virtual desktops
|
||
|
|
│ ├── layout.h # Layout algorithms
|
||
|
|
│ ├── panel.h # Panels
|
||
|
|
│ ├── api.h # WebSocket API
|
||
|
|
│ ├── screenshot.h
|
||
|
|
│ ├── ocr.h
|
||
|
|
│ └── ...
|
||
|
|
├── src/ # Implementation
|
||
|
|
│ ├── main.c # Entry point, event loop
|
||
|
|
│ ├── client.c
|
||
|
|
│ ├── workspace.c
|
||
|
|
│ ├── layout.c
|
||
|
|
│ ├── panel.c
|
||
|
|
│ ├── api.c
|
||
|
|
│ ├── screenshot.c
|
||
|
|
│ ├── ocr.c
|
||
|
|
│ └── ...
|
||
|
|
├── build/ # Object files
|
||
|
|
├── bin/ # Output binary
|
||
|
|
├── examples/ # Client examples
|
||
|
|
├── manual/ # Documentation
|
||
|
|
├── Makefile
|
||
|
|
└── CLAUDE.md # Development guide</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Adding a New Module</h3>
|
||
|
|
<ol>
|
||
|
|
<li>Create <code>include/newmodule.h</code> with public API</li>
|
||
|
|
<li>Create <code>src/newmodule.c</code> with implementation</li>
|
||
|
|
<li>Add <code>newmodule_init()</code> call to <code>main.c:dwn_init()</code></li>
|
||
|
|
<li>Add <code>newmodule_cleanup()</code> call to <code>main.c:dwn_cleanup()</code></li>
|
||
|
|
<li>Makefile automatically picks up new .c files</li>
|
||
|
|
</ol>
|
||
|
|
|
||
|
|
<h2 id="troubleshooting">Troubleshooting</h2>
|
||
|
|
|
||
|
|
<h3>Missing pkg-config</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code># Check if library is found
|
||
|
|
pkg-config --cflags --libs x11
|
||
|
|
|
||
|
|
# If not found, install dev package
|
||
|
|
sudo apt install libx11-dev # Debian/Ubuntu</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Tesseract not found</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code># Check installation
|
||
|
|
pkg-config --cflags --libs tesseract
|
||
|
|
|
||
|
|
# Install if missing
|
||
|
|
sudo apt install libtesseract-dev tesseract-ocr tesseract-ocr-eng</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Linker errors</h3>
|
||
|
|
<p>Ensure all -dev packages are installed. The Makefile uses pkg-config to find libraries.</p>
|
||
|
|
|
||
|
|
<h3>Runtime errors</h3>
|
||
|
|
<ol>
|
||
|
|
<li>Check log file: <code>~/.local/share/dwn/dwn.log</code></li>
|
||
|
|
<li>Build with debug: <code>make clean && make debug</code></li>
|
||
|
|
<li>Build with sanitizers: <code>make clean && make sanitize</code></li>
|
||
|
|
<li>Run in GDB: <code>DISPLAY=:1 gdb ./bin/dwn</code></li>
|
||
|
|
</ol>
|
||
|
|
|
||
|
|
<h3>X11 errors</h3>
|
||
|
|
<p>Run with synchronous X11 for detailed errors:</p>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code>DISPLAY=:1 ./bin/dwn --sync</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h3>Xephyr not starting</h3>
|
||
|
|
<div class="code-block">
|
||
|
|
<pre><code># Check if display :1 is in use
|
||
|
|
ls /tmp/.X11-unix/
|
||
|
|
|
||
|
|
# Use different display
|
||
|
|
Xephyr :2 -screen 1920x1080 &
|
||
|
|
DISPLAY=:2 ./bin/dwn</code></pre>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<footer>
|
||
|
|
<p>DWN Window Manager - retoor <retoor@molodetz.nl></p>
|
||
|
|
</footer>
|
||
|
|
</div>
|
||
|
|
</main>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script src="js/main.js"></script>
|
||
|
|
</body>
|
||
|
|
</html>
|