From 9c7acbc9d88e9e89bc6eb3403991cc9af76baec5 Mon Sep 17 00:00:00 2001 From: Ishank <77890275+BIGBEASTISHANK@users.noreply.github.com> Date: Mon, 27 Nov 2023 00:15:39 +0530 Subject: [PATCH] docs: changes to buildlinux, firstbot, and install-arch-aur. (#1013) --- docpages/building/linux.md | 24 +++++++++++++++---- .../example_programs/the_basics/firstbot.md | 2 +- docpages/install/install-arch-aur.md | 4 +++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docpages/building/linux.md b/docpages/building/linux.md index 9abad1ce41..b90207aa1e 100644 --- a/docpages/building/linux.md +++ b/docpages/building/linux.md @@ -2,9 +2,10 @@ \note You might not need to build a copy of the library for Linux - precompiled deb files for 64 bit and 32 bit Debian and Ubuntu are provided in the GitHub version releases. Unless you are on a different Linux distribution which does not support the installation of deb files, or wish to submit fixes and enhancements to the library itself you should have an easier time installing the precompiled version instead. -## 1. Build Source Code - +## 1. Copy & Build Source code ```bash +git clone https://github.com/brainboxdotcc/DPP +cd DPP/ cmake -B ./build cmake --build ./build -j8 ``` @@ -23,7 +24,7 @@ sudo make install If you want to install the library, its dependencies, and header files to a different directory, specify this directory when running `cmake`: ```bash -cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install +cmake -B ./build -DCMAKE_INSTALL_PREFIX=/path/to/install ``` Then once the build is complete, run `make install` to install to the location you specified. @@ -36,12 +37,27 @@ Once installed to the `/usr/local` directory, you can make use of the library in g++ -std=c++17 mydppbot.cpp -o dppbot -ldpp ``` +If you are on **Arch Linux**, you will need to add `/usr/local` to your environment variables: + +```bash +export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH +export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH +``` + +However, if you don't want to change your environment settings, you can use these flags to compile: + +```bash +g++ -std=c++17 -L/usr/local/lib -I/usr/local/include mydppbot.cpp -o dppbot -ldpp +``` + The important flags in this command-line are: * `-std=c++17` - Required to compile the headers -* `-ldpp` - Link to libdpp.so +* `-L/usr/local/lib` - Required to tell the linker where libdpp is located. +* `-I/usr/local/include` - Required to tell the linker where dpp headers are located. * `mydppbot.cpp` - Your source code * `dppbot` - The name of the executable to make +* `-ldpp` - Link to libdpp.so \include{doc} install_prebuilt_footer.dox diff --git a/docpages/example_programs/the_basics/firstbot.md b/docpages/example_programs/the_basics/firstbot.md index c0b4296a49..bcf52c79c0 100644 --- a/docpages/example_programs/the_basics/firstbot.md +++ b/docpages/example_programs/the_basics/firstbot.md @@ -100,7 +100,7 @@ The `event.reply` function (dpp::slashcommand_t::reply) replies to a slash comma To make the bot start, we must call the dpp::cluster::start method, e.g. in our program by using `bot.start(dpp::st_wait)`. -We also add a line to tell the library to output all its log information to the console, `bot.on_log(dpp::utility::cout_logger());` - if you wanted to do something more advanced, you can replace this parameter with a lambda just like all other events. +We also add a line to tell the library to output all its log information to the console, use `bot.on_log(dpp::utility::cout_logger());` (dpp::utility::cout_logger) - if you wanted to do something more advanced, you can replace this parameter with a lambda just like all other events. The parameter which we set to false indicates if the function should return once all shards are created. Passing dpp::st_wait here tells the program you do not need to do anything once `bot.start` is called. diff --git a/docpages/install/install-arch-aur.md b/docpages/install/install-arch-aur.md index 2e76432ae0..4d1382a641 100644 --- a/docpages/install/install-arch-aur.md +++ b/docpages/install/install-arch-aur.md @@ -12,9 +12,11 @@ or use your favourite package manager: ```bash # example with `yay` (without root) -yay -Sy dpp +yay -Syu dpp ``` +\note The package is currently outdated. We are looking for a new maintainer. For now, please use `dpp-git` or build it from \ref buildlinux "source". + This will do the following three things: - Clone the D++ AUR repository to a directory called `dpp`