Skip to content

Commit 5002f28

Browse files
committed
fix macos
clang and homebrew needed some help cleanups
1 parent b22619a commit 5002f28

File tree

8 files changed

+45
-11
lines changed

8 files changed

+45
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- fix kplot on win
66
- build polishing
7+
- more debug info in "about"
78

89
## 9.0.1 2025/02/24
910

src/ientry.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ ientry_set_property(GObject *object,
155155
{
156156
iEntry *ientry = (iEntry *) object;
157157

158+
const char *text;
159+
158160
switch (prop_id) {
159161
case PROP_TEXT:
160-
const char *text = g_value_get_string(value);
162+
text = g_value_get_string(value);
161163
if (text &&
162164
!g_str_equal(text, ientry->text)) {
163165
VIPS_SETSTR(ientry->text, text);

src/main.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ gboolean main_option_time_save = FALSE;
4747
gboolean main_option_profile = FALSE;
4848
gboolean main_option_no_load_menus = FALSE;
4949

50-
static const char *main_argv0 = NULL; /* argv[0] */
50+
const char *main_argv0 = NULL; /* argv[0] */
5151

5252
static char prefix_buffer[VIPS_PATH_MAX];
5353
static gboolean prefix_valid = FALSE;
@@ -70,9 +70,36 @@ const char *
7070
get_prefix(void)
7171
{
7272
if (!prefix_valid) {
73+
g_autofree char *basename = g_path_get_basename(main_argv0);
74+
g_autofree char *argv0_path = NULL;
75+
7376
const char *prefix;
7477

75-
if (!(prefix = vips_guess_prefix(main_argv0, "VIPSHOME"))) {
78+
prefix = vips_guess_prefix(main_argv0, "VIPSHOME");
79+
80+
if (!prefix ||
81+
!existsf("%s/share/nip4", prefix)) {
82+
/* The libvips guesser failed to find our install area ... try
83+
* searching the path for our exe name.
84+
*
85+
* This can happen with homebrew, for example, where the
86+
* compile-time libvips prefix will not match the nip4 prefix.
87+
*/
88+
GSList *path = path_parse(g_getenv("PATH"));
89+
argv0_path =
90+
(char *) path_map(path, basename, (path_map_fn) g_strdup, NULL);
91+
g_slist_free_full(g_steal_pointer(&path), g_free);
92+
93+
g_autofree char *trailing = g_strjoin("/", "bin", basename, NULL);
94+
if (argv0_path &&
95+
is_postfix(trailing, argv0_path))
96+
argv0_path[strlen(argv0_path) - strlen(trailing)] = '\0';
97+
98+
prefix = argv0_path;
99+
}
100+
101+
if (!prefix ||
102+
!existsf("%s/share/nip4", prefix)) {
76103
error_top(_("Unable to find install area"));
77104
error_vips();
78105

src/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ extern Watchgroup *main_watchgroup;
2727
extern Imageinfogroup *main_imageinfogroup;
2828

2929
extern void *main_c_stack_base;
30+
extern const char *main_argv0;
3031

3132
extern gboolean main_option_time_save;
3233
extern gboolean main_option_profile;

src/mainwindow.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,6 @@ void
10121012
mainwindow_about(Mainwindow *main, VipsBuf *buf)
10131013
{
10141014
double sz = find_space(PATH_TMP);
1015-
10161015
if (sz < 0)
10171016
vips_buf_appendf(buf, _("no temp area\n"));
10181017
else {

src/matrixview.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ matrixview_grid_refresh(Matrixview *matrixview)
205205
{
206206
Matrix *matrix = MATRIX(VOBJECT(matrixview)->iobject);
207207

208+
Tslider *tslider;
209+
const char *label;
210+
208211
int i;
209212
i = 0;
210213
for (GSList *p = matrixview->items; p; p = p->next, i++) {
@@ -217,14 +220,13 @@ matrixview_grid_refresh(Matrixview *matrixview)
217220
break;
218221

219222
case MATRIX_DISPLAY_SLIDER:
220-
Tslider *tslider = TSLIDER(item);
223+
tslider = TSLIDER(item);
221224
tslider->value = matrix->value.coeff[i];
222225
tslider->svalue = matrix->value.coeff[i];
223226
tslider_changed(TSLIDER(item));
224227
break;
225228

226229
case MATRIX_DISPLAY_TOGGLE:
227-
const char *label;
228230
switch ((int) matrix->value.coeff[i]) {
229231
case 0:
230232
label = "0";

src/tilesource.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ tilesource_set_property(GObject *object,
829829
{
830830
Tilesource *tilesource = (Tilesource *) object;
831831

832+
TilesourceMode mode;
832833
int i;
833834
double d;
834835
gboolean b;
@@ -843,7 +844,7 @@ tilesource_set_property(GObject *object,
843844

844845
switch (prop_id) {
845846
case PROP_MODE:
846-
TilesourceMode mode = g_value_get_enum(value);
847+
mode = g_value_get_enum(value);
847848
if (mode >= 0 &&
848849
mode < TILESOURCE_MODE_LAST &&
849850
tilesource->mode != mode) {

src/workspaceview.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,9 @@ workspaceview_drag_begin(GtkEventControllerMotion *self,
10091009
{
10101010
Workspaceview *wview = WORKSPACEVIEW(user_data);
10111011

1012+
Columnview *title;
1013+
Columnview *cview;
1014+
10121015
#ifdef DEBUG_VERBOSE
10131016
printf("workspaceview_drag_begin: %g x %g\n", start_x, start_y);
10141017
#endif /*DEBUG_VERBOSE*/
@@ -1017,13 +1020,11 @@ workspaceview_drag_begin(GtkEventControllerMotion *self,
10171020
case WVIEW_WAIT:
10181021
/* Search for a column titlebar we could be hitting.
10191022
*/
1020-
Columnview *title = workspaceview_find_columnview_title(wview,
1021-
start_x, start_y);
1023+
title = workspaceview_find_columnview_title(wview, start_x, start_y);
10221024

10231025
/* Search for a click on any part of a columnview.
10241026
*/
1025-
Columnview *cview = workspaceview_find_columnview(wview,
1026-
start_x, start_y);
1027+
cview = workspaceview_find_columnview(wview, start_x, start_y);
10271028

10281029
if (title) {
10291030
wview->drag_cview = title;

0 commit comments

Comments
 (0)