# OSS DEV NOTES
This note records some experiences of my open source software development.
## Environment Setup (Docker Container)
Use the openSUSE tumbleweed as the development environment, because it has newest development packages.
### distrobox (docker)
You might get error during installing the additional packages when using old distrobox version, make sure to use the latest distrobox: https://github.com/89luca89/distrobox/tree/main
```sh!
# create a env you can install latest dev packages
(host) $ distrobox create --name box --image opensuse/tumbleweed
# enter the distrobox env (need to setup the passwd for the env)
(host) $ distrobox enter box
# now we are in the distrobox env
(box) $ # do something to check the dev env
```
#### Networking
To disconnect networking for the container, add options `--unshare-netns --additional-flags "--network=bridge"` when creating the development environment.
So that we can connect/disconnect the network with `docker network connect/disconnect bridge kde`
#### Backup
```sh!
(host) $ docker commit box box2
(host) $ distrobox create --name box2 --image box
(host) $ distrobox enter box2
```
### openSUSE in docker (manually config the container)
:::danger
TODO: refer the dockerfiles used by KDE official CI/CD
- https://invent.kde.org/sysadmin/ci-images/-/blob/master/suse-qt69/Dockerfile
:::
### Limitations of Container Env
For KDE development, the offcial points out the limitations and indicates some packages might need to be installed, check https://develop.kde.org/docs/getting-started/building/containers-distrobox/#limitations-of-using-containers
## [KDE/Dolphin](https://invent.kde.org/system/dolphin)
### Dependency
> ref: https://develop.kde.org/docs/getting-started/building/help-dependencies/#opensuse
```sh!
(box) $ sudo zypper refresh
# install dev tools needed by dolphin
(box) $ sudo zypper --plus-content repo-source source-install --build-deps-only dolphin
# some additional packages needed
(box) $ sudo zypper install qt6-test-devel qt6-wayland
```
### Build
> ref: https://develop.kde.org/docs/getting-started/building/cmake-build/#summary
```sh!
(box) $ cmake -B build/ --install-prefix ~/.local
(box) $ cmake --build build/ -j 4 # might eat much RAM!!!
(box) $ cmake --install build/
```
## KDE/qvk
```sh!
# install build dependencies
(box) $ sudo zypper in kf6-kcoreaddons-devel kf6-ki18n-devel qt6-gui-devel qt6-gui-private-devel qt6-virtualkeyboard-devel qt6-waylandclient-devel qt6-waylandclient-private-devel libwayland-client0 wayland-protocols-devel
# install runtime dependencies
(box) $ sudo zypper in qt6-virtualkeyboard-imports
```
## [openSUSE/Zypper](https://github.com/openSUSE/zypper)
> ref: https://en.opensuse.org/openSUSE:Zypper_development
### Dependencies
```sh!
(box) $ sudo zypper in libzypp-devel augeas-devel cmake gcc-c++ pkg-config boost-devel gettext-devel ruby3.4-rubygem-asciidoctor readline-devel
```
### Build
```sh!
(box) $ cmake -B build #-DZYPP_PREFIX=/usr
(box) $ cmake --build build/ -j 4
```
Try `-DZYPP_PREFIX=/usr` if you have installed the `libzypp` packages but still got error like this:
```text!
CMake Error at CMakeLists.txt:26 (INCLUDE):
INCLUDE could not find requested file:
ZyppCommon
...
```
The `ZYPP_PREFIX` is used to find the path of the file `ZyppCommon.cmake` (e.g., `/usr/lib64/cmake/Zypp/ZyppCommon.cmake`). Check the `CMakeLists.txt` and search `IF (DEFINED ZYPP_PREFIX)` in it to see why you need this.
### Debugging