Skip to content

Commit

Permalink
Use Meson GNOME module
Browse files Browse the repository at this point in the history
Split code generation from authors.sh and translators.sh scripts.
  • Loading branch information
qarkai authored and caclark committed Feb 27, 2025
1 parent 16b9725 commit 2d47dac
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 80 deletions.
4 changes: 0 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ i18n = import('i18n')
fs = import('fs')
configuration_inc = include_directories('.')

# External programs
glib_compile_resources = find_program('glib-compile-resources', required : true)
glib_genmarshal = find_program('glib-genmarshal', required : true)

option = get_option('git')
if not option.disabled()
running_from_git = find_program('git', required: false).found() and fs.is_dir('.git')
Expand Down
8 changes: 4 additions & 4 deletions po/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ po_sources = files([
translators_sh = join_paths(scriptsdir, 'translators.sh')

translator_resources = custom_target('translator_resources',
input : ['locales.txt', 'translators.gresource.xml'],
output : ['translators.h', 'translators.c'],
command : [translators_sh, '@PRIVATE_DIR@', meson.current_source_dir(), meson.current_build_dir() , '@INPUT0@', '@INPUT1@', po_sources])
input : 'locales.txt',
output : 'translators',
command : [translators_sh, meson.current_build_dir(), meson.current_source_dir(), '@INPUT@', po_sources])

project_sources += translator_resources
project_sources += gnome.compile_resources('translators', 'translators.gresource.xml', dependencies : translator_resources)
13 changes: 3 additions & 10 deletions scripts/authors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,14 @@
##
## The lists will be displayed in the About - Credits dialog.
##
## $1 Meson PRIVATE_DIR \n
## $2 Meson current_build_dir \n
## $3 running_from_git - "true" or "false" \n
## $4 gresource.xml \n
## $1 Meson current_build_dir \n
## $2 running_from_git - "true" or "false" \n
##

mkdir -p "$1"

if [ "$3" = "true" ]
if [ "$2" = "true" ]
then
git log --pretty=format:"%aN <%aE>" | sed 's/<>//' | sort | uniq --count | sort --general-numeric-sort --reverse --stable --key 1,1 | cut --characters 1-8 --complement > "$1"/authors
printf "\n\0" >> "$1"/authors
else
printf "List of authors not available\n\0" > "$1"/authors
fi

glib-compile-resources --generate-header --sourcedir="$1" --target="$2"/authors.h "$4"
glib-compile-resources --generate-source --sourcedir="$1" --target="$2"/authors.c "$4"
22 changes: 6 additions & 16 deletions scripts/translators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,23 @@
##
## The lists will be displayed in the About - Credits dialog.
##
## $1 Meson PRIVATE_DIR \n
## $1 Meson current_build_dir \n
## $2 Meson current_source_dir \n
## $3 Meson current_build_dir \n
## $4 locales.txt \n
## $5 gresource.xml \n
## $6...$n po source list - space separated list \n
## $3 locales.txt \n
## $4...$n po source list - space separated list \n
##
## It is expected that the .po files have a list of translators in the form: \n
## \# Translators: \n
## \# translator1_name <translator1 email> \n
## \# translator2_name <translator2 email> \n
## \#

mkdir -p "$1"
private_dir="$1"
build_dir="$1"
shift
source_dir="$1"
shift
build_dir="$1"
shift
locales="$1"
shift
resource_xml="$1"
shift

while [ -n "$1" ]
do
Expand All @@ -72,8 +65,5 @@ do
}' "$full_file_path"

shift
done > "$private_dir"/translators
printf "\n\0" >> "$private_dir"/translators

glib-compile-resources --generate-header --sourcedir="$private_dir" --target="$build_dir"/translators.h "$resource_xml"
glib-compile-resources --generate-source --sourcedir="$private_dir" --target="$build_dir"/translators.c "$resource_xml"
done > "$build_dir"/translators
printf "\n\0" >> "$build_dir"/translators
7 changes: 3 additions & 4 deletions src/authors/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
authors_sh = join_paths(scriptsdir, 'authors.sh')

authors_resources = custom_target('authors_resources',
input : 'authors.gresource.xml',
output : ['authors.h', 'authors.c'],
command : [authors_sh, '@PRIVATE_DIR@', meson.current_build_dir() , running_from_git.to_string(), '@INPUT@'])
output : 'authors',
command : [authors_sh, meson.current_build_dir(), running_from_git.to_string()])

project_sources += authors_resources
project_sources += gnome.compile_resources('authors', 'authors.gresource.xml', dependencies : authors_resources)
15 changes: 1 addition & 14 deletions src/icons/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

target_string = '--target=' + meson.current_build_dir() + '/icons.h'
icons_resources_h = custom_target('icons_resources_h',
input : 'icons.gresource.xml',
output : 'icons.h',
command : [glib_compile_resources, '--generate-header', target_string, '--sourcedir=@CURRENT_SOURCE_DIR@', '@INPUT@'])

target_string = '--target=' + meson.current_build_dir() + '/icons.c'
icons_resources_c = custom_target('icons_resources_c',
input : 'icons.gresource.xml',
output : 'icons.c',
command : [glib_compile_resources, '--generate-source', target_string, '--sourcedir=@CURRENT_SOURCE_DIR@', '@INPUT@'])

project_sources += icons_resources_h
project_sources += icons_resources_c
project_sources += gnome.compile_resources('icons', 'icons.gresource.xml')

subdir('svg')
15 changes: 1 addition & 14 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -353,20 +353,7 @@ gq_marshal_pragma = custom_target('gq-marshal-pragma',
project_sources += gq_marshal_pragma

if conf_data.get('HAVE_LCMS', 0) == 1
target_string = '--target=' + meson.current_build_dir() + '/icc.h'
icc_resources_h = custom_target('icc_resources_h',
input : 'icc.gresource.xml',
output : 'icc.h',
command : [glib_compile_resources, '--generate-header', target_string, '--sourcedir=@CURRENT_SOURCE_DIR@', '@INPUT@'])

target_string = '--target=' + meson.current_build_dir() + '/icc.c'
icc_resources_c = custom_target('icc_resources_c',
input : 'icc.gresource.xml',
output : 'icc.c',
command : [glib_compile_resources, '--generate-source', target_string, '--sourcedir=@CURRENT_SOURCE_DIR@', '@INPUT@'])

project_sources += icc_resources_h
project_sources += icc_resources_c
project_sources += gnome.compile_resources('icc', 'icc.gresource.xml')
endif

geeqie_exe = executable('geeqie', project_sources,
Expand Down
15 changes: 1 addition & 14 deletions src/ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#

target_string = '--target=' + meson.current_build_dir() + '/ui.h'
ui_resources_h = custom_target('ui_resources_h',
input : 'ui.gresource.xml',
output : 'ui.h',
command : [glib_compile_resources, '--generate-header', target_string, '--sourcedir=@CURRENT_SOURCE_DIR@', '@INPUT@'])

target_string = '--target=' + meson.current_build_dir() + '/ui.c'
ui_resources_c = custom_target('ui_resources_c',
input : 'ui.gresource.xml',
output : 'ui.c',
command : [glib_compile_resources, '--generate-source', target_string, '--sourcedir=@CURRENT_SOURCE_DIR@', '@INPUT@'])

project_sources += ui_resources_h
project_sources += ui_resources_c
project_sources += gnome.compile_resources('ui', 'ui.gresource.xml')

ui_sources += files('search-and-run.ui')

0 comments on commit 2d47dac

Please sign in to comment.