From baa7d4d6f0ee79c71e9ce46124b7156b4023b33c Mon Sep 17 00:00:00 2001 From: Benoit de Chezelles Date: Sat, 11 Jan 2025 08:46:43 +0100 Subject: [PATCH 1/2] rofi-file-browser: Fix build error & warnings - Fix a hard build error due to incompatible pointer type - Fix build on i686 where `gsize` is not a `unsigned long` - Fix glib-related warning about deprecated functions --- .../rofi-file-browser/fix_build_on_i686.patch | 13 +++ .../fix_incompatible_pointer_type.patch | 27 ++++++ .../fix_recent_glib_deprecation_warning.patch | 83 +++++++++++++++++++ pkgs/by-name/ro/rofi-file-browser/package.nix | 6 ++ 4 files changed, 129 insertions(+) create mode 100644 pkgs/by-name/ro/rofi-file-browser/fix_build_on_i686.patch create mode 100644 pkgs/by-name/ro/rofi-file-browser/fix_incompatible_pointer_type.patch create mode 100644 pkgs/by-name/ro/rofi-file-browser/fix_recent_glib_deprecation_warning.patch diff --git a/pkgs/by-name/ro/rofi-file-browser/fix_build_on_i686.patch b/pkgs/by-name/ro/rofi-file-browser/fix_build_on_i686.patch new file mode 100644 index 000000000000..95c01a8e4ac4 --- /dev/null +++ b/pkgs/by-name/ro/rofi-file-browser/fix_build_on_i686.patch @@ -0,0 +1,13 @@ +diff --git a/src/icons.c b/src/icons.c +index eee00a4..ae476de 100644 +--- a/src/icons.c ++++ b/src/icons.c +@@ -48,7 +48,7 @@ void request_icons_for_file ( FBFile *fbfile, int icon_size, FileBrowserIconData + } + } + +- unsigned long num_icon_names; ++ gsize num_icon_names; + char** icon_names_raw = g_array_steal ( icon_names, &num_icon_names ); + + /* Create icon fetcher requests. */ diff --git a/pkgs/by-name/ro/rofi-file-browser/fix_incompatible_pointer_type.patch b/pkgs/by-name/ro/rofi-file-browser/fix_incompatible_pointer_type.patch new file mode 100644 index 000000000000..3108deb1fa43 --- /dev/null +++ b/pkgs/by-name/ro/rofi-file-browser/fix_incompatible_pointer_type.patch @@ -0,0 +1,27 @@ +diff --git a/src/filebrowser.c b/src/filebrowser.c +index a5a19af..59f0140 100644 +--- a/src/filebrowser.c ++++ b/src/filebrowser.c +@@ -256,21 +256,21 @@ static char *file_browser_get_display_value ( const Mode *sw, unsigned int selec + FBCmd *fbcmd = &pd->cmds[selected_line]; + char* name = fbcmd->name != NULL ? fbcmd->name : fbcmd->cmd; + return rofi_force_utf8 ( name, strlen ( name ) ); + } else { + int index = pd->open_custom ? pd->open_custom_index : selected_line; + FBFile *fbfile = &fd->files[index]; + return rofi_force_utf8 ( fbfile->name, strlen ( fbfile->name ) ); + } + } + +-static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, int height ) ++static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, unsigned int height ) + { + FileBrowserModePrivateData *pd = ( FileBrowserModePrivateData * ) mode_get_private_data ( sw ); + FileBrowserFileData *fd = &pd->file_data; + FileBrowserIconData *id = &pd->icon_data; + + if ( ! id->show_icons ) { + return NULL; + } + + if ( pd->open_custom && pd->show_cmds ) { diff --git a/pkgs/by-name/ro/rofi-file-browser/fix_recent_glib_deprecation_warning.patch b/pkgs/by-name/ro/rofi-file-browser/fix_recent_glib_deprecation_warning.patch new file mode 100644 index 000000000000..829905de44c2 --- /dev/null +++ b/pkgs/by-name/ro/rofi-file-browser/fix_recent_glib_deprecation_warning.patch @@ -0,0 +1,83 @@ +diff --git a/src/cmds.c b/src/cmds.c +index b2f61d7..16554d8 100644 +--- a/src/cmds.c ++++ b/src/cmds.c +@@ -108,21 +108,21 @@ void search_path_for_cmds ( FileBrowserModePrivateData *pd ) + fbcmd->cmd = cmdstr; + fbcmd->name = NULL; + fbcmd->icon_name = NULL; + + num_cmds++; + } + + g_hash_table_steal_all ( table ); + g_hash_table_destroy ( table ); + +- g_qsort_with_data ( cmds, num_cmds, sizeof ( FBCmd ), compare_cmds, NULL ); ++ g_sort_array ( cmds, num_cmds, sizeof ( FBCmd ), compare_cmds, NULL ); + + add_cmds(cmds, num_cmds, pd); + + g_free ( cmds ); + } + + void destroy_cmds ( FileBrowserModePrivateData *pd ) + { + for ( int i = 0; i < pd->num_cmds; i++ ) { + g_free( pd->cmds[i].cmd ); +diff --git a/src/files.c b/src/files.c +index 29a5f9c..6a15b2e 100644 +--- a/src/files.c ++++ b/src/files.c +@@ -135,46 +135,46 @@ void load_files ( FileBrowserFileData *fd ) + FBFile *sort_files = fd->files; + int num_sort_files = fd->num_files; + if ( ! fd->hide_parent ) { + sort_files++; + num_sort_files--; + } + + /* Sort all but the parent dir. */ + if ( fd->sort_by_type ) { + if ( fd->sort_by_depth ) { +- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth_type, NULL ); ++ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth_type, NULL ); + } else { +- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_type, NULL ); ++ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_type, NULL ); + } + } else { + if ( fd->sort_by_depth ) { +- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth, NULL ); ++ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth, NULL ); + } else { +- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files, NULL ); ++ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files, NULL ); + } + } + } + + void change_dir ( char *path, FileBrowserFileData *pd ) + { + char* new_dir = get_canonical_abs_path ( path, pd->current_dir ); + g_free ( pd->current_dir ); + pd->current_dir = new_dir; + g_chdir ( new_dir ); + } + + static bool match_glob_patterns ( const char *basename, FileBrowserFileData *fd ) + { + int len = strlen ( basename ); + for ( int i = 0; i < fd->num_exclude_patterns; i++ ) { +- if ( g_pattern_match ( fd->exclude_patterns[i], len, basename, NULL ) ) { ++ if ( g_pattern_spec_match ( fd->exclude_patterns[i], len, basename, NULL ) ) { + return false; + } + } + return true; + } + + static int add_file ( const char *fpath, G_GNUC_UNUSED const struct stat *sb, int typeflag, struct FTW *ftwbuf ) + { + FileBrowserFileData *fd = global_fd; + diff --git a/pkgs/by-name/ro/rofi-file-browser/package.nix b/pkgs/by-name/ro/rofi-file-browser/package.nix index 76bd8da4488a..025851b0d4dc 100644 --- a/pkgs/by-name/ro/rofi-file-browser/package.nix +++ b/pkgs/by-name/ro/rofi-file-browser/package.nix @@ -20,6 +20,12 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + patches = [ + ./fix_incompatible_pointer_type.patch + ./fix_build_on_i686.patch + ./fix_recent_glib_deprecation_warning.patch + ]; + prePatch = '' substituteInPlace ./CMakeLists.txt \ --replace ' ''${ROFI_PLUGINS_DIR}' " $out/lib/rofi" \ From c81ae66b15b168b8464ab1625c5a611f6d595028 Mon Sep 17 00:00:00 2001 From: Benoit de Chezelles Date: Sat, 11 Jan 2025 08:59:40 +0100 Subject: [PATCH 2/2] rofi-file-browser: add bew as maintainer --- pkgs/by-name/ro/rofi-file-browser/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ro/rofi-file-browser/package.nix b/pkgs/by-name/ro/rofi-file-browser/package.nix index 025851b0d4dc..f1c266a520f9 100644 --- a/pkgs/by-name/ro/rofi-file-browser/package.nix +++ b/pkgs/by-name/ro/rofi-file-browser/package.nix @@ -49,6 +49,9 @@ stdenv.mkDerivation rec { description = "Use rofi to quickly open files"; homepage = "https://github.com/marvinkreis/rofi-file-browser-extended"; license = licenses.mit; - maintainers = with maintainers; [ jluttine ]; + maintainers = with maintainers; [ + bew + jluttine + ]; }; }