From d926cd8dc0e5c8ee38812713632e988bfa085ed3 Mon Sep 17 00:00:00 2001 From: asmeron Date: Mon, 20 Mar 2023 10:36:28 +0600 Subject: [PATCH] [package] update --- Makefile | 158 +++++++++--------- README.md | 26 +++ ...vg => com.ublinux.ubl-settings-manager.svg | 0 source/CMakeLists.txt | 6 +- source/ubl-settings-manager.h | 8 +- ubl-settings-manager.desktop | 2 +- ubl-settings-manager.glade | 14 +- ubl-settings-manager.pot | 22 +-- ubl-settings-manager_ru.po | 24 +-- 9 files changed, 147 insertions(+), 113 deletions(-) rename ru.ublinux.ubl-settings-manager.svg => com.ublinux.ubl-settings-manager.svg (100%) diff --git a/Makefile b/Makefile index 16ade97..b66026b 100644 --- a/Makefile +++ b/Makefile @@ -6,47 +6,49 @@ MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_FILEPATH)))) MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) CMAKE_COMMAND = cmake -#CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source -#CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile -CMAKE_SOURCE_DIR = ./source -CMAKE_BUILD_DIR = ./compile -DEPENDS = cmake +CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source +CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile +#CMAKE_SOURCE_DIR = ./source +#CMAKE_BUILD_DIR = ./compile +FILE_VERSION = VERSION.md +DEPENDS = /bin/cmake +PREFIX ?= /usr PKGNAME = $(MAKEFILE_DIR) #PKGNAME = ubl-settings-manager default_target: all +.PHONY: all init depend debug prepare check build uninstall install clean up_ver help + all: init build init: @echo "Initialize ..."; \ - version="$$(cat VERSION.md)"; \ - version=$${version:8}; \ - search="s/string version_application.*"; \ - replace="string version_application = \"$${version}\";"; \ - sed -i -e "$$search/$$replace/gi" source/ubl-settings-manager.h; \ - echo "-- Build path: ${CMAKE_BUILD_DIR}" - + sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-manager.h; \ + echo "-- Build path: ${CMAKE_BUILD_DIR}" + depend: - @echo "Check depends ..."; \ - if [ ! -f /bin/cmake ]; then \ - echo "-- Depend 'cmake' not found !"; \ - exit 1; \ - fi; \ + @echo "Check depends ..." + @for FILE_DEPEND in $(DEPENDS); do \ + if [ ! -f $${FILE_DEPEND} ]; then \ + echo "ERROR: Depend '$${FILE_DEPEND}' not found !"; \ + exit 1; \ + fi; \ + done; \ echo "Check depends: OK" # $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 debug: @echo "Debug ..." if [ ! -d ${CMAKE_BUILD_DIR} ]; then \ - cmake -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="/usr"; \ + $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \ fi; \ echo "Debug: OK" prepare: @echo "Prepare ..."; \ if [ ! -d ${CMAKE_BUILD_DIR} ]; then \ - cmake -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr"; \ + $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \ fi; \ echo "Prepare: OK" @@ -66,65 +68,64 @@ build: depend prepare uninstall: @echo "Uninstall ..." + @for FILE_PO in $(wildcard *.po); do \ + LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ + FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ + PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + $(RM) "$${PATH_FILE_MO}"; \ + done @for SIZE in 16x16 32x32 48x48 scalable; do \ - $(RM) "/usr/share/icons/hicolor/$${SIZE}/apps/${PKGNAME}.svg"; \ - $(RM) "/usr/share/"${pkgname}"/images/${PKGNAME}.png"; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \ done @for FILE_SVG in $(wildcard *.svg); do \ for SIZE in 16x16 32x32 48x48 scalable; do \ - $(RM) "/usr/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \ done; \ done - @for FILE_PO in $(wildcard *.po); do \ - LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ - FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ - $(RM) "/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ - done - @$(RM) "/usr/bin/${PKGNAME}" - @$(RM) "/usr/share/applications/${PKGNAME}.desktop" - @$(RM) "/usr/share/icons/hicolor/scalable/apps/ru.ublinux.${PKGNAME}.svg" - @$(RM) "/usr/share/${PKGNAME}/ui/ublinux-logo.svg" - @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}.glade" - @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" - @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}-banner.png" - @$(RM) -d "/usr/share/${PKGNAME}/css" - @$(RM) -d "/usr/share/${PKGNAME}/ui" - @$(RM) -d "/usr/share/${PKGNAME}" - @$(RM) "/etc/xdg/${PKGNAME}/${PKGNAME}.conf" - @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null - @update-desktop-database --quiet 2>/dev/null - @touch /usr/share/applications + @$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" + @$(RM) "${DESTDIR}${PREFIX}/etc/xdg/${PKGNAME}/${PKGNAME}.conf" + @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" + @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" + @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" + @if [ -z ${DESTDIR} ]; then \ + [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ + update-desktop-database --quiet &>/dev/null || true; \ + [ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \ + fi @echo "Uninstall: OK" install: check uninstall @echo "Install ..." @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ - install -dm755 /usr/share/locale/$${LANG}/LC_MESSAGES; \ + install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ - echo $${FILE_PO}; \ + PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + echo "$${FILE_PO}"; \ msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \ done @for SIZE in 16 32 48; do \ - install -dm755 /usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps; \ - rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data ru.ublinux.${PKGNAME}.svg -o "/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/ru.ublinux.${PKGNAME}.svg"; \ + install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \ + rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \ done - @install -dm755 /usr/share/icons/hicolor/scalable/apps - @install -Dm644 -t /usr/share/icons/hicolor/scalable/apps/ ru.ublinux.${PKGNAME}.svg - @install -Dm755 -t /usr/bin/ ${CMAKE_BUILD_DIR}/${PKGNAME} - @install -Dm644 -t /usr/share/applications/ ${PKGNAME}.desktop - @install -Dm755 /usr/share/${PKGNAME}/ -d ui - @install -Dm755 /usr/share/${PKGNAME}/ -d css - @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.glade - @install -Dm644 -t /usr/share/${PKGNAME}/css/ ${PKGNAME}.css - @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ublinux-logo.svg - @install -Dm766 -t /etc/xdg/${PKGNAME}/ ${PKGNAME}.conf - @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}-banner.png - @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null - @update-desktop-database --quiet 2>/dev/null - @touch /usr/share/applications + @install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" + @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" + @install -dm755 "${DESTDIR}${PREFIX}/etc/xdg" + @install -Dm744 -t "${DESTDIR}${PREFIX}/etc/xdg/${PKGNAME}/" "${PKGNAME}.conf" + @install -dm755 "${DESTDIR}${PREFIX}/share/applications" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" + @install -dm755 "${DESTDIR}${PREFIX}/share/${PKGNAME}"/{ui,css,images} + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}.glade" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/css/" "${PKGNAME}.css" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "ublinux-logo.svg" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "${PKGNAME}-banner.png" + @if [ -z ${DESTDIR} ]; then \ + [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ + update-desktop-database --quiet &>/dev/null || true; \ + [ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \ + fi @echo "Install: OK" clean: @@ -134,21 +135,24 @@ clean: echo "Clean: error, compile directory exist ${CMAKE_BUILD_DIR}"; \ else \ echo "Clean: OK"; \ - fi; \ - version="$$(cat VERSION.md)"; \ - version=$${version:8}; \ - search="s/string version_application.*"; \ - echo $$search; \ - replace="string version_application = ;"; \ - sed -i -e "$$search/$$replace/gi" source/ubl-settings-manager.h; \ + fi + +up_ver: + @CURRENT=$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2); \ + MAJOR=$$(cut -d. -f1 <<< $${CURRENT}); \ + MINOR=$$(cut -d. -f2 <<< $${CURRENT}); \ + VER="$${MAJOR}.$$(($${MINOR}+1))"; \ + sed "s/VERSION *[[:digit:]]*.*/VERSION $${VER}/" -i ${FILE_VERSION}; \ + echo "Updated version to VERSION.md: $${CURRENT} to $${VER}" help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... init" - @echo "... debug" - @echo "... prepare" - @echo "... compile" - @echo "... install" - @echo "... uninstall" - @echo "... clean" + @echo "The following are some of the valid targets for this Makefile:"; \ + echo "... all (the default if no target is provided)"; \ + echo "... init"; \ + echo "... debug"; \ + echo "... prepare"; \ + echo "... compile"; \ + echo "... install"; \ + echo "... uninstall"; \ + echo "... clean"; \ + echo "... up_ver" diff --git a/README.md b/README.md index 7a5f510..fb8e193 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # ubl-settings-manager +# Выполнить +# Build +In order to build ubl-settings-manager you will need: + +- CMake +- C compiler +- GTK+ 3 & dependencies + +Once you have all the necessary dependencies, you can use: +```sh +$ make +``` + +# Installation +After a successful build, just use: +```sh +$ sudo make install clean +``` + +# Uninstallation +After a successful build, just use: +```sh +$ sudo make uninstall +``` + +![alt text](screenshot/screenshot.png) diff --git a/ru.ublinux.ubl-settings-manager.svg b/com.ublinux.ubl-settings-manager.svg similarity index 100% rename from ru.ublinux.ubl-settings-manager.svg rename to com.ublinux.ubl-settings-manager.svg diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 6279e9e..1859049 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -9,7 +9,11 @@ link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ + -O2 -pipe -fno-plt -fexceptions \ + -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ + -fstack-clash-protection -fcf-protection") set(SOURCE_FILES ubl-settings-manager.c diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index 383bd04..af8076c 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -11,17 +11,17 @@ #define CssPath "/usr/share/ubl-settings-manager/css/ubl-settings-manager.css" #define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf" #define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf" -#define AppIconPath "ru.ublinux.ubl-settings-manager" -#define AppBannerPath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager-banner.png" +#define AppIconPath "com.ublinux.ubl-settings-manager" +#define AppBannerPath "/usr/share/ubl-settings-manager/images/ubl-settings-manager-banner.png" #define DesktopPath "/usr/share/applications/" #define IconPicturesPath "/usr/share/icons/hicolor/scalable/apps/" -#define ublinux_logo "/usr/share/ubl-settings-manager/ui/ublinux-logo.svg" +#define ublinux_logo "/usr/share/ubl-settings-manager/images/ublinux-logo.svg" #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-manager" #define ubl_settings_infoPath "ubl-settings-info" #define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id=" typedef char* string; -string version_application = ; +string version_application = "1.2"; typedef struct apps{ diff --git a/ubl-settings-manager.desktop b/ubl-settings-manager.desktop index afec07e..c16cec7 100644 --- a/ubl-settings-manager.desktop +++ b/ubl-settings-manager.desktop @@ -8,7 +8,7 @@ Comment=ubl-settings-manager Comment[ru]=Приложение для управления настройками UBLinux Type=Application Exec=ubl-settings-manager -Icon=ru.ublinux.ubl-settings-manager +Icon=com.ublinux.ubl-settings-manager Terminal=false X-XfcePluggable=false Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings; diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 612a89d..107cc48 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -456,7 +456,7 @@ 64 True False - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager False @@ -627,7 +627,7 @@ True False 32 - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager 5 @@ -800,7 +800,7 @@ True False 32 - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager 5 @@ -1202,7 +1202,7 @@ True False 32 - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager 5 @@ -1455,7 +1455,7 @@ True False 32 - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager 5 @@ -1885,7 +1885,7 @@ True False 32 - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager 5 @@ -1971,7 +1971,7 @@ Project Home Page UBGroup UBGroup - ru.ublinux.ubl-settings-manager + com.ublinux.ubl-settings-manager gpl-2-0 diff --git a/ubl-settings-manager.pot b/ubl-settings-manager.pot index 8681e7d..0f94860 100644 --- a/ubl-settings-manager.pot +++ b/ubl-settings-manager.pot @@ -1,20 +1,20 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Language translations for ubl-settings-manager package. +# Copyright (C) 2022, UBTech LLC +# This file is distributed under the same license as the ubl-settings-manager package. +# UBLinux Team , 2022 # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-17 18:00+0600\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Project-Id-Version: ubl-settings-manager 1.0\n" +"Report-Msgid-Bugs-To: info@ublinux.com\n" +"POT-Creation-Date: 2023-01-01 00:00+0600\n" +"PO-Revision-Date: 2023-01-01 00:00+0600\n" +"Last-Translator: UBLinux Team \n" +"Language-Team: UBLinux Team \n" "Language: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: source/ubl-settings-manager.c:632 diff --git a/ubl-settings-manager_ru.po b/ubl-settings-manager_ru.po index 15e3a47..24c6e99 100644 --- a/ubl-settings-manager_ru.po +++ b/ubl-settings-manager_ru.po @@ -1,18 +1,18 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Russian translations for ubl-settings-manager package. +# Copyright (C) 2022, UBTech LLC +# This file is distributed under the same license as the ubl-settings-manager package. +# UBLinux Team , 2022 # #, fuzzy -msgid "translateinfo\n" +msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-16 12:28+0600\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ubl-settings-manager 1.0\n" +"Report-Msgid-Bugs-To: info@ublinux.com\n" +"POT-Creation-Date: 2023-01-01 00:00+0600\n" +"PO-Revision-Date: 2023-01-01 00:00+0600\n" +"Last-Translator: UBLinux Team \n" +"Language-Team: Russian - UBLinux Team \n" +"Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n"