diff --git a/README.adoc b/README.adoc index 189eb2a..7c3e60a 100644 --- a/README.adoc +++ b/README.adoc @@ -57,7 +57,9 @@ only. * C++ compiler (tested: https://gcc.gnu.org/[gcc] 5/6/8/9, https://llvm.org/[clang] 3/7) * https://cmake.org/[cmake] (at least: 3.2) +* https://pkgconfig.freedesktop.org/wiki/[pkgconfig] (tested: 0.29) * https://github.com/badaix/popl[popl] (tested: 1.2) +* http://repo.or.cz/w/libxdg-basedir.git[libxdg-basedir] (tested: 1.2) * https://pocoproject.org/[POCO] (tested: 1.9 / 1.7) * http://vsqlite.virtuosic-bytes.com/[vsqlite++] (tested: 0.3) * http://www.icu-project.org/[ICU] (tested: 64.2 / 57.1) @@ -72,7 +74,8 @@ only. [source,zsh] ---- apt-get update -apt-get install g++-6 cmake libpoco-dev libvsqlitepp-dev libicu-dev asciidoc +apt-get install g++-6 cmake pkg-config libpoco-dev libxdg-basedir-dev \ + libvsqlitepp-dev libboost-system-dev libboost-filesystem-dev libicu-dev asciidoc # Inside the source directory: wget -O src/cli/popl.hpp https://raw.githubusercontent.com/badaix/popl/v1.2.0/include/popl.hpp export CXX="g++-6" diff --git a/packages.CMakeLists.txt b/packages.CMakeLists.txt index 2e300d8..35d7b2b 100644 --- a/packages.CMakeLists.txt +++ b/packages.CMakeLists.txt @@ -45,7 +45,7 @@ if (WITH_RPM) set(CPACK_RPM_PACKAGE_LICENSE "GPL-3") set(CPACK_RPM_PACKAGE_URL "https://schlomp.space/tastytea/${PROJECT_NAME}") set(CPACK_RPM_PACKAGE_REQUIRES - "poco-netssl >= 1.6, vsqlite++ >= 0.3, libicu >= 50.1") + "poco-netssl >= 1.6.1, libxdg-basedir, vsqlite++ >= 0.3.13, libicu-devel") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-0.${CPACK_PACKAGE_ARCHITECTURE}") set(CPACK_SOURCE_PACKAGE_FILE_NAME diff --git a/pkg-config/remwharead.pc.in b/pkg-config/remwharead.pc.in index d3ee864..f57d3c1 100644 --- a/pkg-config/remwharead.pc.in +++ b/pkg-config/remwharead.pc.in @@ -9,5 +9,5 @@ Description: @PROJECT_DESCRIPTION@ Version: @PROJECT_VERSION@ Cflags: -I${includedir} Libs: -L${libdir} -l${name} -lvsqlitepp -lstdc++fs -Requires.private: icu-uc, icu-i18n -Libs.private: -lPocoFoundation -lPocoNet -lPocoNetSSL +Requires.private: libxdg-basedir, icu-uc, icu-i18n +Libs.private: -lPocoNet -lPocoNetSSL -lPocoUtil diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 092d14f..e27f2e7 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,5 +1,7 @@ include(GNUInstallDirs) +find_package(PkgConfig REQUIRED) +pkg_check_modules(libxdg-basedir REQUIRED IMPORTED_TARGET libxdg-basedir) find_package(ICU COMPONENTS uc i18n REQUIRED) # Some distributions do not contain Poco*Config.cmake recipes. find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG) @@ -21,7 +23,7 @@ target_include_directories(${PROJECT_NAME} "$") target_link_libraries(${PROJECT_NAME} - PRIVATE ICU::uc ICU::i18n + PRIVATE PkgConfig::libxdg-basedir ICU::uc ICU::i18n PUBLIC vsqlitepp stdc++fs) # If no Poco*Config.cmake recipes are found, look for headers in standard dirs. diff --git a/src/lib/sqlite.cpp b/src/lib/sqlite.cpp index 651d897..2cfb5b4 100644 --- a/src/lib/sqlite.cpp +++ b/src/lib/sqlite.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include "time.hpp" @@ -33,7 +33,10 @@ namespace remwharead { try { - _dbpath = Poco::Path::dataHome() / fs::path("remwharead"); + xdgHandle xdg; + xdgInitHandle(&xdg); + _dbpath = xdgDataHome(&xdg) / fs::path("remwharead"); + xdgWipeHandle(&xdg); if (!fs::exists(_dbpath)) {