From b0e1be9a0f8cdec2f243129887a6048e51b4eb67 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 19:51:41 +0200 Subject: Whitespace fix --- update-po.sh | 22 +++++++++++----------- update-pot.sh | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/update-po.sh b/update-po.sh index 5f9e9fd..eded8f7 100755 --- a/update-po.sh +++ b/update-po.sh @@ -22,17 +22,17 @@ cp po/${GETTEXT_DOMAIN}.pot po/${GETTEXT_DOMAIN}.pot~ cd po/ cat LINGUAS | while read lingua; do - if [ ! -e ${lingua}.po ]; then - msginit --input=${GETTEXT_DOMAIN}.pot --locale=${lingua} --no-translator --output-file=$lingua.po - else - intltool-update --gettext-package ${GETTEXT_DOMAIN} $(basename ${lingua}) - fi - - sed -e 's/\.xml\.in\.h:/.xml.in:/g' \ - -e 's/\.ini\.in\.h:/.ini.in:/g' \ - -e 's/\.xml\.h:/.xml:/g' \ - -e 's/\.ini\.h:/.ini:/g' \ - -i ${lingua}.po + if [ ! -e ${lingua}.po ]; then + msginit --input=${GETTEXT_DOMAIN}.pot --locale=${lingua} --no-translator --output-file=$lingua.po + else + intltool-update --gettext-package ${GETTEXT_DOMAIN} $(basename ${lingua}) + fi + + sed -e 's/\.xml\.in\.h:/.xml.in:/g' \ + -e 's/\.ini\.in\.h:/.ini.in:/g' \ + -e 's/\.xml\.h:/.xml:/g' \ + -e 's/\.ini\.h:/.ini:/g' \ + -i ${lingua}.po done cd - 1>/dev/null diff --git a/update-pot.sh b/update-pot.sh index b0cb9b5..e7e38f5 100755 --- a/update-pot.sh +++ b/update-pot.sh @@ -18,8 +18,8 @@ GETTEXT_DOMAIN=$(cat configure.ac | grep -E "^GETTEXT_PACKAGE=" | sed -e 's/GETT cd po/ && intltool-update --gettext-package ${GETTEXT_DOMAIN} --pot && cd - 1>/dev/null -sed -e 's/\.xml\.in\.h:/.xml.in:/g' \ - -e 's/\.ini\.in\.h:/.ini.in:/g' \ - -e 's/\.xml\.h:/.xml:/g' \ - -e 's/\.ini\.h:/.ini:/g' \ +sed -e 's/\.xml\.in\.h:/.xml.in:/g' \ + -e 's/\.ini\.in\.h:/.ini.in:/g' \ + -e 's/\.xml\.h:/.xml:/g' \ + -e 's/\.ini\.h:/.ini:/g' \ -i po/${GETTEXT_DOMAIN}.pot -- cgit v1.2.3 From 8963b201e55613759c59a593d3db66d3f4c12da1 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 19:45:47 +0200 Subject: config.h: Add dummy file --- config.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 config.h diff --git a/config.h b/config.h new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From be468e9659bc275c3e35a71b847f23a2e498d3d8 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 19:44:46 +0200 Subject: Add CMakeLists.txt files --- CMakeLists.txt | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ cmake/GdbusCodegen.cmake | 36 ++++++++++++++++++++++++ data/CMakeLists.txt | 12 ++++++++ po/CMakeLists.txt | 2 ++ src/CMakeLists.txt | 31 +++++++++++++++++++++ test/CMakeLists.txt | 12 ++++++++ 6 files changed, 165 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/GdbusCodegen.cmake create mode 100644 data/CMakeLists.txt create mode 100644 po/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5a10d2c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,72 @@ +project (ayatana-indicator-printers C) +cmake_minimum_required (VERSION 3.13) + +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + SET (CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE) +endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + +list (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +set (PROJECT_VERSION "22.2.0") +set (PACKAGE ${CMAKE_PROJECT_NAME}) +set (GETTEXT_PACKAGE "ayatana-indicator-printers") + +# Options +option (ENABLE_TESTS "Enable all tests and checks" OFF) +option (ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF) +option (ENABLE_WERROR "Treat all build warnings as errors" OFF) + +if (ENABLE_COVERAGE) + set (ENABLE_TESTS ON) + set (CMAKE_BUILD_TYPE "Coverage") +else () + set (CMAKE_BUILD_TYPE "Release") +endif () + +if (ENABLE_WERROR) + add_definitions ("-Werror") +endif () + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_definitions ("-Weverything") +else () + add_definitions ("-Wall") +endif () + +# Check for prerequisites +include (GNUInstallDirs) +find_package (PkgConfig REQUIRED) +include (FindPkgConfig) +pkg_check_modules (SERVICE REQUIRED gtk+-3.0>=3.0 ayatana-indicator3-0.4>=0.2 dbusmenu-glib-0.4>=0.2 dbusmenu-gtk3-0.4) +find_program (CUPS_CONFIG cups-config REQUIRED) +execute_process (COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS) +execute_process (COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBS) +list (APPEND SERVICE_CFLAGS ${CUPS_CFLAGS}) +list (APPEND SERVICE_LDFLAGS ${CUPS_LIBS}) +list (APPEND SERVICE_LIBRARIES "cups") +include_directories (${CMAKE_SOURCE_DIR})# Drop this + +# Custom targets +set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}) +add_custom_target (dist COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2 --inline-suppr ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/test) + +# Build +add_subdirectory (src) +add_subdirectory (data) +add_subdirectory (po) + +if (ENABLE_TESTS) + include (CTest) + enable_testing () + add_subdirectory (test) + if (ENABLE_COVERAGE) + find_package (CoverageReport) + ENABLE_COVERAGE_REPORT (TARGETS "ayatana-printersmenu" "ayatana-indicator-printers-service" TESTS "mock-cups-notifier" FILTER /usr/include ${CMAKE_BINARY_DIR}/*) + endif () +endif () + +# Display config info +message (STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") +message (STATUS "Unit tests: ${ENABLE_TESTS}") +message (STATUS "Build with -Werror: ${ENABLE_WERROR}") diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake new file mode 100644 index 0000000..5261ba8 --- /dev/null +++ b/cmake/GdbusCodegen.cmake @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.13) +if(POLICY CMP0011) + cmake_policy(SET CMP0011 NEW) +endif(POLICY CMP0011) + +find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable") +if(NOT GDBUS_CODEGEN) + message(FATAL_ERROR "Excutable gdbus-codegen not found") +endif() + +macro(add_gdbus_codegen outfiles name prefix service_xml) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" + COMMAND "${GDBUS_CODEGEN}" + --interface-prefix "${prefix}" + --generate-c-code "${name}" + "${service_xml}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ARGN} "${service_xml}" + ) + list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c") +endmacro(add_gdbus_codegen) + +macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" + COMMAND "${GDBUS_CODEGEN}" + --interface-prefix "${prefix}" + --generate-c-code "${name}" + --c-namespace "${namespace}" + "${service_xml}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ARGN} "${service_xml}" + ) + list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c") +endmacro(add_gdbus_codegen_with_namespace) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..20245cd --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,12 @@ +# ayatana-indicator-printers.service +pkg_check_modules (SYSTEMD systemd) + +if (${SYSTEMD_FOUND}) + pkg_get_variable (SYSTEMD_USER_DIR systemd systemduserunitdir) + configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-printers.service.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-printers.service" @ONLY) + install (FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-printers.service" DESTINATION "${SYSTEMD_USER_DIR}") +endif () + +# ayatana-indicator-printers.desktop +configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-printers.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-printers.desktop" @ONLY) +install (FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-printers.desktop" DESTINATION "/etc/xdg/autostart") diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..fce8216 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,2 @@ +find_package (Intltool REQUIRED) +intltool_install_translations (ALL GETTEXT_PACKAGE ${GETTEXT_PACKAGE}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..98af322 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,31 @@ +# libayatana-printersmenu.so +add_library (ayatana-printersmenu SHARED + indicator-printers.c + indicator-printers.h + indicator-menu-item.c + indicator-menu-item.h + dbus-names.h) +target_include_directories (ayatana-printersmenu PUBLIC ${SERVICE_INCLUDE_DIRS}) +target_compile_definitions (ayatana-printersmenu PUBLIC GETTEXT_PACKAGE="${GETTEXT_PACKAGE}" PACKAGE_NAME="${PACKAGE}") +install (TARGETS ayatana-printersmenu DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/ayatana-indicators3/7/") + +# cups-notifier.h +# cups-notifier.c +include (GdbusCodegen) +add_gdbus_codegen_with_namespace (CUPS_NOTIFIER cups-notifier org.cups.cupsd Cups "${CMAKE_CURRENT_SOURCE_DIR}/org.cups.cupsd.Notifier.xml") + +# ayatana-indicator-printers-service +add_executable (ayatana-indicator-printers-service + indicator-printers-service.c + indicator-printers-menu.c + indicator-printers-menu.h + indicator-printer-state-notifier.c + indicator-printer-state-notifier.h + spawn-printer-settings.c + spawn-printer-settings.h + dbus-names.h + ${CUPS_NOTIFIER}) +target_include_directories (ayatana-indicator-printers-service PUBLIC ${SERVICE_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries (ayatana-indicator-printers-service ${SERVICE_LIBRARIES}) +target_compile_definitions (ayatana-indicator-printers-service PUBLIC GETTEXT_PACKAGE="${GETTEXT_PACKAGE}" LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}") +install (TARGETS ayatana-indicator-printers-service RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..78d8965 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,12 @@ +# cups-notifier.h +# cups-notifier.c +include (GdbusCodegen) +add_gdbus_codegen_with_namespace (CUPS_NOTIFIER cups-notifier org.cups.cupsd Cups "${CMAKE_SOURCE_DIR}/src/org.cups.cupsd.Notifier.xml") + +# mock-cups-notifier +add_executable (mock-cups-notifier mock-cups-notifier.c ${CUPS_NOTIFIER}) +target_include_directories (mock-cups-notifier PUBLIC ${SERVICE_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries (mock-cups-notifier ${SERVICE_LIBRARIES}) +add_test (mock-cups-notifier mock-cups-notifier) + + -- cgit v1.2.3 From 7d9327a7a9e258c38e7fa4bf91ee61924c20f30d Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 19:49:08 +0200 Subject: Use CMake variables in configurable files --- data/ayatana-indicator-printers.desktop.in | 2 +- data/ayatana-indicator-printers.service.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/ayatana-indicator-printers.desktop.in b/data/ayatana-indicator-printers.desktop.in index e0f74b0..1027096 100644 --- a/data/ayatana-indicator-printers.desktop.in +++ b/data/ayatana-indicator-printers.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application Name=Ayatana Indicator Printers -Exec=@pkglibexecdir@/ayatana-indicator-printers-service +Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-printers/ayatana-indicator-printers-service OnlyShowIn=MATE;XFCE;Budgie NoDisplay=true StartupNotify=false diff --git a/data/ayatana-indicator-printers.service.in b/data/ayatana-indicator-printers.service.in index 781f3e6..e482f96 100644 --- a/data/ayatana-indicator-printers.service.in +++ b/data/ayatana-indicator-printers.service.in @@ -4,7 +4,7 @@ PartOf=graphical-session.target PartOf=ayatana-indicators.target [Service] -ExecStart=@pkglibexecdir@/ayatana-indicator-printers-service +ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-printers/ayatana-indicator-printers-service Restart=on-failure [Install] -- cgit v1.2.3 From de319a7f92a0a74a38e15c2ab6f54144fe25bda9 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 19:54:16 +0200 Subject: Update translation scripts --- update-po.sh | 4 ++-- update-pot.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/update-po.sh b/update-po.sh index eded8f7..b0470a0 100755 --- a/update-po.sh +++ b/update-po.sh @@ -16,14 +16,14 @@ set -x # You should have received a copy of the GNU General Public License # along with this program. If not, see -GETTEXT_DOMAIN=$(cat configure.ac | grep -E "^GETTEXT_PACKAGE=" | sed -e 's/GETTEXT_PACKAGE=//') +GETTEXT_DOMAIN=$(cat CMakeLists.txt | grep 'set.*(.*GETTEXT_PACKAGE' | sed -r -e 's/.*\"([^"]+)\"\)/\1/') cp po/${GETTEXT_DOMAIN}.pot po/${GETTEXT_DOMAIN}.pot~ cd po/ cat LINGUAS | while read lingua; do if [ ! -e ${lingua}.po ]; then - msginit --input=${GETTEXT_DOMAIN}.pot --locale=${lingua} --no-translator --output-file=$lingua.po + msginit --input=${GETTEXT_DOMAIN}.pot --locale=${lingua} --no-translator --output-file=$lingua.po else intltool-update --gettext-package ${GETTEXT_DOMAIN} $(basename ${lingua}) fi diff --git a/update-pot.sh b/update-pot.sh index e7e38f5..610f87d 100755 --- a/update-pot.sh +++ b/update-pot.sh @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see -GETTEXT_DOMAIN=$(cat configure.ac | grep -E "^GETTEXT_PACKAGE=" | sed -e 's/GETTEXT_PACKAGE=//') +GETTEXT_DOMAIN=$(cat CMakeLists.txt | grep 'set.*(.*GETTEXT_PACKAGE' | sed -r -e 's/.*\"([^"]+)\"\)/\1/') cd po/ && intltool-update --gettext-package ${GETTEXT_DOMAIN} --pot && cd - 1>/dev/null -- cgit v1.2.3 From 8b90bccb7a7acfa01d3c08a00caaea1e4831f408 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 20:08:47 +0200 Subject: .build.yml: Use CMake build --- .build.yml | 79 ++++++++++++++++++++------------------------------------------ 1 file changed, 25 insertions(+), 54 deletions(-) diff --git a/.build.yml b/.build.yml index 69b5920..93911ed 100644 --- a/.build.yml +++ b/.build.yml @@ -3,32 +3,35 @@ ########################################################## requires: archlinux: - # Useful URL: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ayatana-indicator-session + # Useful URL: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ayatana-indicator-printers - clang - gcc - git - make - startup-notification - which -# - cmake -# - cmake-extras - - mate-common + - cmake + - cmake-extras - intltool - - ayatana-indicator3 - - gobject-introspection + - mate-common - glib2 + - gtk3 + - libdbusmenu-glib + - libdbusmenu-gtk3 + - libayatana-indicator + - libcups - systemd + - cups debian: - # Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-session - - autopoint + # Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-printers - clang - clang-tools - g++ - cppcheck - git -# - cmake -# - cmake-extras + - cmake + - cmake-extras - mate-common - intltool - libglib2.0-dev @@ -40,13 +43,12 @@ requires: - dbus ubuntu: - - autopoint - clang - clang-tools - g++ - git -# - cmake -# - cmake-extras + - cmake + - cmake-extras - mate-common - intltool - libglib2.0-dev @@ -74,45 +76,16 @@ variables: -enable-checker alpha.core.FixedAddr -enable-checker security.insecureAPI.strcpy"' -### the printers indicator requires a very old version of libayatana-indicator, so no need to -### build it from source here. Leaving the ruleset here, nonetheless. - -#before_scripts: -# - cd ${START_DIR} -# - if [ ! -d ayatana-ido-build ]; then -# - git clone --depth 1 https://github.com/AyatanaIndicators/ayatana-ido.git ayatana-ido-build -# - fi -# - cd ayatana-ido-build -# - cmake . -DCMAKE_INSTALL_PREFIX=/usr -# - make -# - make install -# - cd - -# - rm -Rf ayatana-ido-build/ -# - -# - cd ${START_DIR} -# - if [ ! -d libayatana-indicator-build ]; then -# - git clone --depth 1 https://github.com/AyatanaIndicators/libayatana-indicator.git libayatana-indicator-build -# - fi -# - cd libayatana-indicator-build -# - cmake . -DCMAKE_INSTALL_PREFIX=/usr -# - make -# - make install -# - cd - -# - rm -Rf libayatana-indicator-build/ -# build_scripts: - if [ ${DISTRO_NAME} == "debian" ];then - cppcheck --enable=warning,style,performance,portability,information,missingInclude . - fi - - - if [ -e ./autogen.sh ]; then - - NOCONFIGURE=1 ./autogen.sh - - scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc --enable-compile-warnings=maximum - - elif [ -e ./CMakeLists.txt ]; then + - if [ -e ./CMakeLists.txt ]; then - if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ]; then - - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON - else - - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON - fi - else - exit 1 @@ -131,12 +104,10 @@ build_scripts: - fi - scan-build $CHECKERS --keep-cc -o html-report make - fi -# - -# - XVFB_RUN="$(which xvfb-run || true)" -# - if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ];then -# - if [ -e ./autogen.sh ]; then -# - ${XVFB_RUN} make check -# - elif [ -e ./CMakeLists.txt ]; then -# - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test -# - fi -# - fi + - + - XVFB_RUN="$(which xvfb-run || true)" + - if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ];then + - if [ -e ./CMakeLists.txt ]; then + - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test + - fi + - fi -- cgit v1.2.3 From e03433ab4c50dd8b4e1bbaac37e5efac8b407aa8 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 20:17:46 +0200 Subject: debian/*: Change to using CMake --- debian/control | 4 ++-- debian/rules | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/debian/control b/debian/control index 3e98b9c..a6fce8f 100644 --- a/debian/control +++ b/debian/control @@ -3,8 +3,8 @@ Section: x11 Priority: extra Maintainer: Mike Gabriel Build-Depends: debhelper (>= 10), - autotools-dev, - dh-autoreconf | debhelper (>= 9.20160403~), + cmake, + cmake-extras, dh-systemd | debhelper (>= 10.2~), dpkg-dev (>= 1.16.1.1), mate-common, diff --git a/debian/rules b/debian/rules index ba2e36f..fac96d4 100755 --- a/debian/rules +++ b/debian/rules @@ -1,28 +1,32 @@ #!/usr/bin/make -f +export DPKG_GENSYMBOLS_CHECK_LEVEL=4 + export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk -CFLAGS += -Wno-error=deprecated-declarations -LDFLAGS += -Wl,-z,defs -Wl,--as-needed +DEB_CMAKE_EXTRA_FLAGS = \ + -DENABLE_TESTS=ON \ + -DENABLE_COVERAGE=OFF \ + $(NULL) export DPKG_GENSYMBOLS_CHECK_LEVEL = 4 %: - dh $@ --without autoreconf,systemd + dh $@ --with systemd override_dh_auto_configure: - NOCONFIGURE=1 ./autogen.sh - dh_auto_configure -- \ - --disable-static + dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS) override_dh_install: find debian/ayatana-indicator-printers -name \*.la -delete find debian/ayatana-indicator-printers -name \*.a -delete dh_install --fail-missing -override_dh_auto_clean: - dh_auto_clean - # no clue, why they don't disappear during make distclean... - rm -f config.sub config.guess +# Hack as it seems it's not possible to easy run that under dbus-test-runner +override_dh_auto_test: + env -u LD_PRELOAD dh_auto_test + +get-orig-source: + uscan --noconf --force-download --rename --download-current-version --destdir=.. -- cgit v1.2.3 From f487079db3dc94c0b9c80d69430d163a6f388996 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 20:20:05 +0200 Subject: Drop Automake files --- Makefile.am | 25 -------------- Makefile.am.coverage | 47 ------------------------- autogen.sh | 9 ----- configure.ac | 98 ---------------------------------------------------- data/Makefile.am | 34 ------------------ m4/gcov.m4 | 86 --------------------------------------------- src/Makefile.am | 53 ---------------------------- test/Makefile.am | 30 ---------------- 8 files changed, 382 deletions(-) delete mode 100644 Makefile.am delete mode 100644 Makefile.am.coverage delete mode 100755 autogen.sh delete mode 100644 configure.ac delete mode 100644 data/Makefile.am delete mode 100644 m4/gcov.m4 delete mode 100644 src/Makefile.am delete mode 100644 test/Makefile.am diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 26e7118..0000000 --- a/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -SUBDIRS = src data test po - -include $(top_srcdir)/Makefile.am.coverage - -DISTCLEANFILES = \ - INSTALL \ - Makefile.in \ - aclocal.m4 \ - compile \ - configure \ - config.h.in \ - config.h \ - config.sub \ - config.guess \ - depcomp \ - install-sh \ - ltmain.sh \ - missing \ - m4/intltool.m4 \ - m4/libtool.m4 \ - m4/ltoptions.m4 \ - m4/ltsugar.m4 \ - m4/ltversion.m4 \ - m4/lt~obsolete.m4 \ - po/Makefile.in.in diff --git a/Makefile.am.coverage b/Makefile.am.coverage deleted file mode 100644 index 7d2d43f..0000000 --- a/Makefile.am.coverage +++ /dev/null @@ -1,47 +0,0 @@ -# Coverage targets - -.PHONY: clean-gcno clean-gcda \ - coverage-html generate-coverage-html clean-coverage-html \ - coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr - -clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr - -if HAVE_GCOV - -clean-gcno: - @echo Removing old coverage instrumentation - -find -name '*.gcno' -print | xargs -r rm - -clean-gcda: - @echo Removing old coverage results - -find -name '*.gcda' -print | xargs -r rm - -coverage-html: clean-gcda - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html - -generate-coverage-html: - @echo Collecting coverage data - $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool - LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info - -clean-coverage-html: clean-gcda - -$(LCOV) --directory $(top_builddir) -z - -rm -rf coverage.info coveragereport - -if HAVE_GCOVR - -coverage-gcovr: clean-gcda - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr - -generate-coverage-gcovr: - @echo Generating coverage GCOVR report - $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml - -clean-coverage-gcovr: clean-gcda - -rm -rf $(top_builddir)/coverage.xml - -endif # HAVE_GCOVR - -endif # HAVE_GCOV diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 0478484..0000000 --- a/autogen.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -which mate-autogen || { - echo "Could not find 'mate-autgen'. Is mate-common installed?" - exit 1 -} - -. mate-autogen - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index b47ddb6..0000000 --- a/configure.ac +++ /dev/null @@ -1,98 +0,0 @@ -AC_INIT(ayatana-indicator-printers, 22.2.0) - -AC_PREREQ(2.53) -AM_INIT_AUTOMAKE([]) - -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LIBTOOL -AM_PROG_CC_C_O -AM_SILENT_RULES([yes]) -AC_CONFIG_MACRO_DIR([m4]) - -AC_DEFUN([AC_DEFINE_PATH], [ - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_path=`eval echo [$]$2` - ac_define_path=`eval echo [$]ac_define_path` - $1="$ac_define_path" - AC_SUBST($1) - ifelse($3, , - AC_DEFINE_UNQUOTED($1, "$ac_define_path"), - AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) -]) - -IT_PROG_INTLTOOL([0.35.0]) -GETTEXT_PACKAGE=ayatana-indicator-printers -AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext package]) -AC_DEFINE_PATH(LOCALEDIR, "${datadir}/locale", [locale directory]) -AM_GLIB_GNU_GETTEXT - -AC_CONFIG_HEADER(config.h) -AC_CONFIG_FILES([ - Makefile - src/Makefile - data/Makefile - test/Makefile - po/Makefile.in -]) - -PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= 3.0 - ayatana-indicator3-0.4 >= 0.2 - dbusmenu-gtk3-0.4 >= 0.2) -PKG_CHECK_MODULES(SERVICE, gtk+-3.0 >= 3.0 - ayatana-indicator3-0.4 >= 0.2 - dbusmenu-glib-0.4 >= 0.2) - -AC_PATH_PROG(CUPS_CONFIG, cups-config, no) -if test "x$CUPS_CONFIG" = "xno"; then - AC_MSG_ERROR([could not find cups-config]) -fi -AC_CHECK_HEADER(cups/cups.h,,AC_MSG_ERROR([could not find cups.h])) -CUPS_CFLAGS=`$CUPS_CONFIG --cflags` -CUPS_LIBS=`$CUPS_CONFIG --libs` -SERVICE_CFLAGS="$SERVICE_CFLAGS $CUPS_CFLAGS" -SERVICE_LIBS="$SERVICE_LIBS $CUPS_LIBS" - -######################### -# Check for systemd -######################### -PKG_CHECK_MODULES(SYSTEMD, systemd, - [has_systemd=yes], - [] -) -if test "x$has_systemd" = "xyes"; then - SYSTEMD_USERDIR=`$PKG_CONFIG --variable=systemduserunitdir systemd` - AC_SUBST(SYSTEMD_USERDIR) - AC_DEFINE(HAVE_SYSTEMD, 1, [create ayatana-indicator-printers.service for systemd]) -fi - -INDICATORDIR=`$PKG_CONFIG --variable=indicatordir ayatana-indicator3-0.4` -INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir ayatana-indicator3-0.4` - -AC_SUBST(INDICATORDIR) -AC_SUBST(INDICATORICONSDIR) - -########################### -# DBus Service Info -########################### - -DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1` -AC_SUBST(DBUSSERVICEDIR) - -########################### -# gcov coverage reporting -########################### - -m4_include([m4/gcov.m4]) -AC_TDD_GCOV -AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) -AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) -AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) -AC_SUBST(COVERAGE_CFLAGS) -AC_SUBST(COVERAGE_LDFLAGS) - -AC_SUBST(AM_CFLAGS, "-Wall") - -AC_OUTPUT diff --git a/data/Makefile.am b/data/Makefile.am deleted file mode 100644 index 8bf680d..0000000 --- a/data/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -BUILT_SOURCES= -CLEANFILES= -EXTRA_DIST= - -# -# the systemd unit file -# - -#if defined(HAVE_SYSTEMD) -systemddir = $(SYSTEMD_USERDIR) -systemd_DATA = ayatana-indicator-printers.service -systemd_in = $(systemd_DATA:.service=.service.in) -$(systemd_DATA): $(systemd_in) - $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ -BUILT_SOURCES += $(systemd_DATA) -EXTRA_DIST += $(systemd_in) -CLEANFILES += $(systemd_DATA) -#endif - -# -# the xdg autostart job file -# - -xdg_autostartdir = /etc/xdg/autostart -xdg_autostart_DATA = ayatana-indicator-printers.desktop -xdg_autostart_in = $(xdg_autostart_DATA:.desktop=.desktop.in) -$(xdg_autostart_DATA): $(xdg_autostart_in) - $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ -BUILT_SOURCES += $(xdg_autostart_DATA) -CLEANFILES += $(xdg_autostart_DATA) -EXTRA_DIST += $(xdg_autostart_in) - -DISTCLEANFILES = \ - Makefile.in diff --git a/m4/gcov.m4 b/m4/gcov.m4 deleted file mode 100644 index 3163584..0000000 --- a/m4/gcov.m4 +++ /dev/null @@ -1,86 +0,0 @@ -# Checks for existence of coverage tools: -# * gcov -# * lcov -# * genhtml -# * gcovr -# -# Sets ac_cv_check_gcov to yes if tooling is present -# and reports the executables to the variables LCOV, GCOVR and GENHTML. -AC_DEFUN([AC_TDD_GCOV], -[ - AC_ARG_ENABLE(gcov, - AS_HELP_STRING([--enable-gcov], - [enable coverage testing with gcov]), - [use_gcov=$enableval], [use_gcov=no]) - - if test "x$use_gcov" = "xyes"; then - # we need gcc: - if test "$GCC" != "yes"; then - AC_MSG_ERROR([GCC is required for --enable-gcov]) - fi - - # Check if ccache is being used - AC_CHECK_PROG(SHTOOL, shtool, shtool) - case `$SHTOOL path $CC` in - *ccache*[)] gcc_ccache=yes;; - *[)] gcc_ccache=no;; - esac - - if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then - AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) - fi - - lcov_version_list="1.6 1.7 1.8 1.9" - AC_CHECK_PROG(LCOV, lcov, lcov) - AC_CHECK_PROG(GENHTML, genhtml, genhtml) - - if test "$LCOV"; then - AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ - glib_cv_lcov_version=invalid - lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` - for lcov_check_version in $lcov_version_list; do - if test "$lcov_version" = "$lcov_check_version"; then - glib_cv_lcov_version="$lcov_check_version (ok)" - fi - done - ]) - else - lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" - AC_MSG_ERROR([$lcov_msg]) - fi - - case $glib_cv_lcov_version in - ""|invalid[)] - lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." - AC_MSG_ERROR([$lcov_msg]) - LCOV="exit 0;" - ;; - esac - - if test -z "$GENHTML"; then - AC_MSG_ERROR([Could not find genhtml from the lcov package]) - fi - - ac_cv_check_gcov=yes - ac_cv_check_lcov=yes - - # Remove all optimization flags from CFLAGS - changequote({,}) - CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` - changequote([,]) - - # Add the special gcc flags - COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" - COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" - COVERAGE_LDFLAGS="-lgcov" - - # Check availability of gcovr - AC_CHECK_PROG(GCOVR, gcovr, gcovr) - if test -z "$GCOVR"; then - ac_cv_check_gcovr=no - else - ac_cv_check_gcovr=yes - fi - -fi -]) # AC_TDD_GCOV diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 48e81f0..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -printersmenulibdir = $(INDICATORDIR) -printersmenulib_LTLIBRARIES = libayatana-printersmenu.la -libayatana_printersmenu_la_SOURCES = \ - indicator-printers.c \ - indicator-printers.h \ - indicator-menu-item.c \ - indicator-menu-item.h \ - dbus-names.h - -libayatana_printersmenu_la_CPPFLAGS = $(APPLET_CFLAGS) -libayatana_printersmenu_la_CFLAGS = $(COVERAGE_CFLAGS) -libayatana_printersmenu_la_LIBADD = $(APPLET_LIBS) -lm -libayatana_printersmenu_la_LDFLAGS = \ - $(COVERAGE_LDFLAGS) \ - -module -avoid-version - - -cups_notifier_sources = \ - cups-notifier.c \ - cups-notifier.h - -$(cups_notifier_sources): org.cups.cupsd.Notifier.xml - gdbus-codegen \ - --interface-prefix org.cups.cupsd \ - --c-namespace Cups \ - --generate-c-code cups-notifier \ - $^ - - -pkglibexec_PROGRAMS = ayatana-indicator-printers-service -ayatana_indicator_printers_service_SOURCES = \ - indicator-printers-service.c \ - indicator-printers-menu.c \ - indicator-printers-menu.h \ - indicator-printer-state-notifier.c \ - indicator-printer-state-notifier.h \ - spawn-printer-settings.c \ - spawn-printer-settings.h \ - dbus-names.h - -nodist_ayatana_indicator_printers_service_SOURCES = $(cups_notifier_sources) - -ayatana_indicator_printers_service_CPPFLAGS = $(SERVICE_CFLAGS) -ayatana_indicator_printers_service_CFLAGS = $(COVERAGE_CFLAGS) -ayatana_indicator_printers_service_LDADD = $(SERVICE_LIBS) -ayatana_indicator_printers_service_LDFLAGS = $(COVERAGE_LDFLAGS) - -BUILT_SOURCES = $(cups_notifier_sources) -CLEANFILES= $(BUILT_SOURCES) -EXTRA_DIST = org.cups.cupsd.Notifier.xml - -DISTCLEANFILES = \ - Makefile.in \ No newline at end of file diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index 0ecb702..0000000 --- a/test/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -noinst_PROGRAMS = mock-cups-notifier -DISTCLEANFILES = mock-cups-notifier - -cups_notifier_sources = \ - cups-notifier.c \ - cups-notifier.h - -$(cups_notifier_sources): $(top_srcdir)/src/org.cups.cupsd.Notifier.xml - gdbus-codegen \ - --interface-prefix org.cups.cupsd \ - --c-namespace Cups \ - --generate-c-code cups-notifier \ - $^ - -mock_cups_notifier_SOURCES = \ - mock-cups-notifier.c - -nodist_mock_cups_notifier_SOURCES = $(cups_notifier_sources) - -mock_cups_notifier_CPPFLAGS = \ - $(SERVICE_CFLAGS) \ - -I$(top_builddir)/src - -mock_cups_notifier_LDADD = $(SERVICE_LIBS) - -BUILT_SOURCES = $(cups_notifier_sources) -CLEANFILES = $(BUILT_SOURCES) - -DISTCLEANFILES = \ - Makefile.in \ No newline at end of file -- cgit v1.2.3 From 9e5b57ca293414e51f82f70dd374b70798d08d44 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 14 Aug 2022 20:24:43 +0200 Subject: Drop all references to config.h --- CMakeLists.txt | 1 - config.h | 0 src/indicator-printers-service.c | 3 ++- src/indicator-printers.c | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a10d2c..24451e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,6 @@ execute_process (COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBS) list (APPEND SERVICE_CFLAGS ${CUPS_CFLAGS}) list (APPEND SERVICE_LDFLAGS ${CUPS_LIBS}) list (APPEND SERVICE_LIBRARIES "cups") -include_directories (${CMAKE_SOURCE_DIR})# Drop this # Custom targets set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}) diff --git a/config.h b/config.h deleted file mode 100644 index e69de29..0000000 diff --git a/src/indicator-printers-service.c b/src/indicator-printers-service.c index 8d31360..e2a32f7 100644 --- a/src/indicator-printers-service.c +++ b/src/indicator-printers-service.c @@ -1,7 +1,9 @@ /* * Copyright 2012 Canonical Ltd. + * Copyright 2022 Robert Tari * * Authors: Lars Uebernickel + * Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -21,7 +23,6 @@ #include #include #include "dbus-names.h" -#include "config.h" #include #include "cups-notifier.h" #include "indicator-printers-menu.h" diff --git a/src/indicator-printers.c b/src/indicator-printers.c index ba263c9..2b7bb36 100644 --- a/src/indicator-printers.c +++ b/src/indicator-printers.c @@ -1,7 +1,9 @@ /* * Copyright 2012 Canonical Ltd. + * Copyright 2022 Robert Tari * * Authors: Lars Uebernickel + * Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -16,8 +18,6 @@ * with this program. If not, see . */ -#include "config.h" - #include "indicator-printers.h" #include "indicator-menu-item.h" #include "dbus-names.h" -- cgit v1.2.3