master #4
Merged
asmeron
merged 92 commits from Igor1/ubl-settings-resourcequota:master
into master
2 years ago
@ -8,10 +8,13 @@ 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 = /bin/cmake
|
|||||||
PREFIX ?= /usr
|
|||||||
PKGNAME = $(MAKEFILE_DIR)
|
|||||||
|
|||||||
#PKGNAME = ubl-settings-manager
|
|||||||
LATEST_TAG=
|
|||||||
default_target: all
|
|||||||
|
|||||||
.PHONY: all init depend debug prepare check build uninstall install clean help
|
|||||||
@ -21,11 +24,11 @@ all: init build
|
|||||||
init:
|
|||||||
@echo "Initialize ..."; \
|
|||||||
if [ -d ".git" ]; then \
|
|||||||
LATEST_TAG=$$(git describe --tags | sed 's/^v//'); \
|
|||||||
LATEST_TAG=$$(git describe --tags | sed 's/^v//'|grep -oE "^[0-9]{1,}.[0-9]{1,}"); \
|
|||||||
else \
|
|||||||
LATEST_TAG="0.0"; \
|
|||||||
fi; \
|
|||||||
sed -r "s/^(string version_application = ).*/\1\"$${LATEST_TAG}\";/" -i source/${PKGNAME}.h; \
|
|||||||
sed -r "s/^(string version_application).*/\1=\"$${LATEST_TAG}\";/" -i source/${PKGNAME}.h; \
|
|||||||
echo "-- Build path: ${CMAKE_BUILD_DIR}"
|
|||||||
|
|||||||
depend:
|
|||||||
@ -36,15 +39,16 @@ depend:
|
|||||||
exit 1; \
|
|||||||
fi; \
|
|||||||
done; \
|
|||||||
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B${CMAKE_BUILD_DIR} --check-build-system CMakeFiles/Makefile.cmake 1 || exit 1; \
|
|||||||
|
|||||||
echo "Check depends: OK"
|
|||||||
# $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
|||||||
|
|||||||
debug:
|
|||||||
@echo "Debug ..."
|
|||||||
debug: init build
|
|||||||
@echo "Debug ..."; \
|
|||||||
if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
|
|||||||
$(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
|
|||||||
# @cc source/my_device.c source/my_device.h source/filters.c source/filters.h source/ubl-cmake.h source/view_edit.h source/view_edit.c source/view_add.h source/view_add.c source/ubl-utils.h source/ubl-utils.c source/ubl-strings.h source/ubl-settings-resourcequota.h source/ubl-settings-resourcequota.c -o ubl-settings-resourcequota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g
|
|||||||
fi; \
|
|||||||
echo "${CMAKE_BUILD_DIR}/${PKGNAME}"; \
|
|||||||
cp ${CMAKE_BUILD_DIR}/${PKGNAME} ./; \
|
|||||||
echo "Debug: OK"
|
|||||||
|
|||||||
prepare:
|
|||||||
@ -88,7 +92,9 @@ uninstall:
|
|||||||
@$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}"
|
|||||||
@$(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}"
|
|||||||
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.checked.svg"
|
|||||||
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.warning.svg"
|
|||||||
@$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}.policy"
|
|||||||
@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; \
|
|||||||
@ -112,14 +118,12 @@ install: check uninstall
|
|||||||
done
|
|||||||
@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 "${DESTDIR}${PREFIX}/share/polkit-1/actions"
|
|||||||
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy"
|
|||||||
@install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}"
|
|||||||
@install -dm755 "${DESTDIR}/etc/xdg"
|
|||||||
asmeron
commented 2 years ago
Review
Если там пусто, зачем создавать папку ? |
|||||||
@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 -dm755 -d "${DESTDIR}${PREFIX}/share/${PKGNAME}/images"
|
|||||||
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "${PKGNAME}-banner.png"
|
|||||||
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
|
|||||||
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg"
|
|||||||
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.funnel.svg"
|
|||||||
@ -129,6 +133,7 @@ install: check uninstall
|
|||||||
[ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
|
|||||||
fi
|
|||||||
@echo "Install: OK"
|
|||||||
@sed -r "s/^(string version_application=\"*\").*/string version_application;/" -i source/${PKGNAME}.h; \
|
|||||||
|
|||||||
clean:
|
|||||||
@echo "Clean ..."
|
|||||||
@ -139,6 +144,14 @@ clean:
|
|||||||
echo "Clean: OK"; \
|
|||||||
fi
|
|||||||
|
|||||||
up_ver:
|
|||||||
asmeron
commented 2 years ago
Review
Ну есть же примеры предыдущих утилит, зачем использовать старую версию Makefile и всё под неё подгонять ? |
|||||||
@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)"; \
|
|||||||
@ -148,4 +161,5 @@ help:
|
|||||||
echo "... compile"; \
|
|||||||
echo "... install"; \
|
|||||||
echo "... uninstall"; \
|
|||||||
echo "... clean"
|
|||||||
echo "... clean"; \
|
|||||||
echo "... up_ver"
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/com/ublinux/ui">
|
||||
<file>ubl-settings-resourcequota.glade</file>
|
||||
</gresource>
|
||||
<gresource prefix="/com/ublinux/css">
|
||||
<file>ubl-settings-resourcequota.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/com/ublinux/images">
|
||||
<file>ubl-settings-resourcequota-banner.png</file>
|
||||
</gresource>
|
||||
</gresources>
|
@ -1,12 +1,12 @@
|
|||||||
cmake_minimum_required(VERSION 3.23)
|
|||||||
cmake_minimum_required(VERSION 3.7)
|
|||||||
project(ubl-settings-resourcequota)
|
|||||||
|
|||||||
find_package(PkgConfig REQUIRED)
|
|||||||
|
|||||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|||||||
include_directories(${GTK3_INCLUDE_DIRS})
|
|||||||
link_directories(${GTK3_LIBRARY_DIRS})
|
|||||||
add_definitions(${GTK3_CFLAGS_OTHER})
|
|||||||
pkg_check_modules(GTK REQUIRED gtk+-3.0)
|
|||||||
include_directories(${GTK_INCLUDE_DIRS})
|
|||||||
link_directories(${GTK_LIBRARY_DIRS})
|
|||||||
add_definitions(${GTK_CFLAGS_OTHER})
|
|||||||
|
|||||||
pkg_check_modules(VTE291 REQUIRED vte-2.91)
|
|||||||
include_directories(${VTE291_INCLUDE_DIRS})
|
|||||||
@ -24,7 +24,42 @@ if(WEBKIT_LIBRARIES_FOUND)
|
|||||||
add_definitions(${WEBKIT_CFLAGS_OTHER})
|
|||||||
endif()
|
|||||||
|
|||||||
configure_file(ubl-cmake.h.in ubl-cmake.h)
|
|||||||
configure_file(ubl-cmake.in ubl-cmake.h)
|
|||||||
|
|||||||
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h DESTINATION ./)
|
|||||||
|
|||||||
set(GRESOURCE_C resources.c)
|
|||||||
set(GRESOURCE_XML gresource.xml)
|
|||||||
|
|||||||
find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED)
|
|||||||
add_custom_target(GLADE ubl-settings-resourcequota.glade)
|
|||||||
|
|||||||
set(DEPENDFILES
|
|||||||
../ubl-settings-resourcequota.glade
|
|||||||
../gresource.xml
|
|||||||
../ubl-settings-resourcequota-banner.png
|
|||||||
../ubl-settings-resourcequota.css
|
|||||||
)
|
|||||||
|
|||||||
file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|||||||
|
|||||||
add_custom_command(
|
|||||||
OUTPUT ${GRESOURCE_C}
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|||||||
COMMAND ${GLIB_COMPILE_RESOURCES}
|
|||||||
ARGS
|
|||||||
--generate-source
|
|||||||
--target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
|
|||||||
${GRESOURCE_XML}
|
|||||||
VERBATIM
|
|||||||
MAIN_DEPENDENCY ${GRESOURCE_XML}
|
|||||||
DEPENDS
|
|||||||
${GLADE}
|
|||||||
)
|
|||||||
add_custom_target(
|
|||||||
dummy-resource
|
|||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
|
|||||||
)
|
|||||||
|
|||||||
#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")
|
|||||||
@ -32,6 +67,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin
|
|||||||
-O2 -pipe -fno-plt -fexceptions \
|
|||||||
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
|
|||||||
-fstack-clash-protection -fcf-protection")
|
|||||||
|
|||||||
|
|||||||
set(SOURCE_FILES
|
|||||||
ubl-settings-resourcequota.c
|
|||||||
@ -47,15 +83,25 @@ set(SOURCE_FILES
|
|||||||
ubl-strings.h
|
|||||||
ubl-utils.h
|
|||||||
ubl-utils.c
|
|||||||
ubl-cmake.h)
|
|||||||
ubl-cmake.h
|
|||||||
philos_utils.c
|
|||||||
philos_utils.h
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h
|
|||||||
)
|
|||||||
|
|||||||
set(LIBRARIES
|
|||||||
${GTK3_LIBRARIES}
|
|||||||
${GTK_LIBRARIES}
|
|||||||
asmeron
commented 2 years ago
Review
Предыдущие недочёты все повторяются, если один раз в другой утилите говорили об том что использовать GTK3 префикс, то и во всех последующих это применимо должно быть ! |
|||||||
${WEBKIT_LIBRARIES}
|
|||||||
${VTE291_LIBRARIES}
|
|||||||
pthread)
|
|||||||
|
|||||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
|||||||
|
|||||||
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})
|
|||||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES})
|
|||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
|
|||||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
|||||||
set_source_files_properties(
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
|
|||||||
PROPERTIES GENERATED TRUE
|
|||||||
)
|
|||||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
|||||||
add_dependencies(${PROJECT_NAME} dummy-resource)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,120 @@
|
||||
#ifndef PHILOS_UTILS_H
|
||||
#define PHILOS_UTILS_H
|
||||
#include "ubl-utils.h"
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <locale.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkx.h>
|
||||
#include <vte/vte.h>
|
||||
#include <pwd.h>
|
||||
#include <stdbool.h>
|
||||
#include "my_device.h"
|
||||
|
||||
#define catch(x) ExitJmp:if(__HadError)
|
||||
#define throw(x) {__HadError=true;goto ExitJmp;}
|
||||
#define file_source_login_min_max "/etc/login.defs"
|
||||
static char** array_size_pow;
|
||||
typedef struct {
|
||||
char** disk_read;
|
||||
char** disk_write;
|
||||
int* i_o_limit_read;
|
||||
int* i_o_limit_write;
|
||||
int* i_o_limit_read_size;
|
||||
int* i_o_limit_write_size;
|
||||
int size;
|
||||
int size_disk;
|
||||
} temp_config;
|
||||
|
||||
typedef struct {
|
||||
|
||||
GtkWidget* Window;
|
||||
GtkWidget* btnSaveTempSave;
|
||||
GtkWidget* btnTempCancel;
|
||||
|
||||
GtkWidget* entryTempCmd;
|
||||
GtkWidget* chbTempRead;
|
||||
GtkWidget* spinTempRead;
|
||||
GtkWidget* cbtTempRead;
|
||||
|
||||
GtkWidget* chbTempWrite;
|
||||
GtkWidget* spinTempWrite;
|
||||
GtkWidget* cbtTempWrite;
|
||||
|
||||
GtkWidget* chkSoftRestrictionTemp;
|
||||
GtkWidget* spiSevereRestrictionTemp;
|
||||
GtkWidget* cmSevereRestrictionTemp;
|
||||
|
||||
GtkWidget* chkSevereRestrictionTemp;
|
||||
GtkWidget* spinSevereRestrictionTemp;
|
||||
GtkWidget* cmbSevereRestrictionTemp;
|
||||
|
||||
GtkWidget* chkPaddingFLTemp;
|
||||
GtkWidget* spinPaddingFLTemp;
|
||||
GtkWidget* cmbPaddingFLTemp;
|
||||
|
||||
GtkWidget* chkCPULimitTemp;
|
||||
GtkWidget* spinCPULimitTemp;
|
||||
GtkWidget* lblCPULimitTemp;
|
||||
|
||||
GtkWidget* cbtTempDevice;
|
||||
GtkWidget* cbxTempQuotaObj;
|
||||
GtkWidget* cbxTempQuotaLevel2;
|
||||
GtkWidget* boxBlockGui;
|
||||
} temp_set_window;
|
||||
void philos_array_string_remove_char(char*** array, char* str_remove, int size);
|
||||
void philos_set_pow_size_memory(char* str_find, int** array_size,int index, char** array_size_pow);
|
||||
void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index);
|
||||
void philos_free_string_array(char ***array, int size);
|
||||
void philos_free_string_array_n3(char ****array, int size);
|
||||
void philos_free_int_array(int **array, int size);
|
||||
void philos_free_int_array_n2(int ***array, int size);
|
||||
config_str philos_list_group(int* size);
|
||||
unsigned short philos_read_uid_min_max(char* filename, char* search);
|
||||
config_str philos_list_user(int* size);
|
||||
char* philos_str_size_pow_byte(GtkWidget *combo_box_text);
|
||||
char* philos_str_remove(char *str, const char *sub);
|
||||
void philos_split_size_memory(char* str_value, int* size, char* pow_memory);
|
||||
char* philos_format_cfg_str_size_memory(char* str_key, int value, int pow_size_memory);
|
||||
char** philos_str_split(char *parameters, int *size, char *divider);
|
||||
void philos_array_str_copy(char*** source, char*** copy);
|
||||
void philos_set_pow_size_memory_device(char* str_find, int** array_size,int index, char** array_size_pow);
|
||||
void philos_array_int_copy(int** source, int** copy);
|
||||
char** philos_pars_terminal_systemd_cgls(char* CMD_GET_SLICE_SERVICE, char* str_find, int* size_array_data);
|
||||
char* philos_pard_array_add_cmd(char* cmd, temp_config* _config, char* key, int* array_io, int* array_io_pow_size, char** disk, int size);
|
||||
int philos_check_activ_disk(temp_set_window *widgets, temp_config* _config);
|
||||
void philos_temp_generate_cmd(temp_set_window *widgets, temp_config* _config);
|
||||
void philos_temp_del_disk(temp_set_window *widgets, temp_config* _config, int flag_check_array);
|
||||
void philos_temp_config_init(temp_config* _config);
|
||||
void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _config, int flag_check_array);
|
||||
void philos_temp_add_disk(temp_set_window *widgets, temp_config* _config, int flag_check_array);
|
||||
int* philos_int_append(int* array, int* size, int value);
|
||||
int* remove_element_int_array(int* array, int* size, int item_to_delete);
|
||||
int** remove_element_int_array_n3(int** array, int* size, int item_to_delete);
|
||||
char* philos_get_size_bite(GtkWidget* chk_button, GtkWidget* spin, GtkWidget* combo_box_text);
|
||||
void philos_fill_combo_box_text(GtkWidget *cbt, config_str list_data, int size);
|
||||
void philos_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, size_t value);
|
||||
void philos_set_active_widgets(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, int flag_cpu, char* cmd);
|
||||
size_t get_resurs_total(char* cmd);
|
||||
float get_size_pow_memory(size_t size_memory, int size);
|
||||
void philos_set_active_widgets_device_io(GtkWidget* combo_to_l2,GtkWidget *check, GtkWidget *spin, GtkWidget *combo);
|
||||
char *yon_char_get_augumented(char *source, char *append);
|
||||
dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data);
|
||||
char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete);
|
||||
char*** yon_char_parsed_shrink_n3(char ***char_string, int *size, int item_to_delete);
|
||||
dictionary *yon_dictionary_create_empty();
|
||||
void yon_terminal_integrated_launch(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument);
|
||||
dictionary *yon_dictionary_create_conneced(dictionary *targetdict);
|
||||
void yon_int_array_append(int **source, int append);
|
||||
static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data);
|
||||
int philos_config_save(char *command);
|
||||
void philos_array_int_pars_to(int** array, int to);
|
||||
void philos_array_char_pars_to(char*** array, char* to);
|
||||
int find_null_array(temp_config* _config);
|
||||
void init_device_disk(temp_config* _config);
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
#cmakedefine WEBKIT_FOUND
|
@ -0,0 +1 @@
|
||||
#cmakedefine WEBKIT_FOUND
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue
С какой целью скорректирована строка ?