Skip to content

Commit

Permalink
build: add channel option to specify build channel
Browse files Browse the repository at this point in the history
Also show the build channel in the version string.
  • Loading branch information
cboxdoerfer committed Jun 19, 2022
1 parent 8be3540 commit d998320
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 6 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
=================
Version 0.1.3alpha
=================

* Fix unresponsive column headers when an overlay is shown (e.g. when no results are found)
* Fix restoring of column widths from previous session
* Add build option to specify build channel

=================
Version 0.1.2
Expand Down
21 changes: 21 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ AC_ARG_ENABLE(debug,

AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")

AC_ARG_WITH(build-channel,
AS_HELP_STRING([--with-build-channel=channel],
[specify build channel, default: other]),
[case "${withval}" in
other) with_build_channel=other;;
AUR-stable) with_build_channel=AUR-stable;;
AUR-devel) with_build_channel=AUR-devel;;
PPA-stable) with_build_channel=PPA-stable;;
PPA-nightly) with_build_channel=PPA-nightly;;
copr-stable) with_build_channel=copr-stable;;
copr-nightly) with_build_channel=copr-nightly;;
snap-stable) with_build_channel=snap-stable;;
snap-nightly) with_build_channel=snap-nightly;;
flathub-stable) with_build_channel=flathub-stable;;
flathub-nightly) with_build_channel=flathub-nightly;;
*) AC_MSG_ERROR([bad value ${withval} for --with-build-channel]) ;;
esac],
[with_build_channel=other])

AC_DEFINE_UNQUOTED([BUILD_CHANNEL], ["$with_build_channel"], [Build channel])

CFLAGS+=" -Os"

AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS+=" -std=c11" ],
Expand Down
2 changes: 1 addition & 1 deletion copr/fsearch_nightly.spec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mv fsearch-%{version} build
%build
export LDFLAGS="%{?__global_ldflags} -pthread"
pushd build
%meson
%meson -Dchannel=copr-nightly
%meson_build -v
popd

Expand Down
2 changes: 1 addition & 1 deletion copr/fsearch_release.spec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mv fsearch-%{version} build
%build
export LDFLAGS="%{?__global_ldflags} -pthread"
pushd build
%meson
%meson -Dchannel=copr-stable
%meson_build -v
popd

Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export DH_VERBOSE = 1
# dh_make generated override targets
override_dh_auto_configure:
./autogen.sh
./configure --enable-debug --prefix=/usr
./configure --enable-debug --with-build-channel="PPA-stable" --prefix=/usr

# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
Expand Down
5 changes: 4 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
project('fsearch', 'c',
version: '0.1.2',
meson_version: '>= 0.45.0',
default_options: ['c_std=c11'],
default_options: ['c_std=c11',
'channel=other',
],
)
app_id = 'io.github.cboxdoerfer.FSearch'

Expand All @@ -19,6 +21,7 @@ config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('lo
config_h.set_quoted('PACKAGE_WEBSITE', 'https://github.com/cboxdoerfer/fsearch')
config_h.set_quoted('PACKAGE_ICON_NAME', app_id)
config_h.set_quoted('PACKAGE_NAME', 'FSearch')
config_h.set_quoted('BUILD_CHANNEL', get_option('channel'))

add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
# ensure off_t is 64bit
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
option('channel',
type: 'combo',
choices: [ 'other', 'AUR-stable', 'AUR-devel', 'copr-stable', 'copr-nightly', 'PPA-stable', 'PPA-nightly', 'snap-stable', 'snap-nightly', 'flathub-stable', 'flathub-nightly' ],
description: 'The distribution channel for FSearch',
)
1 change: 1 addition & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ parts:
source: https://github.com/cboxdoerfer/fsearch.git
source-branch: fsearch_0.1
meson-parameters:
- -Dchannel=snap-stable
- --buildtype=release
- --prefix=/snap/fsearch/current/usr
build-packages:
Expand Down
20 changes: 18 additions & 2 deletions src/fsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,19 @@ get_first_application_window(FsearchApplication *app) {
return FSEARCH_APPLICATION_WINDOW(windows->data);
}

static GString *
get_application_version(void) {
GString *version = g_string_new(PACKAGE_VERSION);
#ifdef BUILD_CHANNEL
if (g_strcmp0(BUILD_CHANNEL, "other") != 0) {
g_string_append(version, " (");
g_string_append(version, BUILD_CHANNEL);
g_string_append(version, ")");
}
#endif
return version;
}

static void
action_about_activated(GSimpleAction *action, GVariant *parameter, gpointer app) {
g_assert(FSEARCH_IS_APPLICATION(app));
Expand All @@ -363,6 +376,8 @@ action_about_activated(GSimpleAction *action, GVariant *parameter, gpointer app)
return;
}

g_autoptr(GString) version = get_application_version();

gtk_show_about_dialog(GTK_WINDOW(window),
"program-name",
PACKAGE_NAME,
Expand All @@ -375,7 +390,7 @@ action_about_activated(GSimpleAction *action, GVariant *parameter, gpointer app)
"website",
"https://github.com/cboxdoerfer/fsearch",
"version",
PACKAGE_VERSION,
version->str,
"translator-credits",
_("translator-credits"),
"comments",
Expand Down Expand Up @@ -836,7 +851,8 @@ fsearch_application_handle_local_options(GApplication *application, GVariantDict
return fsearch_application_local_database_update();
}
if (g_variant_dict_contains(options, "version")) {
g_print("FSearch %s\n", PACKAGE_VERSION);
g_autoptr(GString) version = get_application_version();
g_print("FSearch %s\n", version->str);
return 0;
}

Expand Down

0 comments on commit d998320

Please sign in to comment.