Skip to content

Commit

Permalink
Packaging documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wbqpk3 committed Oct 24, 2024
1 parent bbfdf8b commit 7cb52a3
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,4 @@ relevant during compilation.
| `CODECOMPASS_LINKER` | The path of the linker, if the system's default linker is to be overridden. |
| `WITH_PLUGIN`/`WITHOUT_PLUGIN` | The names of the plugins to be built/skipped at build. Possible values are **cpp**, **cpp_reparse**, **dummy**, **git**, **metrics**, **search**. The `metrics` and `search` plugins are fundamental, they will be compiled even if not included. `WITH_PLUGIN` **cannot** be used together with `WITHOUT_PLUGIN`. Example: `-DWITH_PLUGIN="cpp;git"` This will compile the cpp, git, metrics and search plugins. |
| `WITH_AUTH` | The names of the authentication plugins to be compiled. Possible values are **plain** and **ldap**. `plain` **cannot** be skipped. Example: `-DWITH_AUTH="plain;ldap"`|
| `INSTALL_RUNTIME_DEPENDENCIES` | If enabled, the required shared objects will be copied to `${CMAKE_INSTALL_PREFIX}/lib/deps/`. Optional, disabled by default. |
74 changes: 74 additions & 0 deletions doc/packaging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# `.deb` package (For Debian/Ubuntu systems)

## Installing a CodeCompass `.deb` package
Before installing a package, verify its checksum:
```
sha256sum codecompass.deb
```

### Installing a package
```
sudo dpkg -i codecompass.deb
```

### Removing package
```
sudo apt remove codecompass
```

## Package structure
When a user installs a CodeCompass deb package, all the files will be placed under `/usr/share/codecompass/`.
A few symlinks are created for the CodeCompass commands:
```
/usr/bin/CodeCompass_logger -> /usr/share/codecompass/bin/CodeCompass_logger
/usr/bin/CodeCompass_parser -> /usr/share/codecompass/bin/CodeCompass_parser
/usr/bin/CodeCompass_webserver -> /usr/share/codecompass/bin/CodeCompass_webserver
```

Moreover, CodeCompass requires some dependencies which are no longer available in standard repositories such as `ODB`.
In order to resolve this, the runtime dependencies will be included in the deb package as shared objects. These dependencies will be installed under `<CodeCompass_install_dir>/lib/deps/`.

Finally, a deb package is created by making a copy of the entire `<CodeCompass_install_dir>`.

## Building a `.deb` package
First, we need to build CodeCompass.

Create a build folder:
```
mkdir build
cd build
```

To enable packaging, run CMake with `-DENABLE_PACKAGING=1`:
```
cmake .. \
-DCMAKE_INSTALL_PREFIX=<CodeCompass_install_dir> \
-DDATABASE=<database_type> \
-DCMAKE_BUILD_TYPE=<build_type> \
-DLLVM_DIR=/usr/lib/llvm-11/cmake \
-DClang_DIR=/usr/lib/cmake/clang-11 \
-DENABLE_PACKAGING=1
```

Build and install CodeCompass:
```
make -j $(nproc)
make install
```

Build the deb package:
```
make deb_package
```

The built package will be located in `build/packaging/`.

## Build options
The built package can be customized by using CMake variables.

| Variable | Meaning |
| -------------------- | ---------------------------------------- |
| `PACKAGE_FILE_NAME` | File name of the resulting `.deb` package. Standard package notation: `<project>_<version>-<package revision>.deb`. If not specified, the package will be named `codecompass-dev.deb`. |
| `PACKAGE_VERSION` | Version of the package for the manifest file. If not specified, version `1.0` will be used. |
| `PACKAGE_DEPENDS` | List of package dependencies. Example: `graphviz, libcairo2 (>= 1.6.0), xdg-utils`. If not specified, the package will have no dependencies. |

0 comments on commit 7cb52a3

Please sign in to comment.