From 4509273d08ce1ae2849769195772285a2562166e Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Mon, 3 Oct 2016 00:15:41 -0700 Subject: [PATCH] Partially fixed linux build --- CMakeLists.txt | 4 +++- Makefile.am | 2 ++ api/CMakeLists.txt | 12 ++++++------ api/sourcefiles.mak | 12 ++++++------ configure.ac | 2 +- getoutput.py | 2 ++ moo/CMakeLists.txt | 6 ++++-- moo/medit-app/Makefile.incl | 2 +- moo/mooedit/Makefile.incl | 6 +++--- moo/mooedit/mooeditdialogs.cpp | 2 +- moo/mooglib/moo-glib.c | 8 +++++--- moo/moopython/moopython.cmake | 11 +++++++---- moo/moopython/plugins/python.ini.in | 4 ++-- moo/moopython/plugins/python.ini.in.in | 11 ----------- moo/moopython/plugins/terminal.ini.in | 4 ++-- moo/moopython/plugins/terminal.ini.in.in | 11 ----------- moo/moopython/pygtk/Makefile.incl | 2 -- moo/mooutils/Makefile.incl | 6 +++--- moo/mooutils/mooarray.h | 2 +- moo/mooutils/mooutils-misc.cpp | 4 ++-- 20 files changed, 51 insertions(+), 62 deletions(-) delete mode 100644 moo/moopython/plugins/python.ini.in.in delete mode 100644 moo/moopython/plugins/terminal.ini.in.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 46e7d529..c1d09283 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,9 @@ cmake_minimum_required(VERSION 3.0) cmake_policy(SET CMP0048 NEW) -include(cmake/PrecompiledHeader.cmake) +if(WIN32) + include(cmake/PrecompiledHeader.cmake) +endif() list(APPEND EXTRA_DIST tools/genenums.py diff --git a/Makefile.am b/Makefile.am index bd1718d9..b499a491 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,8 @@ endif CLEANFILES = +MOO_INTL + include plat/win32/Makefile.incl if MOO_OS_WIN32 diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index 20295512..bafc5aa8 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -49,10 +49,10 @@ SET(source_files ../moo/mooedit/mooeditaction.h ../moo/mooedit/mooeditbookmark.c ../moo/mooedit/mooeditbookmark.h - ../moo/mooedit/mooedit.c + ../moo/mooedit/mooedit.cpp ../moo/mooedit/mooeditconfig.c ../moo/mooedit/mooeditconfig.h - ../moo/mooedit/mooeditdialogs.c + ../moo/mooedit/mooeditdialogs.cpp ../moo/mooedit/mooeditdialogs.h ../moo/mooedit/mooedit-enum-types.c ../moo/mooedit/mooedit-enum-types.h @@ -60,7 +60,7 @@ SET(source_files ../moo/mooedit/mooeditfileinfo.c ../moo/mooedit/mooeditfileinfo.c ../moo/mooedit/mooeditfileinfo.h - ../moo/mooedit/mooedit-fileops.c + ../moo/mooedit/mooedit-fileops.cpp ../moo/mooedit/mooedit-fileops.h ../moo/mooedit/mooeditfiltersettings.c ../moo/mooedit/mooeditfiltersettings.h @@ -197,7 +197,7 @@ SET(source_files ../moo/mooutils/mooencodings.c ../moo/mooutils/mooencodings-data.h ../moo/mooutils/mooencodings.h - ../moo/mooutils/mooentry.c + ../moo/mooutils/mooentry.cpp ../moo/mooutils/mooentry.h ../moo/mooutils/moo-environ.h ../moo/mooutils/moofiledialog.c @@ -278,12 +278,12 @@ SET(source_files ../moo/mooutils/mooutils-macros.h ../moo/mooutils/mooutils-mem.h ../moo/mooutils/mooutils-messages.h - ../moo/mooutils/mooutils-misc.c + ../moo/mooutils/mooutils-misc.cpp ../moo/mooutils/mooutils-misc.h ../moo/mooutils/mooutils-script.c ../moo/mooutils/mooutils-script.h ../moo/mooutils/mooutils-tests.h - ../moo/mooutils/mooutils-thread.c + ../moo/mooutils/mooutils-thread.cpp ../moo/mooutils/mooutils-thread.h ../moo/mooutils/mooutils-treeview.c ../moo/mooutils/mooutils-treeview.h diff --git a/api/sourcefiles.mak b/api/sourcefiles.mak index b599bf58..d22dfa5f 100644 --- a/api/sourcefiles.mak +++ b/api/sourcefiles.mak @@ -19,10 +19,10 @@ source_files = \ ../moo/mooedit/mooeditaction.h\ ../moo/mooedit/mooeditbookmark.c\ ../moo/mooedit/mooeditbookmark.h\ - ../moo/mooedit/mooedit.c\ + ../moo/mooedit/mooedit.cpp\ ../moo/mooedit/mooeditconfig.c\ ../moo/mooedit/mooeditconfig.h\ - ../moo/mooedit/mooeditdialogs.c\ + ../moo/mooedit/mooeditdialogs.cpp\ ../moo/mooedit/mooeditdialogs.h\ ../moo/mooedit/mooedit-enum-types.c\ ../moo/mooedit/mooedit-enum-types.h\ @@ -30,7 +30,7 @@ source_files = \ ../moo/mooedit/mooeditfileinfo.c\ ../moo/mooedit/mooeditfileinfo.c\ ../moo/mooedit/mooeditfileinfo.h\ - ../moo/mooedit/mooedit-fileops.c\ + ../moo/mooedit/mooedit-fileops.cpp\ ../moo/mooedit/mooedit-fileops.h\ ../moo/mooedit/mooeditfiltersettings.c\ ../moo/mooedit/mooeditfiltersettings.h\ @@ -167,7 +167,7 @@ source_files = \ ../moo/mooutils/mooencodings.c\ ../moo/mooutils/mooencodings-data.h\ ../moo/mooutils/mooencodings.h\ - ../moo/mooutils/mooentry.c\ + ../moo/mooutils/mooentry.cpp\ ../moo/mooutils/mooentry.h\ ../moo/mooutils/moo-environ.h\ ../moo/mooutils/moofiledialog.c\ @@ -248,12 +248,12 @@ source_files = \ ../moo/mooutils/mooutils-macros.h\ ../moo/mooutils/mooutils-mem.h\ ../moo/mooutils/mooutils-messages.h\ - ../moo/mooutils/mooutils-misc.c\ + ../moo/mooutils/mooutils-misc.cpp\ ../moo/mooutils/mooutils-misc.h\ ../moo/mooutils/mooutils-script.c\ ../moo/mooutils/mooutils-script.h\ ../moo/mooutils/mooutils-tests.h\ - ../moo/mooutils/mooutils-thread.c\ + ../moo/mooutils/mooutils-thread.cpp\ ../moo/mooutils/mooutils-thread.h\ ../moo/mooutils/mooutils-treeview.c\ ../moo/mooutils/mooutils-treeview.h\ diff --git a/configure.ac b/configure.ac index c35adece..8f008f0a 100644 --- a/configure.ac +++ b/configure.ac @@ -84,7 +84,7 @@ if test x$MOO_DEV_MODE = "xyes" -a "x$XSLTPROC" = "x"; then AC_MSG_ERROR([xsltproc not found]) fi -AC_DEFINE(MOO_CONFIG_H_INCLUDED, 1) +AC_DEFINE_UNQUOTED(MOO_CONFIG_H_INCLUDED, 1, MOO_CONFIG_H_INCLUDED) AC_CONFIG_HEADERS([config.h]) AH_TOP([#ifndef __CONFIG_H__ #define __CONFIG_H__]) diff --git a/getoutput.py b/getoutput.py index 96f46ace..716b08c2 100644 --- a/getoutput.py +++ b/getoutput.py @@ -10,6 +10,8 @@ output = output.replace('\r\n', '\n').replace('\r', '\n') filename = sys.argv[1] tmp = filename + '.tmp' +if not os.path.exists(os.path.dirname(tmp)): + os.makedirs(os.path.dirname(tmp)) with open(tmp, 'w') as f: f.write(output) if os.path.exists(filename): diff --git a/moo/CMakeLists.txt b/moo/CMakeLists.txt index f6422b3f..b61d2aaf 100644 --- a/moo/CMakeLists.txt +++ b/moo/CMakeLists.txt @@ -98,7 +98,9 @@ if(MOO_ENABLE_PYTHON) endif() ADD_MODULE(medit-app) -include_directories(${PROJECT_SOURCE_DIR}/moo/mooutils/moowin32/ms) +if(WIN32) + include_directories(${PROJECT_SOURCE_DIR}/moo/mooutils/moowin32/ms) +endif() include_directories( ${PROJECT_BINARY_DIR} @@ -112,7 +114,7 @@ source_group("generated\\sources" REGULAR_EXPRESSION ".*\\.c(pp)?$") source_group("generated\\headers" REGULAR_EXPRESSION ".*\\.h$") source_group("misc\\glade" REGULAR_EXPRESSION ".*\\.glade$") -set(MOO_USE_PCH TRUE) +set(MOO_USE_PCH ${WIN32}) if(MOO_USE_PCH) set(MEDIT_PCH_SOURCES moo-pch.c diff --git a/moo/medit-app/Makefile.incl b/moo/medit-app/Makefile.incl index a52f2893..b79a4ab5 100644 --- a/moo/medit-app/Makefile.incl +++ b/moo/medit-app/Makefile.incl @@ -39,7 +39,7 @@ medit_SOURCES = \ medit-app/mem-debug.h \ medit-app/run-tests.h \ medit-app/parse.h \ - medit-app/main.c \ + medit-app/main.cpp \ $(moo_sources) \ $(plugins_sources) diff --git a/moo/mooedit/Makefile.incl b/moo/mooedit/Makefile.incl index da60f578..d6fedcc6 100644 --- a/moo/mooedit/Makefile.incl +++ b/moo/mooedit/Makefile.incl @@ -34,13 +34,13 @@ moo_sources += \ mooedit/mooeditaction-factory.c \ mooedit/mooeditaction-factory.h \ mooedit/mooeditbookmark.c \ - mooedit/mooedit.c \ + mooedit/mooedit.cpp \ mooedit/mooeditconfig.c \ - mooedit/mooeditdialogs.c \ + mooedit/mooeditdialogs.cpp \ mooedit/mooedit-enum-types.c \ mooedit/mooedit-enum-types.h \ mooedit/mooedit-enums.h \ - mooedit/mooedit-fileops.c \ + mooedit/mooedit-fileops.cpp \ mooedit/mooedit-fileops.h \ mooedit/mooeditfiltersettings.c \ mooedit/mooedithistoryitem.c \ diff --git a/moo/mooedit/mooeditdialogs.cpp b/moo/mooedit/mooeditdialogs.cpp index f65f8ece..af32b4f3 100644 --- a/moo/mooedit/mooeditdialogs.cpp +++ b/moo/mooedit/mooeditdialogs.cpp @@ -83,7 +83,7 @@ _moo_edit_open_dialog (GtkWidget *widget, info_array = moo_open_info_array_new (); for (i = 0; i < files->n_elms; ++i) - moo_open_info_array_take (info_array, moo_open_info_new_file (files->elms[i], encoding, -1, 0)); + moo_open_info_array_take (info_array, moo_open_info_new_file (files->elms[i], encoding, -1, MooOpenFlags (0))); g_object_unref (start); start = g_file_get_parent (files->elms[0]); diff --git a/moo/mooglib/moo-glib.c b/moo/mooglib/moo-glib.c index c41d7072..d8f14593 100644 --- a/moo/mooglib/moo-glib.c +++ b/moo/mooglib/moo-glib.c @@ -76,7 +76,8 @@ static void convert_g_stat_buf (const GStatBuf* gbuf, MgwStatBuf* mbuf) #ifndef _MSC_VER -#define call_with_errno(err__, func__, rtype__, ...) \ + +#define _call_with_errno(err__, func__, rtype__, ...) \ ({ \ rtype__ result__; \ errno = 0; \ @@ -85,6 +86,7 @@ static void convert_g_stat_buf (const GStatBuf* gbuf, MgwStatBuf* mbuf) (err__)->value = errno; \ result__; \ }) + #else // _MSC_VER #define _call_with_errno(what__, result__) \ @@ -93,6 +95,8 @@ static void convert_g_stat_buf (const GStatBuf* gbuf, MgwStatBuf* mbuf) if (err != NULL) \ err->value = errno; \ +#endif // _MSC_VER + #define call_with_errno0(func__, result__) \ _call_with_errno((func__)(), result__) @@ -108,8 +112,6 @@ static void convert_g_stat_buf (const GStatBuf* gbuf, MgwStatBuf* mbuf) #define call_with_errno4(func__, result__, a1__, a2__, a3__, a4__) \ _call_with_errno((func__)((a1__), (a2__), (a3__), (a4__)), result__) -#endif // _MSC_VER - const char * mgw_strerror (mgw_errno_t err) diff --git a/moo/moopython/moopython.cmake b/moo/moopython/moopython.cmake index f9f3455c..b41e0356 100644 --- a/moo/moopython/moopython.cmake +++ b/moo/moopython/moopython.cmake @@ -8,6 +8,9 @@ include_directories(${PYTHON_INCLUDE_DIR}) set(MOO_PYTHON_LIB_DIR ${CMAKE_INSTALL_PREFIX}/bin/Lib) + +set(MOO_GTK_DIR /usr) + set(PYGOBJECT_DEFS_DIR ${MOO_GTK_DIR}/share/pygobject/2.0/defs) set(PYGTK_DEFS_DIR ${MOO_GTK_DIR}/share/pygtk/2.0/defs) set(PYGTK_INCLUDE_DIR "${MOO_GTK_DIR}/include/pygtk-2.0") @@ -47,14 +50,14 @@ list(APPEND built_moopython_sources ) if(WIN32) -set(codegen_platform --platform win32) + set(codegen_platform --platform win32) endif() list(APPEND built_moopython_sources moopython/pygtk/moo.defs) -add_custom_command(OUTPUT moopython/pygtk/moo.defs - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/getoutput.py moopython/pygtk/moo.defs + add_custom_command(OUTPUT moopython/pygtk/moo.defs + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/getoutput.py moopython/pygtk/moo.defs ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/api/gendefs.py ${CMAKE_SOURCE_DIR}/api/moo.xml - DEPENDS ${gendefs_files} ${CMAKE_SOURCE_DIR}/api/moo.xml) + DEPENDS ${gendefs_files} ${CMAKE_SOURCE_DIR}/api/moo.xml) set(codegen_files moopython/codegen/codegen.py diff --git a/moo/moopython/plugins/python.ini.in b/moo/moopython/plugins/python.ini.in index 9f3c9ef1..5f1aaa66 100644 --- a/moo/moopython/plugins/python.ini.in +++ b/moo/moopython/plugins/python.ini.in @@ -5,7 +5,7 @@ version=@MOO_MODULE_MAJOR_VERSION@.@MOO_MODULE_MINOR_VERSION@ [plugin] id=Python -name=Python -description=Python support +_name=Python +_description=Python support author=Yevgen Muntyan version=@MOO_VERSION@ diff --git a/moo/moopython/plugins/python.ini.in.in b/moo/moopython/plugins/python.ini.in.in deleted file mode 100644 index 5f1aaa66..00000000 --- a/moo/moopython/plugins/python.ini.in.in +++ /dev/null @@ -1,11 +0,0 @@ -[module] -type=Python -file=python.py -version=@MOO_MODULE_MAJOR_VERSION@.@MOO_MODULE_MINOR_VERSION@ - -[plugin] -id=Python -_name=Python -_description=Python support -author=Yevgen Muntyan -version=@MOO_VERSION@ diff --git a/moo/moopython/plugins/terminal.ini.in b/moo/moopython/plugins/terminal.ini.in index a5976376..cdce3390 100644 --- a/moo/moopython/plugins/terminal.ini.in +++ b/moo/moopython/plugins/terminal.ini.in @@ -5,7 +5,7 @@ version=@MOO_MODULE_MAJOR_VERSION@.@MOO_MODULE_MINOR_VERSION@ [plugin] id=Terminal -name=Terminal -description=Terminal plugin +_name=Terminal +_description=Terminal plugin author=Yevgen Muntyan version=@MOO_VERSION@ diff --git a/moo/moopython/plugins/terminal.ini.in.in b/moo/moopython/plugins/terminal.ini.in.in deleted file mode 100644 index cdce3390..00000000 --- a/moo/moopython/plugins/terminal.ini.in.in +++ /dev/null @@ -1,11 +0,0 @@ -[module] -type=Python -file=terminal.py -version=@MOO_MODULE_MAJOR_VERSION@.@MOO_MODULE_MINOR_VERSION@ - -[plugin] -id=Terminal -_name=Terminal -_description=Terminal plugin -author=Yevgen Muntyan -version=@MOO_VERSION@ diff --git a/moo/moopython/pygtk/Makefile.incl b/moo/moopython/pygtk/Makefile.incl index d388611e..9169a18f 100644 --- a/moo/moopython/pygtk/Makefile.incl +++ b/moo/moopython/pygtk/Makefile.incl @@ -13,8 +13,6 @@ gendefs_files = \ moo_override_files = \ moopython/pygtk/mooutils.override \ - moopython/pygtk/moopaned.override \ - moopython/pygtk/mooedit.override \ moopython/pygtk/moo.override EXTRA_DIST += \ diff --git a/moo/mooutils/Makefile.incl b/moo/mooutils/Makefile.incl index ceeb371d..1de58a19 100644 --- a/moo/mooutils/Makefile.incl +++ b/moo/mooutils/Makefile.incl @@ -7,7 +7,7 @@ moo_utils_enum_headers = \ moo_sources += \ $(moo_utils_enum_headers) \ mooutils/mooarray.h \ - mooutils/mooutils-thread.c \ + mooutils/mooutils-thread.cpp \ mooutils/mooutils-thread.h \ mooutils/moohistorymgr.c \ mooutils/moohistorymgr.h \ @@ -49,7 +49,7 @@ moo_sources += \ mooutils/mooencodings-data.h \ mooutils/mooencodings.c \ mooutils/mooencodings.h \ - mooutils/mooentry.c \ + mooutils/mooentry.cpp \ mooutils/mooentry.h \ mooutils/moofiledialog.c \ mooutils/moofileicon.c \ @@ -122,7 +122,7 @@ moo_sources += \ mooutils/mooutils-macros.h \ mooutils/mooutils-mem.h \ mooutils/mooutils-messages.h \ - mooutils/mooutils-misc.c \ + mooutils/mooutils-misc.cpp \ mooutils/mooutils-misc.h \ mooutils/mooutils-script.c \ mooutils/mooutils-script.h \ diff --git a/moo/mooutils/mooarray.h b/moo/mooutils/mooarray.h index 97cbbe6a..2cbc16cb 100644 --- a/moo/mooutils/mooarray.h +++ b/moo/mooutils/mooarray.h @@ -181,7 +181,7 @@ array_type##_sort (ArrayType *ar, GCompareFunc func) \ \ g_qsort_with_data (ar->elms, ar->n_elms, sizeof (*ar->elms), \ array_type##_gcompare_data_func, \ - func); \ + (gpointer) func); \ } \ \ gssize array_type##_find (const ArrayType *ar, ElmType *elm) \ diff --git a/moo/mooutils/mooutils-misc.cpp b/moo/mooutils/mooutils-misc.cpp index f428fca6..e7f07102 100644 --- a/moo/mooutils/mooutils-misc.cpp +++ b/moo/mooutils/mooutils-misc.cpp @@ -277,7 +277,7 @@ find_by_xid (GSList *windows, XID w) for (l = windows; l != NULL; l = l->next) if (GDK_WINDOW_XID (GTK_WIDGET(l->data)->window) == w) - return l->data; + return (GtkWindow*) l->data; return NULL; } @@ -303,7 +303,7 @@ _moo_get_top_window (GSList *windows) g_return_val_if_fail (windows != NULL, NULL); if (!windows->next) - return windows->data; + return (GtkWindow*) windows->data; for (l = windows; l != NULL; l = l->next) {