1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
3 build-basic-autotools.c
4 Copyright (C) 2000 Naba Kumar
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <glib/gstdio.h>
26 #include <libanjuta/anjuta-shell.h>
27 #include <libanjuta/anjuta-launcher.h>
28 #include <libanjuta/anjuta-utils.h>
29 #include <libanjuta/anjuta-debug.h>
30 #include <libanjuta/anjuta-plugin-manager.h>
31 #include <libanjuta/interfaces/ianjuta-file.h>
32 #include <libanjuta/interfaces/ianjuta-file-manager.h>
33 #include <libanjuta/interfaces/ianjuta-project-manager.h>
34 #include <libanjuta/interfaces/ianjuta-file-loader.h>
35 #include <libanjuta/interfaces/ianjuta-buildable.h>
36 #include <libanjuta/interfaces/ianjuta-builder.h>
37 #include <libanjuta/interfaces/ianjuta-environment.h>
38 #include <libanjuta/interfaces/ianjuta-message-manager.h>
39 #include <libanjuta/interfaces/ianjuta-document-manager.h>
40 #include <libanjuta/interfaces/ianjuta-file-savable.h>
41 #include <libanjuta/interfaces/ianjuta-indicable.h>
42 #include <libanjuta/interfaces/ianjuta-preferences.h>
44 #include "build-basic-autotools.h"
45 #include "build-options.h"
50 #define ICON_FILE "anjuta-build-basic-autotools-plugin-48.png"
51 #define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-build-basic-autotools-plugin.ui"
52 #define MAX_BUILD_PANES 3
53 #define PREF_INDICATORS_AUTOMATIC "indicators.automatic"
54 #define PREF_INSTALL_ROOT "build.install.root"
55 #define PREF_INSTALL_ROOT_COMMAND "build.install.root.command"
56 #define PREF_PARALLEL_MAKE "build.parallel.make"
57 #define PREF_PARALLEL_MAKE_JOB "build.parallel.make.job"
58 #define PREF_TRANSLATE_MESSAGE "build.translate.message"
59 #define PREF_CONTINUE_ON_ERROR "build.continue.error"
61 #define BUILD_PREFS_DIALOG "preferences_dialog_build"
62 #define BUILD_PREFS_ROOT "preferences_build_container"
63 #define INSTALL_ROOT_CHECK "preferences_toggle:bool:0:0:build.install.root"
64 #define INSTALL_ROOT_ENTRY "preferences_entry:text:sudo:0:build.install.root.command"
65 #define PARALLEL_MAKE_CHECK "preferences_toggle:bool:0:0:build.parallel.make"
66 #define PARALLEL_MAKE_SPIN "preferences_spin:int:1:0:build.parallel.make.job"
68 #define DEFAULT_COMMAND_COMPILE "make"
69 #define DEFAULT_COMMAND_BUILD "make"
70 #define DEFAULT_COMMAND_IS_BUILT "make -q"
71 #define DEFAULT_COMMAND_BUILD_TARBALL "make dist"
72 #define DEFAULT_COMMAND_INSTALL "make install"
73 #define DEFAULT_COMMAND_CONFIGURE "configure"
74 #define DEFAULT_COMMAND_GENERATE "autogen.sh"
75 #define DEFAULT_COMMAND_CLEAN "make clean"
76 #define DEFAULT_COMMAND_DISTCLEAN "make distclean"
77 #define DEFAULT_COMMAND_AUTORECONF "autoreconf -i --force"
79 #define CHOOSE_COMMAND(plugin,command) \
80 ((plugin->commands[(IANJUTA_BUILDABLE_COMMAND_##command)]) ? \
81 (plugin->commands[(IANJUTA_BUILDABLE_COMMAND_##command)]) \
83 (DEFAULT_COMMAND_##command))
85 static gpointer parent_class
;
114 IAnjutaIndicableIndicator indicator
;
115 } BuildIndicatorLocation
;
117 /* Command processing */
120 AnjutaPlugin
*plugin
;
122 AnjutaLauncher
*launcher
;
125 IAnjutaBuilderCallback callback
;
128 IAnjutaMessageView
*message_view
;
129 GHashTable
*build_dir_stack
;
131 /* Indicator locations */
134 /* Editors in which indicators have been updated */
135 GHashTable
*indicators_updated_editors
;
138 IAnjutaEnvironment
*environment
;
142 static void update_project_ui (BasicAutotoolsPlugin
*bb_plugin
);
143 static gboolean
directory_has_file (const gchar
*dirname
, const gchar
*filename
);
145 static GList
*patterns_list
= NULL
;
147 /* The translations should match that of 'make' program. Both strings uses
148 * pearl regular expression
149 * 2 similar strings are used in order to parse the output of 2 different
150 * version of make if necessary. If you update one string, move the first
151 * string into the second slot and then replace the first string only. */
152 static MessagePattern patterns_make_entering
[] = {{N_("make(\\[\\d+\\])?:\\s+Entering\\s+directory\\s+`(.+)'"), NULL
, NULL
},
153 {N_("make(\\[\\d+\\])?:\\s+Entering\\s+directory\\s+'(.+)'"), NULL
, NULL
},
156 /* The translations should match that of 'make' program. Both strings uses
157 * pearl regular expression
158 * 2 similar strings are used in order to parse the output of 2 different
159 * version of make if necessary. If you update one string, move the first
160 * string into the second slot and then replace the first string only. */
161 static MessagePattern patterns_make_leaving
[] = {{N_("make(\\[\\d+\\])?:\\s+Leaving\\s+directory\\s+`(.+)'"), NULL
, NULL
},
162 {N_("make(\\[\\d+\\])?:\\s+Leaving\\s+directory\\s+'(.+)'"), NULL
, NULL
},
166 *---------------------------------------------------------------------------*/
169 build_shell_expand (const gchar
*input
)
173 if (input
== NULL
) return NULL
;
175 expand
= g_string_sized_new (strlen (input
));
177 for (; *input
!= '\0'; input
++)
183 /* Variable expansion */
188 while (isalnum (*end
) || (*end
== '_')) end
++;
189 var_name_len
= end
- input
- 1;
190 if (var_name_len
> 0)
194 g_string_append_len (expand
, input
+ 1, var_name_len
);
195 value
= g_getenv (expand
->str
+ expand
->len
- var_name_len
);
196 g_string_truncate (expand
, expand
->len
- var_name_len
);
197 g_string_append (expand
, value
);
205 /* User home directory expansion */
206 if (isspace(input
[1]) || (input
[1] == G_DIR_SEPARATOR
) || (input
[1] == '\0'))
208 g_string_append (expand
, g_get_home_dir());
216 g_string_append_c (expand
, *input
);
219 return g_string_free (expand
, FALSE
);
223 build_argv_command (const gchar
*cmd_dir
, const gchar
*cmd
, gchar
**argv
)
229 split_cmd
= g_strsplit (cmd
, " ", 2);
230 split_len
= g_strv_length (split_cmd
);
240 argv_len
= g_strv_length (argv
);
241 new_cmd
= g_new (gchar
*, split_len
+ argv_len
+ 1);
242 memcpy (new_cmd
, split_cmd
, split_len
* sizeof (gchar
*));
244 memcpy (new_cmd
+ split_len
, argv
, (argv_len
+ 1) * sizeof (gchar
*));
250 gchar
*cmd
= new_cmd
[0];
252 new_cmd
[0] = g_strconcat (cmd_dir
, G_DIR_SEPARATOR_S
, cmd
, NULL
);
260 build_add_env_variable (gchar
**envp
, const gchar
*name
, const gchar
*value
)
267 /* Look for an already existing variable */
268 for (var
= envp
; *var
!= NULL
; var
++)
270 if (strcmp (*var
, name
) == 0)
272 /* Just update variable */
275 *var
[strlen(name
)] = '\0';
280 *var
= g_strconcat (name
, "=", value
, NULL
);
289 /* Need to create a new variable */
290 var
= g_new (gchar
*, len
+ 2);
291 *var
= g_strconcat (name
, value
== NULL
? NULL
: "=", value
, NULL
);
294 memcpy (&var
[1], envp
, len
* sizeof (gchar
*));
303 build_add_arg (gchar
**argv
, const gchar
*argument
)
308 len
= g_strv_length (argv
);
310 /* Need to create a new variable */
311 new_argv
= g_new (gchar
*, len
+ 2);
312 new_argv
[0] = argv
[0];
313 new_argv
[1] = g_strdup (argument
);
314 memcpy (&new_argv
[2], &argv
[1], len
* sizeof (gchar
*));
320 /* Allow installation as root (#321455) */
321 static void on_root_check_toggled(GtkWidget
* toggle_button
, GtkWidget
* entry
)
323 gtk_widget_set_sensitive(entry
,
324 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button
)));
328 get_root_install_command(BasicAutotoolsPlugin
*bplugin
)
330 AnjutaPlugin
* plugin
= ANJUTA_PLUGIN(bplugin
);
331 AnjutaPreferences
* prefs
= anjuta_shell_get_preferences (plugin
->shell
, NULL
);
332 if (anjuta_preferences_get_int (prefs
, PREF_INSTALL_ROOT
))
334 gchar
* command
= anjuta_preferences_get(prefs
, PREF_INSTALL_ROOT_COMMAND
);
344 /* Indicator locations reported by the build */
346 static BuildIndicatorLocation
*
347 build_indicator_location_new (const gchar
*filename
, gint line
,
348 IAnjutaIndicableIndicator indicator
)
350 BuildIndicatorLocation
*loc
= g_new0 (BuildIndicatorLocation
, 1);
351 loc
->filename
= g_strdup (filename
);
353 loc
->indicator
= indicator
;
358 build_indicator_location_set (BuildIndicatorLocation
*loc
,
359 IAnjutaEditor
*editor
,
360 const gchar
*editor_filename
)
362 IAnjutaIterable
*line_start
, *line_end
;
364 if (editor
&& editor_filename
&&
365 IANJUTA_IS_INDICABLE (editor
) &&
366 IANJUTA_IS_EDITOR (editor
) &&
367 strcmp (editor_filename
, loc
->filename
) == 0)
369 DEBUG_PRINT ("loc line: %d", loc
->line
);
371 line_start
= ianjuta_editor_get_line_begin_position (editor
,
374 line_end
= ianjuta_editor_get_line_end_position (editor
,
376 ianjuta_indicable_set (IANJUTA_INDICABLE (editor
),
377 line_start
, line_end
, loc
->indicator
,
380 g_object_unref (line_start
);
381 g_object_unref (line_end
);
386 build_indicator_location_free (BuildIndicatorLocation
*loc
)
388 g_free (loc
->filename
);
395 build_context_stack_destroy (gpointer value
)
397 GSList
*slist
= (GSList
*)value
;
400 g_slist_foreach (slist
, (GFunc
)g_free
, NULL
);
401 g_slist_free (slist
);
406 build_context_push_dir (BuildContext
*context
, const gchar
*key
,
411 if (context
->build_dir_stack
== NULL
)
413 context
->build_dir_stack
=
414 g_hash_table_new_full (g_str_hash
, g_str_equal
, NULL
,
415 build_context_stack_destroy
);
417 dir_stack
= g_hash_table_lookup (context
->build_dir_stack
, key
);
419 g_hash_table_steal (context
->build_dir_stack
, key
);
421 dir_stack
= g_slist_prepend (dir_stack
, g_strdup (dir
));
422 g_hash_table_insert (context
->build_dir_stack
, (gpointer
)key
, dir_stack
);
426 build_context_pop_dir (BuildContext
*context
, const gchar
*key
,
432 if (context
->build_dir_stack
== NULL
)
434 dir_stack
= g_hash_table_lookup (context
->build_dir_stack
, key
);
435 if (dir_stack
== NULL
)
438 g_hash_table_steal (context
->build_dir_stack
, key
);
439 top_dir
= dir_stack
->data
;
440 dir_stack
= g_slist_remove (dir_stack
, top_dir
);
442 if (strcmp (top_dir
, dir
) != 0)
444 DEBUG_PRINT("Directory stack misaligned!!");
448 g_hash_table_insert (context
->build_dir_stack
, (gpointer
)key
, dir_stack
);
452 build_context_get_dir (BuildContext
*context
, const gchar
*key
)
456 if (context
->build_dir_stack
== NULL
)
458 dir_stack
= g_hash_table_lookup (context
->build_dir_stack
, key
);
459 if (dir_stack
== NULL
)
462 return dir_stack
->data
;
466 build_context_destroy_command (BuildContext
*context
)
468 if (context
->used
) return FALSE
;
469 if (context
->callback
)
473 /* Emit command-finished signal abort */
474 err
= g_error_new_literal (ianjuta_builder_error_quark (),
475 IANJUTA_BUILDER_ABORTED
,
476 _("Command aborted"));
477 context
->callback (G_OBJECT (context
->plugin
), context
, err
, context
->user_data
);
479 context
->callback
= NULL
;
482 if (context
->launcher
)
484 g_object_unref (context
->launcher
);
485 context
->launcher
= NULL
;
488 if (context
->environment
)
490 g_object_unref (context
->environment
);
491 context
->environment
= NULL
;
494 /* Empty context, remove from pool */
495 if (context
->message_view
== NULL
)
497 ANJUTA_PLUGIN_BASIC_AUTOTOOLS (context
->plugin
)->contexts_pool
=
498 g_list_remove (ANJUTA_PLUGIN_BASIC_AUTOTOOLS (context
->plugin
)->contexts_pool
,
511 build_context_destroy_view (BuildContext
*context
)
513 if (context
->message_view
)
515 gtk_widget_destroy (GTK_WIDGET (context
->message_view
));
516 context
->message_view
= NULL
;
519 if (context
->build_dir_stack
)
521 g_hash_table_destroy (context
->build_dir_stack
);
522 context
->build_dir_stack
= NULL
;
524 if (context
->indicators_updated_editors
)
526 g_hash_table_destroy (context
->indicators_updated_editors
);
527 context
->indicators_updated_editors
= NULL
;
530 g_slist_foreach (context
->locations
, (GFunc
) build_indicator_location_free
,
532 g_slist_free (context
->locations
);
533 context
->locations
= NULL
;
535 /* Empty context, remove from pool */
536 if (context
->launcher
== NULL
)
538 ANJUTA_PLUGIN_BASIC_AUTOTOOLS (context
->plugin
)->contexts_pool
=
539 g_list_remove (ANJUTA_PLUGIN_BASIC_AUTOTOOLS (context
->plugin
)->contexts_pool
,
552 build_context_destroy (BuildContext
*context
)
554 if (build_context_destroy_command (context
))
556 build_context_destroy_view (context
);
561 build_context_reset (BuildContext
*context
)
565 ianjuta_message_view_clear (context
->message_view
, NULL
);
567 if (context
->build_dir_stack
)
568 g_hash_table_destroy (context
->build_dir_stack
);
569 context
->build_dir_stack
= NULL
;
571 g_slist_foreach (context
->locations
,
572 (GFunc
) build_indicator_location_free
, NULL
);
573 g_slist_free (context
->locations
);
574 context
->locations
= NULL
;
585 fp
= fopen (PACKAGE_DATA_DIR
"/build/automake-c.filters", "r");
588 DEBUG_PRINT ("Failed to load filters: %s",
589 PACKAGE_DATA_DIR
"/build/automake-c.filters");
592 while (!feof (fp
) && !ferror (fp
))
596 BuildPattern
*pattern
;
598 fgets (buffer
, 1024, fp
);
601 tokens
= g_strsplit (buffer
, "|||", 3);
603 if (!tokens
[0] || !tokens
[1])
605 DEBUG_PRINT ("Cannot parse regex: %s", buffer
);
609 pattern
= g_new0 (BuildPattern
, 1);
610 pattern
->pattern
= g_strdup (tokens
[0]);
611 pattern
->replace
= g_strdup (tokens
[1]);
613 pattern
->options
= atoi (tokens
[2]);
616 patterns_list
= g_list_prepend (patterns_list
, pattern
);
618 patterns_list
= g_list_reverse (patterns_list
);
622 build_regex_init_message (MessagePattern
*patterns
)
624 g_return_if_fail (patterns
!= NULL
);
626 if (patterns
->regex
!= NULL
)
627 return; /* Already done */
629 for (;patterns
->pattern
!= NULL
; patterns
++)
631 /* Untranslated string */
632 patterns
->regex
= g_regex_new(
638 /* Translated string */
639 patterns
->local_regex
= g_regex_new(
640 _(patterns
->pattern
),
651 GError
*error
= NULL
;
653 build_regex_init_message (patterns_make_entering
);
655 build_regex_init_message (patterns_make_leaving
);
661 if (((BuildPattern
*)(patterns_list
->data
))->regex
)
664 node
= patterns_list
;
667 BuildPattern
*pattern
;
669 pattern
= node
->data
;
675 &error
); /* for error message */
677 DEBUG_PRINT ("GRegex compilation failed: pattern \"%s\": error %s",
678 pattern
->pattern
, error
->message
);
679 g_error_free (error
);
681 node
= g_list_next (node
);
685 /* Regex processing */
687 build_get_summary (const gchar
*details
, BuildPattern
* bp
)
690 GMatchInfo
*match_info
;
695 if (!bp
|| !bp
->regex
)
698 matched
= g_regex_match(
699 bp
->regex
, /* result of g_regex_new() */
700 details
, /* the subject string */
706 ret
= g_string_new ("");
708 while (*iter
!= '\0')
710 if (*iter
== '\\' && isdigit(*(iter
+ 1)))
712 char temp
[2] = {0, 0};
713 gint start_pos
, end_pos
;
715 temp
[0] = *(iter
+ 1);
716 int idx
= atoi (temp
);
718 g_match_info_fetch_pos (match_info
, idx
, &start_pos
, &end_pos
);
720 ret
= g_string_append_len (ret
, details
+ start_pos
,
721 end_pos
- start_pos
);
730 iter
= g_utf8_next_char (iter
);
733 ret
= g_string_append_len (ret
, start
, end
- start
);
737 final
= g_string_free (ret
, FALSE
);
738 if (strlen (final
) <= 0) {
743 g_match_info_free (match_info
);
749 on_build_mesg_arrived (AnjutaLauncher
*launcher
,
750 AnjutaLauncherOutputType output_type
,
751 const gchar
* mesg
, gpointer user_data
)
753 BuildContext
*context
= (BuildContext
*)user_data
;
754 /* Message view could have been destroyed */
755 if (context
->message_view
)
756 ianjuta_message_view_buffer_append (context
->message_view
, mesg
, NULL
);
760 parse_error_line (const gchar
* line
, gchar
** filename
, int *lineno
)
767 while (line
[i
++] != ':')
769 if (i
>= strlen (line
) || i
>= 512 || line
[i
- 1] == ' ')
774 if (isdigit (line
[i
]))
777 while (isdigit (line
[i
++])) ;
778 dummy
= g_strndup (&line
[j
], i
- j
- 1);
779 *lineno
= atoi (dummy
);
782 dummy
= g_strndup (line
, j
- 1);
783 *filename
= g_strdup (g_strstrip (dummy
));
790 i
= strlen (line
) - 1;
791 while (isspace (line
[i
]) == FALSE
)
802 while (line
[i
++] != ':')
804 if (i
>= strlen (line
) || i
>= 512 || line
[i
- 1] == ' ')
811 if (isdigit (line
[i
]))
814 while (isdigit (line
[i
++])) ;
815 dummy
= g_strndup (&line
[j
], i
- j
- 1);
816 *lineno
= atoi (dummy
);
819 dummy
= g_strndup (&line
[k
], j
- k
- 1);
820 *filename
= g_strdup (g_strstrip (dummy
));
831 on_build_mesg_format (IAnjutaMessageView
*view
, const gchar
*one_line
,
832 BuildContext
*context
)
834 gchar
*dummy_fn
, *line
;
836 IAnjutaMessageViewType type
;
838 gchar
*summary
= NULL
;
839 gchar
*freeptr
= NULL
;
840 BasicAutotoolsPlugin
*p
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (context
->plugin
);
842 GMatchInfo
*match_info
;
845 g_return_if_fail (one_line
!= NULL
);
847 /* Check if make enter a new directory */
849 for (pat
= patterns_make_entering
; pat
->pattern
!= NULL
; pat
++)
851 matched
= g_regex_match(
857 g_match_info_free (match_info
);
858 matched
= g_regex_match(
864 g_match_info_free (match_info
);
871 dir
= g_match_info_fetch (match_info
, 2);
872 dir
= context
->environment
? ianjuta_environment_get_real_directory(context
->environment
, dir
, NULL
)
874 build_context_push_dir (context
, "default", dir
);
875 summary
= g_strdup_printf(_("Entering: %s"), dir
);
876 ianjuta_message_view_append (view
, IANJUTA_MESSAGE_VIEW_TYPE_NORMAL
,
877 summary
, one_line
, NULL
);
880 g_match_info_free (match_info
);
883 /* Check if make leave a directory */
885 for (pat
= patterns_make_leaving
; pat
->pattern
!= NULL
; pat
++)
887 matched
= g_regex_match(
893 g_match_info_free (match_info
);
894 matched
= g_regex_match(
900 g_match_info_free (match_info
);
907 dir
= g_match_info_fetch (match_info
, 2);
908 dir
= context
->environment
? ianjuta_environment_get_real_directory(context
->environment
, dir
, NULL
)
910 build_context_pop_dir (context
, "default", dir
);
911 summary
= g_strdup_printf(_("Leaving: %s"), dir
);
912 ianjuta_message_view_append (view
, IANJUTA_MESSAGE_VIEW_TYPE_NORMAL
,
913 summary
, one_line
, NULL
);
916 g_match_info_free (match_info
);
919 /* Save freeptr so that we can free the copied string */
920 line
= freeptr
= g_strdup (one_line
);
922 g_strchug(line
); /* Remove leading whitespace */
923 if (g_str_has_prefix(line
, "if ") == TRUE
)
928 /* Find the first occurence of ';' (ignoring nesting in quotations) */
929 end
= strchr(line
, ';');
936 type
= IANJUTA_MESSAGE_VIEW_TYPE_NORMAL
;
937 if (parse_error_line(line
, &dummy_fn
, &dummy_int
))
939 gchar
*start_str
, *end_str
, *mid_str
;
940 BuildIndicatorLocation
*loc
;
941 IAnjutaIndicableIndicator indicator
;
943 if ((strstr (line
, "warning:") != NULL
) ||
944 (strstr (line
, _("warning:")) != NULL
))
946 type
= IANJUTA_MESSAGE_VIEW_TYPE_WARNING
;
947 indicator
= IANJUTA_INDICABLE_WARNING
;
951 type
= IANJUTA_MESSAGE_VIEW_TYPE_ERROR
;
952 indicator
= IANJUTA_INDICABLE_CRITICAL
;
955 mid_str
= strstr (line
, dummy_fn
);
956 DEBUG_PRINT ("mid_str = %s, line = %s", mid_str
, line
);
957 start_str
= g_strndup (line
, mid_str
- line
);
958 end_str
= line
+ strlen (start_str
) + strlen (dummy_fn
);
959 DEBUG_PRINT("dummy_fn: %s", dummy_fn
);
960 if (g_path_is_absolute(dummy_fn
))
962 mid_str
= g_strdup(dummy_fn
);
966 mid_str
= g_build_filename (build_context_get_dir (context
, "default"),
969 DEBUG_PRINT ("mid_str: %s", mid_str
);
973 line
= g_strconcat (start_str
, mid_str
, end_str
, NULL
);
975 /* We sucessfully build an absolute path of the file (mid_str),
976 * so we create an indicator location for it and save it.
977 * Additionally, check of current editor holds this file and if
978 * so, set the indicator.
980 DEBUG_PRINT ("dummy int: %d", dummy_int
);
982 loc
= build_indicator_location_new (mid_str
, dummy_int
,
984 context
->locations
= g_slist_prepend (context
->locations
, loc
);
986 /* If current editor file is same as indicator file, set indicator */
987 if (anjuta_preferences_get_int (anjuta_shell_get_preferences (context
->plugin
->shell
, NULL
), PREF_INDICATORS_AUTOMATIC
))
989 build_indicator_location_set (loc
, p
->current_editor
,
990 p
->current_editor_filename
);
995 line
= g_strconcat (start_str
, dummy_fn
, end_str
, NULL
);
1001 else if (strstr (line
, ": ") != NULL
)
1003 type
= IANJUTA_MESSAGE_VIEW_TYPE_INFO
;
1006 node
= patterns_list
;
1009 BuildPattern
*pattern
= node
->data
;
1010 summary
= build_get_summary (line
, pattern
);
1013 node
= g_list_next (node
);
1018 ianjuta_message_view_append (view
, type
, summary
, line
, NULL
);
1022 ianjuta_message_view_append (view
, type
, line
, "", NULL
);
1027 on_build_mesg_parse (IAnjutaMessageView
*view
, const gchar
*line
,
1028 BuildContext
*context
)
1032 if (parse_error_line (line
, &filename
, &lineno
))
1034 IAnjutaDocumentManager
*docman
;
1037 /* Go to file and line number */
1038 docman
= anjuta_shell_get_interface (context
->plugin
->shell
,
1039 IAnjutaDocumentManager
,
1042 /* Full path is detected from parse_error_line() */
1043 file
= g_file_new_for_path(filename
);
1044 ianjuta_document_manager_goto_file_line_mark(docman
, file
, lineno
, TRUE
, NULL
);
1045 g_object_unref (file
);
1050 on_build_terminated (AnjutaLauncher
*launcher
,
1051 gint child_pid
, gint status
, gulong time_taken
,
1052 BuildContext
*context
)
1054 context
->used
= FALSE
;
1055 if (context
->callback
!= NULL
)
1058 IAnjutaBuilderCallback callback
;
1060 if (WIFEXITED (status
))
1062 if (WEXITSTATUS (status
) != 0)
1064 err
= g_error_new (ianjuta_builder_error_quark (),
1065 WEXITSTATUS (status
),
1066 _("Command exited with status %d"), WEXITSTATUS (status
));
1069 else if (WIFSIGNALED (status
))
1071 switch (WTERMSIG (status
))
1074 err
= g_error_new (ianjuta_builder_error_quark (),
1075 IANJUTA_BUILDER_CANCELED
,
1076 _("Command canceled by user"));
1079 err
= g_error_new (ianjuta_builder_error_quark (),
1080 IANJUTA_BUILDER_ABORTED
,
1081 _("Command aborted by user"));
1084 err
= g_error_new (ianjuta_builder_error_quark (),
1085 IANJUTA_BUILDER_INTERRUPTED
,
1086 _("Command terminated with signal %d"), WTERMSIG(status
));
1092 err
= g_error_new_literal (ianjuta_builder_error_quark (),
1093 IANJUTA_BUILDER_TERMINATED
,
1094 _("Command terminated for an unknown reason"));
1096 callback
= context
->callback
;
1097 context
->callback
= NULL
;
1098 callback (G_OBJECT (context
->plugin
), context
, err
, context
->user_data
);
1101 return; /* Another command is run */
1103 g_signal_handlers_disconnect_by_func (context
->launcher
,
1104 G_CALLBACK (on_build_terminated
),
1107 /* Message view could have been destroyed before */
1108 if (context
->message_view
)
1112 buff1
= g_strdup_printf (_("Total time taken: %lu secs\n"),
1116 ianjuta_message_view_buffer_append (context
->message_view
,
1117 _("Completed unsuccessful\n"), NULL
);
1121 ianjuta_message_view_buffer_append (context
->message_view
,
1122 _("Completed successful\n"), NULL
);
1124 ianjuta_message_view_buffer_append (context
->message_view
, buff1
, NULL
);
1127 /* Goto the first error if it exists */
1128 /* if (anjuta_preferences_get_int (ANJUTA_PREFERENCES (app->preferences),
1129 "build.option.gotofirst"))
1130 an_message_manager_next(app->messages);
1133 update_project_ui (ANJUTA_PLUGIN_BASIC_AUTOTOOLS (context
->plugin
));
1135 build_context_destroy_command (context
);
1139 on_message_view_destroyed (BuildContext
*context
, GtkWidget
*view
)
1141 DEBUG_PRINT ("Destroying build context");
1142 context
->message_view
= NULL
;
1144 build_context_destroy_view (context
);
1148 g_hashtable_foreach_true (gpointer key
, gpointer value
, gpointer user_data
)
1153 static BuildContext
*
1154 build_get_context_with_message(BasicAutotoolsPlugin
*plugin
, const gchar
*dir
)
1156 IAnjutaMessageManager
*mesg_manager
;
1159 BuildContext
*context
= NULL
;
1160 static gint message_pane_count
= 0;
1162 /* Initialise regex rules */
1165 subdir
= g_path_get_basename (dir
);
1166 /* Translators: the first number is the number of the build attemp,
1167 the string is the directory where the build takes place */
1168 snprintf (mname
, 128, _("Build %d: %s"), ++message_pane_count
, subdir
);
1171 /* If we already have MAX_BUILD_PANES build panes, find a free context */
1172 if (g_list_length (plugin
->contexts_pool
) >= MAX_BUILD_PANES
)
1175 node
= plugin
->contexts_pool
;
1180 if (c
->launcher
== NULL
)
1185 node
= g_list_next (node
);
1189 mesg_manager
= anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin
)->shell
,
1190 IAnjutaMessageManager
, NULL
);
1193 build_context_reset (context
);
1195 /* It will be re-inserted in right order */
1196 plugin
->contexts_pool
= g_list_remove (plugin
->contexts_pool
, context
);
1197 ianjuta_message_manager_set_view_title (mesg_manager
,
1198 context
->message_view
,
1203 /* If no free context found, create one */
1204 context
= g_new0 (BuildContext
, 1);
1205 context
->plugin
= ANJUTA_PLUGIN(plugin
);
1206 context
->indicators_updated_editors
=
1207 g_hash_table_new (g_direct_hash
, g_direct_equal
);
1209 context
->message_view
=
1210 ianjuta_message_manager_add_view (mesg_manager
, mname
,
1212 g_signal_connect (G_OBJECT (context
->message_view
), "buffer_flushed",
1213 G_CALLBACK (on_build_mesg_format
), context
);
1214 g_signal_connect (G_OBJECT (context
->message_view
), "message_clicked",
1215 G_CALLBACK (on_build_mesg_parse
), context
);
1216 g_object_weak_ref (G_OBJECT (context
->message_view
),
1217 (GWeakNotify
)on_message_view_destroyed
, context
);
1220 ianjuta_message_manager_set_current_view (mesg_manager
,
1221 context
->message_view
, NULL
);
1223 /* Reset indicators in editors */
1224 if (IANJUTA_IS_INDICABLE (plugin
->current_editor
))
1225 ianjuta_indicable_clear (IANJUTA_INDICABLE (plugin
->current_editor
),
1227 /* This is only since glib 2.12.
1228 g_hash_table_remove_all (context->indicators_updated_editors);
1230 g_hash_table_foreach_remove (context
->indicators_updated_editors
,
1231 g_hashtable_foreach_true
, NULL
);
1236 static BuildContext
*
1237 build_get_context (BasicAutotoolsPlugin
*plugin
, const gchar
*dir
,
1240 BuildContext
*context
= NULL
;
1241 AnjutaPluginManager
*plugin_manager
;
1245 context
= build_get_context_with_message (plugin
, dir
);
1249 /* Context without a message view */
1250 context
= g_new0 (BuildContext
, 1);
1251 DEBUG_PRINT ("new context %p", context
);
1252 context
->plugin
= ANJUTA_PLUGIN(plugin
);
1255 plugin_manager
= anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin
)->shell
, NULL
);
1257 if (context
->environment
!= NULL
)
1259 g_object_unref (context
->environment
);
1261 if (anjuta_plugin_manager_is_active_plugin (plugin_manager
, "IAnjutaEnvironment"))
1263 IAnjutaEnvironment
*env
= IANJUTA_ENVIRONMENT (anjuta_shell_get_object (ANJUTA_PLUGIN (plugin
)->shell
,
1264 "IAnjutaEnvironment", NULL
));
1267 context
->environment
= env
;
1271 context
->environment
= NULL
;
1274 context
->callback
= NULL
;
1275 context
->launcher
= anjuta_launcher_new ();
1276 g_signal_connect (G_OBJECT (context
->launcher
), "child-exited",
1277 G_CALLBACK (on_build_terminated
), context
);
1278 build_context_push_dir (context
, "default", dir
);
1279 dir
= g_strconcat (dir
, "/", NULL
);
1282 plugin
->contexts_pool
= g_list_append (plugin
->contexts_pool
, context
);
1287 /* Save all current anjuta files */
1289 save_all_files (AnjutaPlugin
*plugin
)
1291 IAnjutaDocumentManager
*docman
;
1292 IAnjutaFileSavable
* save
;
1294 docman
= anjuta_shell_get_interface (plugin
->shell
, IAnjutaDocumentManager
, NULL
);
1295 /* No document manager, so no file to save */
1298 save
= IANJUTA_FILE_SAVABLE (docman
);
1299 if (save
) ianjuta_file_savable_save (save
, NULL
);
1304 build_execute_command_in_context (BuildContext
* context
, const gchar
*dir
,
1307 IAnjutaBuilderCallback callback
, gpointer user_data
,
1312 g_return_val_if_fail (argv
!= NULL
, FALSE
);
1314 real_dir
= g_strdup (dir
);
1316 context
->callback
= callback
;
1317 context
->user_data
= user_data
;
1318 context
->used
= TRUE
;
1320 /* Add current directory */
1321 envp
= build_add_env_variable (envp
, "PWD", dir
);
1323 if (context
->environment
)
1325 if (!ianjuta_environment_override (context
->environment
, &real_dir
, &argv
, &envp
, NULL
))
1327 g_object_unref (context
->environment
);
1328 context
->environment
= NULL
;
1332 if (context
->message_view
)
1336 command
= g_strjoinv (" ", argv
);
1337 ianjuta_message_view_buffer_append (context
->message_view
,
1338 "Building in directory: ", NULL
);
1339 ianjuta_message_view_buffer_append (context
->message_view
, dir
, NULL
);
1340 ianjuta_message_view_buffer_append (context
->message_view
, "\n", NULL
);
1341 ianjuta_message_view_buffer_append (context
->message_view
, command
, NULL
);
1342 ianjuta_message_view_buffer_append (context
->message_view
, "\n", NULL
);
1345 anjuta_launcher_execute_v (context
->launcher
, argv
, envp
,
1346 on_build_mesg_arrived
, context
);
1350 anjuta_launcher_execute_v (context
->launcher
, argv
, envp
,
1358 target_from_source (BasicAutotoolsPlugin
*plugin
, const gchar
*target
)
1360 if ((plugin
->project_root_dir
== NULL
) ||
1361 (plugin
->project_build_dir
== NULL
) ||
1362 (strcmp (plugin
->project_root_dir
, plugin
->project_build_dir
) == 0))
1364 return g_strdup (target
);
1368 return g_strconcat (plugin
->project_build_dir
, target
+ strlen (plugin
->project_root_dir
), NULL
);
1372 static BuildContext
*
1373 build_execute_command_full (BasicAutotoolsPlugin
* bplugin
, const gchar
*dir
,
1375 gboolean save_file
, gboolean with_view
, gchar
*envp
[],
1376 IAnjutaBuilderCallback callback
, gpointer user_data
,
1379 AnjutaPlugin
* plugin
= ANJUTA_PLUGIN(bplugin
);
1380 BuildContext
*context
;
1381 AnjutaPreferences
* prefs
= anjuta_shell_get_preferences (plugin
->shell
, NULL
);
1386 save_all_files (ANJUTA_PLUGIN (plugin
));
1388 context
= build_get_context (bplugin
, dir
, with_view
);
1390 /* Send options to make */
1391 if (strcmp (argv
[0], "make") == 0)
1393 if (!anjuta_preferences_get_int (prefs
, PREF_TRANSLATE_MESSAGE
))
1395 envp
= build_add_env_variable (envp
, "LANGUAGE", "C");
1397 if (anjuta_preferences_get_int (prefs
, PREF_PARALLEL_MAKE
))
1399 gchar
*arg
= g_strdup_printf ("-j%d", anjuta_preferences_get_int (prefs
, PREF_PARALLEL_MAKE_JOB
));
1400 argv
= build_add_arg (argv
, arg
);
1403 if (anjuta_preferences_get_int (prefs
, PREF_CONTINUE_ON_ERROR
))
1405 argv
= build_add_arg (argv
, "-k");
1409 /* Expand shell variable */
1410 for (arg
= argv
; *arg
!= NULL
; arg
++)
1415 *arg
= build_shell_expand (old_arg
);
1419 ok
= build_execute_command_in_context (context
, dir
, argv
, envp
, callback
, user_data
, NULL
);
1428 build_context_destroy (context
);
1436 build_execute_command (BasicAutotoolsPlugin
* bplugin
, const gchar
*dir
,
1437 const gchar
*command
, gboolean save_file
, GError
**err
)
1442 /* Store args and environment variables as string array */
1443 if (!g_shell_parse_argv (command
, NULL
, &argv
, NULL
))
1446 ok
= build_execute_command_full (bplugin
, dir
, argv
, save_file
, TRUE
, NULL
, NULL
, NULL
, NULL
) != NULL
;
1452 build_cancel_command (BasicAutotoolsPlugin
* bplugin
, BuildContext
*context
,
1457 if (context
== NULL
) return;
1459 for (node
= g_list_first (bplugin
->contexts_pool
); node
!= NULL
; node
= g_list_next (node
))
1461 if (node
->data
== context
)
1463 if (context
->launcher
!= NULL
)
1465 anjuta_launcher_signal (context
->launcher
, SIGTERM
);
1471 /* Invalid handle passed */
1472 g_return_if_reached ();
1476 build_compile_file_real (BasicAutotoolsPlugin
*plugin
, const gchar
*file
)
1479 gchar
*target_basename
;
1480 gchar
*target_dirname
;
1484 /* FIXME: This should be configuration somewhere, eg. preferences */
1485 static GHashTable
*target_ext
= NULL
;
1488 target_ext
= g_hash_table_new (g_str_hash
, g_str_equal
);
1489 g_hash_table_insert (target_ext
, ".c", ".o");
1490 g_hash_table_insert (target_ext
, ".cpp", ".o");
1491 g_hash_table_insert (target_ext
, ".cxx", ".o");
1492 g_hash_table_insert (target_ext
, ".c++", ".o");
1493 g_hash_table_insert (target_ext
, ".cc", ".o");
1494 g_hash_table_insert (target_ext
, ".in", "");
1495 g_hash_table_insert (target_ext
, ".in.in", ".in");
1496 g_hash_table_insert (target_ext
, ".la", ".la");
1497 g_hash_table_insert (target_ext
, ".a", ".a");
1498 g_hash_table_insert (target_ext
, ".so", ".so");
1499 g_hash_table_insert (target_ext
, ".java", ".class");
1502 g_return_val_if_fail (file
!= NULL
, FALSE
);
1505 target
= target_from_source (plugin
, file
);
1506 target_basename
= g_path_get_basename (target
);
1507 target_dirname
= g_path_get_dirname (target
);
1508 ext_ptr
= strrchr (target_basename
, '.');
1511 const gchar
*new_ext
;
1512 new_ext
= g_hash_table_lookup (target_ext
, ext_ptr
);
1518 command
= g_strconcat (CHOOSE_COMMAND (plugin
, COMPILE
), " ",
1519 target_basename
, new_ext
, NULL
);
1520 build_execute_command (plugin
, target_dirname
, command
, TRUE
, NULL
);
1525 /* If file has no extension, take it as target itself */
1527 command
= g_strconcat (CHOOSE_COMMAND(plugin
, COMPILE
), " ",
1528 target_basename
, NULL
);
1529 build_execute_command (plugin
, target_dirname
, command
, TRUE
, NULL
);
1533 g_free (target_basename
);
1534 g_free (target_dirname
);
1538 /* FIXME: Prompt the user to create a Makefile with a wizard
1539 (if there is no Makefile in the directory) or to add a target
1540 rule in the above hash table, eg. editing the preferences, if
1541 there is target extension defined for that file extension.
1544 window
= GTK_WINDOW (ANJUTA_PLUGIN (plugin
)->shell
);
1545 anjuta_util_dialog_error (window
, _("Can not compile \"%s\": No compile rule defined for this file type."), file
);
1552 build_build_project (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1554 build_execute_command (plugin
, plugin
->project_build_dir
,
1555 CHOOSE_COMMAND (plugin
, BUILD
), TRUE
, NULL
);
1559 build_install_project (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1561 gchar
* root
= get_root_install_command(plugin
);
1562 gchar
* command
= g_strdup_printf("%s %s", root
,
1563 CHOOSE_COMMAND (plugin
, INSTALL
));
1565 build_execute_command (plugin
, plugin
->project_build_dir
,
1566 command
, TRUE
, NULL
);
1571 build_clean_project (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1573 build_execute_command (plugin
, plugin
->project_build_dir
,
1574 CHOOSE_COMMAND (plugin
, CLEAN
), FALSE
, NULL
);
1578 build_remove_build_dir (GObject
*sender
,
1579 IAnjutaBuilderHandle context
,
1587 build_distclean_project (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1591 if (!g_shell_parse_argv (CHOOSE_COMMAND (plugin
, DISTCLEAN
), NULL
, &argv
, NULL
))
1594 build_execute_command_full (plugin
, plugin
->project_build_dir
, argv
, TRUE
, TRUE
, NULL
, build_remove_build_dir
, plugin
, NULL
);
1598 on_select_configuration (GtkRadioMenuItem
*item
, gpointer user_data
)
1600 if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item
)))
1602 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (user_data
);
1607 name
= g_object_get_data (G_OBJECT (item
), "untranslated_name");
1609 build_configuration_list_select (plugin
->configurations
, name
);
1611 value
= g_new0 (GValue
, 1);
1612 g_value_init (value
, G_TYPE_STRING
);
1614 uri
= build_configuration_list_get_build_uri (plugin
->configurations
, build_configuration_list_get_selected (plugin
->configurations
));
1615 g_value_set_string (value
, uri
);
1618 anjuta_shell_add_value (ANJUTA_PLUGIN (plugin
)->shell
, IANJUTA_BUILDER_ROOT_URI
, value
, NULL
);
1623 build_update_configuration_menu (BasicAutotoolsPlugin
*plugin
)
1625 GtkWidget
*submenu
= NULL
;
1626 BuildConfiguration
*cfg
;
1627 BuildConfiguration
*selected
;
1628 GSList
*group
= NULL
;
1630 submenu
= gtk_menu_new ();
1631 selected
= build_configuration_list_get_selected (plugin
->configurations
);
1632 for (cfg
= build_configuration_list_get_first (plugin
->configurations
); cfg
!= NULL
; cfg
= build_configuration_next (cfg
))
1636 item
= gtk_radio_menu_item_new_with_mnemonic (group
, build_configuration_get_translated_name (cfg
));
1637 group
= gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item
));
1638 if (cfg
== selected
)
1640 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item
), TRUE
);
1642 g_object_set_data_full (G_OBJECT (item
), "untranslated_name", g_strdup (build_configuration_get_name (cfg
)), g_free
);
1643 g_signal_connect (G_OBJECT (item
), "toggled", G_CALLBACK (on_select_configuration
), plugin
);
1644 gtk_menu_shell_append (GTK_MENU_SHELL (submenu
), item
);
1646 gtk_menu_item_set_submenu (GTK_MENU_ITEM (plugin
->configuration_menu
), submenu
);
1647 gtk_widget_show_all (submenu
);
1651 build_project_configured (GObject
*sender
,
1652 IAnjutaBuilderHandle context
,
1656 BasicAutotoolsPlugin
*plugin
= (BasicAutotoolsPlugin
*)sender
;
1660 value
= g_new0 (GValue
, 1);
1661 g_value_init (value
, G_TYPE_STRING
);
1663 uri
= build_configuration_list_get_build_uri (plugin
->configurations
, build_configuration_list_get_selected (plugin
->configurations
));
1664 g_value_set_string (value
, uri
);
1667 anjuta_shell_add_value (ANJUTA_PLUGIN (plugin
)->shell
, IANJUTA_BUILDER_ROOT_URI
, value
, NULL
);
1669 build_update_configuration_menu (plugin
);
1673 build_configure_project_after_autogen (GObject
*sender
,
1674 IAnjutaBuilderHandle context
,
1678 BuildLinkCommand
*link
= (BuildLinkCommand
*)user_data
;
1679 BasicAutotoolsPlugin
*plugin
= (BasicAutotoolsPlugin
*)sender
;
1683 struct stat conf_stat
, log_stat
;
1686 filename
= g_build_filename (link
->project_dir
, "configure", NULL
);
1687 if (stat (filename
, &conf_stat
) != 0)
1689 anjuta_util_dialog_error (link
->parent
, _("Can not configure project: Missing configure script in %s."), link
->project_dir
);
1694 filename
= g_build_filename (link
->build_dir
, "config.log", NULL
);
1695 if ((stat (filename
, &log_stat
) != 0) ||
1696 (log_stat
.st_mtime
< conf_stat
.st_mtime
))
1698 link
->argv
= build_argv_command (link
->project_dir
,
1699 CHOOSE_COMMAND (plugin
, CONFIGURE
),
1701 build_execute_command_in_context ((BuildContext
*)context
, link
->build_dir
, link
->argv
,
1702 NULL
, build_project_configured
, NULL
, NULL
);
1708 g_free (link
->project_dir
);
1709 g_free (link
->build_dir
);
1710 g_strfreev (link
->argv
);
1715 build_configure_project (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1718 gboolean run_autogen
= FALSE
;
1719 const gchar
*project_root
;
1720 GValue value
= {0,};
1722 run_autogen
= !directory_has_file (plugin
->project_root_dir
, "configure");
1724 anjuta_shell_get_value (ANJUTA_PLUGIN (plugin
)->shell
, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI
, &value
, NULL
);
1725 project_root
= g_value_get_string (&value
);
1726 parent
= GTK_WINDOW (ANJUTA_PLUGIN(plugin
)->shell
);
1727 if (build_dialog_configure (parent
, project_root
, plugin
->configurations
, &run_autogen
))
1729 BuildConfiguration
*config
;
1735 config
= build_configuration_list_get_selected (plugin
->configurations
);
1736 uri
= build_configuration_list_get_build_uri (plugin
->configurations
, config
);
1737 build_file
= g_file_new_for_uri (uri
);
1739 build_dir
= g_file_get_path (build_file
);
1740 g_object_unref (build_file
);
1742 IAnjutaBuilderCallback callback
= NULL
;
1743 BuildLinkCommand
* user_data
= NULL
;
1747 gboolean has_autogen
= directory_has_file (plugin
->project_root_dir
,
1750 gchar
**args
= g_strdupv (build_configuration_get_args (config
));
1751 argv
= build_argv_command (plugin
->project_root_dir
,
1752 has_autogen
? CHOOSE_COMMAND (plugin
, GENERATE
) : CHOOSE_COMMAND (plugin
, AUTORECONF
),
1756 /* Plan to run configure afterward */
1757 user_data
= g_new (BuildLinkCommand
, 1);
1758 user_data
->project_dir
= g_strdup (plugin
->project_root_dir
);
1759 user_data
->build_dir
= g_strdup (build_dir
);
1760 /* Remove command name from argument array */
1761 user_data
->argv
= g_strdupv (&argv
[1]);
1762 user_data
->parent
= parent
;
1764 callback
= build_configure_project_after_autogen
;
1768 /* Run configure only */
1769 gchar
**args
= g_strdupv (build_configuration_get_args (config
));
1771 argv
= build_argv_command (plugin
->project_root_dir
,
1772 CHOOSE_COMMAND (plugin
, CONFIGURE
),
1774 callback
= build_project_configured
;
1776 build_execute_command_full (plugin
, build_dir
,
1777 argv
, TRUE
, TRUE
, NULL
,
1778 callback
, user_data
, NULL
);
1784 build_distribution_project (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1786 build_execute_command (plugin
, plugin
->project_build_dir
,
1787 CHOOSE_COMMAND (plugin
, BUILD_TARBALL
),
1792 build_build_module (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1794 gchar
*dirname
= g_dirname (plugin
->current_editor_filename
);
1795 gchar
*target
= target_from_source (plugin
, dirname
);
1797 build_execute_command (plugin
, target
,
1798 CHOOSE_COMMAND (plugin
, BUILD
),
1805 build_install_module (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1807 gchar
*dirname
= g_dirname (plugin
->current_editor_filename
);
1808 gchar
* root
= get_root_install_command(plugin
);
1809 gchar
*target
= target_from_source (plugin
, dirname
);
1810 gchar
* command
= g_strdup_printf ("%s %s", root
,
1811 CHOOSE_COMMAND (plugin
, INSTALL
));
1813 build_execute_command (plugin
, target
, command
, TRUE
, NULL
);
1820 build_clean_module (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1822 gchar
*dirname
= g_dirname (plugin
->current_editor_filename
);
1823 gchar
*target
= target_from_source (plugin
, dirname
);
1824 build_execute_command (plugin
, target
,
1825 CHOOSE_COMMAND (plugin
, CLEAN
),
1832 build_compile_file (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1834 if (plugin
->current_editor_filename
)
1836 build_compile_file_real (plugin
, plugin
->current_editor_filename
);
1840 /* File manager context menu */
1842 fm_compile (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1844 if (plugin
->fm_current_filename
)
1846 build_compile_file_real (plugin
, plugin
->fm_current_filename
);
1851 fm_build (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1856 g_return_if_fail (plugin
->fm_current_filename
!= NULL
);
1858 if (g_file_test (plugin
->fm_current_filename
, G_FILE_TEST_IS_DIR
))
1859 dir
= g_strdup (plugin
->fm_current_filename
);
1861 dir
= g_path_get_dirname (plugin
->fm_current_filename
);
1862 target
= target_from_source (plugin
, dir
);
1863 build_execute_command (plugin
, target
,
1864 CHOOSE_COMMAND (plugin
, BUILD
),
1871 fm_install (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1878 g_return_if_fail (plugin
->fm_current_filename
!= NULL
);
1881 if (g_file_test (plugin
->fm_current_filename
, G_FILE_TEST_IS_DIR
))
1882 dir
= g_strdup (plugin
->fm_current_filename
);
1884 dir
= g_path_get_dirname (plugin
->fm_current_filename
);
1885 root
= get_root_install_command(plugin
);
1886 command
= g_strdup_printf ("%s %s", root
,
1887 CHOOSE_COMMAND (plugin
, INSTALL
));
1889 target
= target_from_source (plugin
, dir
);
1890 build_execute_command (plugin
, dir
, command
, TRUE
, NULL
);
1895 fm_clean (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1900 g_return_if_fail (plugin
->fm_current_filename
!= NULL
);
1902 if (g_file_test (plugin
->fm_current_filename
, G_FILE_TEST_IS_DIR
))
1903 dir
= g_strdup (plugin
->fm_current_filename
);
1905 dir
= g_path_get_dirname (plugin
->fm_current_filename
);
1907 target
= target_from_source (plugin
, dir
);
1908 build_execute_command (plugin
, target
,
1909 CHOOSE_COMMAND (plugin
, CLEAN
),
1914 /* Project manager context menu */
1916 pm_compile (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1918 if (plugin
->pm_current_filename
)
1920 build_compile_file_real (plugin
, plugin
->pm_current_filename
);
1925 pm_build (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1930 g_return_if_fail (plugin
->pm_current_filename
!= NULL
);
1932 if (g_file_test (plugin
->pm_current_filename
, G_FILE_TEST_IS_DIR
))
1933 dir
= g_strdup (plugin
->pm_current_filename
);
1935 dir
= g_path_get_dirname (plugin
->pm_current_filename
);
1936 target
= target_from_source (plugin
, dir
);
1937 build_execute_command (plugin
, target
,
1938 CHOOSE_COMMAND (plugin
, BUILD
),
1945 pm_install (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1952 g_return_if_fail (plugin
->pm_current_filename
!= NULL
);
1954 root
= get_root_install_command(plugin
);
1955 command
= g_strdup_printf ("%s %s", root
,
1956 CHOOSE_COMMAND (plugin
, INSTALL
));
1959 if (g_file_test (plugin
->pm_current_filename
, G_FILE_TEST_IS_DIR
))
1960 dir
= g_strdup (plugin
->pm_current_filename
);
1962 dir
= g_path_get_dirname (plugin
->pm_current_filename
);
1963 target
= target_from_source (plugin
, dir
);
1964 build_execute_command (plugin
, target
, command
, TRUE
, NULL
);
1971 pm_clean (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1976 g_return_if_fail (plugin
->pm_current_filename
!= NULL
);
1978 if (g_file_test (plugin
->pm_current_filename
, G_FILE_TEST_IS_DIR
))
1979 dir
= g_strdup (plugin
->pm_current_filename
);
1981 dir
= g_path_get_dirname (plugin
->pm_current_filename
);
1982 target
= target_from_source (plugin
, dir
);
1983 build_execute_command (plugin
, target
,
1984 CHOOSE_COMMAND (plugin
, CLEAN
),
1991 mv_cancel (GtkAction
*action
, BasicAutotoolsPlugin
*plugin
)
1993 IAnjutaMessageManager
*msgman
;
1995 msgman
= anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin
)->shell
,
1996 IAnjutaMessageManager
,
2001 IAnjutaMessageView
*view
;
2003 view
= ianjuta_message_manager_get_current_view (msgman
, NULL
);
2008 for (node
= g_list_first (plugin
->contexts_pool
); node
!= NULL
; node
= g_list_next (node
))
2010 BuildContext
*context
;
2012 context
= (BuildContext
*)node
->data
;
2013 if (context
->message_view
== view
)
2015 if (context
->launcher
!= NULL
)
2017 anjuta_launcher_signal (context
->launcher
, SIGTERM
);
2026 static GtkActionEntry build_actions
[] =
2029 "ActionMenuBuild", NULL
,
2030 N_("_Build"), NULL
, NULL
, NULL
2033 "ActionBuildBuildProject", NULL
,
2034 N_("_Build Project"), "<shift>F11",
2035 N_("Build whole project"),
2036 G_CALLBACK (build_build_project
)
2039 "ActionBuildInstallProject", NULL
,
2040 N_("_Install Project"), NULL
,
2041 N_("Install whole project"),
2042 G_CALLBACK (build_install_project
)
2045 "ActionBuildCleanProject", NULL
,
2046 N_("_Clean Project"), NULL
,
2047 N_("Clean whole project"),
2048 G_CALLBACK (build_clean_project
)
2051 "ActionBuildConfigure", NULL
,
2052 N_("C_onfigure Project..."), NULL
,
2053 N_("Configure project"),
2054 G_CALLBACK (build_configure_project
)
2057 "ActionBuildDistribution", NULL
,
2058 N_("Build _Tarball"), NULL
,
2059 N_("Build project tarball distribution"),
2060 G_CALLBACK (build_distribution_project
)
2063 "ActionBuildBuildModule", GTK_STOCK_EXECUTE
,
2064 N_("_Build Module"), "F11",
2065 N_("Build module associated with current file"),
2066 G_CALLBACK (build_build_module
)
2069 "ActionBuildInstallModule", NULL
,
2070 N_("_Install Module"), NULL
,
2071 N_("Install module associated with current file"),
2072 G_CALLBACK (build_install_module
)
2075 "ActionBuildCleanModule", NULL
,
2076 N_("_Clean Module"), NULL
,
2077 N_("Clean module associated with current file"),
2078 G_CALLBACK (build_clean_module
)
2081 "ActionBuildCompileFile", GTK_STOCK_CONVERT
,
2082 N_("Co_mpile File"), "F9",
2083 N_("Compile current editor file"),
2084 G_CALLBACK (build_compile_file
)
2087 "ActionBuildSelectConfiguration", NULL
,
2088 N_("Select Configuration"), NULL
,
2089 N_("Select current configuration"),
2093 "ActionBuildRemoveConfiguration", NULL
,
2094 N_("Remove Configuration"), NULL
,
2095 N_("Clean project (distclean) and remove configuration directory if possible"),
2096 G_CALLBACK (build_distclean_project
)
2100 static GtkActionEntry build_popup_actions
[] =
2103 "ActionPopupBuild", NULL
,
2104 N_("_Build"), NULL
, NULL
, NULL
2107 "ActionPopupBuildCompile", GTK_STOCK_CONVERT
,
2108 N_("_Compile"), NULL
,
2110 G_CALLBACK (fm_compile
)
2113 "ActionPopupBuildBuild", GTK_STOCK_EXECUTE
,
2116 G_CALLBACK (fm_build
)
2119 "ActionPopupBuildInstall", NULL
,
2120 N_("_Install"), NULL
,
2121 N_("Install module"),
2122 G_CALLBACK (fm_install
)
2125 "ActionPopupBuildClean", NULL
,
2128 G_CALLBACK (fm_clean
)
2131 "ActionPopupPMBuild", NULL
,
2132 N_("_Build"), NULL
, NULL
, NULL
2135 "ActionPopupPMBuildCompile", GTK_STOCK_CONVERT
,
2136 N_("_Compile"), NULL
,
2138 G_CALLBACK (pm_compile
)
2141 "ActionPopupPMBuildBuild", GTK_STOCK_EXECUTE
,
2144 G_CALLBACK (pm_build
)
2147 "ActionPopupPMBuildInstall", NULL
,
2148 N_("_Install"), NULL
,
2149 N_("Install module"),
2150 G_CALLBACK (pm_install
)
2153 "ActionPopupPMBuildClean", NULL
,
2156 G_CALLBACK (pm_clean
)
2159 "ActionPopupMVBuildCancel", NULL
,
2160 N_("_Cancel command"), NULL
,
2161 N_("Cancel build command"),
2162 G_CALLBACK (mv_cancel
)
2167 directory_has_makefile (const gchar
*dirname
)
2170 gboolean makefile_exists
;
2172 makefile_exists
= TRUE
;
2173 makefile
= g_build_filename (dirname
, "Makefile", NULL
);
2174 if (!g_file_test (makefile
, G_FILE_TEST_EXISTS
))
2177 makefile
= g_build_filename (dirname
, "makefile", NULL
);
2178 if (!g_file_test (makefile
, G_FILE_TEST_EXISTS
))
2181 makefile
= g_build_filename (dirname
, "MAKEFILE", NULL
);
2182 if (!g_file_test (makefile
, G_FILE_TEST_EXISTS
))
2184 makefile_exists
= FALSE
;
2189 return makefile_exists
;
2193 directory_has_file (const gchar
*dirname
, const gchar
*filename
)
2199 filepath
= g_build_filename (dirname
, filename
, NULL
);
2200 if (!g_file_test (filepath
, G_FILE_TEST_EXISTS
))
2208 escape_label (const gchar
*str
)
2213 ret
= g_string_new ("");
2215 while (*iter
!= '\0')
2219 ret
= g_string_append (ret
, "__");
2228 iter
= g_utf8_next_char (iter
);
2231 ret
= g_string_append_len (ret
, start
, end
- start
);
2234 return g_string_free (ret
, FALSE
);
2238 update_module_ui (BasicAutotoolsPlugin
*bb_plugin
)
2242 gchar
*filename
= NULL
;
2243 gchar
*module
= NULL
;
2245 gboolean has_file
= FALSE
;
2246 gboolean has_makefile
= FALSE
;
2248 ui
= anjuta_shell_get_ui (ANJUTA_PLUGIN (bb_plugin
)->shell
, NULL
);
2250 DEBUG_PRINT ("Updating module UI");
2252 has_file
= bb_plugin
->current_editor_filename
!= NULL
;
2256 gchar
*build_dirname
;
2258 dirname
= g_dirname (bb_plugin
->current_editor_filename
);
2259 build_dirname
= target_from_source (bb_plugin
, dirname
);
2261 module
= escape_label (g_basename (dirname
));
2262 filename
= escape_label (g_basename (bb_plugin
->current_editor_filename
));
2263 has_makefile
= directory_has_makefile (build_dirname
);
2264 g_free (build_dirname
);
2268 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2269 "ActionBuildBuildModule");
2270 label
= g_strdup_printf (module
? _("_Build (%s)") : _("_Build"), module
);
2271 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
,
2272 "label", label
, NULL
);
2275 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2276 "ActionBuildInstallModule");
2277 label
= g_strdup_printf (module
? _("_Install (%s)") : _("_Install"), module
);
2278 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
,
2279 "label", label
, NULL
);
2282 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2283 "ActionBuildCleanModule");
2284 label
= g_strdup_printf (module
? _("_Clean (%s)") : _("_Clean"), module
);
2285 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
,
2286 "label", label
, NULL
);
2290 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2291 "ActionBuildCompileFile");
2292 label
= g_strdup_printf (filename
? _("Co_mpile (%s)") : _("Co_mpile"), filename
);
2293 g_object_set (G_OBJECT (action
), "sensitive", has_file
,
2294 "label", label
, NULL
);
2302 update_project_ui (BasicAutotoolsPlugin
*bb_plugin
)
2306 gboolean has_makefile
;
2307 gboolean has_project
;
2309 DEBUG_PRINT ("Updating project UI");
2311 has_project
= bb_plugin
->project_root_dir
!= NULL
;
2312 has_makefile
= has_project
&& directory_has_makefile (bb_plugin
->project_build_dir
);
2314 ui
= anjuta_shell_get_ui (ANJUTA_PLUGIN (bb_plugin
)->shell
, NULL
);
2315 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2316 "ActionBuildBuildProject");
2317 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
, NULL
);
2318 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2319 "ActionBuildInstallProject");
2320 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
, NULL
);
2321 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2322 "ActionBuildCleanProject");
2323 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
, NULL
);
2324 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2325 "ActionBuildDistribution");
2326 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
, NULL
);
2327 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2328 "ActionBuildConfigure");
2329 g_object_set (G_OBJECT (action
), "sensitive", has_project
, NULL
);
2330 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2331 "ActionBuildSelectConfiguration");
2332 g_object_set (G_OBJECT (action
), "sensitive", has_project
, NULL
);
2333 action
= anjuta_ui_get_action (ui
, "ActionGroupBuild",
2334 "ActionBuildRemoveConfiguration");
2335 g_object_set (G_OBJECT (action
), "sensitive", has_makefile
, NULL
);
2337 update_module_ui (bb_plugin
);
2341 on_session_save (AnjutaShell
*shell
, AnjutaSessionPhase phase
,
2342 AnjutaSession
*session
, BasicAutotoolsPlugin
*plugin
)
2344 GList
*configurations
;
2345 BuildConfiguration
*cfg
;
2348 if (phase
!= ANJUTA_SESSION_PHASE_NORMAL
)
2351 configurations
= build_configuration_list_to_string_list (plugin
->configurations
);
2352 anjuta_session_set_string_list (session
, "Build",
2353 "Configuration list",
2355 g_list_foreach (configurations
, (GFunc
)g_free
, NULL
);
2356 g_list_free (configurations
);
2358 cfg
= build_configuration_list_get_selected (plugin
->configurations
);
2361 name
= build_configuration_get_name (cfg
);
2362 anjuta_session_set_string (session
, "Build", "Selected Configuration", name
);
2367 on_session_load (AnjutaShell
*shell
, AnjutaSessionPhase phase
,
2368 AnjutaSession
*session
, BasicAutotoolsPlugin
*plugin
)
2370 GList
*configurations
;
2373 if (phase
!= ANJUTA_SESSION_PHASE_NORMAL
)
2376 configurations
= anjuta_session_get_string_list (session
, "Build",
2377 "Configuration list");
2379 build_configuration_list_from_string_list (plugin
->configurations
, configurations
);
2380 g_list_foreach (configurations
, (GFunc
)g_free
, NULL
);
2381 g_list_free (configurations
);
2383 selected
= anjuta_session_get_string (session
, "Build", "Selected Configuration");
2384 build_configuration_list_select (plugin
->configurations
, selected
);
2387 build_project_configured (G_OBJECT (plugin
), NULL
, NULL
, NULL
);
2391 value_added_fm_current_file (AnjutaPlugin
*plugin
, const char *name
,
2392 const GValue
*value
, gpointer data
)
2397 GFileInfo
* file_info
;
2400 gboolean makefile_exists
, is_dir
;
2402 file
= g_value_get_object (value
);
2403 filename
= g_file_get_path (file
);
2404 g_return_if_fail (filename
!= NULL
);
2406 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2407 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2409 if (ba_plugin
->fm_current_filename
)
2410 g_free (ba_plugin
->fm_current_filename
);
2411 ba_plugin
->fm_current_filename
= filename
;
2413 file_info
= g_file_query_info (file
, G_FILE_ATTRIBUTE_STANDARD_TYPE
,
2414 G_FILE_QUERY_INFO_NONE
, NULL
, NULL
);
2415 is_dir
= (g_file_info_get_file_type(file_info
) == G_FILE_TYPE_DIRECTORY
);
2417 dirname
= g_strdup (filename
);
2419 dirname
= g_path_get_dirname (filename
);
2420 makefile_exists
= directory_has_makefile (dirname
);
2423 if (!makefile_exists
)
2426 action
= anjuta_ui_get_action (ui
, "ActionGroupPopupBuild", "ActionPopupBuild");
2427 g_object_set (G_OBJECT (action
), "sensitive", TRUE
, NULL
);
2428 action
= anjuta_ui_get_action (ui
, "ActionGroupPopupBuild",
2429 "ActionPopupBuildCompile");
2431 g_object_set (G_OBJECT (action
), "sensitive", FALSE
, NULL
);
2433 g_object_set (G_OBJECT (action
), "sensitive", TRUE
, NULL
);
2437 value_removed_fm_current_file (AnjutaPlugin
*plugin
,
2438 const char *name
, gpointer data
)
2442 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2444 if (ba_plugin
->fm_current_filename
)
2445 g_free (ba_plugin
->fm_current_filename
);
2446 ba_plugin
->fm_current_filename
= NULL
;
2448 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2449 action
= anjuta_ui_get_action (ui
, "ActionGroupPopupBuild", "ActionPopupBuild");
2450 g_object_set (G_OBJECT (action
), "sensitive", FALSE
, NULL
);
2454 value_added_pm_current_uri (AnjutaPlugin
*plugin
, const char *name
,
2455 const GValue
*value
, gpointer data
)
2460 gchar
*dirname
, *filename
;
2461 gboolean makefile_exists
, is_dir
;
2464 uri
= g_value_get_string (value
);
2465 file
= g_file_new_for_uri (uri
);
2466 filename
= g_file_get_path (file
);
2467 g_object_unref (file
);
2468 g_return_if_fail (filename
!= NULL
);
2471 if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
2475 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2476 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2478 if (ba_plugin
->pm_current_filename
)
2479 g_free (ba_plugin
->pm_current_filename
);
2480 ba_plugin
->pm_current_filename
= filename
;
2482 is_dir
= g_file_test (filename
, G_FILE_TEST_IS_DIR
);
2484 dirname
= g_strdup (filename
);
2486 dirname
= g_path_get_dirname (filename
);
2487 makefile_exists
= directory_has_makefile (dirname
);
2490 if (!makefile_exists
)
2493 action
= anjuta_ui_get_action (ui
, "ActionGroupPopupBuild", "ActionPopupPMBuild");
2494 g_object_set (G_OBJECT (action
), "sensitive", TRUE
, NULL
);
2495 action
= anjuta_ui_get_action (ui
, "ActionGroupPopupBuild",
2496 "ActionPopupPMBuildCompile");
2498 g_object_set (G_OBJECT (action
), "sensitive", FALSE
, NULL
);
2500 g_object_set (G_OBJECT (action
), "sensitive", TRUE
, NULL
);
2504 value_removed_pm_current_uri (AnjutaPlugin
*plugin
,
2505 const char *name
, gpointer data
)
2509 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2511 if (ba_plugin
->pm_current_filename
)
2512 g_free (ba_plugin
->pm_current_filename
);
2513 ba_plugin
->pm_current_filename
= NULL
;
2515 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2516 action
= anjuta_ui_get_action (ui
, "ActionGroupPopupBuild", "ActionPopupPMBuild");
2517 g_object_set (G_OBJECT (action
), "sensitive", FALSE
, NULL
);
2521 value_added_project_root_uri (AnjutaPlugin
*plugin
, const gchar
*name
,
2522 const GValue
*value
, gpointer user_data
)
2524 BasicAutotoolsPlugin
*bb_plugin
;
2525 const gchar
*root_uri
;
2527 bb_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2529 g_free (bb_plugin
->project_root_dir
);
2530 bb_plugin
->project_root_dir
= NULL
;
2532 root_uri
= g_value_get_string (value
);
2535 GFile
* file
= g_file_new_for_uri (root_uri
);
2536 bb_plugin
->project_root_dir
=
2537 g_file_get_path(file
);
2538 g_object_unref (file
);
2541 build_configuration_list_set_project_uri (bb_plugin
->configurations
, root_uri
);
2543 /* Export project build uri */
2544 anjuta_shell_add_value (ANJUTA_PLUGIN(plugin
)->shell
,
2545 IANJUTA_BUILDER_ROOT_URI
,
2548 update_project_ui (bb_plugin
);
2552 value_removed_project_root_uri (AnjutaPlugin
*plugin
, const gchar
*name
,
2555 BasicAutotoolsPlugin
*bb_plugin
;
2557 bb_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2559 g_free (bb_plugin
->project_root_dir
);
2560 g_free (bb_plugin
->project_build_dir
);
2561 g_free (bb_plugin
->program_args
);
2563 bb_plugin
->run_in_terminal
= TRUE
;
2564 bb_plugin
->program_args
= NULL
;
2565 bb_plugin
->project_build_dir
= NULL
;
2566 bb_plugin
->project_root_dir
= NULL
;
2568 build_configuration_list_set_project_uri (bb_plugin
->configurations
, NULL
);
2570 /* Export project build uri */
2571 anjuta_shell_remove_value (ANJUTA_PLUGIN (plugin
)->shell
,
2572 IANJUTA_BUILDER_ROOT_URI
, NULL
);
2574 update_project_ui (bb_plugin
);
2578 value_added_project_build_uri (AnjutaPlugin
*plugin
, const gchar
*name
,
2579 const GValue
*value
, gpointer user_data
)
2581 BasicAutotoolsPlugin
*bb_plugin
;
2582 const gchar
*build_uri
;
2584 bb_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2586 g_free (bb_plugin
->project_build_dir
);
2587 bb_plugin
->project_build_dir
= NULL
;
2589 build_uri
= g_value_get_string (value
);
2592 GFile
* file
= g_file_new_for_uri (build_uri
);
2593 bb_plugin
->project_build_dir
=
2594 g_file_get_path(file
);
2595 g_object_unref (file
);
2597 update_project_ui (bb_plugin
);
2601 on_update_indicators_idle (gpointer data
)
2603 AnjutaPlugin
*plugin
= ANJUTA_PLUGIN (data
);
2604 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (data
);
2605 IAnjutaEditor
*editor
= ba_plugin
->current_editor
;
2607 /* If indicators are not yet updated in the editor, do it */
2608 if (ba_plugin
->current_editor_filename
&&
2609 IANJUTA_IS_INDICABLE (editor
) &&
2610 anjuta_preferences_get_int (anjuta_shell_get_preferences (plugin
->shell
,
2612 PREF_INDICATORS_AUTOMATIC
))
2615 node
= ba_plugin
->contexts_pool
;
2618 BuildContext
*context
= node
->data
;
2619 if (g_hash_table_lookup (context
->indicators_updated_editors
,
2623 ianjuta_indicable_clear (IANJUTA_INDICABLE (editor
), NULL
);
2626 loc_node
= context
->locations
;
2629 build_indicator_location_set ((BuildIndicatorLocation
*) loc_node
->data
,
2630 IANJUTA_EDITOR (editor
), ba_plugin
->current_editor_filename
);
2631 loc_node
= g_slist_next (loc_node
);
2633 g_hash_table_insert (context
->indicators_updated_editors
,
2636 node
= g_list_next (node
);
2643 on_editor_destroy (IAnjutaEditor
*editor
, BasicAutotoolsPlugin
*ba_plugin
)
2645 g_hash_table_remove (ba_plugin
->editors_created
, editor
);
2649 on_editor_changed (IAnjutaEditor
*editor
, IAnjutaIterable
*position
,
2650 gboolean added
, gint length
, gint lines
, const gchar
*text
,
2651 BasicAutotoolsPlugin
*ba_plugin
)
2654 IAnjutaIterable
*begin_pos
, *end_pos
;
2655 if (g_hash_table_lookup (ba_plugin
->editors_created
,
2658 line
= ianjuta_editor_get_line_from_position (editor
, position
, NULL
);
2659 begin_pos
= ianjuta_editor_get_line_begin_position (editor
, line
, NULL
);
2660 end_pos
= ianjuta_editor_get_line_end_position (editor
, line
, NULL
);
2661 if (IANJUTA_IS_INDICABLE (editor
))
2663 DEBUG_PRINT ("Clearing indicator on line %d", line
);
2664 ianjuta_indicable_set (IANJUTA_INDICABLE (editor
), begin_pos
,
2665 end_pos
, IANJUTA_INDICABLE_NONE
, NULL
);
2667 DEBUG_PRINT ("Editor changed: line number = %d, added = %d,"
2668 " text length = %d, number of lines = %d",
2669 line
, added
, length
, lines
);
2670 g_object_unref (begin_pos
);
2671 g_object_unref (end_pos
);
2675 value_added_current_editor (AnjutaPlugin
*plugin
, const char *name
,
2676 const GValue
*value
, gpointer data
)
2682 editor
= g_value_get_object (value
);
2684 if (!IANJUTA_IS_EDITOR(editor
))
2687 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2688 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2690 g_free (ba_plugin
->current_editor_filename
);
2691 ba_plugin
->current_editor_filename
= NULL
;
2692 ba_plugin
->current_editor
= IANJUTA_EDITOR (editor
);
2694 if (g_hash_table_lookup (ba_plugin
->editors_created
,
2695 ba_plugin
->current_editor
) == NULL
)
2697 g_hash_table_insert (ba_plugin
->editors_created
,
2698 ba_plugin
->current_editor
,
2699 ba_plugin
->current_editor
);
2700 g_signal_connect (ba_plugin
->current_editor
, "destroy",
2701 G_CALLBACK (on_editor_destroy
), plugin
);
2702 g_signal_connect (ba_plugin
->current_editor
, "changed",
2703 G_CALLBACK (on_editor_changed
), plugin
);
2706 file
= ianjuta_file_get_file (IANJUTA_FILE (editor
), NULL
);
2711 filename
= g_file_get_path(file
);
2712 g_object_unref (file
);
2713 g_return_if_fail (filename
!= NULL
);
2714 ba_plugin
->current_editor_filename
= filename
;
2715 update_module_ui (ba_plugin
);
2717 g_idle_add (on_update_indicators_idle
, plugin
);
2721 value_removed_current_editor (AnjutaPlugin
*plugin
,
2722 const char *name
, gpointer data
)
2724 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2726 if (ba_plugin
->indicators_updated_editors
&&
2727 g_hash_table_lookup (ba_plugin
->indicators_updated_editors
,
2728 ba_plugin
->current_editor
))
2730 g_hash_table_remove (ba_plugin
->indicators_updated_editors
,
2731 ba_plugin
->current_editor
);
2734 if (ba_plugin
->current_editor_filename
)
2735 g_free (ba_plugin
->current_editor_filename
);
2736 ba_plugin
->current_editor_filename
= NULL
;
2737 ba_plugin
->current_editor
= NULL
;
2739 update_module_ui (ba_plugin
);
2743 activate_plugin (AnjutaPlugin
*plugin
)
2746 static gboolean initialized
= FALSE
;
2747 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2749 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2751 g_signal_connect (plugin
->shell
, "save-session",
2752 G_CALLBACK (on_session_save
),
2754 g_signal_connect (plugin
->shell
, "load-session",
2755 G_CALLBACK (on_session_load
),
2758 /* Add action group */
2759 ba_plugin
->build_action_group
=
2760 anjuta_ui_add_action_group_entries (ui
,
2762 _("Build commands"),
2764 sizeof(build_actions
)/sizeof(GtkActionEntry
),
2765 GETTEXT_PACKAGE
, TRUE
, plugin
);
2766 ba_plugin
->build_popup_action_group
=
2767 anjuta_ui_add_action_group_entries (ui
,
2768 "ActionGroupPopupBuild",
2769 _("Build popup commands"),
2770 build_popup_actions
,
2771 sizeof(build_popup_actions
)/sizeof(GtkActionEntry
),
2772 GETTEXT_PACKAGE
, FALSE
, plugin
);
2774 ba_plugin
->build_merge_id
= anjuta_ui_merge (ui
, UI_FILE
);
2776 ba_plugin
->configuration_menu
= gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui
),
2777 "/MenuMain/PlaceHolderBuildMenus/MenuBuild/SelectConfiguration");
2778 update_project_ui (ba_plugin
);
2781 ba_plugin
->fm_watch_id
=
2782 anjuta_plugin_add_watch (plugin
, IANJUTA_FILE_MANAGER_SELECTED_FILE
,
2783 value_added_fm_current_file
,
2784 value_removed_fm_current_file
, NULL
);
2785 ba_plugin
->pm_watch_id
=
2786 anjuta_plugin_add_watch (plugin
, IANJUTA_PROJECT_MANAGER_CURRENT_URI
,
2787 value_added_pm_current_uri
,
2788 value_removed_pm_current_uri
, NULL
);
2789 ba_plugin
->project_root_watch_id
=
2790 anjuta_plugin_add_watch (plugin
, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI
,
2791 value_added_project_root_uri
,
2792 value_removed_project_root_uri
, NULL
);
2793 ba_plugin
->project_build_watch_id
=
2794 anjuta_plugin_add_watch (plugin
, IANJUTA_BUILDER_ROOT_URI
,
2795 value_added_project_build_uri
,
2797 ba_plugin
->editor_watch_id
=
2798 anjuta_plugin_add_watch (plugin
, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT
,
2799 value_added_current_editor
,
2800 value_removed_current_editor
, NULL
);
2807 deactivate_plugin (AnjutaPlugin
*plugin
)
2810 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin
);
2812 ui
= anjuta_shell_get_ui (plugin
->shell
, NULL
);
2814 g_signal_handlers_disconnect_by_func (plugin
->shell
,
2815 G_CALLBACK (on_session_save
),
2817 g_signal_handlers_disconnect_by_func (plugin
->shell
,
2818 G_CALLBACK (on_session_load
),
2821 /* Remove watches */
2822 anjuta_plugin_remove_watch (plugin
, ba_plugin
->fm_watch_id
, TRUE
);
2823 anjuta_plugin_remove_watch (plugin
, ba_plugin
->pm_watch_id
, TRUE
);
2824 anjuta_plugin_remove_watch (plugin
, ba_plugin
->project_root_watch_id
, TRUE
);
2825 anjuta_plugin_remove_watch (plugin
, ba_plugin
->project_build_watch_id
, TRUE
);
2826 anjuta_plugin_remove_watch (plugin
, ba_plugin
->editor_watch_id
, TRUE
);
2829 anjuta_ui_unmerge (ui
, ba_plugin
->build_merge_id
);
2831 /* Remove action group */
2832 anjuta_ui_remove_action_group (ui
, ba_plugin
->build_action_group
);
2833 anjuta_ui_remove_action_group (ui
, ba_plugin
->build_popup_action_group
);
2838 dispose (GObject
*obj
)
2840 G_OBJECT_CLASS (parent_class
)->dispose (obj
);
2844 finalize (GObject
*obj
)
2847 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (obj
);
2849 for (i
= 0; i
< IANJUTA_BUILDABLE_N_COMMANDS
; i
++)
2851 g_free (ba_plugin
->commands
[i
]);
2852 ba_plugin
->commands
[i
] = NULL
;
2855 g_free (ba_plugin
->fm_current_filename
);
2856 g_free (ba_plugin
->pm_current_filename
);
2857 g_free (ba_plugin
->project_root_dir
);
2858 g_free (ba_plugin
->project_build_dir
);
2859 g_free (ba_plugin
->current_editor_filename
);
2860 g_free (ba_plugin
->program_args
);
2861 build_configuration_list_free (ba_plugin
->configurations
);
2863 ba_plugin
->fm_current_filename
= NULL
;
2864 ba_plugin
->pm_current_filename
= NULL
;
2865 ba_plugin
->project_root_dir
= NULL
;
2866 ba_plugin
->project_build_dir
= NULL
;
2867 ba_plugin
->current_editor_filename
= NULL
;
2868 ba_plugin
->program_args
= NULL
;
2869 ba_plugin
->configurations
= NULL
;
2871 G_OBJECT_CLASS (parent_class
)->finalize (obj
);
2875 basic_autotools_plugin_instance_init (GObject
*obj
)
2878 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (obj
);
2880 for (i
= 0; i
< IANJUTA_BUILDABLE_N_COMMANDS
; i
++)
2881 ba_plugin
->commands
[i
] = NULL
;
2883 ba_plugin
->fm_current_filename
= NULL
;
2884 ba_plugin
->pm_current_filename
= NULL
;
2885 ba_plugin
->project_root_dir
= NULL
;
2886 ba_plugin
->project_build_dir
= NULL
;
2887 ba_plugin
->current_editor
= NULL
;
2888 ba_plugin
->current_editor_filename
= NULL
;
2889 ba_plugin
->contexts_pool
= NULL
;
2890 ba_plugin
->configurations
= build_configuration_list_new ();
2891 ba_plugin
->program_args
= NULL
;
2892 ba_plugin
->run_in_terminal
= TRUE
;
2893 ba_plugin
->last_exec_uri
= NULL
;
2894 ba_plugin
->editors_created
= g_hash_table_new (g_direct_hash
,
2899 basic_autotools_plugin_class_init (GObjectClass
*klass
)
2901 AnjutaPluginClass
*plugin_class
= ANJUTA_PLUGIN_CLASS (klass
);
2903 parent_class
= g_type_class_peek_parent (klass
);
2905 plugin_class
->activate
= activate_plugin
;
2906 plugin_class
->deactivate
= deactivate_plugin
;
2907 klass
->dispose
= dispose
;
2908 klass
->finalize
= finalize
;
2913 ibuildable_compile (IAnjutaBuildable
*manager
, const gchar
* filename
,
2916 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2917 build_compile_file_real (plugin
, filename
);
2922 ibuildable_set_command (IAnjutaBuildable
*manager
,
2923 IAnjutaBuildableCommand command_id
,
2924 const gchar
*command_override
, GError
**err
)
2926 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2927 if (plugin
->commands
[command_id
])
2928 g_free (plugin
->commands
[command_id
]);
2929 plugin
->commands
[command_id
] = g_strdup (command_override
);
2933 ibuildable_reset_commands (IAnjutaBuildable
*manager
, GError
**err
)
2936 BasicAutotoolsPlugin
*ba_plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2938 for (i
= 0; i
< IANJUTA_BUILDABLE_N_COMMANDS
; i
++)
2940 g_free (ba_plugin
->commands
[i
]);
2941 ba_plugin
->commands
[i
] = NULL
;
2945 static const gchar
*
2946 ibuildable_get_command (IAnjutaBuildable
*manager
,
2947 IAnjutaBuildableCommand command_id
,
2950 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2951 return plugin
->commands
[command_id
];
2955 ibuildable_build (IAnjutaBuildable
*manager
, const gchar
*directory
,
2958 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2959 build_execute_command (plugin
, directory
,
2960 CHOOSE_COMMAND (plugin
, BUILD
),
2965 ibuildable_clean (IAnjutaBuildable
*manager
, const gchar
*directory
,
2968 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2969 build_execute_command (plugin
, directory
,
2970 CHOOSE_COMMAND (plugin
, CLEAN
),
2975 ibuildable_install (IAnjutaBuildable
*manager
, const gchar
*directory
,
2978 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2979 gchar
* root
= get_root_install_command(plugin
);
2980 gchar
* command
= g_strdup_printf ("%s %s", root
,
2981 CHOOSE_COMMAND (plugin
, INSTALL
));
2983 build_execute_command (plugin
, directory
, command
, TRUE
, NULL
);
2988 ibuildable_configure (IAnjutaBuildable
*manager
, const gchar
*directory
,
2991 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
2992 build_execute_command (plugin
, directory
,
2993 CHOOSE_COMMAND (plugin
, CONFIGURE
),
2998 ibuildable_generate (IAnjutaBuildable
*manager
, const gchar
*directory
,
3001 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
3002 if (directory_has_file (plugin
->project_root_dir
, "autogen.sh"))
3004 build_execute_command (plugin
, directory
,
3005 CHOOSE_COMMAND (plugin
, GENERATE
),
3010 /* FIXME: get override command for this too */
3011 build_execute_command (plugin
, directory
,
3012 "autoreconf -i --force",
3018 ibuildable_execute (IAnjutaBuildable
*manager
, const gchar
*uri
,
3021 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (manager
);
3022 if (uri
&& strlen (uri
) > 0)
3023 execute_program (plugin
, uri
);
3025 execute_program (plugin
, NULL
);
3029 ibuildable_iface_init (IAnjutaBuildableIface
*iface
)
3031 /* iface->compile = ibuildable_compile; */
3032 iface
->set_command
= ibuildable_set_command
;
3033 iface
->get_command
= ibuildable_get_command
;
3034 iface
->reset_commands
= ibuildable_reset_commands
;
3035 iface
->build
= ibuildable_build
;
3036 iface
->clean
= ibuildable_clean
;
3037 iface
->install
= ibuildable_install
;
3038 iface
->configure
= ibuildable_configure
;
3039 iface
->generate
= ibuildable_generate
;
3040 iface
->execute
= ibuildable_execute
;
3044 ifile_open (IAnjutaFile
*manager
, GFile
* file
,
3047 gchar
* uri
= g_file_get_uri (file
);
3048 ianjuta_buildable_execute (IANJUTA_BUILDABLE (manager
), uri
, NULL
);
3053 ifile_get_file (IAnjutaFile
*manager
, GError
**err
)
3055 DEBUG_PRINT ("Unsupported operation");
3060 ifile_iface_init (IAnjutaFileIface
*iface
)
3062 iface
->open
= ifile_open
;
3063 iface
->get_file
= ifile_get_file
;
3067 /* IAnjutaBuilder implementation
3068 *---------------------------------------------------------------------------*/
3070 static IAnjutaBuilderHandle
3071 ibuilder_is_built (IAnjutaBuilder
*builder
, const gchar
*uri
,
3072 IAnjutaBuilderCallback callback
, gpointer user_data
,
3075 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (builder
);
3076 BuildContext
*context
;
3080 gchar
**args
= g_new0 (gchar
*, 2);
3081 GFile
* file
= g_file_new_for_uri (uri
);
3083 filename
= g_file_get_path (file
);
3084 g_object_unref (file
);
3085 if (filename
== NULL
) return NULL
;
3086 args
[0] = g_path_get_basename (filename
);
3087 dirname
= g_path_get_dirname (filename
);
3089 argv
= build_argv_command (NULL
, CHOOSE_COMMAND (plugin
, IS_BUILT
), args
);
3091 context
= build_execute_command_full (plugin
, dirname
, argv
,
3093 callback
, user_data
, err
);
3096 return (IAnjutaBuilderHandle
)context
;
3099 static IAnjutaBuilderHandle
3100 ibuilder_build (IAnjutaBuilder
*builder
, const gchar
*uri
,
3101 IAnjutaBuilderCallback callback
, gpointer user_data
,
3104 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (builder
);
3105 BuildContext
*context
;
3109 gchar
**args
= g_new0 (gchar
*, 2);
3110 GFile
* file
= g_file_new_for_uri (uri
);
3112 filename
= g_file_get_path (file
);
3113 g_object_unref (file
);
3114 if (filename
== NULL
) return NULL
;
3115 args
[0] = g_path_get_basename (filename
);
3116 dirname
= g_path_get_dirname (filename
);
3118 argv
= build_argv_command (NULL
, CHOOSE_COMMAND (plugin
, BUILD
), args
);
3120 context
= build_execute_command_full (plugin
, dirname
, argv
,
3122 callback
, user_data
, err
);
3125 return (IAnjutaBuilderHandle
)context
;
3129 ibuilder_cancel (IAnjutaBuilder
*builder
, IAnjutaBuilderHandle handle
, GError
**err
)
3131 BasicAutotoolsPlugin
*plugin
= ANJUTA_PLUGIN_BASIC_AUTOTOOLS (builder
);
3133 build_cancel_command (plugin
, (BuildContext
*)handle
, err
);
3137 ibuilder_iface_init (IAnjutaBuilderIface
*iface
)
3139 iface
->is_built
= ibuilder_is_built
;
3140 iface
->build
= ibuilder_build
;
3141 iface
->cancel
= ibuilder_cancel
;
3144 /* IAnjutaPreferences implementation
3145 *---------------------------------------------------------------------------*/
3147 static GladeXML
*gxml
;
3150 ipreferences_merge(IAnjutaPreferences
* ipref
, AnjutaPreferences
* prefs
, GError
** e
)
3152 GtkWidget
*root_check
;
3155 /* Create the preferences page */
3156 gxml
= glade_xml_new (GLADE_FILE
, BUILD_PREFS_DIALOG
, NULL
);
3157 root_check
= glade_xml_get_widget(gxml
, INSTALL_ROOT_CHECK
);
3158 entry
= glade_xml_get_widget(gxml
, INSTALL_ROOT_ENTRY
);
3159 g_signal_connect(G_OBJECT(root_check
), "toggled", G_CALLBACK(on_root_check_toggled
), entry
);
3160 on_root_check_toggled (root_check
, entry
);
3161 root_check
= glade_xml_get_widget(gxml
, PARALLEL_MAKE_CHECK
);
3162 entry
= glade_xml_get_widget(gxml
, PARALLEL_MAKE_SPIN
);
3163 g_signal_connect(G_OBJECT(root_check
), "toggled", G_CALLBACK(on_root_check_toggled
), entry
);
3164 on_root_check_toggled (root_check
, entry
);
3166 anjuta_preferences_add_page (prefs
, gxml
, BUILD_PREFS_ROOT
, _("Build Autotools"), ICON_FILE
);
3170 ipreferences_unmerge(IAnjutaPreferences
* ipref
, AnjutaPreferences
* prefs
, GError
** e
)
3172 GtkWidget
*root_check
;
3175 root_check
= glade_xml_get_widget(gxml
, INSTALL_ROOT_CHECK
);
3176 entry
= glade_xml_get_widget(gxml
, INSTALL_ROOT_ENTRY
);
3177 g_signal_handlers_disconnect_by_func(G_OBJECT(root_check
),
3178 G_CALLBACK(on_root_check_toggled
), entry
);
3179 root_check
= glade_xml_get_widget(gxml
, PARALLEL_MAKE_CHECK
);
3180 entry
= glade_xml_get_widget(gxml
, PARALLEL_MAKE_SPIN
);
3181 g_signal_handlers_disconnect_by_func(G_OBJECT(root_check
),
3182 G_CALLBACK(on_root_check_toggled
), entry
);
3184 anjuta_preferences_remove_page(prefs
, _("Build Autotools"));
3186 g_object_unref (gxml
);
3190 ipreferences_iface_init(IAnjutaPreferencesIface
* iface
)
3192 iface
->merge
= ipreferences_merge
;
3193 iface
->unmerge
= ipreferences_unmerge
;
3196 ANJUTA_PLUGIN_BEGIN (BasicAutotoolsPlugin
, basic_autotools_plugin
);
3197 ANJUTA_PLUGIN_ADD_INTERFACE (ibuilder
, IANJUTA_TYPE_BUILDER
);
3198 ANJUTA_PLUGIN_ADD_INTERFACE (ibuildable
, IANJUTA_TYPE_BUILDABLE
);
3199 ANJUTA_PLUGIN_ADD_INTERFACE (ifile
, IANJUTA_TYPE_FILE
);
3200 ANJUTA_PLUGIN_ADD_INTERFACE (ipreferences
, IANJUTA_TYPE_PREFERENCES
);
3203 ANJUTA_SIMPLE_PLUGIN (BasicAutotoolsPlugin
, basic_autotools_plugin
);