From a513128d767813e2360573ad58843deb087079c2 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 1 Aug 2006 06:36:16 -0500 Subject: [PATCH] Install library, python module, and headers --- configure.ac | 1 + m4/Makefile.am | 1 - m4/moo-dirs.m4 | 2 - m4/moo-flags.m4 | 1 - m4/moo-gtkhtml.m4 | 39 ------------ moo.kdevelop | 14 ++--- moo/Makefile.am | 41 +++++++++++- moo/moo.h | 2 - moo/moo.pc.in | 5 +- moo/mooapp/Makefile.am | 5 ++ moo/mooedit/Makefile.am | 6 ++ moo/mooedit/mootextfind.c | 24 +++---- moo/mooedit/mootextsearch-private.h | 74 ++++++++++++++++++++++ moo/mooedit/mootextsearch.c | 98 ++++++++++++++--------------- moo/mooedit/mootextsearch.h | 48 -------------- moo/moopython/Makefile.am | 14 ++++- moo/moopython/mooplugin-python.c | 28 ++++++++- moo/mooscript/Makefile.am | 5 ++ moo/mooterm/Makefile.am | 5 ++ moo/mooutils/Makefile.am | 9 ++- tests/medit-app.c | 7 +-- tests/medit-app.opag | 7 +-- 22 files changed, 251 insertions(+), 185 deletions(-) delete mode 100644 m4/moo-gtkhtml.m4 create mode 100644 moo/mooedit/mootextsearch-private.h diff --git a/configure.ac b/configure.ac index 586941bc..8b867a4f 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,7 @@ MOO_COMPONENTS MOO_AC_RELOC MOO_AC_SET_DIRS(moo) MOO_AC_FLAGS +AM_CONDITIONAL(MOO_INSTALL_LIB, true) ################################################################################ diff --git a/m4/Makefile.am b/m4/Makefile.am index 9a7bf403..21a1c274 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = \ moo-flags.m4 \ moo-funcs.m4 \ moo-gtk.m4 \ - moo-gtkhtml.m4 \ moo-os.m4 \ moo-pcre.m4 \ moo-progs.m4 \ diff --git a/m4/moo-dirs.m4 b/m4/moo-dirs.m4 index 6324ec9a..6d17e498 100644 --- a/m4/moo-dirs.m4 +++ b/m4/moo-dirs.m4 @@ -17,8 +17,6 @@ AC_DEFUN([MOO_AC_SET_DIRS],[ MOO_TEXT_LANG_FILES_DIR="${MOO_DATA_DIR}/syntax" AC_SUBST(MOO_TEXT_LANG_FILES_DIR) - moo_libincludedir=${MOO_LIB_DIR}/include moo_includedir=${includedir}/$1 - AC_SUBST(moo_libincludedir) AC_SUBST(moo_includedir) ]) diff --git a/m4/moo-flags.m4 b/m4/moo-flags.m4 index d99764be..26396c12 100644 --- a/m4/moo-flags.m4 +++ b/m4/moo-flags.m4 @@ -5,7 +5,6 @@ AC_DEFUN([MOO_AC_FLAGS],[ AC_REQUIRE([MOO_AC_FAM]) AC_REQUIRE([MOO_PKG_CHECK_GTK_VERSIONS]) AC_REQUIRE([MOO_AC_SET_DIRS]) - AC_REQUIRE([MOO_AC_GTKHTML]) moo_top_src_dir=`cd $srcdir && pwd` MOO_CFLAGS="$MOO_CFLAGS -I$moo_top_src_dir/moo $GTK_CFLAGS $MOO_PCRE_CFLAGS -DXDG_PREFIX=_moo_edit_xdg -DG_LOG_DOMAIN=\\\"Moo\\\"" diff --git a/m4/moo-gtkhtml.m4 b/m4/moo-gtkhtml.m4 deleted file mode 100644 index d81f1774..00000000 --- a/m4/moo-gtkhtml.m4 +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################## -# MOO_AC_GTKHTML() -# -# AC_DEFUN([MOO_AC_GTKHTML],[ -# MOO_USE_GTKHTML=auto -# -# AC_ARG_WITH([gtkhtml], -# AC_HELP_STRING([--with-gtkhtml], [whether to use gtkhtml (default = AUTO)]),[ -# if test x$with_gtkhtml = "xyes"; then -# MOO_USE_GTKHTML="yes" -# else -# MOO_USE_GTKHTML="no" -# fi -# ]) -# -# if test x$MOO_USE_GTKHTML != xno; then -# PKG_CHECK_MODULES(GTKHTML, [libgtkhtml-2.0], [ -# MOO_USE_GTKHTML=yes -# MOO_GTKHTML_PACKAGE=libgtkhtml-2.0 -# AC_DEFINE(MOO_USE_GTKHTML, 1, [use libgtkhtml-2.0]) -# ],[ -# if test x$MOO_USE_GTKHTML = xyes; then -# AC_MSG_ERROR([libgtkhtml-2 not found.]) -# else -# MOO_USE_GTKHTML=no -# fi -# ]) -# fi -# -# AC_SUBST(MOO_USE_GTKHTML) -# AC_SUBST(MOO_GTKHTML_PACKAGE) -# AM_CONDITIONAL(MOO_USE_GTKHTML, test x$MOO_USE_GTKHTML = "xyes") -# ]) - -AC_DEFUN([MOO_AC_GTKHTML],[ - AM_CONDITIONAL(MOO_USE_GTKHTML, false) - MOO_GTKHTML_PACKAGE= - AC_SUBST(MOO_GTKHTML_PACKAGE) -]) diff --git a/moo.kdevelop b/moo.kdevelop index 49f8918b..b41375b0 100644 --- a/moo.kdevelop +++ b/moo.kdevelop @@ -38,7 +38,7 @@ debug - ./medit + tests/medit executable / -n @@ -48,7 +48,7 @@ - --enable-debug --enable-all-gcc-warnings --enable-printing --disable-shared --without-system-pcre + --enable-debug --enable-all-gcc-warnings --enable-printing --disable-static --without-system-pcre build/debug kdevgccoptions kdevgppoptions @@ -221,7 +221,7 @@ - + libtool --g-fatal-warnings -n true false @@ -291,16 +291,16 @@ - + A new empty GAP source file - + A new empty C++ file. - + A new empty header file for C/C++. - + A new empty C file. diff --git a/moo/Makefile.am b/moo/Makefile.am index 77364480..84d25e82 100644 --- a/moo/Makefile.am +++ b/moo/Makefile.am @@ -2,8 +2,18 @@ moo_include_headers = \ moo.h \ moo-version.h -# moo_libinclude_headers = \ -# $(moo_prefix)/moo-config.h +if MOO_INSTALL_LIB +moo_include_HEADERS = $(moo_include_headers) +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = moo.pc +endif + +# mooedit_includedir = $(moo_includedir)/mooedit +# mooedit_include_HEADERS = $(mooedit_include_headers) +# mooterm_includedir = $(moo_includedir)/mooterm +# mooterm_include_HEADERS = $(mooterm_include_headers) +# mooutils_includedir = $(moo_includedir)/mooutils +# mooutils_include_HEADERS = $(mooutils_include_headers) EXTRA_DIST = \ TODO @@ -38,9 +48,34 @@ endif SUBDIRS = $(subdirs) . DIST_SUBDIRS = mooutils mooterm mooedit mooapp moopython mooscript moofileview +if MOO_INSTALL_LIB +lib_LTLIBRARIES = libmoo.la +else noinst_LTLIBRARIES = libmoo.la +endif + #lib_LTLIBRARIES = libmoo.la -libmoo_la_LIBADD = $(libs) +libmoo_la_LIBADD = $(libs) $(MOO_LIBS) $(PYTHON_LDFLAGS) # libmoo_la_LDFLAGS = -no-undefined -export-symbols-regex "^(moo_|ms_|m_|egg_regex_).*" libmoo_la_LDFLAGS = -no-undefined -export-symbols-regex ".*" libmoo_la_SOURCES = $(moo_include_headers) + + +if MOO_INSTALL_LIB +pyexec_LTLIBRARIES = moo.la +moo_la_SOURCES = \ + moopython/moopython-utils.c \ + moopython/moopython-utils.h \ + moopython/mooplugin-python.c \ + moopython/mooplugin-python.h +moo_la_LDFLAGS = -module -no-undefined -export-symbols-regex "initmoo" +moo_la_LIBADD = moopython/pygtk/libmoopygtk.la libmoo.la +moo_la_CFLAGS = \ + -I.. \ + -I$(top_builddir) \ + $(MOO_CFLAGS) \ + $(MOO_DEBUG_CFLAGS) \ + $(PYTHON_INCLUDES) \ + $(PYGTK_CFLAGS) \ + -DMOO_PYTHON_MODULE +endif diff --git a/moo/moo.h b/moo/moo.h index d09918ba..6cc6b596 100644 --- a/moo/moo.h +++ b/moo/moo.h @@ -44,8 +44,6 @@ #include #include -#include -#include #include #include #include diff --git a/moo/moo.pc.in b/moo/moo.pc.in index 1f1cf5d5..ff0db868 100644 --- a/moo/moo.pc.in +++ b/moo/moo.pc.in @@ -1,6 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ +datarootdir=@datarootdir@ datadir=@datadir@ libdir=@libdir@ @@ -9,7 +10,7 @@ pluginsdir=@MOO_LIB_DIR@/plugins Name: moo Description: A text editor and terminal emulator library -Requires: gtk+-2.0 @MOO_XML_PKG_NAME@ @MOO_GTKHTML_PACKAGE@ +Requires: gtk+-2.0 @MOO_XML_PKG_NAME@ Version: @MOO_VERSION_UNQUOTED@ -Cflags: -I@moo_includedir@ -I@moo_libincludedir@ +Cflags: -I@moo_includedir@ Libs: -L${libdir} -lmoo @PYTHON_LDFLAGS@ diff --git a/moo/mooapp/Makefile.am b/moo/mooapp/Makefile.am index f1b9c1c3..8b83b919 100644 --- a/moo/mooapp/Makefile.am +++ b/moo/mooapp/Makefile.am @@ -4,6 +4,11 @@ BUILT_SOURCES = \ mooapp_include_headers = \ mooapp.h +if MOO_INSTALL_LIB +mooapp_includedir = $(moo_includedir)/mooapp +mooapp_include_HEADERS = $(mooapp_include_headers) +endif + mooapp_sources = \ $(mooapp_include_headers) \ mooappabout-glade.h \ diff --git a/moo/mooedit/Makefile.am b/moo/mooedit/Makefile.am index 398da673..bf01f1c9 100644 --- a/moo/mooedit/Makefile.am +++ b/moo/mooedit/Makefile.am @@ -54,6 +54,7 @@ mooedit_noinst_headers = \ mootextfind-glade.h \ mootextfind.h \ mootextgotoline-glade.h \ + mootextsearch-private.h \ mootextview-private.h \ quicksearch-glade.h \ statusbar-glade.h @@ -170,3 +171,8 @@ AM_CFLAGS = \ -I$(top_builddir) \ $(MOO_CFLAGS) \ $(MOO_DEBUG_CFLAGS) + +if MOO_INSTALL_LIB +mooedit_includedir = $(moo_includedir)/mooedit +mooedit_include_HEADERS = $(mooedit_include_headers) +endif diff --git a/moo/mooedit/mootextfind.c b/moo/mooedit/mootextfind.c index 9f23478d..9d34d436 100644 --- a/moo/mooedit/mootextfind.c +++ b/moo/mooedit/mootextfind.c @@ -16,7 +16,7 @@ #include "mooedit/mootextgotoline-glade.h" #include "mooedit/mootextview.h" #include "mooedit/mooeditdialogs.h" -#include "mooedit/mootextsearch.h" +#include "mooedit/mootextsearch-private.h" #include "mooedit/mooeditprefs.h" #include "mooutils/moohistoryentry.h" #include "mooutils/mooentry.h" @@ -619,11 +619,11 @@ do_find (const GtkTextIter *start, if (regex) { if (flags & MOO_FIND_BACKWARDS) - return moo_text_search_regex_backward (start, end, regex, match_start, - match_end, NULL, NULL, NULL); + return _moo_text_search_regex_backward (start, end, regex, match_start, + match_end, NULL, NULL, NULL); else - return moo_text_search_regex_forward (start, end, regex, match_start, - match_end, NULL, NULL, NULL); + return _moo_text_search_regex_forward (start, end, regex, match_start, + match_end, NULL, NULL, NULL); } else { @@ -1045,8 +1045,8 @@ do_replace_silent (GtkTextIter *start, search_flags |= MOO_TEXT_SEARCH_WHOLE_WORDS; if (regex) - return moo_text_replace_regex_all (start, end, regex, replacement, - flags & MOO_FIND_REPL_LITERAL); + return _moo_text_replace_regex_all (start, end, regex, replacement, + flags & MOO_FIND_REPL_LITERAL); else return moo_text_replace_all (start, end, text, replacement, search_flags); } @@ -1164,12 +1164,12 @@ do_replace_interactive (GtkTextView *view, search_flags |= MOO_TEXT_SEARCH_WHOLE_WORDS; if (regex) - *replaced = moo_text_replace_regex_all_interactive (start, end, regex, replacement, - flags & MOO_FIND_REPL_LITERAL, - replace_func, &data); + *replaced = _moo_text_replace_regex_all_interactive (start, end, regex, replacement, + flags & MOO_FIND_REPL_LITERAL, + replace_func, &data); else - *replaced = moo_text_replace_all_interactive (start, end, text, replacement, - search_flags, replace_func, &data); + *replaced = _moo_text_replace_all_interactive (start, end, text, replacement, + search_flags, replace_func, &data); if (data.dialog) gtk_widget_destroy (data.dialog); diff --git a/moo/mooedit/mootextsearch-private.h b/moo/mooedit/mootextsearch-private.h new file mode 100644 index 00000000..7cecef78 --- /dev/null +++ b/moo/mooedit/mootextsearch-private.h @@ -0,0 +1,74 @@ +/* + * mootextsearch-private.h + * + * Copyright (C) 2004-2006 by Yevgen Muntyan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * See COPYING file that comes with this distribution. + */ + +#ifndef __MOO_TEXT_SEARCH_PRIVATE_H__ +#define __MOO_TEXT_SEARCH_PRIVATE_H__ + +#include +#include + +G_BEGIN_DECLS + + +/* replacement is evaluated in case of regex */ +typedef MooTextReplaceResponse (*MooTextReplaceFunc) (const char *text, + EggRegex *regex, + const char *replacement, + const GtkTextIter *to_replace_start, + const GtkTextIter *to_replace_end, + gpointer user_data); + + +gboolean _moo_text_search_regex_forward (const GtkTextIter *start, + const GtkTextIter *end, + EggRegex *regex, + GtkTextIter *match_start, + GtkTextIter *match_end, + char **string, + int *match_offset, + int *match_len); +gboolean _moo_text_search_regex_backward (const GtkTextIter *start, + const GtkTextIter *end, + EggRegex *regex, + GtkTextIter *match_start, + GtkTextIter *match_end, + char **string, + int *match_offset, + int *match_len); + +int _moo_text_replace_regex_all (GtkTextIter *start, + GtkTextIter *end, + EggRegex *regex, + const char *replacement, + gboolean replacement_literal); + +int _moo_text_replace_regex_all_interactive + (GtkTextIter *start, + GtkTextIter *end, + EggRegex *regex, + const char *replacement, + gboolean replacement_literal, + MooTextReplaceFunc func, + gpointer func_data); +int _moo_text_replace_all_interactive (GtkTextIter *start, + GtkTextIter *end, + const char *text, + const char *replacement, + MooTextSearchFlags flags, + MooTextReplaceFunc func, + gpointer func_data); + + +G_END_DECLS + +#endif /* __MOO_TEXT_SEARCH_PRIVATE_H__ */ diff --git a/moo/mooedit/mootextsearch.c b/moo/mooedit/mootextsearch.c index 564e5a84..ad97376d 100644 --- a/moo/mooedit/mootextsearch.c +++ b/moo/mooedit/mootextsearch.c @@ -11,20 +11,20 @@ * See COPYING file that comes with this distribution. */ -#include "mooedit/mootextsearch.h" +#include "mooedit/mootextsearch-private.h" #include "mooedit/gtksourceiter.h" #include gboolean -moo_text_search_regex_forward (const GtkTextIter *search_start, - const GtkTextIter *search_end, - EggRegex *regex, - GtkTextIter *match_start, - GtkTextIter *match_end, - char **string, - int *match_offset, - int *match_len) +_moo_text_search_regex_forward (const GtkTextIter *search_start, + const GtkTextIter *search_end, + EggRegex *regex, + GtkTextIter *match_start, + GtkTextIter *match_end, + char **string, + int *match_offset, + int *match_len) { GtkTextIter start, end; GtkTextBuffer *buffer; @@ -129,14 +129,14 @@ find_last_match (EggRegex *regex, gboolean -moo_text_search_regex_backward (const GtkTextIter *search_start, - const GtkTextIter *search_end, - EggRegex *regex, - GtkTextIter *match_start, - GtkTextIter *match_end, - char **string, - int *match_offset, - int *match_len) +_moo_text_search_regex_backward (const GtkTextIter *search_start, + const GtkTextIter *search_end, + EggRegex *regex, + GtkTextIter *match_start, + GtkTextIter *match_end, + char **string, + int *match_offset, + int *match_len) { GtkTextIter slice_start, slice_end; GtkTextBuffer *buffer; @@ -337,9 +337,9 @@ moo_text_search_forward (const GtkTextIter *start, if (!regex) return FALSE; - return moo_text_search_regex_forward (start, end, regex, - match_start, match_end, - NULL, NULL, NULL); + return _moo_text_search_regex_forward (start, end, regex, + match_start, match_end, + NULL, NULL, NULL); } @@ -394,9 +394,9 @@ moo_text_search_backward (const GtkTextIter *start, if (!regex) return FALSE; - return moo_text_search_regex_backward (start, end, regex, - match_start, match_end, - NULL, NULL, NULL); + return _moo_text_search_regex_backward (start, end, regex, + match_start, match_end, + NULL, NULL, NULL); } @@ -485,8 +485,8 @@ moo_text_replace_regex_all_real (GtkTextIter *start, GError *error = NULL; int match_len; - if (!moo_text_search_regex_forward (start, end, regex, &match_start, &match_end, - &string, NULL, &match_len)) + if (!_moo_text_search_regex_forward (start, end, regex, &match_start, &match_end, + &string, NULL, &match_len)) goto out; if (!match_len) @@ -595,11 +595,11 @@ out: int -moo_text_replace_regex_all (GtkTextIter *start, - GtkTextIter *end, - EggRegex *regex, - const char *replacement, - gboolean replacement_literal) +_moo_text_replace_regex_all (GtkTextIter *start, + GtkTextIter *end, + EggRegex *regex, + const char *replacement, + gboolean replacement_literal) { g_return_val_if_fail (start != NULL, 0); g_return_val_if_fail (regex != NULL, 0); @@ -611,13 +611,13 @@ moo_text_replace_regex_all (GtkTextIter *start, int -moo_text_replace_regex_all_interactive (GtkTextIter *start, - GtkTextIter *end, - EggRegex *regex, - const char *replacement, - gboolean replacement_literal, - MooTextReplaceFunc func, - gpointer func_data) +_moo_text_replace_regex_all_interactive (GtkTextIter *start, + GtkTextIter *end, + EggRegex *regex, + const char *replacement, + gboolean replacement_literal, + MooTextReplaceFunc func, + gpointer func_data) { g_return_val_if_fail (start != NULL, 0); g_return_val_if_fail (regex != NULL, 0); @@ -660,8 +660,8 @@ moo_text_replace_all (GtkTextIter *start, if (!regex) return 0; - return moo_text_replace_regex_all (start, end, regex, replacement, - flags & MOO_TEXT_SEARCH_REPL_LITERAL); + return _moo_text_replace_regex_all (start, end, regex, replacement, + flags & MOO_TEXT_SEARCH_REPL_LITERAL); } buffer = gtk_text_iter_get_buffer (start); @@ -704,13 +704,13 @@ out: int -moo_text_replace_all_interactive (GtkTextIter *start, - GtkTextIter *end, - const char *text, - const char *replacement, - MooTextSearchFlags flags, - MooTextReplaceFunc func, - gpointer func_data) +_moo_text_replace_all_interactive (GtkTextIter *start, + GtkTextIter *end, + const char *text, + const char *replacement, + MooTextSearchFlags flags, + MooTextReplaceFunc func, + gpointer func_data) { int count = 0; GtkTextMark *end_mark; @@ -738,9 +738,9 @@ moo_text_replace_all_interactive (GtkTextIter *start, if (!regex) return 0; - return moo_text_replace_regex_all_interactive (start, end, regex, replacement, - flags & MOO_TEXT_SEARCH_REPL_LITERAL, - func, func_data); + return _moo_text_replace_regex_all_interactive (start, end, regex, replacement, + flags & MOO_TEXT_SEARCH_REPL_LITERAL, + func, func_data); } buffer = gtk_text_iter_get_buffer (start); diff --git a/moo/mooedit/mootextsearch.h b/moo/mooedit/mootextsearch.h index 12571c52..35221f34 100644 --- a/moo/mooedit/mootextsearch.h +++ b/moo/mooedit/mootextsearch.h @@ -15,7 +15,6 @@ #define __MOO_TEXT_SEARCH_H__ #include -#include G_BEGIN_DECLS @@ -40,15 +39,6 @@ typedef enum { MOO_TEXT_REPLACE_ALL = 3 } MooTextReplaceResponse; -/* replacement is evaluated in case of regex */ -typedef MooTextReplaceResponse (*MooTextReplaceFunc) (const char *text, - EggRegex *regex, - const char *replacement, - const GtkTextIter *to_replace_start, - const GtkTextIter *to_replace_end, - gpointer user_data); - - gboolean moo_text_search_forward (const GtkTextIter *start, const char *str, MooTextSearchFlags flags, @@ -62,50 +52,12 @@ gboolean moo_text_search_backward (const GtkTextIter *start, GtkTextIter *match_end, const GtkTextIter *end); -gboolean moo_text_search_regex_forward (const GtkTextIter *start, - const GtkTextIter *end, - EggRegex *regex, - GtkTextIter *match_start, - GtkTextIter *match_end, - char **string, - int *match_offset, - int *match_len); -gboolean moo_text_search_regex_backward (const GtkTextIter *start, - const GtkTextIter *end, - EggRegex *regex, - GtkTextIter *match_start, - GtkTextIter *match_end, - char **string, - int *match_offset, - int *match_len); - -int moo_text_replace_regex_all (GtkTextIter *start, - GtkTextIter *end, - EggRegex *regex, - const char *replacement, - gboolean replacement_literal); int moo_text_replace_all (GtkTextIter *start, GtkTextIter *end, const char *text, const char *replacement, MooTextSearchFlags flags); -int moo_text_replace_regex_all_interactive - (GtkTextIter *start, - GtkTextIter *end, - EggRegex *regex, - const char *replacement, - gboolean replacement_literal, - MooTextReplaceFunc func, - gpointer func_data); -int moo_text_replace_all_interactive (GtkTextIter *start, - GtkTextIter *end, - const char *text, - const char *replacement, - MooTextSearchFlags flags, - MooTextReplaceFunc func, - gpointer func_data); - G_END_DECLS diff --git a/moo/moopython/Makefile.am b/moo/moopython/Makefile.am index 05f9abcc..334c20be 100644 --- a/moo/moopython/Makefile.am +++ b/moo/moopython/Makefile.am @@ -15,15 +15,23 @@ moopython_sources += \ endif noinst_LTLIBRARIES = libmoopython.la -libmoopython_la_LIBADD = pygtk/libmoopygtk.la +libmoopython_la_LIBADD = libmoopython_la_SOURCES = $(moopython_sources) -AM_CFLAGS = \ + +if MOO_INSTALL_LIB +lib_define = -DMOO_INSTALL_LIB +else +libmoopython_la_LIBADD += pygtk/libmoopygtk.la +endif + +libmoopython_la_CFLAGS = \ -I.. \ -I$(top_builddir) \ $(MOO_CFLAGS) \ $(MOO_DEBUG_CFLAGS) \ $(PYTHON_INCLUDES) \ - $(PYGTK_CFLAGS) + $(PYGTK_CFLAGS) \ + $(lib_define) EXTRA_DIST += \ codegen/__init__.py \ diff --git a/moo/moopython/mooplugin-python.c b/moo/moopython/mooplugin-python.c index 8a588752..06e02f9a 100644 --- a/moo/moopython/mooplugin-python.c +++ b/moo/moopython/mooplugin-python.c @@ -12,7 +12,11 @@ */ #include + +#ifndef MOO_INSTALL_LIB #define NO_IMPORT_PYGOBJECT +#endif + #include "pygobject.h" #ifdef HAVE_CONFIG_H @@ -353,6 +357,23 @@ moo_python_plugin_read_dirs (void) } +static gboolean +init_moo_pygtk (void) +{ +#ifndef MOO_INSTALL_LIB + return _moo_pygtk_init (); +#else + PyObject *module = PyImport_ImportModule ((char*) "moo"); + + if (!module) + PyErr_SetString(PyExc_ImportError, + "could not import moo"); + + return module != NULL; +#endif +} + + gboolean _moo_python_plugin_init (void) { @@ -361,7 +382,7 @@ _moo_python_plugin_init (void) if (!moo_python_api_init ()) return FALSE; - if (!_moo_pygtk_init ()) + if (!init_moo_pygtk ()) { PyErr_Print (); moo_python_init (MOO_PY_API_VERSION, NULL); @@ -405,7 +426,10 @@ MOO_PLUGIN_INIT_FUNC_DECL void initmoo (void) { in_moo_module = TRUE; - moo_python_api_init (); + + if (!moo_python_running()) + moo_python_api_init (); + _moo_pygtk_init (); } #endif diff --git a/moo/mooscript/Makefile.am b/moo/mooscript/Makefile.am index d8c303cc..ffbec150 100644 --- a/moo/mooscript/Makefile.am +++ b/moo/mooscript/Makefile.am @@ -38,3 +38,8 @@ AM_CFLAGS = \ -I$(top_builddir) \ $(MOO_CFLAGS) \ $(MOO_DEBUG_CFLAGS) + +if MOO_INSTALL_LIB +mooscript_includedir = $(moo_includedir)/mooscript +mooscript_include_HEADERS = $(mooscript_headers) +endif diff --git a/moo/mooterm/Makefile.am b/moo/mooterm/Makefile.am index 29d46f63..610cded0 100644 --- a/moo/mooterm/Makefile.am +++ b/moo/mooterm/Makefile.am @@ -84,6 +84,11 @@ libmooterm_la_SOURCES += $(mooterm_win32_sources) EXTRA_DIST += $(mooterm_unix_sources) endif +if MOO_INSTALL_LIB +mooterm_includedir = $(moo_includedir)/mooterm +mooterm_include_HEADERS = $(mooterm_include_headers) +endif + AM_CFLAGS = \ -I$(top_builddir) \ -I.. \ diff --git a/moo/mooutils/Makefile.am b/moo/mooutils/Makefile.am index 86eaa75e..dd1ee13e 100644 --- a/moo/mooutils/Makefile.am +++ b/moo/mooutils/Makefile.am @@ -23,8 +23,8 @@ gtk_2_4_sources = \ newgtk/gtkfontbutton.h mooutils_include_headers = \ - eggregex.h \ mooaccelbutton.h \ + mooaction.h \ moobigpaned.h \ mooclosure.h \ moocmd.h \ @@ -57,13 +57,13 @@ mooutils_include_headers = \ mooutils_sources = \ $(mooutils_include_headers) \ + eggregex.h \ eggregex.c \ mooaccel.h \ mooaccel.c \ mooaccelbutton-glade.h \ mooaccelbutton.c \ mooaccelprefs-glade.h \ - mooaction.h \ mooaction.c \ mooactionfactory.h \ mooactionfactory.c \ @@ -215,3 +215,8 @@ AM_CFLAGS = \ $(pcre_include) \ $(MOO_CFLAGS) \ $(MOO_DEBUG_CFLAGS) + +if MOO_INSTALL_LIB +mooutils_includedir = $(moo_includedir)/mooutils +mooutils_include_HEADERS = $(mooutils_include_headers) +endif diff --git a/tests/medit-app.c b/tests/medit-app.c index a4f13e1c..f00b40b7 100644 --- a/tests/medit-app.c +++ b/tests/medit-app.c @@ -14,12 +14,7 @@ #include "medit-ui.h" #include "THANKS.h" -#include -#include -#include -#include -#include -#include +#include #include #include #include diff --git a/tests/medit-app.opag b/tests/medit-app.opag index 2d6b405d..303fdbe2 100644 --- a/tests/medit-app.opag +++ b/tests/medit-app.opag @@ -13,12 +13,7 @@ #include "medit-ui.h" #include "THANKS.h" -#include -#include -#include -#include -#include -#include +#include #include #include #include